Merge branch 'master' into prepare-clang-format
# Conflicts: # src/KOKKOS/nbin_kokkos.h # src/KOKKOS/nbin_ssa_kokkos.h # src/MOLECULE/bond_fene_expand.h # src/USER-DPD/nbin_ssa.h # src/USER-DPD/nstencil_half_bin_2d_ssa.h # src/USER-DPD/nstencil_half_bin_3d_ssa.h # src/USER-INTEL/nbin_intel.h # src/USER-MISC/fix_propel_self.cpp # src/USER-OMP/npair_full_multi_old_omp.h # src/USER-OMP/npair_half_multi_old_newton_omp.h # src/USER-OMP/npair_half_size_multi_newtoff_omp.h # src/USER-OMP/npair_halffull_newtoff_omp.h # src/USER-OMP/npair_halffull_newton_omp.h # src/USER-OMP/npair_skip_omp.h # src/main.cpp # src/nbin_standard.h # src/npair_full_multi_old.h # src/npair_halffull_newtoff.h # src/npair_halffull_newton.h # src/npair_skip.h # src/npair_skip_respa.h # src/npair_skip_size.h # src/npair_skip_size_off2on.h # src/npair_skip_size_off2on_oneside.h # src/nstencil_full_bin_2d.h # src/nstencil_full_bin_3d.h # src/nstencil_full_ghost_bin_2d.h # src/nstencil_full_ghost_bin_3d.h # src/nstencil_full_multi_2d.h # src/nstencil_full_multi_3d.h # src/nstencil_full_multi_old_2d.h # src/nstencil_full_multi_old_3d.h # src/nstencil_half_bin_2d_newtoff.cpp # src/nstencil_half_bin_3d_newtoff.cpp # src/nstencil_half_bin_3d_newton_tri.h # src/nstencil_half_ghost_bin_2d_newtoff.cpp # src/nstencil_half_ghost_bin_2d_newtoff.h # src/nstencil_half_ghost_bin_3d_newtoff.cpp # src/nstencil_half_ghost_bin_3d_newtoff.h # src/nstencil_half_multi_2d.h # src/nstencil_half_multi_2d_newtoff.h # src/nstencil_half_multi_2d_newton_tri.h # src/nstencil_half_multi_2d_tri.h # src/nstencil_half_multi_3d_newtoff.h # src/nstencil_half_multi_3d_newton_tri.h
This commit is contained in:
39
src/main.cpp
39
src/main.cpp
@ -19,10 +19,21 @@
|
||||
#endif
|
||||
|
||||
#include <cstdlib>
|
||||
#include <mpi.h>
|
||||
|
||||
#if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE)
|
||||
#include <fenv.h>
|
||||
#endif
|
||||
|
||||
#if defined(LAMMPS_EXCEPTIONS)
|
||||
#include "exceptions.h"
|
||||
#endif
|
||||
|
||||
// import MolSSI Driver Interface library
|
||||
#if defined(LMP_USER_MDI)
|
||||
#include <mdi.h>
|
||||
#endif
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -33,11 +44,27 @@ int main(int argc, char **argv)
|
||||
{
|
||||
MPI_Init(&argc, &argv);
|
||||
|
||||
MPI_Comm lammps_comm = MPI_COMM_WORLD;
|
||||
|
||||
#if defined(LMP_USER_MDI)
|
||||
// initialize MDI interface, if compiled in
|
||||
|
||||
int mdi_flag;
|
||||
if (MDI_Init(&argc, &argv)) MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
if (MDI_Initialized(&mdi_flag)) MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
|
||||
// get the MPI communicator that spans all ranks running LAMMPS
|
||||
// when using MDI, this may be a subset of MPI_COMM_WORLD
|
||||
|
||||
|
||||
if (mdi_flag)
|
||||
if (MDI_MPI_get_world_comm(&lammps_comm)) MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
#endif
|
||||
|
||||
#if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE)
|
||||
// enable trapping selected floating point exceptions.
|
||||
// this uses GNU extensions and is only tested on Linux
|
||||
// therefore we make it depend on -D_GNU_SOURCE, too.
|
||||
|
||||
#if defined(LAMMPS_TRAP_FPE) && defined(_GNU_SOURCE)
|
||||
fesetenv(FE_NOMASK_ENV);
|
||||
fedisableexcept(FE_ALL_EXCEPT);
|
||||
feenableexcept(FE_DIVBYZERO);
|
||||
@ -47,13 +74,13 @@ int main(int argc, char **argv)
|
||||
|
||||
#ifdef LAMMPS_EXCEPTIONS
|
||||
try {
|
||||
LAMMPS *lammps = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||
LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm);
|
||||
lammps->input->file();
|
||||
delete lammps;
|
||||
} catch (LAMMPSAbortException &ae) {
|
||||
MPI_Abort(ae.universe, 1);
|
||||
} catch (LAMMPSException &e) {
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
MPI_Barrier(lammps_comm);
|
||||
MPI_Finalize();
|
||||
exit(1);
|
||||
} catch (fmt::format_error &fe) {
|
||||
@ -63,7 +90,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#else
|
||||
try {
|
||||
LAMMPS *lammps = new LAMMPS(argc, argv, MPI_COMM_WORLD);
|
||||
LAMMPS *lammps = new LAMMPS(argc, argv, lammps_comm);
|
||||
lammps->input->file();
|
||||
delete lammps;
|
||||
} catch (fmt::format_error &fe) {
|
||||
@ -72,6 +99,6 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
MPI_Barrier(lammps_comm);
|
||||
MPI_Finalize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user