avoid including accelerator_kokkos.h in main.cpp
This commit is contained in:
@ -72,13 +72,11 @@ if(DOWNLOAD_KOKKOS)
|
|||||||
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
set_target_properties(LAMMPS::KOKKOSCONTAINERS PROPERTIES
|
||||||
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
IMPORTED_LOCATION "${INSTALL_DIR}/lib/libkokkoscontainers.a")
|
||||||
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
target_link_libraries(lammps PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
||||||
target_link_libraries(lmp PRIVATE LAMMPS::KOKKOSCORE LAMMPS::KOKKOSCONTAINERS)
|
|
||||||
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
add_dependencies(LAMMPS::KOKKOSCORE kokkos_build)
|
||||||
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
add_dependencies(LAMMPS::KOKKOSCONTAINERS kokkos_build)
|
||||||
elseif(EXTERNAL_KOKKOS)
|
elseif(EXTERNAL_KOKKOS)
|
||||||
find_package(Kokkos 3.7.01 REQUIRED CONFIG)
|
find_package(Kokkos 3.7.01 REQUIRED CONFIG)
|
||||||
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
target_link_libraries(lammps PRIVATE Kokkos::kokkos)
|
||||||
target_link_libraries(lmp PRIVATE Kokkos::kokkos)
|
|
||||||
else()
|
else()
|
||||||
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
|
||||||
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
|
||||||
@ -98,7 +96,6 @@ else()
|
|||||||
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
${LAMMPS_LIB_KOKKOS_BIN_DIR})
|
||||||
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
target_include_directories(lammps PRIVATE ${Kokkos_INCLUDE_DIRS})
|
||||||
target_link_libraries(lammps PRIVATE kokkos)
|
target_link_libraries(lammps PRIVATE kokkos)
|
||||||
target_link_libraries(lmp PRIVATE kokkos)
|
|
||||||
if(BUILD_SHARED_LIBS_WAS_ON)
|
if(BUILD_SHARED_LIBS_WAS_ON)
|
||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -33,6 +33,10 @@
|
|||||||
#include <unistd.h> // for getpid()
|
#include <unistd.h> // for getpid()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
void kokkos_lmp_finalize();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef LMP_KOKKOS_GPU
|
#ifdef LMP_KOKKOS_GPU
|
||||||
|
|
||||||
// for detecting GPU-aware MPI support:
|
// for detecting GPU-aware MPI support:
|
||||||
@ -80,6 +84,11 @@ using namespace LAMMPS_NS;
|
|||||||
int KokkosLMP::is_finalized = 0;
|
int KokkosLMP::is_finalized = 0;
|
||||||
int KokkosLMP::init_ngpus = 0;
|
int KokkosLMP::init_ngpus = 0;
|
||||||
|
|
||||||
|
void LAMMPS_NS::kokkos_lmp_finalize()
|
||||||
|
{
|
||||||
|
KokkosLMP::finalize();
|
||||||
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||||
|
|||||||
@ -61,6 +61,11 @@ class KokkosLMP {
|
|||||||
int neigh_count(int) { return 0; }
|
int neigh_count(int) { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void kokkos_lmp_finalize()
|
||||||
|
{
|
||||||
|
KokkosLMP::finalize();
|
||||||
|
}
|
||||||
|
|
||||||
class AtomKokkos : public Atom {
|
class AtomKokkos : public Atom {
|
||||||
public:
|
public:
|
||||||
tagint **k_special;
|
tagint **k_special;
|
||||||
|
|||||||
15
src/main.cpp
15
src/main.cpp
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
#include "lammps.h"
|
#include "lammps.h"
|
||||||
|
|
||||||
#include "accelerator_kokkos.h"
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "lmppython.h"
|
#include "lmppython.h"
|
||||||
|
|
||||||
@ -33,6 +32,10 @@
|
|||||||
#include <mdi.h>
|
#include <mdi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
extern void kokkos_lmp_finalize();
|
||||||
|
}
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -76,18 +79,18 @@ int main(int argc, char **argv)
|
|||||||
lammps->input->file();
|
lammps->input->file();
|
||||||
delete lammps;
|
delete lammps;
|
||||||
} catch (LAMMPSAbortException &ae) {
|
} catch (LAMMPSAbortException &ae) {
|
||||||
KokkosLMP::finalize();
|
kokkos_lmp_finalize();
|
||||||
Python::finalize();
|
Python::finalize();
|
||||||
MPI_Abort(ae.universe, 1);
|
MPI_Abort(ae.universe, 1);
|
||||||
} catch (LAMMPSException &) {
|
} catch (LAMMPSException &) {
|
||||||
KokkosLMP::finalize();
|
kokkos_lmp_finalize();
|
||||||
Python::finalize();
|
Python::finalize();
|
||||||
MPI_Barrier(lammps_comm);
|
MPI_Barrier(lammps_comm);
|
||||||
MPI_Finalize();
|
MPI_Finalize();
|
||||||
exit(1);
|
exit(1);
|
||||||
} catch (fmt::format_error &fe) {
|
} catch (fmt::format_error &fe) {
|
||||||
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
|
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
|
||||||
KokkosLMP::finalize();
|
kokkos_lmp_finalize();
|
||||||
Python::finalize();
|
Python::finalize();
|
||||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -99,13 +102,13 @@ int main(int argc, char **argv)
|
|||||||
delete lammps;
|
delete lammps;
|
||||||
} catch (fmt::format_error &fe) {
|
} catch (fmt::format_error &fe) {
|
||||||
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
|
fprintf(stderr, "fmt::format_error: %s\n", fe.what());
|
||||||
KokkosLMP::finalize();
|
kokkos_lmp_finalize();
|
||||||
Python::finalize();
|
Python::finalize();
|
||||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
KokkosLMP::finalize();
|
kokkos_lmp_finalize();
|
||||||
Python::finalize();
|
Python::finalize();
|
||||||
MPI_Barrier(lammps_comm);
|
MPI_Barrier(lammps_comm);
|
||||||
MPI_Finalize();
|
MPI_Finalize();
|
||||||
|
|||||||
Reference in New Issue
Block a user