https://mooseframework.inl.gov
Public Member Functions | Private Member Functions | List of all members
MooseInit Class Reference

Initialization object for any MOOSE-based application. More...

#include <MooseInit.h>

Inheritance diagram for MooseInit:
[legend]

Public Member Functions

 MooseInit (int argc, char *argv[], MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD)
 
virtual ~MooseInit ()=default
 
const Parallel::Communicatorcomm () const
 
Parallel::Communicatorcomm ()
 

Private Member Functions

void initKokkos ()
 

Detailed Description

Initialization object for any MOOSE-based application.

This object must be created in the main() of any MOOSE-based application so everything is properly initialized and finalized.

Definition at line 23 of file MooseInit.h.

Constructor & Destructor Documentation

◆ MooseInit()

MooseInit::MooseInit ( int  argc,
char *  argv[],
MPI_Comm  COMM_WORLD_IN = MPI_COMM_WORLD 
)

Definition at line 47 of file MooseInit.C.

48  : LibMeshInit(argc, argv, COMM_WORLD_IN)
49 {
50  LibmeshPetscCallA(COMM_WORLD_IN, PetscPopSignalHandler()); // get rid of PETSc error handler
51 
52 // Set the number of OpenMP threads to the same as the number of threads libMesh is going to use
53 #ifdef LIBMESH_HAVE_OPENMP
54  omp_set_num_threads(libMesh::n_threads());
55 #endif
56 
57 #ifdef MOOSE_LIBTORCH_ENABLED
58  at::set_num_threads(libMesh::n_threads());
59  at::set_num_interop_threads(libMesh::n_threads());
60 #endif
61 
62  if (!libMesh::on_command_line("--enable-refcount-printing"))
64 
66 
67  // Make sure that any calls to the global random number generator are consistent among processes
69 
71 
72 #ifdef MOOSE_KOKKOS_ENABLED
73  initKokkos();
74 #endif
75 }
static void initialize()
Must be called by main thread before any threaded computation! Do NOT call in a worker thread! ...
void initKokkos()
unsigned int n_threads()
void RegisterSigHandler()
Definition: MooseInit.C:42
LibMeshInit(int argc, const char *const *argv, MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD, int n_threads=-1)
static void seed(unsigned int seed)
The method seeds the random number generator.
Definition: MooseRandom.h:44
bool on_command_line(std::string arg)
static void disable_print_counter_info()

◆ ~MooseInit()

virtual MooseInit::~MooseInit ( )
virtualdefault

Member Function Documentation

◆ initKokkos()

void MooseInit::initKokkos ( )
private

Referenced by MooseInit().


The documentation for this class was generated from the following files: