Unverified Commit 669a49e9 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1908 from stanmoore1/kk_finalize

Finalize Kokkos on error exit
parents 7bd32152 704207f3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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);
}