Add additional error check

This commit is contained in:
Stan Gerald Moore
2021-06-25 10:47:55 -06:00
parent 30ac0107c8
commit a74a718b6f
2 changed files with 6 additions and 3 deletions

View File

@ -306,16 +306,17 @@ KokkosLMP::~KokkosLMP()
void KokkosLMP::initialize(Kokkos::InitArguments args)
{
if (!Kokkos::is_initialized())
if (!Kokkos::is_initialized()) {
if (is_finalized)
error->all(FLERR,"Kokkos package already finalized, cannot re-initialize");
Kokkos::initialize(args);
}
}
/* ---------------------------------------------------------------------- */
void KokkosLMP::finalize()
{
static int is_finalized = 0;
if (Kokkos::is_initialized() && !is_finalized)
Kokkos::finalize();
is_finalized = 1;

View File

@ -49,6 +49,8 @@ class KokkosLMP : protected Pointers {
int newtonflag;
double binsize;
static int is_finalized;
KokkosLMP(class LAMMPS *, int, char **);
~KokkosLMP();
static void initialize(Kokkos::InitArguments);