7 #include "smith/infrastructure/application_manager.hpp"
23 #include "smith/smith_config.hpp"
25 #ifdef SMITH_USE_PETSC
43 void signalHandler(
int signal)
45 std::cerr <<
"[SIGNAL]: Received signal " << signal <<
" (" << strsignal(signal) <<
"), exiting" << std::endl;
55 if (axom::slic::isInitialized()) {
56 smith::logger::flush();
57 smith::logger::finalize();
60 #ifdef SMITH_USE_PETSC
61 #ifdef SMITH_USE_SLEPC
62 mfem::MFEMFinalizeSlepc();
64 mfem::MFEMFinalizePetsc();
68 #ifdef SMITH_USE_SUNDIALS
69 mfem::Sundials::Finalize();
74 int mpi_initialized = 0;
75 MPI_Initialized(&mpi_initialized);
76 int mpi_finalized = 0;
77 MPI_Finalized(&mpi_finalized);
78 if (mpi_initialized && !mpi_finalized) {
90 if (MPI_Init(&argc, &argv) != MPI_SUCCESS) {
91 std::cerr <<
"Failed to initialize MPI" << std::endl;
96 if (!logger::initialize(comm_)) {
97 std::cerr <<
"Failed to initialize SLIC logger" << std::endl;
101 if (doesPrintRunInfo) {
110 #ifdef SMITH_USE_SUNDIALS
111 mfem::Sundials::Init();
114 #ifdef SMITH_USE_PETSC
119 PetscOptionsSetValue(NULL,
"-options_left",
"no");
120 #ifdef SMITH_USE_SLEPC
121 mfem::MFEMInitializeSlepc(&argc, &argv);
123 mfem::MFEMInitializePetsc(&argc, &argv);
125 PetscPopSignalHandler();
132 std::signal(SIGABRT, signalHandler);
133 std::signal(SIGINT, signalHandler);
134 std::signal(SIGSEGV, signalHandler);
135 std::signal(SIGTERM, signalHandler);
This file contains the interface used for retrieving information about how the driver is configured.
This file contains the interface used for initializing/terminating any hardware accelerator-related f...
~ApplicationManager()
Calls smith::finalizer.
ApplicationManager(int argc, char *argv[], MPI_Comm comm=MPI_COMM_WORLD, bool doesPrintRunInfo=true, ExecutionSpace exec_space=ExecutionSpace::CPU)
Initialize MPI, signal handling, logging, profiling, hypre, sundials, petsc, and slepc.
This file contains the all the necessary functions and macros required for logging as well as a helpe...
void initializeDevice(ExecutionSpace exec_space)
Initializes the device (GPU)
void terminateDevice()
Cleans up the device, if applicable.
void initialize([[maybe_unused]] MPI_Comm comm, [[maybe_unused]] std::string options)
Initializes performance monitoring using the Caliper and Adiak libraries.
void finalize()
Concludes performance monitoring and writes collected data to a file.
Accelerator functionality.
void finalizer()
Destroy MPI, signal handling, logging, profiling, hypre, sundials, petsc, and slepc....
ExecutionSpace
enum used for signalling whether or not to perform certain calculations on the CPU or GPU
void printRunInfo()
Outputs basic run information to the screen.
Various helper functions and macros for profiling using Caliper.