Merge pull request #1908 from stanmoore1/kk_finalize

Finalize Kokkos on error exit
This commit is contained in:
Axel Kohlmeyer 2020-02-27 12:05:17 -05:00 committed by GitHub
commit 669a49e994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,11 @@ class KokkosLMP {
int neigh_count(int) {return 0;}
};
class Kokkos {
public:
static void finalize() {}
};
class AtomKokkos : public Atom {
public:
tagint **k_special;

View File

@ -18,6 +18,7 @@
#include "universe.h"
#include "output.h"
#include "input.h"
#include "accelerator_kokkos.h"
#if defined(LAMMPS_EXCEPTIONS)
#include "update.h"
@ -83,6 +84,7 @@ void Error::universe_all(const char *file, int line, const char *str)
snprintf(msg, 100, "ERROR: %s (%s:%d)\n", str, truncpath(file), line);
throw LAMMPSException(msg);
#else
if (lmp->kokkos) Kokkos::finalize();
MPI_Finalize();
exit(1);
#endif
@ -173,6 +175,7 @@ void Error::all(const char *file, int line, const char *str)
if (logfile) fclose(logfile);
if (universe->nworlds > 1) MPI_Abort(universe->uworld,1);
if (lmp->kokkos) Kokkos::finalize();
MPI_Finalize();
exit(1);
#endif
@ -259,6 +262,7 @@ void Error::done(int status)
if (screen && screen != stdout) fclose(screen);
if (logfile) fclose(logfile);
if (lmp->kokkos) Kokkos::finalize();
MPI_Finalize();
exit(status);
}