www.mooseframework.org
MooseInit.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "MooseInit.h"
11 #include "ParallelUniqueId.h"
12 #include "Factory.h"
13 #include "ActionFactory.h"
14 #include "Executioner.h"
15 #include "MooseRandom.h"
16 
17 // PETSc
18 #include "petscsys.h"
19 
20 #ifdef LIBMESH_HAVE_OPENMP
21 #include <omp.h>
22 #endif
23 
24 #include <unistd.h>
25 #include <signal.h>
26 
27 void
28 SigHandler(int signum)
29 {
31  return;
32 }
33 
34 void
36 {
37  signal(SIGUSR1, SigHandler);
38 }
39 
40 MooseInit::MooseInit(int argc, char * argv[], MPI_Comm COMM_WORLD_IN)
41  : LibMeshInit(argc, argv, COMM_WORLD_IN)
42 {
43  PetscPopSignalHandler(); // get rid of PETSc error handler
44 
45 // Set the number of OpenMP threads to the same as the number of threads libMesh is going to use
46 #ifdef LIBMESH_HAVE_OPENMP
47  omp_set_num_threads(libMesh::n_threads());
48 #endif
49 
51 
52  // Make sure that any calls to the global random number generator are consistent among processes
54 
56 }
static void initialize()
Must be called by main thread before any threaded computation! Do NOT call in a worker thread! ...
unsigned int n_threads()
void RegisterSigHandler()
Definition: MooseInit.C:35
MooseInit(int argc, char *argv[], MPI_Comm COMM_WORLD_IN=MPI_COMM_WORLD)
Definition: MooseInit.C:40
static void seed(unsigned int seed)
The method seeds the random number generator.
Definition: MooseRandom.h:43
int interrupt_signal_number
Used by the signal handler to determine if we should write a checkpoint file out at any point during ...
Definition: Moose.C:648
void SigHandler(int signum)
Definition: MooseInit.C:28