diff --git a/.github/workflows/idefix-ci.yml b/.github/workflows/idefix-ci.yml index c3e4d18a..483a31c5 100644 --- a/.github/workflows/idefix-ci.yml +++ b/.github/workflows/idefix-ci.yml @@ -3,9 +3,12 @@ on: workflow_dispatch: push: branches: - - main + - master pull_request: +env: + TEST_OPTIONS: -DKokkos_ENABLE_CUDA=ON + jobs: Linter: # Don't do this in forks @@ -17,7 +20,9 @@ jobs: with: lfs: false - run: pre-commit install - - run: pre-commit run --all-files + - name: Run linter + id: linter + run: pre-commit run --all-files Hydrodynamics: needs: Linter diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d19a5ad0..0ebafac3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,67 +8,69 @@ 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 -Vector potential tests: - stage: checks +MPI tests: + stage: base_checks image: lesurg/idefix:latest script: - cd test - - ./checks_vector_potential.sh $TEST_OPTIONS + - ./checks_mpi.sh $TEST_OPTIONS -MPI tests: - stage: checks +Vector potential tests: + stage: base_checks image: lesurg/idefix:latest script: - cd test - - ./checks_mpi.sh $TEST_OPTIONS + - ./checks_vector_potential.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 +78,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