Debian Codegraph @

packages/muelu/test/unit_tests_kokkos/MueLu_UnitTests_kokkos.cpp

raw
1 // @HEADER
2 // *****************************************************************************
3 // MueLu: A package for multigrid based preconditioning
4 //
5 // Copyright 2012 NTESS and the MueLu contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9
10 #include <Teuchos_UnitTestRepository.hpp>
11 #include <Teuchos_DefaultComm.hpp>
12 #include <Teuchos_StandardCatchMacros.hpp>
13 #include <Kokkos_Core.hpp>
14
15 #include "MueLu_TestHelpers_kokkos.hpp"
16
17 /*#include <Teuchos_DefaultComm.hpp>
18 #include <Teuchos_StandardCatchMacros.hpp>
19 #include <Teuchos_UnitTestRepository.hpp>
20 #include <Teuchos_VerboseObject.hpp>
21
22 #include <Kokkos_Core.hpp>
23
24 #include "MueLu_TestHelpers_kokkos.hpp"
25
26 #include "MueLu_VerboseObject.hpp"*/
27
28 int main(int argc, char* argv[]) {
29 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
30
31 Kokkos::initialize(argc, argv);
32
33 bool success = false;
34 bool verbose = true;
35 int ierr = -1;
36 try {
37 // Note: the command line parameter --linAlgebra= is taken into account.
38 // Xpetra parameters are added to the Teuchos::CommandLineProcessor of Teuchos::UnitTestRepository in MueLu_TestHelpers_kokkos.cpp
39
40 #ifdef ParallelDebug
41 RCP<const Teuchos::Comm<int> > comm = Teuchos::DefaultComm<int>::getComm();
42
43 int mypid = comm->getRank();
44
45 if (mypid == 0) std::cout << "Host and Process Ids for tasks" << std::endl;
46 for (int i = 0; i < comm->getSize(); i++) {
47 if (i == mypid) {
48 char buf[80];
49 char hostname[80];
50 gethostname(hostname, sizeof(hostname));
51 int pid = getpid();
52 sprintf(buf, "Host: %s\tMPI rank: %d,\tPID: %d\n\tattach %d\n\tcontinue\n",
53 hostname, mypid, pid, pid);
54 printf("%s\n", buf);
55 fflush(stdout);
56 sleep(1);
57 }
58 }
59
60 if (mypid == 0) {
61 printf("** Enter a character to continue > ");
62 fflush(stdout);
63 char go = ' ';
64 scanf("%c", &go);
65 }
66 comm->barrier();
67 #endif
68
69 #ifdef HAVE_TEUCHOS_STACKTRACE
70 Teuchos::print_stack_on_segfault();
71 #endif
72
73 // Comment this line to get rid of MueLu output
74 MueLu::VerboseObject::SetDefaultVerbLevel(MueLu::High);
75
76 ierr = Teuchos::UnitTestRepository::runUnitTestsFromMain(argc, argv);
77
78 success = true;
79 }
80 TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
81 Kokkos::finalize();
82 return (success ? ierr : EXIT_FAILURE);
83 }