Tpetra parallel linear algebra
Version of the Day
|
Scope guard whose destructor automatically calls Tpetra::finalize for you. More...
#include <Tpetra_Core.hpp>
Public Member Functions | |
ScopeGuard (int *argc, char ***argv) | |
Initialize Tpetra. More... | |
ScopeGuard ()=delete | |
Default constructor (FORBIDDEN) More... | |
~ScopeGuard () | |
Finalize Tpetra. More... | |
Scope guard whose destructor automatically calls Tpetra::finalize for you.
This class' constructor does the same thing as Tpetra::initialize (see above). Its destructor automatically calls Tpetra::finalize. This ensures correct Tpetra finalization even if intervening code throws an exception.
Compare to Kokkos::ScopeGuard and Teuchos::GlobalMPISession.
Always give the ScopeGuard instance a name. Otherwise, you'll create a temporary object whose destructor will be called right away. That's not what you want.
Here is an example of how to use this class:
Definition at line 189 of file Tpetra_Core.hpp.
Tpetra::ScopeGuard::ScopeGuard | ( | int * | argc, |
char *** | argv | ||
) |
Initialize Tpetra.
If MPI_Init has not yet been called, then call it. If Kokkos::initialize has not yet been called, then call it.
argc | [in/out] Address of the first argument to main(). |
argv | [in/out] Address of the second argument to main(). |
Definition at line 340 of file Tpetra_Core.cpp.
|
delete |
Default constructor (FORBIDDEN)
You must give ScopeGuard's constructor argc and argv. Use the constructor above this one.
Tpetra::ScopeGuard::~ScopeGuard | ( | ) |
Finalize Tpetra.
If the constructor called Kokkos::initialize, then call Kokkos::finalize. If the constructor called MPI_Init, then call MPI_Finalize.
Definition at line 352 of file Tpetra_Core.cpp.