From 99eaa77b9c8c4f72c1c75bed4521600c7c6b758c Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Mon, 1 Mar 2021 18:17:36 -0500 Subject: [PATCH 1/5] Replace travis with github actions --- .github/workflows/CI.yml | 120 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 123 --------------------------------------- 2 files changed, 120 insertions(+), 123 deletions(-) create mode 100644 .github/workflows/CI.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..1377953 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,120 @@ +name: CI +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '0 3 * * *' + +jobs: + CI: + strategy: + matrix: + distro: ['ubuntu:latest'] + cxx: ['g++', 'clang++'] + backend: ['SERIAL', 'OPENMP'] + cmake_build_type: ['Debug', 'Release'] + kokkos_ver: ['3.2.01'] + arborx: ['ArborX', 'NoArborX'] + nnp: ['ON', 'OFF'] + runs-on: ubuntu-20.04 + container: ghcr.io/kokkos/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 + with: + repository: kokkos/kokkos + ref: ${{ matrix.kokkos_ver }} + path: kokkos + - name: Build kokkos + working-directory: kokkos + run: | + cmake -B build \ + -DCMAKE_INSTALL_PREFIX=$HOME/kokkos \ + -DKokkos_ENABLE_OPENMP=${{ matrix.openmp }} \ + -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ + -DKokkos_ENABLE_HWLOC=ON \ + -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} + cmake --build build --parallel 2 + cmake --install build + - name: Checkout arborx + if: ${{ matrix.arborx == 'ArborX' }} + uses: actions/checkout@v2.2.0 + with: + repository: arborx/ArborX + ref: master + path: arborx + - name: Build arborx + if: ${{ matrix.arborx == 'ArborX' }} + working-directory: arborx + run: | + cmake -B build \ + -DCMAKE_PREFIX_PATH=${HOME}/kokkos \ + -DCMAKE_INSTALL_PREFIX=$HOME/arborx \ + -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ + -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} + cmake --build build --parallel 2 + cmake --install build + - name: Checkout Cabana + uses: actions/checkout@v2.2.0 + with: + repository: ECP-CoPA/Cabana + ref: master + path: cabana + - name: Build Cabana + working-directory: cabana + run: | + cmake -B build \ + -DCMAKE_INSTALL_PREFIX=$HOME/Cabana \ + -DMPIEXEC_MAX_NUMPROCS=2 -DMPIEXEC_PREFLAGS="--oversubscribe" \ + -DCMAKE_PREFIX_PATH="$HOME/kokkos;$HOME/arborx" \ + -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ + -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 + with: + repository: CompPhysVienna/n2p2 + ref: v2.0.1 + path: n2p2 + - name: Build n2p2 + if: ${{ matrix.nnp == 'ON' }} + working-directory: n2p2/src + run: | + mkdir -p $HOME/n2p2/include + 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 + - name: Build CabanaMD + run: | + cmake -B build \ + -DCMAKE_INSTALL_PREFIX=$HOME/CabanaMD \ + -DMPIEXEC_MAX_NUMPROCS=2 -DMPIEXEC_PREFLAGS="--oversubscribe" \ + -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \ + -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" \ + -DCMAKE_PREFIX_PATH="$HOME/Cabana" \ + -DCabanaMD_ENABLE_TESTING=ON \ + -DCabanaMD_ENABLE_NNP=${{ matrix.nnp }} \ + -DN2P2_DIR=$HOME/n2p2 + 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/.travis.yml b/.travis.yml deleted file mode 100644 index 444133a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,123 +0,0 @@ -language: cpp - -# against hwloc error (travis-ci/travis-ci#10019) -sudo: required - -stages: - - canary - - test - -jobs: - include: - - stage: canary - env: BACKENDS="OPENMP" - -env: - global: - - CCACHE_CPP2=yes - matrix: - - BACKENDS="OPENMP" - - BACKENDS="PTHREAD" LAYOUT=1 - - BACKENDS="SERIAL" LAYOUT=2 - - BACKENDS="OPENMP" ArborX=ON LAYOUT=6 - - BACKENDS="OPENMP" NNP=ON LAYOUT=1 LAYOUT_NNP=1 - - BACKENDS="OPENMP" ArborX=ON NNP=ON LAYOUT=2 LAYOUT_NNP=3 - - BACKENDS="PTHREAD" ArborX=ON NNP=ON LAYOUT=6 - - BACKENDS="SERIAL" ArborX=ON NNP=ON - -addons: - apt: - sources: - - sourceline: 'ppa:ubuntu-toolchain-r/test' - packages: - - ccache - - libhwloc-dev - - libopenmpi-dev - - openmpi-bin - - g++-6 - -before_script: - - ccache -z - - for i in ${BACKENDS}; do KOKKOS_OPTS+=( -DKokkos_ENABLE_${i}=ON ); done - - for i in ${LAYOUT}; do CABANAMD_OPTS+=( -DCabanaMD_LAYOUT=${i} ); done - - for i in ${LAYOUT_NNP}; do CABANAMD_OPTS+=( -DCabanaMD_LAYOUT_NNP=${i} ); done - # LD_LIBRARY_PATH workaround for libomp: https://github.com/travis-ci/travis-ci/issues/8613 - - if [[ ${CC} = clang ]]; then export LD_LIBRARY_PATH=/usr/local/clang/lib:$LD_LIBRARY_PATH; fi - - if [[ ${CC} = gcc ]]; then export CXX=g++-6; export CC=gcc-6; export FC=gfortran-6; fi - - pushd $HOME/build - - git clone --depth=1 https://github.com/kokkos/kokkos.git && - pushd kokkos && mkdir build && pushd build && - cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_INSTALL_PREFIX=$HOME/kokkos - -DKokkos_ENABLE_SERIAL=OFF - ${KOKKOS_OPTS[@]} - -DKokkos_ENABLE_HWLOC=ON -DKokkos_CXX_STANDARD=14 - .. && - make -j2 VERBOSE=1 && make install && - popd && popd - - if [[ ${ArborX} ]]; then - git clone --depth=1 https://github.com/arborx/ArborX.git && - pushd ArborX && mkdir build && pushd build && - cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_PREFIX_PATH=${HOME}/kokkos - -DCMAKE_INSTALL_PREFIX=${HOME}/ArborX - .. && - make -j2 VERBOSE=1 && make install && - popd && popd; - fi - - git clone --depth=1 https://github.com/ECP-copa/Cabana.git - - pushd Cabana && mkdir build && pushd build && - cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_PREFIX_PATH="$HOME/kokkos;$HOME/ArborX" - -DCMAKE_INSTALL_PREFIX=$HOME/Cabana - ${CABANA_OPTS[@]} - -DCabana_ENABLE_MPI=ON -DCabana_ENABLE_ARBORX=${ArborX} - -DCabana_ENABLE_TESTING=OFF -DCabana_ENABLE_EXAMPLES=OFF - -DCabana_ENABLE_PERFORMANCE_TESTING=OFF - .. && - make -k -j2 VERBOSE=1 && make install && - popd && popd - - if [[ ${NNP} ]]; then - git clone --depth=1 --branch v2.0.1 https://github.com/CompPhysVienna/n2p2.git && - pushd n2p2 && pushd src && - make libnnpif INTERFACES=CabanaMD && - popd && popd; - fi - - if [[ ${COVERAGE} ]]; then - pip install --user coverxygen && - mkdir -p $HOME/.local/bin && wget -O $HOME/.local/bin/codecov https://codecov.io/bash && chmod +x $HOME/.local/bin/codecov; - fi - - popd - -script: - - mkdir build && pushd build && - cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" - -DCMAKE_PREFIX_PATH="$HOME/Cabana" - -DCabanaMD_ENABLE_TESTING=ON - -DCabanaMD_REQUIRE_SERIAL=OFF - -DCabanaMD_ENABLE_NNP=${NNP} - -DN2P2_DIR=$HOME/build/n2p2 - ${CABANAMD_OPTS[@]} - .. && - make -j4 VERBOSE=1 && - make test CTEST_OUTPUT_ON_FAILURE=1 && - make format && git diff --exit-code && - popd - -after_success: - - ccache -s - - if [[ ${COVERAGE} ]]; then pwd && pushd build && pwd && - codecov -x gcov-6; fi - -branches: - only: - - master - -cache: - directories: - - $HOME/.ccache - -compiler: - - gcc - - clang From f48d761a5206b7c9e04a3658094a2ecdc32b4337 Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Mon, 1 Mar 2021 18:27:48 -0500 Subject: [PATCH 2/5] Apply clang-format 10 --- src/binning_cabana_impl.h | 6 +++--- src/comm_mpi_impl.h | 6 +++--- src/inputFile_impl.h | 10 +++++----- src/neighbor_types/neighbor_verlet.h | 8 ++++---- src/system.h | 2 +- unit_test/tstIntegrator.hpp | 13 +++++++------ unit_test/tstNeighbor.hpp | 4 ++-- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/binning_cabana_impl.h b/src/binning_cabana_impl.h index 40d776d..e814dfb 100644 --- a/src/binning_cabana_impl.h +++ b/src/binning_cabana_impl.h @@ -94,9 +94,9 @@ void Binning::create_binning( T_X_FLOAT dx_in, T_X_FLOAT dy_in, minz = -dz * halo_depth - eps + system->local_mesh_lo_z; maxz = dz * halo_depth + eps + system->local_mesh_hi_z; - T_X_FLOAT delta[3] = {dx, dy, dz}; - T_X_FLOAT min[3] = {minx, miny, minz}; - T_X_FLOAT max[3] = {maxx, maxy, maxz}; + T_X_FLOAT delta[3] = { dx, dy, dz }; + T_X_FLOAT min[3] = { minx, miny, minz }; + T_X_FLOAT max[3] = { maxx, maxy, maxz }; system->slice_x(); auto x = system->x; diff --git a/src/comm_mpi_impl.h b/src/comm_mpi_impl.h index 312a371..bb7a924 100644 --- a/src/comm_mpi_impl.h +++ b/src/comm_mpi_impl.h @@ -100,9 +100,9 @@ void Comm::create_domain_decomposition() for ( int p = 0; p < 6; p++ ) { - neighbors_dist[p] = {proc_rank, proc_neighbors_send[p], - proc_neighbors_recv[p]}; - neighbors_halo[p] = {proc_neighbors_send[p], proc_neighbors_recv[p]}; + neighbors_dist[p] = { proc_rank, proc_neighbors_send[p], + proc_neighbors_recv[p] }; + neighbors_halo[p] = { proc_neighbors_send[p], proc_neighbors_recv[p] }; std::sort( neighbors_halo[p].begin(), neighbors_halo[p].end() ); auto unique_end = diff --git a/src/inputFile_impl.h b/src/inputFile_impl.h index bfcb65c..f4edc44 100644 --- a/src/inputFile_impl.h +++ b/src/inputFile_impl.h @@ -56,8 +56,8 @@ std::vector split( const std::string &line ) { // Split line on spaces and tabs std::regex re( "[ \r\t\n]" ); - std::sregex_token_iterator first{line.begin(), line.end(), re, -1}, last; - std::vector words{first, last}; + std::sregex_token_iterator first{ line.begin(), line.end(), re, -1 }, last; + std::vector words{ first, last }; // Remove empty words.erase( std::remove_if( words.begin(), words.end(), @@ -497,8 +497,8 @@ void InputFile::create_lattice( Comm *comm ) T_X_FLOAT max_x = lattice_constant * lattice_nx; T_X_FLOAT max_y = lattice_constant * lattice_ny; T_X_FLOAT max_z = lattice_constant * lattice_nz; - std::array global_low = {0.0, 0.0, 0.0}; - std::array global_high = {max_x, max_y, max_z}; + std::array global_low = { 0.0, 0.0, 0.0 }; + std::array global_high = { max_x, max_y, max_z }; system->create_domain( global_low, global_high ); s = *system; @@ -723,7 +723,7 @@ void InputFile::create_lattice( Comm *comm ) for ( T_INT i = 0; i < system->N_local; i++ ) { LAMMPS_RandomVelocityGeom random; - double x_i[3] = {h_x( i, 0 ), h_x( i, 1 ), h_x( i, 2 )}; + double x_i[3] = { h_x( i, 0 ), h_x( i, 1 ), h_x( i, 2 ) }; random.reset( temperature_seed, x_i ); T_FLOAT mass_i = h_mass( h_type( i ) ); diff --git a/src/neighbor_types/neighbor_verlet.h b/src/neighbor_types/neighbor_verlet.h index 9a5c870..96410ef 100644 --- a/src/neighbor_types/neighbor_verlet.h +++ b/src/neighbor_types/neighbor_verlet.h @@ -44,10 +44,10 @@ class NeighborVerlet : public Neighbor { T_INT N_local = system->N_local; - double grid_min[3] = {system->ghost_mesh_lo_x, system->ghost_mesh_lo_y, - system->ghost_mesh_lo_z}; - double grid_max[3] = {system->ghost_mesh_hi_x, system->ghost_mesh_hi_y, - system->ghost_mesh_hi_z}; + double grid_min[3] = { system->ghost_mesh_lo_x, system->ghost_mesh_lo_y, + system->ghost_mesh_lo_z }; + double grid_max[3] = { system->ghost_mesh_hi_x, system->ghost_mesh_hi_y, + system->ghost_mesh_hi_z }; system->slice_x(); auto x = system->x; diff --git a/src/system.h b/src/system.h index aca1e6f..e286cdc 100644 --- a/src/system.h +++ b/src/system.h @@ -141,7 +141,7 @@ class SystemCommon global_mesh_z = global_mesh->extent( 2 ); // Create the global grid. - std::array is_periodic = {true, true, true}; + std::array is_periodic = { true, true, true }; auto global_grid = Cajita::createGlobalGrid( MPI_COMM_WORLD, global_mesh, is_periodic, partitioner ); diff --git a/unit_test/tstIntegrator.hpp b/unit_test/tstIntegrator.hpp index d9f0820..bd08f5e 100644 --- a/unit_test/tstIntegrator.hpp +++ b/unit_test/tstIntegrator.hpp @@ -43,8 +43,8 @@ t_System createParticles( const int num_particle, const int num_ghost, system.N_local = num_particle - num_ghost; system.N_ghost = num_ghost; - system.create_domain( {box_min, box_min, box_min}, - {box_max, box_max, box_max} ); + system.create_domain( { box_min, box_min, box_min }, + { box_max, box_max, box_max } ); system.slice_integrate(); auto x = system.x; @@ -112,10 +112,11 @@ void testIntegratorReversibility( int steps ) system.slice_v(); auto v = system.v; Kokkos::RangePolicy exec_policy( 0, num_particle ); - Kokkos::parallel_for( exec_policy, KOKKOS_LAMBDA( const int p ) { - for ( int d = 0; d < 3; ++d ) - v( p, d ) *= -1.0; - } ); + Kokkos::parallel_for( + exec_policy, KOKKOS_LAMBDA( const int p ) { + for ( int d = 0; d < 3; ++d ) + v( p, d ) *= -1.0; + } ); // Integrate back for ( int s = 0; s < steps; ++s ) diff --git a/unit_test/tstNeighbor.hpp b/unit_test/tstNeighbor.hpp index 88c476d..6a7f653 100644 --- a/unit_test/tstNeighbor.hpp +++ b/unit_test/tstNeighbor.hpp @@ -260,8 +260,8 @@ t_System createAtoms( const int num_atom, const int num_ghost, system.N_local = num_atom - num_ghost; system.N_ghost = num_ghost; - system.create_domain( {box_min, box_min, box_min}, - {box_max, box_max, box_max} ); + system.create_domain( { box_min, box_min, box_min }, + { box_max, box_max, box_max } ); // Create random atom positions within the box. system.slice_x(); From e9a4d8103ff18a2f058c6d60d715a80792c1b149 Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Wed, 3 Mar 2021 12:34:11 -0500 Subject: [PATCH 3/5] Add different layout/vector length builds --- .github/workflows/CI.yml | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1377953..3570eda 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,6 +20,44 @@ jobs: kokkos_ver: ['3.2.01'] arborx: ['ArborX', 'NoArborX'] nnp: ['ON', 'OFF'] + layout: ['1'] + vector: ['1'] + layout_nnp: ['1'] + vector_nnp: ['1'] + include: + - distro: 'ubuntu:latest' + cxx: 'g++' + openmp: 'ON' + cmake_build_type: 'Release' + kokkos_ver: '3.2.01' + arborx: 'NoArborX' + nnp: 'OFF' + layout: '2' + vector: '64' + layout_nnp: '1' + vector_nnp: '1' + - distro: 'ubuntu:latest' + cxx: 'g++' + openmp: 'ON' + cmake_build_type: 'Release' + kokkos_ver: '3.2.01' + arborx: 'NoArborX' + nnp: 'ON' + layout: '6' + vector: '32' + layout_nnp: '3' + vector_nnp: '32' + - distro: 'ubuntu:latest' + cxx: 'g++' + openmp: 'ON' + cmake_build_type: 'Release' + kokkos_ver: '3.2.01' + arborx: 'NoArborX' + nnp: 'OFF' + layout: '6' + vector: '"1;8;32;1;8;32"' + layout_nnp: '3' + vector_nnp: '"32;8;1"' runs-on: ubuntu-20.04 container: ghcr.io/kokkos/ci-containers/${{ matrix.distro }} steps: @@ -105,8 +143,12 @@ jobs: -DCMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" \ -DCMAKE_PREFIX_PATH="$HOME/Cabana" \ -DCabanaMD_ENABLE_TESTING=ON \ + -DCabanaMD_LAYOUT=${{ matrix.layout }} \ + -DCabanaMD_VECTORLENGTH=${{ matrix.vector }} \ -DCabanaMD_ENABLE_NNP=${{ matrix.nnp }} \ - -DN2P2_DIR=$HOME/n2p2 + -DN2P2_DIR=$HOME/n2p2 \ + -DCabanaMD_LAYOUT_NNP=${{ matrix.layout_nnp }} \ + -DCabanaMD_VECTORLENGTH_NNP=${{ matrix.vector_nnp }} cmake --build build --parallel 2 CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test cmake --install build From f05ff5ec8c10f641b046153f166d6a801cbdc156 Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:41:46 -0500 Subject: [PATCH 4/5] Switch to Cabana ci-containers --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3570eda..3c19199 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -59,7 +59,7 @@ jobs: layout_nnp: '3' vector_nnp: '"32;8;1"' runs-on: ubuntu-20.04 - container: ghcr.io/kokkos/ci-containers/${{ matrix.distro }} + container: ghcr.io/ecp-copa/ci-containers/${{ matrix.distro }} steps: - name: Get trail license if: ${{ matrix.cxx == 'icpc' }} From 2a5d0520a96a22fa95578a5bcc7bc46e768209fa Mon Sep 17 00:00:00 2001 From: Sam Reeve <6740307+streeve@users.noreply.github.com> Date: Tue, 16 Mar 2021 13:13:49 -0400 Subject: [PATCH 5/5] Pick different scheduled job time from Cabana --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3c19199..16691d1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,7 +7,7 @@ on: branches: - master schedule: - - cron: '0 3 * * *' + - cron: '0 5 * * *' jobs: CI: