diff --git a/CMakeLists.txt b/CMakeLists.txt index 33c19c34256d..b255806b5331 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,6 +116,9 @@ endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") find_package(Filesystem REQUIRED COMPONENTS Experimental Final) +# Use Neighborhood collectives +set(WITH_NEIGHBORHOOD_COLLECTIVES OFF CACHE BOOL "Build with Neighborhood collectives") + set(ENABLE_MPI OFF) set(NUM_MPI_PROC_TESTING "4" CACHE STRING "Number of mpi processors to use when running tests with MPI") if (NOT PARTHENON_DISABLE_MPI) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 39472f9f27b8..d42646e6043d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,8 +11,6 @@ # the public, perform publicly and display publicly, and to permit others to do so. #========================================================================================= -# set(WITH_NEIGHBORHOOD_COLLECTIVES OFF CACHE BOOL "Build with Neighborhood collectives") - # Configure config.hpp set(PROBLEM_GENERATOR "") # TODO: Figure out what to put here if (ENABLE_MPI) @@ -21,6 +19,13 @@ else () set(MPI_OPTION NOT_MPI_PARALLEL) endif() +# Configure config.hpp +if (WITH_NEIGHBORHOOD_COLLECTIVES) + set(ENABLE_NEIGHBORHOOD_COLLECTIVES USE_NEIGHBORHOOD_COLLECTIVES) +else () + set(ENABLE_NEIGHBORHOOD_COLLECTIVES DO_NOT_USE_NEIGHBORHOOD_COLLECTIVES) +endif() + # The following lines determine the default loop pattern by setting the # default defines to the appropriate "tags" in the config.hpp file. # See `kokkos_abstraction.hpp` for available tags and what they translate to. @@ -322,10 +327,6 @@ if (PARTHENON_ENABLE_ASCENT) endif() endif() -if(WITH_NEIGHBORHOOD_COLLECTIVES) - ADD_DEFINITIONS(-DUSE_NEIGHBORHOOD_COLLECTIVES) -endif() - lint_target(parthenon) target_include_directories(parthenon PUBLIC diff --git a/src/bvals/comms/mm_neigh_token.hpp b/src/bvals/comms/mm_neigh_token.hpp index 2469b4851431..bd89e8aee733 100644 --- a/src/bvals/comms/mm_neigh_token.hpp +++ b/src/bvals/comms/mm_neigh_token.hpp @@ -6,6 +6,8 @@ #include #include #include + +#include "config.hpp" #include "kokkos_abstraction.hpp" #include "basic_types.hpp" diff --git a/src/config.hpp.in b/src/config.hpp.in index 299fe0936978..ac7c8886e31c 100644 --- a/src/config.hpp.in +++ b/src/config.hpp.in @@ -39,6 +39,9 @@ // MPI parallelization (MPI_PARALLEL or NOT_MPI_PARALLEL) #define @MPI_OPTION@ +// Enable Neighborhood Collectives (otherwise use P2P) +#define @ENABLE_NEIGHBORHOOD_COLLECTIVES@ + // define PARTHENON_ENABLE_HOST_COMM_BUFFERS or not at all #cmakedefine PARTHENON_ENABLE_HOST_COMM_BUFFERS