-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add force module that uses KRS
- Loading branch information
Showing
24 changed files
with
829 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
//************************************************************************ | ||
// ExaMiniMD v. 1.0 | ||
// Copyright (2018) National Technology & Engineering Solutions of Sandia, | ||
// LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA-0003525 with NTESS, the U.S. Government | ||
// retains certain rights in this software. | ||
// | ||
// ExaMiniMD is licensed under 3-clause BSD terms of use: Redistribution and | ||
// use in source and binary forms, with or without modification, are | ||
// permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the Corporation nor the names of the contributors | ||
// may be used to endorse or promote products derived from this software | ||
// without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
// IN NO EVENT SHALL NTESS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Christian R. Trott ([email protected]) | ||
//************************************************************************ | ||
|
||
#include <comm_lib.h> | ||
#include <assert.h> | ||
|
||
#if EXAMINIMD_ENABLE_MPI | ||
#include <mpi.h> | ||
#endif | ||
|
||
#ifdef EXAMINIMD_ENABLE_KOKKOS_REMOTE_SPACES | ||
#include <Kokkos_RemoteSpaces.hpp> | ||
#endif | ||
|
||
void comm_lib_init(int argc, char* argv[]) { | ||
#if defined (EXAMINIMD_ENABLE_MPI) || defined (EXAMINIMD_ENABLE_KOKKOS_REMOTE_SPACES) | ||
int mpi_thread_level_available; | ||
int mpi_thread_level_required = MPI_THREAD_MULTIPLE; | ||
|
||
#ifdef KOKKOS_ENABLE_DEFAULT_DEVICE_TYPE_SERIAL | ||
mpi_thread_level_required = MPI_THREAD_SINGLE; | ||
#endif | ||
|
||
MPI_Init_thread(&argc, &argv, mpi_thread_level_required, | ||
&mpi_thread_level_available); | ||
assert(mpi_thread_level_available >= mpi_thread_level_required); | ||
|
||
#ifdef KRS_ENABLE_SHMEMSPACE | ||
shmem_init_thread(mpi_thread_level_required, &mpi_thread_level_available); | ||
assert(mpi_thread_level_available >= mpi_thread_level_required); | ||
#endif | ||
|
||
#ifdef KRS_ENABLE_NVSHMEMSPACE | ||
MPI_Comm mpi_comm; | ||
nvshmemx_init_attr_t attr; | ||
mpi_comm = MPI_COMM_WORLD; | ||
attr.mpi_comm = &mpi_comm; | ||
nvshmemx_init_attr(NVSHMEMX_INIT_WITH_MPI_COMM, &attr); | ||
#endif | ||
} | ||
|
||
void comm_lib_finalize() { | ||
#if defined (EXAMINIMD_ENABLE_MPI) || defined (EXAMINIMD_ENABLE_KOKKOS_REMOTE_SPACES) | ||
#ifdef KRS_ENABLE_SHMEMSPACE | ||
shmem_finalize(); | ||
#endif | ||
#ifdef KRS_ENABLE_NVSHMEMSPACE | ||
nvshmem_finalize(); | ||
#endif | ||
MPI_Finalize(); | ||
#endif | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//************************************************************************ | ||
// ExaMiniMD v. 1.0 | ||
// Copyright (2018) National Technology & Engineering Solutions of Sandia, | ||
// LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA-0003525 with NTESS, the U.S. Government | ||
// retains certain rights in this software. | ||
// | ||
// ExaMiniMD is licensed under 3-clause BSD terms of use: Redistribution and | ||
// use in source and binary forms, with or without modification, are | ||
// permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the Corporation nor the names of the contributors | ||
// may be used to endorse or promote products derived from this software | ||
// without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
// IN NO EVENT SHALL NTESS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Christian R. Trott ([email protected]) | ||
//************************************************************************ | ||
|
||
#pragma once | ||
|
||
#ifndef COMM_INIT_H | ||
#define COMM_INIT_H | ||
|
||
void comm_lib_init(int argc, char* argv[]); | ||
void comm_lib_finalize(); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
FILE(GLOB SRCS *.cpp) | ||
target_sources(ExaMiniMD PRIVATE ${SRCS}) | ||
|
||
if (!ENABLE_MPI AND !ENABLE_KOKKOS_REMOTE_SPACES) | ||
# Skip MPI module | ||
list(FILTER SRCS EXCLUDE REGEX ".*comm_mpi\\.cpp$") | ||
endif() | ||
|
||
target_sources(ExaMiniMD PRIVATE ${SRCS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ | |
// Questions? Contact Christian R. Trott ([email protected]) | ||
//************************************************************************ | ||
|
||
#include <string> | ||
|
||
#if defined(EXAMINIMD_ENABLE_MPI) || defined (EXAMINIMD_ENABLE_KOKKOS_REMOTE_SPACES) | ||
#include<comm_mpi.h> | ||
|
||
|
@@ -390,7 +392,8 @@ void CommMPI::exchange_halo() { | |
}; | ||
|
||
void CommMPI::update_halo() { | ||
#ifndef SHMEMTESTS_USE_HALO | ||
|
||
#if !defined(SHMEMTESTS_USE_HALO) && defined(EXAMINIMD_ENABLE_KOKKOS_REMOTE_SPACES) | ||
return; | ||
#else | ||
Kokkos::Profiling::pushRegion("Comm::update_halo"); | ||
|
@@ -478,7 +481,13 @@ void CommMPI::update_force() { | |
Kokkos::Profiling::popRegion(); | ||
}; | ||
|
||
const char* CommMPI::name() { return "CommMPI"; } | ||
const char* CommMPI::name() { | ||
comm_name = std::string("CommMPI"); | ||
#ifdef EXAMINIMD_ENABLE_KOKKOS_REMOTE_SPACES | ||
comm_name += "Distrib"; | ||
#endif | ||
return comm_name.c_str(); | ||
} | ||
|
||
int CommMPI::process_rank() { return proc_rank; } | ||
int CommMPI::num_processes() { return proc_size; } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
FILE(GLOB SRCS *.cpp) | ||
|
||
|
||
#Skip lj_ideal, snap and cell | ||
#Skip snap and cell | ||
#TODO: SNAP is outdates and should likely be removed all together as it is | ||
list(FILTER SRCS EXCLUDE REGEX ".*lj_cell\\.cpp$") | ||
list(FILTER SRCS EXCLUDE REGEX ".*lj_idial_neigh\\.cpp$") | ||
list(FILTER SRCS EXCLUDE REGEX ".*snap_neigh\\.cpp$") | ||
|
||
target_sources(ExaMiniMD PRIVATE ${SRCS}) | ||
# Skip force-type module if Kokkos Remote Spaces is not enabled | ||
if (ENABLE_KOKKOS_REMOTE_SPACES) | ||
message(STATUS "Building with support for force_lj_neigh_distrib") | ||
else() | ||
#Otherwise exclude | ||
list(FILTER SRCS EXCLUDE REGEX ".*distrib\\.cpp$") | ||
endif() | ||
|
||
target_sources(ExaMiniMD PRIVATE ${SRCS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//************************************************************************ | ||
// ExaMiniMD v. 1.0 | ||
// Copyright (2018) National Technology & Engineering Solutions of Sandia, | ||
// LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA-0003525 with NTESS, the U.S. Government | ||
// retains certain rights in this software. | ||
// | ||
// ExaMiniMD is licensed under 3-clause BSD terms of use: Redistribution and | ||
// use in source and binary forms, with or without modification, are | ||
// permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, | ||
// this list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the Corporation nor the names of the contributors | ||
// may be used to endorse or promote products derived from this software | ||
// without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY NTESS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
// IN NO EVENT SHALL NTESS OR THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | ||
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
// POSSIBILITY OF SUCH DAMAGE. | ||
// | ||
// Questions? Contact Christian R. Trott ([email protected]) | ||
//************************************************************************ | ||
|
||
#include<force_lj_neigh_distrib_impl.h> | ||
#define FORCETYPE_DECLARE_TEMPLATE_MACRO(NeighType) ForceLJNeigh<NeighType> | ||
#define FORCE_MODULES_TEMPLATE | ||
#include<modules_neighbor.h> | ||
#undef FORCE_MODULES_TEMPLATE |
Oops, something went wrong.