use finalize wrappers from the LAMMPS library interface

This commit is contained in:
Axel Kohlmeyer
2023-03-07 08:23:36 -05:00
parent 40790f6c45
commit 6c1ed6a9b5
2 changed files with 11 additions and 34 deletions

View File

@ -14,7 +14,7 @@
#include "lammps.h"
#include "input.h"
#include "lmppython.h"
#include "library.h"
#if defined(LAMMPS_EXCEPTIONS)
#include "exceptions.h"
@ -32,20 +32,6 @@
#include <mdi.h>
#endif
#if defined(LMP_KOKKOS)
namespace LAMMPS_NS {
extern void kokkos_lmp_finalize();
}
#else
#include "accelerator_kokkos.h"
namespace LAMMPS_NS {
void kokkos_lmp_finalize()
{
KokkosLMP::finalize();
}
}
#endif
using namespace LAMMPS_NS;
/* ----------------------------------------------------------------------
@ -89,19 +75,19 @@ int main(int argc, char **argv)
lammps->input->file();
delete lammps;
} catch (LAMMPSAbortException &ae) {
kokkos_lmp_finalize();
Python::finalize();
lammps_kokkos_finalize();
lammps_python_finalize();
MPI_Abort(ae.universe, 1);
} catch (LAMMPSException &) {
kokkos_lmp_finalize();
Python::finalize();
lammps_kokkos_finalize();
lammps_python_finalize();
MPI_Barrier(lammps_comm);
MPI_Finalize();
exit(1);
} catch (fmt::format_error &fe) {
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
kokkos_lmp_finalize();
Python::finalize();
lammps_kokkos_finalize();
lammps_python_finalize();
MPI_Abort(MPI_COMM_WORLD, 1);
exit(1);
}
@ -112,14 +98,14 @@ int main(int argc, char **argv)
delete lammps;
} catch (fmt::format_error &fe) {
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
kokkos_lmp_finalize();
Python::finalize();
lammps_kokkos_finalize();
lammps_python_finalize();
MPI_Abort(MPI_COMM_WORLD, 1);
exit(1);
}
#endif
kokkos_lmp_finalize();
Python::finalize();
lammps_kokkos_finalize();
lammps_python_finalize();
MPI_Barrier(lammps_comm);
MPI_Finalize();
}