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();
70 int mpi_initialized = 0;
71 MPI_Initialized(&mpi_initialized);
72 int mpi_finalized = 0;
73 MPI_Finalized(&mpi_finalized);
74 if (mpi_initialized && !mpi_finalized) {
84 if (MPI_Init(&argc, &argv) != MPI_SUCCESS) {
85 std::cerr <<
"Failed to initialize MPI" << std::endl;
90 if (!logger::initialize(comm_)) {
91 std::cerr <<
"Failed to initialize SLIC logger" << std::endl;
95 if (doesPrintRunInfo) {
104 #ifdef SMITH_USE_SUNDIALS
105 mfem::Sundials::Init();
108 #ifdef SMITH_USE_PETSC
113 PetscOptionsSetValue(NULL,
"-options_left",
"no");
114 #ifdef SMITH_USE_SLEPC
115 mfem::MFEMInitializeSlepc(&argc, &argv);
117 mfem::MFEMInitializePetsc(&argc, &argv);
119 PetscPopSignalHandler();
126 std::signal(SIGABRT, signalHandler);
127 std::signal(SIGINT, signalHandler);
128 std::signal(SIGSEGV, signalHandler);
129 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)
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()
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....
void printRunInfo()
Outputs basic run information to the screen.
Various helper functions and macros for profiling using Caliper.