Passing the number of threads in use to libmesh.

This commit is contained in:
Patrick Shriwise 2020-04-07 15:48:35 -05:00
parent cb5952ba38
commit 074f7f7cd3

View file

@ -58,7 +58,24 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
// Parse command-line arguments
int err = parse_command_line(argc, argv);
//if (err) return err;
if (err) return err;
#ifdef LIBMESH
#ifdef _OPENMP
int n_threads = omp_get_max_threads();
#else
int n_threads = 1;
#endif
// initialize libmesh
#ifdef OPENMC_MPI
if (!settings::LMI) settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv, mpi::intracomm, n_threads);
#else
if (!settings::LMI) settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv, n_threads);
#endif
#endif
// Start total and initialization timer
simulation::time_total.start();
@ -72,10 +89,6 @@ int openmc_init(int argc, char* argv[], const void* intracomm)
}
#endif
#ifdef LIBMESH
if (!settings::LMI) settings::LMI = std::make_unique<libMesh::LibMeshInit>(argc, argv);
#endif
// Initialize random number generator -- if the user specifies a seed, it
// will be re-initialized later