diff --git a/.github/workflows/spack.yml b/.github/workflows/spack.yml index aa186ebf..525c9fbf 100644 --- a/.github/workflows/spack.yml +++ b/.github/workflows/spack.yml @@ -46,6 +46,9 @@ jobs: needs: job_one runs-on: ubuntu-latest steps: + - name: Get number of CPU cores + uses: SimenB/github-actions-cpu-cores@v2 + id: cpu-cores - name: grab main project uses: actions/checkout@v4 with: @@ -83,7 +86,7 @@ jobs: cd ./KORC ./build.sh - cd ./build && ctest --output-on-failure + cd ./build && ctest -j ${{ steps.cpu-cores.outputs.count }} --output-on-failure - name: Show Cache if: failure() diff --git a/.gitignore b/.gitignore index bcc2221d..509913cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,6 @@ # ignore build directory /build -# ignore all CMakeFile directories -**/CMakeFiles - -# ignore all CmakeCache.txt files -CMakeCache.txt - -# ignore all cmake_install.cmake files -cmake_install.cmake - # ignore all Makefile files generated by cmake Makefile src/Makefile @@ -31,10 +22,6 @@ FIO/m3dc1_lib/makefile #ignore files in OUT_TEST **/OUT_TEST -# ignore CTest files -CTestTestfile.cmake -**/Testing - #ignore FIO build and install /FIO/build /FIO/install @@ -42,4 +29,4 @@ CTestTestfile.cmake #ignore all build files *.o *.mod -*.a \ No newline at end of file +*.a diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 29e079e7..4df81da0 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,16 +19,34 @@ target_link_libraries (xtest set_property(TARGET xtest PROPERTY LINKER_LANGUAGE Fortran) -add_test (NAME egyro_test - COMMAND ${CMAKE_SOURCE_DIR}/test/egyro/korc_egyro.sh ${CMAKE_SOURCE_DIR}/test/egyro - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +configure_file(${CMAKE_SOURCE_DIR}/test/egyro/korc_egyro.sh.in ${CMAKE_BINARY_DIR}/egyro_test/korc_egyro.sh) +configure_file(${CMAKE_SOURCE_DIR}/test/mars/korc_mars.sh.in ${CMAKE_BINARY_DIR}/mars_test/korc_mars.sh) if(USE_PSPLINE) - add_test (NAME mars_test - COMMAND ${CMAKE_SOURCE_DIR}/test/mars/korc_mars.sh ${CMAKE_SOURCE_DIR}/test/mars + add_test (NAME mars_test_1 + COMMAND ${CMAKE_BINARY_DIR}/mars_test/korc_mars.sh 1 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_tests_properties (mars_test_1 PROPERTIES PROCESSORS 1 ENVIRONMENT OMP_NUM_THREADS=1) endif() -add_test (NAME unit_testing - COMMAND xtest TEST_OUT - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +foreach(RANK IN ITEMS 1 2 4 8 16) + if(${RANK} LESS_EQUAL ${MPIEXEC_MAX_NUMPROCS}) + add_test (NAME egyro_test_${RANK} + COMMAND ${CMAKE_BINARY_DIR}/egyro_test/korc_egyro.sh ${RANK} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_tests_properties (egyro_test_${RANK} PROPERTIES PROCESSORS ${RANK} ENVIRONMENT OMP_NUM_THREADS=1) + + # if(USE_PSPLINE) + # add_test (NAME mars_test_${RANK} + # COMMAND ${CMAKE_BINARY_DIR}/mars_test/korc_mars.sh ${RANK} + # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + # set_tests_properties (mars_test_${RANK} PROPERTIES PROCESSORS ${RANK} ENVIRONMENT OMP_NUM_THREADS=1) + # endif() + + add_test (NAME unit_testing_${RANK} + COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${RANK} ./xtest TEST_OUT + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + set_tests_properties (unit_testing_${RANK} PROPERTIES PROCESSORS ${RANK} ENVIRONMENT OMP_NUM_THREADS=1) + endif() +endforeach() + diff --git a/test/egyro/korc_egyro.sh b/test/egyro/korc_egyro.sh deleted file mode 100755 index 708f57cc..00000000 --- a/test/egyro/korc_egyro.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -ex - -#define input file -INPUT_FILE=$1/"input_file_egyro.korc" -#define output directory -OUT_DIR="egyro_test" - -#check that output directory doesn't exist so bash doesn't complain -mkdir -p $OUT_DIR - -#assumes binary directory ../KORC/build/bin was added to path -./xkorc $INPUT_FILE $OUT_DIR/ - -h5diff -r -d 0.000001 $OUT_DIR/file_0.h5 $1/file_0.h5 - diff --git a/test/egyro/korc_egyro.sh.in b/test/egyro/korc_egyro.sh.in new file mode 100755 index 00000000..2f564541 --- /dev/null +++ b/test/egyro/korc_egyro.sh.in @@ -0,0 +1,18 @@ +#!/bin/bash + +set -ex + +#define input file +INPUT_FILE="${CMAKE_SOURCE_DIR}/test/egyro/input_file_egyro.korc" +#define output directory +OUT_DIR="egyro_test/rank_$1" + +#check that output directory doesn't exist so bash doesn't complain +if [ ! -d $OUT_DIR ]; then + mkdir -p $OUT_DIR +fi + +#assumes binary directory ../KORC/build/bin was added to path +${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} $1 ./xkorc $INPUT_FILE $OUT_DIR/ + +h5diff -r -d 0.000001 $OUT_DIR/file_0.h5 ${CMAKE_SOURCE_DIR}/test/egyro/file_0.h5 diff --git a/test/mars/korc_mars.sh b/test/mars/korc_mars.sh deleted file mode 100755 index 15b9c7c7..00000000 --- a/test/mars/korc_mars.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -ex - -#define input file -INPUT_FILE=$1/"input_file_D3D_191366_1762ms_MARS.korc" -#define output directory -OUT_DIR="mars_test" - -#check that output directory doesn't exist so bash doesn't complain -if [ ! -d $OUT_DIR ]; then - mkdir -p $OUT_DIR -fi -if [ ! -f D3D_191366_1762ms_MARS.h5 ]; then - ln -s $1/D3D_191366_1762ms_MARS.h5 D3D_191366_1762ms_MARS.h5 -fi - -./xkorc $INPUT_FILE $OUT_DIR/ - -h5diff -r -d 0.007 $OUT_DIR/file_0.h5 $1/file_0_new_random.h5 - diff --git a/test/mars/korc_mars.sh.in b/test/mars/korc_mars.sh.in new file mode 100755 index 00000000..ddbcad14 --- /dev/null +++ b/test/mars/korc_mars.sh.in @@ -0,0 +1,20 @@ +#!/bin/bash + +set -ex + +#define input file +INPUT_FILE="${CMAKE_SOURCE_DIR}/test/mars/input_file_D3D_191366_1762ms_MARS.korc" +#define output directory +OUT_DIR="mars_test/rank_$1" + +#check that output directory doesn't exist so bash doesn't complain +if [ ! -d $OUT_DIR ]; then + mkdir -p $OUT_DIR +fi +if [ ! -f D3D_191366_1762ms_MARS.h5 ]; then + ln -s ${CMAKE_SOURCE_DIR}/test/mars/D3D_191366_1762ms_MARS.h5 D3D_191366_1762ms_MARS.h5 +fi + +${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} $1 ./xkorc $INPUT_FILE $OUT_DIR/ + +h5diff -r -d 0.008 $OUT_DIR/file_0.h5 ${CMAKE_SOURCE_DIR}/test/mars/file_0_new_random.h5