From b91b6be0c3294d80f622a02f2bb8dc745d2ee8a4 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Mon, 23 Jan 2023 22:21:43 +0100 Subject: [PATCH 01/13] add checks for linter (tentative) --- .github/workflows/idefix-ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index c3e4d18a..0d6afad6 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -17,7 +17,18 @@ jobs: with: lfs: false - run: pre-commit install - - run: pre-commit run --all-files + - name: Run linter + id: linter + continue-on-error: true + run: pre-commit run --all-files + - name: Report linter conclusions + if: always() + uses: dflydev/check-runs-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + id: linter + conclusion: ${{ steps.linter.outcome }} + fail-on-error: true Hydrodynamics: needs: Linter From 9f7e716c162be583a15e290ef5395629916bbf45 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Mon, 23 Jan 2023 22:25:34 +0100 Subject: [PATCH 02/13] Update idefix-ci.yml --- .github/workflows/idefix-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index 0d6afad6..97ca6d1e 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -27,6 +27,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} id: linter + name: Linter conclusion: ${{ steps.linter.outcome }} fail-on-error: true From 2438573cdc29437c27c3a6f55384113fc53a1673 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 08:42:18 +0100 Subject: [PATCH 03/13] Use another action-check link --- .github/workflows/idefix-ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index 97ca6d1e..d9e7b2e8 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -21,15 +21,14 @@ jobs: id: linter continue-on-error: true run: pre-commit run --all-files - - name: Report linter conclusions + - uses: LouisBrunner/checks-action@v1.1.1 if: always() - uses: dflydev/check-runs-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - id: linter - name: Linter - conclusion: ${{ steps.linter.outcome }} - fail-on-error: true + name: Linter checks + conclusion: ${{ job.status }} + output: | + {"summary":${{ steps.test.outputs.summary }}} Hydrodynamics: needs: Linter From 50bb8606f92b4c2004e1aeb4bae4a185ea4b7cbc Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 08:44:06 +0100 Subject: [PATCH 04/13] changer id --- .github/workflows/idefix-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index d9e7b2e8..f4927aa7 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -28,7 +28,7 @@ jobs: name: Linter checks conclusion: ${{ job.status }} output: | - {"summary":${{ steps.test.outputs.summary }}} + {"summary":${{ steps.linter.outputs.summary }}} Hydrodynamics: needs: Linter From f0010f68906b3a02cc62321b8482f4f21142d76a Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 08:47:32 +0100 Subject: [PATCH 05/13] remove summary --- .github/workflows/idefix-ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index f4927aa7..d1fae792 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -27,8 +27,6 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} name: Linter checks conclusion: ${{ job.status }} - output: | - {"summary":${{ steps.linter.outputs.summary }}} Hydrodynamics: needs: Linter From c4359f19f46f69c83362d9591ea80704f8035d50 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 08:58:53 +0100 Subject: [PATCH 06/13] add permissions --- .github/workflows/idefix-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index d1fae792..ce5ef583 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -5,7 +5,11 @@ on: branches: - main pull_request: - + +permissions: + contents: read + packages: read + jobs: Linter: # Don't do this in forks From d0a381ade7dfe5daab082c0ca3c3f4cac0f5e8f6 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 09:11:05 +0100 Subject: [PATCH 07/13] change version --- .github/workflows/idefix-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index ce5ef583..eb30bdbe 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -25,7 +25,7 @@ jobs: id: linter continue-on-error: true run: pre-commit run --all-files - - uses: LouisBrunner/checks-action@v1.1.1 + - uses: LouisBrunner/checks-action@v1.5.0 if: always() with: token: ${{ secrets.GITHUB_TOKEN }} From 773310612b7c1648062a872f50bd64f989867405 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 09:19:13 +0100 Subject: [PATCH 08/13] add check write access --- .github/workflows/idefix-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index eb30bdbe..df1646ea 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -9,6 +9,7 @@ on: permissions: contents: read packages: read + checks: write jobs: Linter: From 25029d6515c71020868f8e4e0148bb6b440ee413 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 09:54:51 +0100 Subject: [PATCH 09/13] remove checks and enable cuda --- .github/workflows/idefix-ci.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index df1646ea..b4269a04 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -6,10 +6,8 @@ on: - main pull_request: -permissions: - contents: read - packages: read - checks: write +env: + TEST_OPTIONS: -DKokkos_ENABLE_CUDA=ON jobs: Linter: @@ -24,14 +22,7 @@ jobs: - run: pre-commit install - name: Run linter id: linter - continue-on-error: true run: pre-commit run --all-files - - uses: LouisBrunner/checks-action@v1.5.0 - if: always() - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Linter checks - conclusion: ${{ job.status }} Hydrodynamics: needs: Linter From e557506936ef66fc9756b311300e3ff79727dbca Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 09:56:18 +0100 Subject: [PATCH 10/13] make linter happy --- .github/workflows/idefix-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index b4269a04..58145069 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -5,10 +5,10 @@ on: branches: - main pull_request: - + env: TEST_OPTIONS: -DKokkos_ENABLE_CUDA=ON - + jobs: Linter: # Don't do this in forks From c45d86b770be3262825be2e252708416768a953a Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 12:02:10 +0100 Subject: [PATCH 11/13] run tests on push on master --- .github/workflows/idefix-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index 58145069..483a31c5 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: push: branches: - - main + - master pull_request: env: From 5d73044fb2975b3b278629b1c775684da2922840 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Fri, 13 Jan 2023 15:14:17 +0100 Subject: [PATCH 12/13] Refactor CI tests --- .gitlab-ci.yml | 31 +++++--- test/MHD/ResistiveAlfvenWave/setup.cpp | 2 +- test/checks_examples.sh | 27 +++++-- test/checks_highorder.sh | 42 ++++++---- test/checks_hydro.sh | 26 +++++-- test/checks_mhd.sh | 30 ++++--- test/checks_mpi.sh | 104 ++++++++++++++++--------- test/checks_singleprecision.sh | 47 +++++------ test/checks_utils.sh | 31 +++++--- test/checks_vector_potential.sh | 26 +++++-- 10 files changed, 237 insertions(+), 129 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d19a5ad0..51b049f6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,32 +8,41 @@ workflow: - if: $CI_PIPELINE_SOURCE == 'web' # execute jobs when created by using Run pipeline button in the GitLab UI, from the project’s CI/CD > Pipelines section. stages: - - checks - - deploy + - linter + - base_checks + - advanced_checks + - documentation lint: - stage: checks + stage: linter image: lesurg/idefix:latest script: - pre-commit install - pre-commit run --all-files HD tests: - stage: checks + stage: base_checks image: lesurg/idefix:latest script: - cd test - ./checks_hydro.sh $TEST_OPTIONS MHD tests: - stage: checks + stage: base_checks image: lesurg/idefix:latest script: - cd test - ./checks_mhd.sh $TEST_OPTIONS +MPI tests: + stage: base_checks + image: lesurg/idefix:latest + script: + - cd test + - ./checks_mpi.sh $TEST_OPTIONS + Vector potential tests: - stage: checks + stage: base_checks image: lesurg/idefix:latest script: - cd test @@ -47,28 +56,28 @@ MPI tests: - ./checks_mpi.sh $TEST_OPTIONS HighOrder tests: - stage: checks + stage: advanced_checks image: lesurg/idefix:latest script: - cd test - ./checks_highorder.sh $TEST_OPTIONS SinglePrecision tests: - stage: checks + stage: advanced_checks image: lesurg/idefix:latest script: - cd test - ./checks_singleprecision.sh $TEST_OPTIONS Examples tests: - stage: checks + stage: advanced_checks image: lesurg/idefix:latest script: - cd test - ./checks_examples.sh $TEST_OPTIONS Utils tests: - stage: checks + stage: advanced_checks image: lesurg/idefix:latest script: - cd test @@ -76,7 +85,7 @@ Utils tests: pages: image: lesurg/idefix-documentation:latest - stage: deploy + stage: documentation script: - dir="public" - rm -rf $dir diff --git a/test/MHD/ResistiveAlfvenWave/setup.cpp b/test/MHD/ResistiveAlfvenWave/setup.cpp index b641b7eb..3f92fc0a 100644 --- a/test/MHD/ResistiveAlfvenWave/setup.cpp +++ b/test/MHD/ResistiveAlfvenWave/setup.cpp @@ -19,7 +19,7 @@ void Analysis(DataBlock & data) { }, Kokkos::Sum(etot)); #ifdef WITH_MPI - MPI_Reduce(MPI_IN_LACE, &etot, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); + MPI_Reduce(MPI_IN_PLACE, &etot, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); #endif if(idfx::prank == 0) { diff --git a/test/checks_examples.sh b/test/checks_examples.sh index 6939e329..d563aac9 100755 --- a/test/checks_examples.sh +++ b/test/checks_examples.sh @@ -35,32 +35,45 @@ echo $IDEFIX_DIR set -e options=$@ -# HD tests + +TMP_DIR="$(mktemp -d)" +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} + for rep in $rep_example_list; do - TMP_DIR="$(mktemp -d)" + cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR as working directory" echo "***********************************************" - rm -f CMakeCache.txt - cmake $IDEFIX_DIR $options || { echo "!!!! Example $rep failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options || finish "!!!! Example $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! Example $rep failed during compilation"; exit 1; } + make -j 8 || finish "!!!! Example $rep failed during compilation" echo "***********************************************" echo "Running $rep" echo "***********************************************" - ./idefix -maxcycles 10 -nowrite -Werror || { echo "!!!! Example $rep failed running"; exit 1; } + ./idefix -maxcycles 10 -nowrite -Werror || finish "!!!! Example $rep failed running" echo "***********************************************" echo "Cleaning $rep in $TMP_DIR" echo "***********************************************" - rm -rf $TMP_DIR + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done + +echo "Test was successfull" +cd $TEST_DIR +rm -rf $TMP_DIR diff --git a/test/checks_highorder.sh b/test/checks_highorder.sh index 26c78d99..9b55974d 100755 --- a/test/checks_highorder.sh +++ b/test/checks_highorder.sh @@ -30,88 +30,96 @@ if [ -z ${var+IDEFIX_DIR} ] & [ -d "$IDEFIX_DIR" ] ; then fi export IDEFIX_DIR=$target_dir -echo $IDEFIX_DIR set -e options=$@ +TMP_DIR="$(mktemp -d)" +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} + # High order tests for rep in $rep_list; do - TMP_DIR="$(mktemp -d)" cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR as working directory" echo "***********************************************" - rm -f CMakeCache.txt for order in $order_list; do - cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order || { echo "!!!!$rep with $order failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order || finish "!!!!$rep with $order failed during configuration" echo "***********************************************" echo "Making $rep with $order" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! $rep with $order failed during compilation with"; exit 1; } + make -j 8 || finish "!!!! $rep with $order failed during compilation" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep with $order and $ini" echo "***********************************************" - ./idefix -i $ini -nolog || { echo "!!!! $rep with $order failed running with $ini"; exit 1; } + ./idefix -i $ini -nolog || finish "!!!! $rep with $order failed running with $ini" cd python echo "***********************************************" echo "Testing $rep with $order and $ini" echo "***********************************************" - python3 testidefix.py -noplot || { echo "!!!! $rep with $order failed validation with $ini"; exit 1; } + python3 testidefix.py -noplot || finish "!!!! $rep with $order failed validation with $ini" cd .. done - make clean rm -f *.vtk *.dbl *.dmp done echo "***********************************************" echo "Cleaning $rep in $TMP_DIR" echo "***********************************************" - rm -rf $TMP_DIR + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done #do it with MPI (only the default .ini files though) # High order tests for rep in $rep_MPI_list; do - TMP_DIR="$(mktemp -d)" cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR as working directory" echo "***********************************************" - rm -f CMakeCache.txt + for order in $order_list; do - cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order -DIdefix_MPI=ON || { echo "!!!!$rep with $order failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order -DIdefix_MPI=ON || finish "!!!!$rep with $order failed during configuration" echo "***********************************************" echo "Making $rep with $order" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! $rep with $order and MPI failed during compilation with"; exit 1; } + make -j 8 || finish "!!!! $rep with $order and MPI failed during compilation with" echo "***********************************************" echo "Running $rep with $order and MPI" echo "***********************************************" - mpirun -np 4 ./idefix || { echo "!!!! $rep with $order and MPI failed running "; exit 1; } + mpirun -np 4 ./idefix || finish "!!!! $rep with $order and MPI failed running " cd python echo "***********************************************" echo "Testing $rep with $order and MPI" echo "***********************************************" - python3 testidefix.py -noplot || { echo "!!!! $rep with $order and MPI failed validation"; exit 1; } + python3 testidefix.py -noplot || finish "!!!! $rep with $order and MPI failed validation" cd .. - make clean rm -f *.vtk *.dbl *.dmp done echo "***********************************************" echo "Cleaning $rep in $TMP_DIR" echo "***********************************************" - rm -rf $TMP_DIR + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done + +echo "Test was successfull" +cd $TEST_DIR +rm -rf $TMP_DIR diff --git a/test/checks_hydro.sh b/test/checks_hydro.sh index 8231aad0..5313dad0 100755 --- a/test/checks_hydro.sh +++ b/test/checks_hydro.sh @@ -33,43 +33,53 @@ set -e options=$@ # HD tests +TMP_DIR="$(mktemp -d)" +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} + for rep in $rep_HD_list; do - TMP_DIR="$(mktemp -d)" cp -R $TEST_DIR/HD/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR as working directory" echo "***********************************************" - rm -f CMakeCache.txt def_files=$(ls definitions*.hpp) for def in $def_files; do - cmake $IDEFIX_DIR $options -DIdefix_DEFS=$def|| { echo "!!!! HD $rep failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_DEFS=$def|| finish "!!!! HD $rep failed during configuration" echo "***********************************************" echo "Making $rep with $def" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! HD $rep failed during compilation with $def"; exit 1; } + make -j 8 || finish "!!!! HD $rep failed during compilation with $def" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" - ./idefix -i $ini -nolog || { echo "!!!! HD $rep failed running with $def and $ini"; exit 1; } + ./idefix -i $ini -nolog || finish "!!!! HD $rep failed running with $def and $ini" cd python echo "***********************************************" echo "Testing $rep with $ini and $def" echo "***********************************************" - python3 testidefix.py -noplot || { echo "!!!! HD $rep failed validation with $def and $ini"; exit 1; } + python3 testidefix.py -noplot || finish "!!!! HD $rep failed validation with $def and $ini" cd .. done - make clean rm -f *.vtk *.dbl *.dmp done echo "***********************************************" echo "Cleaning $rep in $TMP_DIR" echo "***********************************************" - rm -rf $TMP_DIR + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done +echo "Test was successfull" +cd $TEST_DIR +rm -rf $TMP_DIR diff --git a/test/checks_mhd.sh b/test/checks_mhd.sh index 4a83ac4a..4748e7ab 100755 --- a/test/checks_mhd.sh +++ b/test/checks_mhd.sh @@ -32,40 +32,52 @@ echo $IDEFIX_DIR set -e options=$@ +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} # MHD tests for rep in $rep_MHD_list; do - cp -R $TEST_DIR/MHD/$rep $TMP_DIR - cd $TMP_DIR/$rep + cp -R $TEST_DIR/MHD/$rep/* $TMP_DIR + cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" - rm -f CMakeCache.txt def_files=$(ls definitions*.hpp) for def in $def_files; do - cmake $IDEFIX_DIR $options -DIdefix_DEFS=$def|| { echo "!!!! MHD $rep failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_DEFS=$def|| finish "!!!! MHD $rep failed during configuration" echo "***********************************************" echo "Making $rep with $def" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! MHD $rep failed during compilation with $def"; exit 1; } + make -j 8 || finish "!!!! MHD $rep failed during compilation with $def" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" - ./idefix -i $ini -nolog || { echo "!!!! MHD $rep failed running with $def and $ini"; exit 1; } + ./idefix -i $ini -nolog || finish "!!!! MHD $rep failed running with $def and $ini" cd python echo "***********************************************" echo "Testing $rep with $ini and $def" echo "***********************************************" - python3 testidefix.py -noplot -i ../$ini || { echo "!!!! MHD $rep failed validation with $def and $ini"; exit 1; } + python3 testidefix.py -noplot -i ../$ini || finish "!!!! MHD $rep failed validation with $def and $ini" cd .. done + rm -f *.vtk *.dbl *.dmp done + echo "***********************************************" + echo "Cleaning $TMP_DIR" + echo "***********************************************" + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done - -echo "Cleaning temporary directory $TMP_DIR" +echo "Test was successfull" +cd $TEST_DIR rm -rf $TMP_DIR diff --git a/test/checks_mpi.sh b/test/checks_mpi.sh index 1c93e57e..60eef2b3 100755 --- a/test/checks_mpi.sh +++ b/test/checks_mpi.sh @@ -1,7 +1,8 @@ #!/bin/bash rep_2D_mpi_list="HD/MachReflection HD/ViscousFlowPastCylinder HD/FargoPlanet MHD/OrszagTang" -rep_3D_mpi_list="MHD/AmbipolarCshock3D MHD/AxisFluxTube MHD/LinearWaveTest MHD/FargoMHDSpherical MHD/OrszagTang3D" +rep_3D_mpi_list="MHD/AxisFluxTube MHD/LinearWaveTest MHD/FargoMHDSpherical MHD/OrszagTang3D" +rep_3D_noX3_list="MHD/AmbipolarCshock3D" # refer to the parent dir of this file, wherever this is called from # a python equivalent is e.g. @@ -10,8 +11,6 @@ rep_3D_mpi_list="MHD/AmbipolarCshock3D MHD/AxisFluxTube MHD/LinearWaveTest MHD/F # TEST_DIR = pathlib.Path(__file__).parent TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" TMP_DIR="$(mktemp -d)" -mkdir $TMP_DIR/HD -mkdir $TMP_DIR/MHD function resolve_path { # resolve relative paths @@ -19,6 +18,15 @@ function resolve_path { echo "`cd "$1";pwd`" } +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} + target_dir=$(resolve_path $TEST_DIR/..) if [ -z ${var+IDEFIX_DIR} ] & [ -d "$IDEFIX_DIR" ] ; then @@ -38,67 +46,95 @@ options=$@ # 2D MPI tests for rep in $rep_2D_mpi_list; do - cp -R $TEST_DIR/$rep $TMP_DIR/$rep - cd $TMP_DIR/$rep + cp -R $TEST_DIR/$rep/* $TMP_DIR + cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" - rm -f CMakeCache.txt - cmake $IDEFIX_DIR -DIdefix_MPI=ON $options + cmake $IDEFIX_DIR -DIdefix_MPI=ON $options || finish "!!!! MPI $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" - make clean; make -j 10 + make -j 8 || finish "!!!! MPI $rep failed during compilation" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" - mpirun -np 4 ./idefix -i $ini -dec 2 2 -nolog + mpirun -np 4 ./idefix -i $ini -dec 2 2 -nolog || finish "!!!! MPI $rep failed during runtime with $ini" cd python echo "***********************************************" echo "Testing $rep with $ini" echo "***********************************************" - python3 testidefix.py -noplot -i ../$ini + python3 testidefix.py -noplot -i ../$ini || finish "!!!! MPI $rep failed during validation" cd .. done - make clean - rm -f *.vtk *.dbl *.dmp + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done # MHD tests -for rep in $rep_3D_mpi_list; do - cp -R $TEST_DIR/$rep $TMP_DIR/$rep - cd $TMP_DIR/$rep +for rep in $rep_3D_noX3_list; do + cp -R $TEST_DIR/$rep/* $TMP_DIR + cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" - rm -f CMakeCache.txt - cmake $IDEFIX_DIR -DIdefix_MPI=ON $options + cmake $IDEFIX_DIR -DIdefix_MPI=ON $options || finish "!!!! MPI $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" - make clean; make -j 10 + make -j 8 || finish "!!!! MPI $rep failed during compilation" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" - mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog + mpirun -np 4 ./idefix -i $ini -dec 2 2 1 -nolog || finish "!!!! MPI $rep failed during runtime with $ini" cd python echo "***********************************************" echo "Testing $rep with $ini" echo "***********************************************" - python3 testidefix.py -noplot -i ../$ini + python3 testidefix.py -noplot || finish "!!!! MPI $rep failed during validation" cd .. done + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt + cd $TEST_DIR +done +for rep in $rep_3D_mpi_list; do + cp -R $TEST_DIR/$rep/* $TMP_DIR + cd $TMP_DIR + echo "***********************************************" + echo "Configuring $rep" + echo "Using $TMP_DIR/$rep as working directory" + echo "***********************************************" + cmake $IDEFIX_DIR -DIdefix_MPI=ON $options || finish "!!!! MPI $rep failed during configuration" + echo "***********************************************" + echo "Making $rep" + echo "***********************************************" + make -j 8 || finish "!!!! MPI $rep failed during compilation" + + ini_files=$(ls *.ini) + for ini in $ini_files; do + echo "***********************************************" + echo "Running $rep with $ini" + echo "***********************************************" + mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog || finish "!!!! MPI $rep failed during runtime with $ini" + + cd python + echo "***********************************************" + echo "Testing $rep with $ini" + echo "***********************************************" + python3 testidefix.py -noplot -i ../$ini || finish "!!!! MPI $rep failed during validation" + cd .. + done + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt cd $TEST_DIR done @@ -106,30 +142,29 @@ done rep="HD/SedovBlastWave" ## Cartesian blast -cp -R $TEST_DIR/$rep $TMP_DIR/$rep -cd $TMP_DIR/$rep +cp -R $TEST_DIR/$rep/* $TMP_DIR +cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" -rm -f CMakeCache.txt -cmake $IDEFIX_DIR -DIdefix_MPI=ON $options +cmake $IDEFIX_DIR -DIdefix_MPI=ON -DIdefix_MHD=OFF $options || finish "!!!! MPI $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" -make clean; make -j 10 +make -j 8 || finish "!!!! MPI $rep failed during compilation" ini="idefix.ini" echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" -mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog +mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog || finish "!!!! MPI $rep failed during runtime with $ini" cd python echo "***********************************************" echo "Testing $rep with $ini" echo "***********************************************" -python3 testidefix.py -noplot -i ../$ini +python3 testidefix.py -noplot -i ../$ini || finish "!!!! MPI $rep failed during validation" cd .. ## Spherical blast @@ -137,27 +172,26 @@ echo "***********************************************" echo "Configuring $rep in spherical geometry" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" -rm -f CMakeCache.txt -cmake $IDEFIX_DIR -DIdefix_MPI=ON -DIdefix_DEFS=definitions-spherical.hpp $options + +cmake $IDEFIX_DIR -DIdefix_MPI=ON -DIdefix_MHD=OFF -DIdefix_DEFS=definitions-spherical.hpp $options || finish "!!!! MPI $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" -make clean; make -j 10 +make -j 8 || finish "!!!! MPI $rep failed during compilation" ini="idefix-spherical.ini" echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" -mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog +mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog || finish "!!!! MPI $rep failed during runtime with $ini" cd python echo "***********************************************" echo "Testing $rep with $ini" echo "***********************************************" -python3 testidefix.py -noplot -i ../$ini +python3 testidefix.py -noplot -i ../$ini || finish "!!!! MPI $rep failed during validation" +## done +echo "Test was successfull" cd $TEST_DIR - - -echo "Cleaning temporary directory $TMP_DIR" rm -rf $TMP_DIR diff --git a/test/checks_singleprecision.sh b/test/checks_singleprecision.sh index ae705c21..ef7fe895 100755 --- a/test/checks_singleprecision.sh +++ b/test/checks_singleprecision.sh @@ -29,88 +29,91 @@ if [ -z ${var+IDEFIX_DIR} ] & [ -d "$IDEFIX_DIR" ] ; then fi export IDEFIX_DIR=$target_dir -echo $IDEFIX_DIR + set -e options=$@ +TMP_DIR="$(mktemp -d)" +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} + # High order tests for rep in $rep_list; do - TMP_DIR="$(mktemp -d)" + cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR as working directory" echo "***********************************************" - rm -f CMakeCache.txt - - cmake $IDEFIX_DIR $options -DIdefix_PRECISION=Single || { echo "!!!!$rep in single precision failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_PRECISION=Single || finish "!!!!$rep in single precision failed during configuration" echo "***********************************************" echo "Making $rep in single precision" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! $rep in single precision failed during compilation with"; exit 1; } + make -j 8 || finish "!!!! $rep in single precision failed during compilation with" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep in single precision and $ini" echo "***********************************************" - ./idefix -i $ini -nolog || { echo "!!!! $rep in single precision failed running with $ini"; exit 1; } + ./idefix -i $ini -nolog || finish "!!!! $rep in single precision failed running with $ini" cd python echo "***********************************************" echo "Testing $rep in single precision and $ini" echo "***********************************************" - python3 testidefix.py -noplot || { echo "!!!! $rep in single precision failed validation with $ini"; exit 1; } + python3 testidefix.py -noplot || finish "!!!! $rep in single precision failed validation with $ini" cd .. done - make clean - rm -f *.vtk *.dbl *.dmp echo "***********************************************" echo "Cleaning $rep in $TMP_DIR" echo "***********************************************" - rm -rf $TMP_DIR + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done #do it with MPI (only the default .ini files though) # High order tests for rep in $rep_MPI_list; do - TMP_DIR="$(mktemp -d)" cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR as working directory" echo "***********************************************" - rm -f CMakeCache.txt - - cmake $IDEFIX_DIR $options -DIdefix_MPI=ON -DIdefix_PRECISION=Single || { echo "!!!!$rep in single precision failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_MPI=ON -DIdefix_PRECISION=Single || finish "!!!!$rep in single precision failed during configuration" echo "***********************************************" echo "Making $rep in single precision" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! $rep in single precision and MPI failed during compilation with"; exit 1; } + make -j 8 || finish "!!!! $rep in single precision and MPI failed during compilation with" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep in single precision, $ini and MPI" echo "***********************************************" - mpirun -np 4 ./idefix -i $ini -nolog || { echo "!!!! $rep in single precision and MPI failed running "; exit 1; } + mpirun -np 4 ./idefix -i $ini -nolog || finish "!!!! $rep in single precision and MPI failed running " cd python echo "***********************************************" echo "Testing $rep in single precision and MPI" echo "***********************************************" - python3 testidefix.py -noplot || { echo "!!!! $rep in single precision and MPI failed validation"; exit 1; } + python3 testidefix.py -noplot || finish "!!!! $rep in single precision and MPI failed validation" cd .. done - make clean - rm -f *.vtk *.dbl *.dmp - echo "***********************************************" echo "Cleaning $rep in $TMP_DIR" echo "***********************************************" - rm -rf $TMP_DIR + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt done +echo "Test was successfull" +cd $TEST_DIR +rm -rf $TMP_DIR diff --git a/test/checks_utils.sh b/test/checks_utils.sh index fd8f7a3f..30e55166 100755 --- a/test/checks_utils.sh +++ b/test/checks_utils.sh @@ -34,43 +34,52 @@ options=$@ rep="utils/lookupTable" TMP_DIR="$(mktemp -d)" +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} + cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Making numpy test files" echo "***********************************************" -python3 makeNpy.py +python3 makeNpy.py || finish "!!!! can't make numpy test file" echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" -rm -f CMakeCache.txt -cmake $IDEFIX_DIR -DIdefix_MPI=ON $options +cmake $IDEFIX_DIR -DIdefix_MPI=ON $options || finish "!!!! Example $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" -make clean; make -j 10 -mpirun -np 4 ./idefix +make -j 8 || finish "!!!! Test $rep failed during compilation" +mpirun -np 4 ./idefix || finish "!!!! Test $rep failed during runtime" +rm -rf *.vtk *.dbl *.dmp *.ini python + cd $TEST_DIR -rm -rf $TMP_DIR # Validate DumpImage rep="utils/dumpImage" -TMP_DIR="$(mktemp -d)" cp -R $TEST_DIR/$rep/* $TMP_DIR cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" -rm -f CMakeCache.txt -cmake $IDEFIX_DIR $options +cmake $IDEFIX_DIR $options || finish "!!!! Example $rep failed during configuration" echo "***********************************************" echo "Making $rep" echo "***********************************************" -make clean; make -j 10 -./idefix +make -j 8 || finish "!!!! Test $rep failed during compilation" +./idefix || finish "!!!! Test $rep failed during runtime" + +echo "Test was successfull" cd $TEST_DIR rm -rf $TMP_DIR diff --git a/test/checks_vector_potential.sh b/test/checks_vector_potential.sh index 5dc7840d..7fad07f1 100755 --- a/test/checks_vector_potential.sh +++ b/test/checks_vector_potential.sh @@ -32,41 +32,51 @@ echo $IDEFIX_DIR set -e options=$@ +function finish () +{ + echo $1 + echo "Cleaning directory $TMP_DIR" + cd $TEST_DIR + rm -rf $TMP_DIR + exit 1 +} # MHD+Vector potential tests for rep in $rep_MHD_list; do - cp -R $TEST_DIR/MHD/$rep $TMP_DIR - cd $TMP_DIR/$rep + cp -R $TEST_DIR/MHD/$rep/* $TMP_DIR + cd $TMP_DIR echo "***********************************************" echo "Configuring $rep" echo "Using $TMP_DIR/$rep as working directory" echo "***********************************************" - rm -f CMakeCache.txt + def_files=$(ls definitions*.hpp) for def in $def_files; do - cmake $IDEFIX_DIR $options -DIdefix_EVOLVE_VECTOR_POTENTIAL=ON -DIdefix_DEFS=$def|| { echo "!!!! MHD $rep failed during configuration"; exit 1; } + cmake $IDEFIX_DIR $options -DIdefix_EVOLVE_VECTOR_POTENTIAL=ON -DIdefix_DEFS=$def|| finish "!!!! MHD $rep failed during configuration" echo "***********************************************" echo "Making $rep with $def" echo "***********************************************" - make clean; make -j 10 || { echo "!!!! MHD $rep failed during compilation with $def"; exit 1; } + make -j 8 || finish "!!!! MHD $rep failed during compilation with $def" ini_files=$(ls *.ini) for ini in $ini_files; do echo "***********************************************" echo "Running $rep with $ini" echo "***********************************************" - ./idefix -i $ini -nolog || { echo "!!!! MHD $rep failed running with $def and $ini"; exit 1; } + ./idefix -i $ini -nolog || finish "!!!! MHD $rep failed running with $def and $ini" cd python echo "***********************************************" echo "Testing $rep with $ini and $def" echo "***********************************************" - python3 testidefix.py -noplot || { echo "!!!! MHD $rep failed validation with $def and $ini"; exit 1; } + python3 testidefix.py -noplot || finish "!!!! MHD $rep failed validation with $def and $ini" cd .. done done + rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt cd $TEST_DIR done -echo "Cleaning temporary directory $TMP_DIR" +echo "Test was successfull" +cd $TEST_DIR rm -rf $TMP_DIR From f27cee78963b5e8aa911806396eede4351ac44df Mon Sep 17 00:00:00 2001 From: Geoffroy Lesur Date: Tue, 24 Jan 2023 12:23:08 +0100 Subject: [PATCH 13/13] fix gitlab-ci --- .gitlab-ci.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 51b049f6..0ebafac3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,13 +48,6 @@ Vector potential tests: - cd test - ./checks_vector_potential.sh $TEST_OPTIONS -MPI tests: - stage: checks - image: lesurg/idefix:latest - script: - - cd test - - ./checks_mpi.sh $TEST_OPTIONS - HighOrder tests: stage: advanced_checks image: lesurg/idefix:latest