specfem::program::Context¶
-
class Context¶
RAII-based context managing Kokkos and MPI lifecycle.
This class provides RAII-based management of Kokkos and MPI initialization and proper resource cleanup.
Usage:
int main(int argc, char* argv[]) { specfem::program::Context context(argc, argv); // Kokkos & MPI automatically initialized // ... use context ... // Automatic cleanup on scope exit }
Deleted copy/move constructors and assignment operators
Context manages global resources (Kokkos and MPI) with RAII semantics. Copying or moving would violate single-ownership and could lead to double-finalization or resource corruption.
Public Functions
-
Context(int argc, char *argv[])¶
Initialize context from command line arguments.
- Parameters:
argc – Argument count
argv – Argument vector
-
Context(int argc, char *argv[], int nprocs)¶
Initialize context with subset of MPI processes.
- Parameters:
argc – Argument count
argv – Argument vector
nprocs – Number of processes to use (creates subset communicator)
-
explicit Context(const std::vector<std::string> &args)¶
Initialize context from argument vector.
- Parameters:
args – Vector of arguments
-
Context(int argc, char *argv[])¶