diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 16691d1..98a0ba8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,8 +6,6 @@ on: pull_request: branches: - master - schedule: - - cron: '0 5 * * *' jobs: CI: @@ -17,7 +15,7 @@ jobs: cxx: ['g++', 'clang++'] backend: ['SERIAL', 'OPENMP'] cmake_build_type: ['Debug', 'Release'] - kokkos_ver: ['3.2.01'] + kokkos_ver: ['3.7.02'] arborx: ['ArborX', 'NoArborX'] nnp: ['ON', 'OFF'] layout: ['1'] @@ -29,7 +27,7 @@ jobs: cxx: 'g++' openmp: 'ON' cmake_build_type: 'Release' - kokkos_ver: '3.2.01' + kokkos_ver: '3.7.02' arborx: 'NoArborX' nnp: 'OFF' layout: '2' @@ -40,7 +38,7 @@ jobs: cxx: 'g++' openmp: 'ON' cmake_build_type: 'Release' - kokkos_ver: '3.2.01' + kokkos_ver: '3.7.02' arborx: 'NoArborX' nnp: 'ON' layout: '6' @@ -51,7 +49,7 @@ jobs: cxx: 'g++' openmp: 'ON' cmake_build_type: 'Release' - kokkos_ver: '3.2.01' + kokkos_ver: '3.7.02' arborx: 'NoArborX' nnp: 'OFF' layout: '6' @@ -61,13 +59,8 @@ jobs: runs-on: ubuntu-20.04 container: ghcr.io/ecp-copa/ci-containers/${{ matrix.distro }} steps: - - name: Get trail license - if: ${{ matrix.cxx == 'icpc' }} - run: | - mkdir ~/Licenses - curl https://dynamicinstaller.intel.com/api/v2/license > ~/Licenses/intel.lic - name: Checkout kokkos - uses: actions/checkout@v2.2.0 + uses: actions/checkout@v3 with: repository: kokkos/kokkos ref: ${{ matrix.kokkos_ver }} @@ -85,10 +78,10 @@ jobs: cmake --install build - name: Checkout arborx if: ${{ matrix.arborx == 'ArborX' }} - uses: actions/checkout@v2.2.0 + uses: actions/checkout@v3 with: repository: arborx/ArborX - ref: master + ref: v1.4.1 path: arborx - name: Build arborx if: ${{ matrix.arborx == 'ArborX' }} @@ -102,10 +95,10 @@ jobs: cmake --build build --parallel 2 cmake --install build - name: Checkout Cabana - uses: actions/checkout@v2.2.0 + uses: actions/checkout@v3 with: repository: ECP-CoPA/Cabana - ref: master + ref: 0.6.1 path: cabana - name: Build Cabana working-directory: cabana @@ -115,12 +108,13 @@ jobs: -DMPIEXEC_MAX_NUMPROCS=2 -DMPIEXEC_PREFLAGS="--oversubscribe" \ -DCMAKE_PREFIX_PATH="$HOME/kokkos;$HOME/arborx" \ -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ + -DCabana_DISABLE_CAJITA_DEPRECATION_WARNINGS=ON \ -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} cmake --build build --parallel 2 cmake --install build - name: Checkout n2p2 if: ${{ matrix.nnp == 'ON' }} - uses: actions/checkout@v2.2.0 + uses: actions/checkout@v3 with: repository: CompPhysVienna/n2p2 ref: v2.0.1 @@ -133,7 +127,7 @@ jobs: mkdir -p $HOME/n2p2/lib make libnnpif INTERFACES=CabanaMD PROJECT_INCLUDE=$HOME/n2p2/include PROJECT_LIB=$HOME/n2p2/lib - name: Checkout CabanaMD - uses: actions/checkout@v2.2.0 + uses: actions/checkout@v3 - name: Build CabanaMD run: | cmake -B build \ @@ -152,11 +146,3 @@ jobs: cmake --build build --parallel 2 CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test cmake --install build - - name: Format CabanaMD - working-directory: build - run: | - make format - git diff --exit-code - - name: Upload Report to codecov.io - if: ${{ matrix.coverage }} - uses: codecov/codecov-action@v1 diff --git a/.github/workflows/Weekly.yml b/.github/workflows/Weekly.yml new file mode 100644 index 0000000..1309b8a --- /dev/null +++ b/.github/workflows/Weekly.yml @@ -0,0 +1,64 @@ +name: Nightly +on: + workflow_dispatch: + schedule: + - cron: '30 6 * * 1' + +jobs: + CI: + strategy: + matrix: + backend: ["OPENMP", "SERIAL"] + cmake_build_type: ['Release'] + runs-on: ubuntu-20.04 + container: ghcr.io/ecp-copa/ci-containers/ubuntu:latest + steps: + - name: Checkout kokkos + uses: actions/checkout@v3 + with: + repository: kokkos/kokkos + ref: develop + path: kokkos + - name: Build kokkos + working-directory: kokkos + run: | + cmake -B build \ + -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ + -DCMAKE_INSTALL_PREFIX=$HOME/kokkos \ + -DKokkos_ENABLE_${{ matrix.backend }}=ON \ + -DKokkos_ENABLE_DEPRECATED_CODE_3=OFF + cmake --build build --parallel 2 + cmake --install build + - name: Checkout Cabana + uses: actions/checkout@v3 + with: + repository: ECP-CoPA/Cabana + ref: master + path: cabana + - name: Build Cabana + working-directory: cabana + run: | + cmake -B build \ + -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ + -DCMAKE_INSTALL_PREFIX=$HOME/Cabana \ + -DCMAKE_PREFIX_PATH="$HOME/kokkos" \ + -DCabana_DISABLE_CAJITA_DEPRECATION_WARNINGS=ON + cmake --build build --parallel 2 + cmake --install build + - name: Checkout CabanaMD + uses: actions/checkout@v3 + - name: Build CabanaMD + run: | + cmake -B build \ + -D CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \ + -D CMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" \ + -D CMAKE_INSTALL_PREFIX=$HOME/CabanaPD \ + -D CMAKE_PREFIX_PATH="$HOME/Cabana" \ + -D MPIEXEC_MAX_NUMPROCS=2 \ + -D MPIEXEC_PREFLAGS="--oversubscribe" \ + -D CabanaPD_ENABLE_TESTING=ON + cmake --build build --parallel 2 + cmake --install build + - name: Test CabanaPD + run: | + CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..ec200e9 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,12 @@ +name: Clang-Format Check +on: [pull_request] +jobs: + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run clang-format style check + uses: jidicula/clang-format-action@v4.6.2 + with: + clang-format-version: '10' diff --git a/CMakeLists.txt b/CMakeLists.txt index 954ed05..d9f8ad2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,37 +13,11 @@ include(GNUInstallDirs) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -##---------------------------------------------------------------------------## -# Download and unpack googletest -##---------------------------------------------------------------------------## -include(FetchContent) -FetchContent_Declare( - googletest - GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.10.0 -) -FetchContent_GetProperties(googletest) -if(NOT googletest_POPULATED) - FetchContent_Populate(googletest) - add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR}) -endif() - -# Prevent GoogleTest from overriding our compiler/linker options -# when building with Visual Studio -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - ##---------------------------------------------------------------------------## # Set up main options (inherit from Kokkos and Cabana CMake) ##---------------------------------------------------------------------------## find_package(Cabana REQUIRED) -if( NOT Cabana_ENABLE_MPI ) - message( FATAL_ERROR "Cabana must be compiled with MPI" ) -endif() -if( NOT Cabana_ENABLE_CAJITA ) - message( FATAL_ERROR "Cabana must be compiled with Cajita" ) -endif() - ##---------------------------------------------------------------------------## # Set up optional libraries ##---------------------------------------------------------------------------## @@ -78,6 +52,16 @@ add_subdirectory(bin) ##---------------------------------------------------------------------------## option(CabanaMD_ENABLE_TESTING "Build tests" OFF) if(CabanaMD_ENABLE_TESTING) + find_package(GTest 1.10 REQUIRED) + # Workaround for FindGTest module in CMake older than 3.20 + if(TARGET GTest::gtest) + set(gtest_target GTest::gtest) + elseif(TARGET GTest::GTest) + set(gtest_target GTest::GTest) + else() + message(FATAL_ERROR "bug in GTest find module workaround") + endif() + enable_testing() add_subdirectory(unit_test) endif() diff --git a/src/cabanamd_impl.h b/src/cabanamd_impl.h index 69ce761..e16d2a0 100644 --- a/src/cabanamd_impl.h +++ b/src/cabanamd_impl.h @@ -81,7 +81,7 @@ void CbnMD::init( InputCL commandline ) using exe_space = typename t_System::execution_space; if ( print_rank() ) - exe_space::print_configuration( out ); + exe_space().print_configuration( out ); #ifndef CabanaMD_ENABLE_NNP // Check that the requested pair_style was compiled diff --git a/src/neighbor_types/neighbor_tree.h b/src/neighbor_types/neighbor_tree.h index 139dc9c..183575f 100644 --- a/src/neighbor_types/neighbor_tree.h +++ b/src/neighbor_types/neighbor_tree.h @@ -53,7 +53,7 @@ class NeighborTree auto x = system->x; t_iteration tag; - list = Cabana::Experimental::makeNeighborList( + list = Cabana::Experimental::makeNeighborList( tag, x, 0, N_local, neigh_cut, max_neigh_guess ); } @@ -100,7 +100,7 @@ class NeighborTree auto x = system->x; t_iteration tag; - list = Cabana::Experimental::make2DNeighborList( + list = Cabana::Experimental::make2DNeighborList( tag, x, 0, N_local, neigh_cut, max_neigh_guess ); } diff --git a/src/system.h b/src/system.h index e286cdc..4af29a4 100644 --- a/src/system.h +++ b/src/system.h @@ -129,7 +129,7 @@ class SystemCommon std::array high_corner ) { // Create the MPI partitions. - Cajita::UniformDimPartitioner partitioner; + Cajita::DimBlockPartitioner<3> partitioner; ranks_per_dim = partitioner.ranksPerDimension( MPI_COMM_WORLD, {} ); // Create global mesh of MPI partitions. diff --git a/unit_test/CMakeLists.txt b/unit_test/CMakeLists.txt index 7da1462..67f0d71 100644 --- a/unit_test/CMakeLists.txt +++ b/unit_test/CMakeLists.txt @@ -1,5 +1,3 @@ -set(gtest_args --gtest_color=yes) - ##--------------------------------------------------------------------------## ## On-node tests ##--------------------------------------------------------------------------## @@ -30,7 +28,7 @@ macro(CabanaMD_add_tests) set(_target ${_test}_test_${_uppercase_device}) add_executable(${_target} ${_file} ${CABANAMD_UNIT_TEST_MAIN}) target_include_directories(${_target} PRIVATE ${_dir} ${CMAKE_CURRENT_SOURCE_DIR}) - target_link_libraries(${_target} PRIVATE CabanaMD gtest CabanaMD) + target_link_libraries(${_target} PRIVATE CabanaMD ${gtest_target} CabanaMD) foreach(_np ${CABANAMD_UNIT_TEST_MPIEXEC_NUMPROCS}) if(_device STREQUAL PTHREAD OR _device STREQUAL OPENMP)