Make Kokkos init/finalize calls safer
This commit is contained in:
@ -78,15 +78,16 @@ int main(int argc, char **argv)
|
||||
lammps->input->file();
|
||||
delete lammps;
|
||||
} catch (LAMMPSAbortException &ae) {
|
||||
if (Kokkos::is_initialized()) Kokkos::finalize();
|
||||
KokkosLMP::finalize();
|
||||
MPI_Abort(ae.universe, 1);
|
||||
} catch (LAMMPSException &e) {
|
||||
if (Kokkos::is_initialized()) Kokkos::finalize();
|
||||
KokkosLMP::finalize();
|
||||
MPI_Barrier(lammps_comm);
|
||||
MPI_Finalize();
|
||||
exit(1);
|
||||
} catch (fmt::format_error &fe) {
|
||||
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
|
||||
KokkosLMP::finalize();
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
exit(1);
|
||||
}
|
||||
@ -97,11 +98,12 @@ int main(int argc, char **argv)
|
||||
delete lammps;
|
||||
} catch (fmt::format_error &fe) {
|
||||
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
|
||||
KokkosLMP::finalize();
|
||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
if (Kokkos::is_initialized()) Kokkos::finalize();
|
||||
KokkosLMP::finalize();
|
||||
MPI_Barrier(lammps_comm);
|
||||
MPI_Finalize();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user