Skip to content

Commit

Permalink
MueLu Viz test: Use test ETI
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcgcg committed Dec 21, 2023
1 parent a30051c commit 9a9e4ba
Showing 1 changed file with 5 additions and 157 deletions.
162 changes: 5 additions & 157 deletions packages/muelu/test/viz/Viz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,162 +542,10 @@ int main_(Teuchos::CommandLineProcessor& clp, Xpetra::UnderlyingLib& lib, int ar
return (success ? EXIT_SUCCESS : EXIT_FAILURE);
}

int main(int argc, char* argv[]) {
bool success = false;
bool verbose = true;

Teuchos::GlobalMPISession mpiSession(&argc, &argv);

try {
const bool throwExceptions = false;
const bool recogniseAllOptions = false;

Teuchos::CommandLineProcessor clp(throwExceptions, recogniseAllOptions);
Xpetra::Parameters xpetraParameters(clp);

std::string node = "";
clp.setOption("node", &node, "node type (serial | openmp | cuda | hip)");

switch (clp.parse(argc, argv, NULL)) {
case Teuchos::CommandLineProcessor::PARSE_ERROR: return EXIT_FAILURE;
case Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED:
case Teuchos::CommandLineProcessor::PARSE_UNRECOGNIZED_OPTION:
case Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL: break;
}

Xpetra::UnderlyingLib lib = xpetraParameters.GetLib();

if (lib == Xpetra::UseEpetra) {
#ifdef HAVE_MUELU_EPETRA
return main_<double, int, int, Xpetra::EpetraNode>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Epetra is not available");
#endif
}

if (lib == Xpetra::UseTpetra) {
if (node == "") {
typedef Tpetra::KokkosClassic::DefaultNode::DefaultNodeType Node;

#ifndef HAVE_MUELU_EXPLICIT_INSTANTIATION
return main_<double, int, long, Node>(clp, lib, argc, argv);
#else
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_INT_INT)
return main_<double, int, int, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_INT_LONG)
return main_<double, int, long, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_INT_LONG_LONG)
return main_<double, int, long long, Node>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Found no suitable instantiation");
#endif
#endif
} else if (node == "serial") {
#ifdef KOKKOS_ENABLE_SERIAL
typedef Tpetra::KokkosCompat::KokkosSerialWrapperNode Node;

#ifndef HAVE_MUELU_EXPLICIT_INSTANTIATION
return main_<double, int, long, Node>(clp, lib, argc, argv);
#else
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_INT)
return main_<double, int, int, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_LONG)
return main_<double, int, long, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_LONG_LONG)
return main_<double, int, long long, Node>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Found no suitable instantiation");
#endif
#endif
#else
throw MueLu::Exceptions::RuntimeError("Serial node type is disabled");
#endif
} else if (node == "openmp") {
#ifdef KOKKOS_ENABLE_OPENMP
typedef Tpetra::KokkosCompat::KokkosOpenMPWrapperNode Node;

#ifndef HAVE_MUELU_EXPLICIT_INSTANTIATION
return main_<double, int, long, Node>(clp, lib, argc, argv);
#else
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_INT)
return main_<double, int, int, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_LONG)
return main_<double, int, long, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_LONG_LONG)
return main_<double, int, long long, Node>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Found no suitable instantiation");
#endif
#endif
#else
throw MueLu::Exceptions::RuntimeError("OpenMP node type is disabled");
#endif
} else if (node == "cuda") {
#ifdef KOKKOS_ENABLE_CUDA
typedef Tpetra::KokkosCompat::KokkosCudaWrapperNode Node;

#ifndef HAVE_MUELU_EXPLICIT_INSTANTIATION
return main_<double, int, long, Node>(clp, lib, argc, argv);
#else
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_CUDA) && defined(HAVE_TPETRA_INST_INT_INT)
return main_<double, int, int, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_CUDA) && defined(HAVE_TPETRA_INST_INT_LONG)
return main_<double, int, long, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_CUDA) && defined(HAVE_TPETRA_INST_INT_LONG_LONG)
return main_<double, int, long long, Node>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Found no suitable instantiation");
#endif
#endif
#else
throw MueLu::Exceptions::RuntimeError("CUDA node type is disabled");
#endif
} else if (node == "hip") {
#ifdef KOKKOS_ENABLE_HIP
typedef Tpetra::KokkosCompat::KokkosHIPWrapperNode Node;

#ifndef HAVE_MUELU_EXPLICIT_INSTANTIATION
return main_<double, int, long, Node>(clp, lib, argc, argv);
#else
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_HIP) && defined(HAVE_TPETRA_INST_INT_INT)
return main_<double, int, int, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_HIP) && defined(HAVE_TPETRA_INST_INT_LONG)
return main_<double, int, long, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_HIP) && defined(HAVE_TPETRA_INST_INT_LONG_LONG)
return main_<double, int, long long, Node>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Found no suitable instantiation");
#endif
#endif
#else
throw MueLu::Exceptions::RuntimeError("HIP node type is disabled");
#endif
} else if (node == "sycl") {
#ifdef KOKKOS_ENABLE_SYCL
typedef Tpetra::KokkosCompat::KokkosSYCLWrapperNode Node;

#ifndef HAVE_MUELU_EXPLICIT_INSTANTIATION
return main_<double, int, long, Node>(clp, lib, argc, argv);
#else
#if defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_SYCL) && defined(HAVE_TPETRA_INST_INT_INT)
return main_<double, int, int, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_SYCL) && defined(HAVE_TPETRA_INST_INT_LONG)
return main_<double, int, long, Node>(clp, lib, argc, argv);
#elif defined(HAVE_TPETRA_INST_DOUBLE) && defined(HAVE_TPETRA_INST_SYCL) && defined(HAVE_TPETRA_INST_INT_LONG_LONG)
return main_<double, int, long long, Node>(clp, lib, argc, argv);
#else
throw MueLu::Exceptions::RuntimeError("Found no suitable instantiation");
#endif
#endif
#else
throw MueLu::Exceptions::RuntimeError("SYCL node type is disabled");
#endif
} else {
throw MueLu::Exceptions::RuntimeError("Unrecognized node type");
}
}
}
TEUCHOS_STANDARD_CATCH_STATEMENTS(verbose, std::cerr, success);
//- -- --------------------------------------------------------
#define MUELU_AUTOMATIC_TEST_ETI_NAME main_
#include "MueLu_Test_ETI.hpp"

return (success ? EXIT_SUCCESS : EXIT_FAILURE);
int main(int argc, char* argv[]) {
return Automatic_Test_ETI(argc, argv);
}

0 comments on commit 9a9e4ba

Please sign in to comment.