Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Kokkos Remote Spaces 1.2, rebases on top of master #39

Open
wants to merge 45 commits into
base: remote-spaces
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7c29655
Update deprecated 'dimension' functions in favor of ISO/C++ vocabular…
Jul 22, 2019
7f4ec40
Kokkos::Max no longer in Experimental namespace for Kokkos v3.0 promo…
Jul 22, 2019
da6ece6
Remove compiler warning for unused printf format specifier (examinimd…
Jul 22, 2019
33d47c3
Template parameters for StaticCrsGraph (Kokkos_StaticCrsGraph.hpp) ha…
Jul 22, 2019
df45188
Update team_size_max() calls. With kokkos v3.0 promotion, TeamPolicy<…
Jul 22, 2019
8dc8c45
Pass basic league and team size arguments to the TeamPolicy CTOR.
Jul 23, 2019
b439ad2
More precisely determine TeamPolicy CTOR args.
Jul 25, 2019
b6db78e
Merge pull request #28 from alanphumphrey/master
stanmoore1 Sep 9, 2019
8baad0f
Build with CMake 3.10+
calccrypto May 18, 2020
c0b7564
use target_sources instead of setting variable in parent scope
calccrypto May 19, 2020
9cd8e31
set ExaMiniMD target to use Cuda instead of individual files
calccrypto May 19, 2020
89fc9f3
include and link MPI when used
calccrypto May 19, 2020
4c18d8c
cmake_minimum_required at top only
calccrypto May 19, 2020
8cce3f8
use MPI CXX and imported target instead of variables
calccrypto May 19, 2020
d11a228
use CMP0076 to resolve paths in target_source immediately
calccrypto May 19, 2020
aba28ec
Kokkos 3.0 REQUIRED
calccrypto May 19, 2020
2e1a076
check for CMP0076 before setting it
calccrypto May 19, 2020
51cd066
MPI fixes
calccrypto May 19, 2020
750d714
use kokkos_check instead of string FIND to check for Cuda
calccrypto May 19, 2020
b1a81d2
fix USE_CUDA
calccrypto May 19, 2020
e92093b
Merge pull request #29 from calccrypto/cmake
stanmoore1 Jul 30, 2020
78ac857
Changes to allow HIP
stanmoore1 Aug 19, 2020
452ab81
Merge pull request #30 from ECP-copa/hip
stanmoore1 Aug 19, 2020
2e0d45b
Atempt to make ExaMiniMD work with OpenMPTarget
crtrott Oct 23, 2020
62ab8c4
Fix running with the SYCL backend
masterleinad May 25, 2021
8bc340d
Merge pull request #31 from crtrott/compile-with-openmptarget
stanmoore1 May 25, 2021
cba5ca9
Merge branch 'master' into add_sycl
stanmoore1 May 25, 2021
7a31e3b
Merge pull request #32 from masterleinad/add_sycl
stanmoore1 May 25, 2021
51390b6
fixup: MPI CMake configure flag typo
streeve Mar 13, 2023
71fcd92
Merge pull request #36 from streeve/fixup_mpi_flag
stanmoore1 Mar 13, 2023
1da7489
Install exe with CMake
streeve Mar 13, 2023
65e61ac
Merge pull request #37 from streeve/cmake_install
stanmoore1 Mar 13, 2023
3b50f4b
Fix compile error
stanmoore1 Oct 9, 2023
3264e29
Merge pull request #38 from ECP-copa/iostream
stanmoore1 Oct 12, 2023
fa7e2be
Initial Support for SHMEM Based halo access
crtrott May 10, 2018
85f41f2
Update RemoteSpaces Stuff
crtrott Sep 7, 2018
4b28b1d
Update init logic
crtrott Sep 12, 2018
da3cc0a
Working NVSHMEM
crtrott Sep 12, 2018
cf54b44
Skip update_halo when using remote memory spaces
crtrott Sep 13, 2018
5ef0acb
RemoteSpaces: add double3 variant and SNAP support
crtrott Sep 13, 2018
cc40a50
Fixes for QUO Space
crtrott Sep 13, 2018
e787973
- Add support for Kokkos Remote Spaces 1.2
janciesko Jun 12, 2024
a7eaaaf
Temporarily disable non-relevant module backends
janciesko Jun 13, 2024
c051efb
Do not silenly drop unsupported comm-type
janciesko Jun 17, 2024
68f4353
Move Comm into a file
janciesko Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.16)

project(ExaMiniMD LANGUAGES CXX)

include(GNUInstallDirs)

find_package(Kokkos REQUIRED)

option(ENABLE_MPI "Whether to build with MPI" OFF)
option(ENABLE_KOKKOS_REMOTE_SPACES "Whether to build with Kokkos Remote Spaces" OFF)

if (ENABLE_MPI)
find_package(MPI REQUIRED CXX)
message(STATUS "Building with MPI support")
set(BACKEND_NAME MPI)
list(APPEND BACKENDS ${BACKEND_NAME})
endif()

if (ENABLE_KOKKOS_REMOTE_SPACES)
find_package(MPI REQUIRED CXX)
find_package(KokkosRemoteSpaces REQUIRED)
message(STATUS "Building with Kokkos Remote Spaces support")
set(BACKEND_NAME KokkosRemoteSpaces)
list(APPEND BACKENDS ${BACKEND_NAME})
endif()

list(LENGTH BACKENDS N_BACKENDS)
if (${N_BACKENDS} GREATER_EQUAL "2")
message(FATAL_ERROR "Must specify a single valid communiction implementation. ${N_BACKENDS} given")
endif()

if (${N_BACKENDS} EQUAL "0")
message(STATUS "Building with serial comm type")
endif()


add_subdirectory(src)
add_subdirectory(input)
8 changes: 8 additions & 0 deletions input/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set(FILES
in.lj)

foreach(FILE ${FILES})
configure_file(${FILE} ${FILE} COPYONLY)
endforeach()

add_subdirectory(snap)
8 changes: 4 additions & 4 deletions input/in.lj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# 3d Lennard-Jones melt
# Example using Lennard-Jones potential

units lj
atom_style atomic

newton off
lattice fcc 0.8442
region box block 0 40 0 40 0 40
region box block 0 100 0 100 0 100
create_box 1 box
create_atoms 1 box
mass 1 2.0
Expand All @@ -16,8 +16,8 @@ pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5

neighbor 0.3 bin
neigh_modify delay 0 every 20 check no
neigh_modify every 20 one 50
fix 1 all nve
thermo 10

run 100
run 100
12 changes: 12 additions & 0 deletions input/snap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(FILES
in.snap.Ta06A
in.snap.W
Ta06A.snap
Ta06A.snapcoeff
Ta06A.snapparam
W.snapcoeff
W.snapparam)

foreach(FILE ${FILES})
configure_file(${FILE} ${FILE} COPYONLY)
endforeach()
4 changes: 2 additions & 2 deletions input/snap/in.snap.W
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ newton on
# generate the box and atom positions using a BCC lattice

lattice sc 3.1803
region box block 0 4 0 8 0 8
region box block 0 8 0 8 0 8
create_box 1 box
create_atoms 1 box

Expand All @@ -27,7 +27,7 @@ thermo 10
# Set up NVE run

neighbor 1.0 bin
neigh_modify once no every 1 delay 0 check yes
neigh_modify once no every 20 delay 0 check yes

# Run MD

Expand Down
21 changes: 21 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FILE(GLOB SRCS *.cpp)
add_executable(ExaMiniMD ${SRCS})

set(SUBDIRECTORIES
binning_types
comm_types
force_types
neighbor_types)

foreach(SUBDIR ${SUBDIRECTORIES})
add_subdirectory(${SUBDIR})
endforeach()

if(ENABLE_MPI)
target_compile_definitions(ExaMiniMD PRIVATE EXAMINIMD_ENABLE_MPI)
endif()

target_include_directories(ExaMiniMD PRIVATE ${Kokkos_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${SUBDIRECTORIES})
target_link_libraries(ExaMiniMD PRIVATE $<$<BOOL:${ENABLE_MPI}>:MPI::MPI_CXX> Kokkos::kokkos $<$<BOOL:${ENABLE_KOKKOS_REMOTE_SPACES}>:Kokkos::kokkosremotespaces>)

install(TARGETS ExaMiniMD DESTINATION ${CMAKE_INSTALL_BINDIR})
82 changes: 0 additions & 82 deletions src/Makefile

This file was deleted.

2 changes: 2 additions & 0 deletions src/binning_types/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FILE(GLOB SRCS *.cpp)
target_sources(ExaMiniMD PRIVATE ${SRCS})
2 changes: 1 addition & 1 deletion src/binning_types/binning_kksort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace {
void BinningKKSort::create_binning(T_X_FLOAT dx_in, T_X_FLOAT dy_in, T_X_FLOAT dz_in, int halo_depth, bool do_local, bool do_ghost, bool sort) {
if(do_local||do_ghost) {
nhalo = halo_depth;
std::pair<T_INT,T_INT> range(do_local?0:system->N_local,
Kokkos::pair<T_INT,T_INT> range(do_local?0:system->N_local,
do_ghost?system->N_local+system->N_ghost:system->N_local);

nbinx = T_INT(system->sub_domain_x/dx_in);
Expand Down
88 changes: 88 additions & 0 deletions src/comm_lib.cpp
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
}
47 changes: 47 additions & 0 deletions src/comm_lib.h
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
3 changes: 3 additions & 0 deletions src/comm_types/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FILE(GLOB SRCS *.cpp)
target_sources(ExaMiniMD PRIVATE ${SRCS})
target_sources(ExaMiniMD PRIVATE ${SRCS})
Loading