deal.II version GIT relicensing-2287-g6548a49e0a 2024-12-20 18:30:00+00:00
|
#include <deal.II/base/init_finalize.h>
Classes | |
struct | Signals |
Public Member Functions | |
InitFinalize (int &argc, char **&argv, const InitializeLibrary &libraries, const unsigned int max_num_threads=numbers::invalid_unsigned_int) | |
~InitFinalize () | |
void | finalize () |
Static Public Member Functions | |
static void | register_request (MPI_Request &request) |
static void | unregister_request (MPI_Request &request) |
Static Public Attributes | |
static Signals | signals = InitFinalize::Signals() |
Private Attributes | |
InitializeLibrary | libraries |
bool | is_finalized = false |
bool | finalize_petscslepc |
Static Private Attributes | |
static std::set< MPI_Request * > | requests |
A class that is used to initialize and finalize deal.II and the external libraries requested by the user.
Definition at line 97 of file init_finalize.h.
InitFinalize::InitFinalize | ( | int & | argc, |
char **& | argv, | ||
const InitializeLibrary & | libraries, | ||
const unsigned int | max_num_threads = numbers::invalid_unsigned_int |
||
) |
Initialize deal.II and the requested external libraries.
max_num_threads
or, following the discussion above, a number of threads equal to the number of cores allocated to this MPI process. However, MultithreadInfo::set_thread_limit() in turn also evaluates the environment variable DEAL_II_NUM_THREADS. Finally, the worker threads can only be created on cores to which the current MPI process has access to; some MPI implementations limit the number of cores each process may access to one or a subset of cores in order to ensure better cache behavior. Consequently, the number of threads that will really be created will be the minimum of the argument passed here, the environment variable (if set), and the number of cores accessible to the thread.main()
. Consequently, this extends to the current class: the best place to create an object of this type is also at or close to the top of main()
. Definition at line 63 of file init_finalize.cc.
InitFinalize::~InitFinalize | ( | ) |
Destructor. Finalize deal.II and the external libraries initialize by deal.II.
Definition at line 438 of file init_finalize.cc.
void InitFinalize::finalize | ( | ) |
Finalize deal.II and the external libraries initialize by deal.II.
Definition at line 328 of file init_finalize.cc.
|
static |
Register a reference to an MPI_Request on which we need to call MPI_Wait
before calling MPI_Finalize
.
The object request
needs to exist when MPI_Finalize is called, which means the request is typically statically allocated. Otherwise, you need to call unregister_request() before the request goes out of scope. Note that it is acceptable for a request to be already waited on (and consequently reset to MPI_REQUEST_NULL).
It is acceptable to call this function more than once with the same instance (as it is done in the example below).
Typically, this function is used by CollectiveMutex and not directly, but it can also be used directly like this:
Definition at line 303 of file init_finalize.cc.
|
static |
Unregister a request previously added using register_request().
Definition at line 312 of file init_finalize.cc.
|
static |
Definition at line 201 of file init_finalize.h.
|
private |
Definition at line 204 of file init_finalize.h.
|
staticprivate |
Requests to MPI_Wait before finalizing
Definition at line 209 of file init_finalize.h.
|
private |
Definition at line 211 of file init_finalize.h.
|
private |
Definition at line 214 of file init_finalize.h.