Skip to content

Commit 10b80ae

Browse files
authored
Use Cuda for validation of the test pipeline (#2)
Cherry-pick refactor CIs from private repo Add Cuda Checks
1 parent 4e8bfce commit 10b80ae

11 files changed

Lines changed: 242 additions & 136 deletions

File tree

.github/workflows/idefix-ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ on:
33
workflow_dispatch:
44
push:
55
branches:
6-
- main
6+
- master
77
pull_request:
88

9+
env:
10+
TEST_OPTIONS: -DKokkos_ENABLE_CUDA=ON
11+
912
jobs:
1013
Linter:
1114
# Don't do this in forks
@@ -17,7 +20,9 @@ jobs:
1720
with:
1821
lfs: false
1922
- run: pre-commit install
20-
- run: pre-commit run --all-files
23+
- name: Run linter
24+
id: linter
25+
run: pre-commit run --all-files
2126

2227
Hydrodynamics:
2328
needs: Linter

.gitlab-ci.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,75 +8,77 @@ workflow:
88
- 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.
99

1010
stages:
11-
- checks
12-
- deploy
11+
- linter
12+
- base_checks
13+
- advanced_checks
14+
- documentation
1315

1416
lint:
15-
stage: checks
17+
stage: linter
1618
image: lesurg/idefix:latest
1719
script:
1820
- pre-commit install
1921
- pre-commit run --all-files
2022

2123
HD tests:
22-
stage: checks
24+
stage: base_checks
2325
image: lesurg/idefix:latest
2426
script:
2527
- cd test
2628
- ./checks_hydro.sh $TEST_OPTIONS
2729

2830
MHD tests:
29-
stage: checks
31+
stage: base_checks
3032
image: lesurg/idefix:latest
3133
script:
3234
- cd test
3335
- ./checks_mhd.sh $TEST_OPTIONS
3436

35-
Vector potential tests:
36-
stage: checks
37+
MPI tests:
38+
stage: base_checks
3739
image: lesurg/idefix:latest
3840
script:
3941
- cd test
40-
- ./checks_vector_potential.sh $TEST_OPTIONS
42+
- ./checks_mpi.sh $TEST_OPTIONS
4143

42-
MPI tests:
43-
stage: checks
44+
Vector potential tests:
45+
stage: base_checks
4446
image: lesurg/idefix:latest
4547
script:
4648
- cd test
47-
- ./checks_mpi.sh $TEST_OPTIONS
49+
- ./checks_vector_potential.sh $TEST_OPTIONS
4850

4951
HighOrder tests:
50-
stage: checks
52+
stage: advanced_checks
5153
image: lesurg/idefix:latest
5254
script:
5355
- cd test
5456
- ./checks_highorder.sh $TEST_OPTIONS
5557

5658
SinglePrecision tests:
57-
stage: checks
59+
stage: advanced_checks
5860
image: lesurg/idefix:latest
5961
script:
6062
- cd test
6163
- ./checks_singleprecision.sh $TEST_OPTIONS
6264

6365
Examples tests:
64-
stage: checks
66+
stage: advanced_checks
6567
image: lesurg/idefix:latest
6668
script:
6769
- cd test
6870
- ./checks_examples.sh $TEST_OPTIONS
6971

7072
Utils tests:
71-
stage: checks
73+
stage: advanced_checks
7274
image: lesurg/idefix:latest
7375
script:
7476
- cd test
7577
- ./checks_utils.sh $TEST_OPTIONS
7678

7779
pages:
7880
image: lesurg/idefix-documentation:latest
79-
stage: deploy
81+
stage: documentation
8082
script:
8183
- dir="public"
8284
- rm -rf $dir

test/MHD/ResistiveAlfvenWave/setup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void Analysis(DataBlock & data) {
1919
}, Kokkos::Sum<double>(etot));
2020

2121
#ifdef WITH_MPI
22-
MPI_Reduce(MPI_IN_LACE, &etot, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
22+
MPI_Reduce(MPI_IN_PLACE, &etot, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
2323
#endif
2424

2525
if(idfx::prank == 0) {

test/checks_examples.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,45 @@ echo $IDEFIX_DIR
3535
set -e
3636
options=$@
3737

38-
# HD tests
38+
39+
TMP_DIR="$(mktemp -d)"
40+
function finish ()
41+
{
42+
echo $1
43+
echo "Cleaning directory $TMP_DIR"
44+
cd $TEST_DIR
45+
rm -rf $TMP_DIR
46+
exit 1
47+
}
48+
3949
for rep in $rep_example_list; do
40-
TMP_DIR="$(mktemp -d)"
50+
4151
cp -R $TEST_DIR/$rep/* $TMP_DIR
4252
cd $TMP_DIR
4353
echo "***********************************************"
4454
echo "Configuring $rep"
4555
echo "Using $TMP_DIR as working directory"
4656
echo "***********************************************"
47-
rm -f CMakeCache.txt
4857

49-
cmake $IDEFIX_DIR $options || { echo "!!!! Example $rep failed during configuration"; exit 1; }
58+
cmake $IDEFIX_DIR $options || finish "!!!! Example $rep failed during configuration"
5059
echo "***********************************************"
5160
echo "Making $rep"
5261
echo "***********************************************"
53-
make clean; make -j 10 || { echo "!!!! Example $rep failed during compilation"; exit 1; }
62+
make -j 8 || finish "!!!! Example $rep failed during compilation"
5463

5564

5665
echo "***********************************************"
5766
echo "Running $rep"
5867
echo "***********************************************"
59-
./idefix -maxcycles 10 -nowrite -Werror || { echo "!!!! Example $rep failed running"; exit 1; }
68+
./idefix -maxcycles 10 -nowrite -Werror || finish "!!!! Example $rep failed running"
6069

6170
echo "***********************************************"
6271
echo "Cleaning $rep in $TMP_DIR"
6372
echo "***********************************************"
64-
rm -rf $TMP_DIR
73+
rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt
6574

6675
done
76+
77+
echo "Test was successfull"
78+
cd $TEST_DIR
79+
rm -rf $TMP_DIR

test/checks_highorder.sh

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,88 +30,96 @@ if [ -z ${var+IDEFIX_DIR} ] & [ -d "$IDEFIX_DIR" ] ; then
3030
fi
3131

3232
export IDEFIX_DIR=$target_dir
33-
echo $IDEFIX_DIR
3433

3534
set -e
3635
options=$@
3736

37+
TMP_DIR="$(mktemp -d)"
38+
function finish ()
39+
{
40+
echo $1
41+
echo "Cleaning directory $TMP_DIR"
42+
cd $TEST_DIR
43+
rm -rf $TMP_DIR
44+
exit 1
45+
}
46+
3847
# High order tests
3948
for rep in $rep_list; do
40-
TMP_DIR="$(mktemp -d)"
4149
cp -R $TEST_DIR/$rep/* $TMP_DIR
4250
cd $TMP_DIR
4351
echo "***********************************************"
4452
echo "Configuring $rep"
4553
echo "Using $TMP_DIR as working directory"
4654
echo "***********************************************"
47-
rm -f CMakeCache.txt
4855
for order in $order_list; do
4956

50-
cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order || { echo "!!!!$rep with $order failed during configuration"; exit 1; }
57+
cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order || finish "!!!!$rep with $order failed during configuration"
5158
echo "***********************************************"
5259
echo "Making $rep with $order"
5360
echo "***********************************************"
54-
make clean; make -j 10 || { echo "!!!! $rep with $order failed during compilation with"; exit 1; }
61+
make -j 8 || finish "!!!! $rep with $order failed during compilation"
5562

5663
ini_files=$(ls *.ini)
5764
for ini in $ini_files; do
5865
echo "***********************************************"
5966
echo "Running $rep with $order and $ini"
6067
echo "***********************************************"
61-
./idefix -i $ini -nolog || { echo "!!!! $rep with $order failed running with $ini"; exit 1; }
68+
./idefix -i $ini -nolog || finish "!!!! $rep with $order failed running with $ini"
6269

6370
cd python
6471
echo "***********************************************"
6572
echo "Testing $rep with $order and $ini"
6673
echo "***********************************************"
67-
python3 testidefix.py -noplot || { echo "!!!! $rep with $order failed validation with $ini"; exit 1; }
74+
python3 testidefix.py -noplot || finish "!!!! $rep with $order failed validation with $ini"
6875
cd ..
6976
done
70-
make clean
7177
rm -f *.vtk *.dbl *.dmp
7278
done
7379
echo "***********************************************"
7480
echo "Cleaning $rep in $TMP_DIR"
7581
echo "***********************************************"
76-
rm -rf $TMP_DIR
82+
rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt
7783
done
7884

7985
#do it with MPI (only the default .ini files though)
8086
# High order tests
8187
for rep in $rep_MPI_list; do
82-
TMP_DIR="$(mktemp -d)"
8388
cp -R $TEST_DIR/$rep/* $TMP_DIR
8489
cd $TMP_DIR
8590
echo "***********************************************"
8691
echo "Configuring $rep"
8792
echo "Using $TMP_DIR as working directory"
8893
echo "***********************************************"
89-
rm -f CMakeCache.txt
94+
9095
for order in $order_list; do
9196

92-
cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order -DIdefix_MPI=ON || { echo "!!!!$rep with $order failed during configuration"; exit 1; }
97+
cmake $IDEFIX_DIR $options -DIdefix_RECONSTRUCTION=$order -DIdefix_MPI=ON || finish "!!!!$rep with $order failed during configuration"
9398
echo "***********************************************"
9499
echo "Making $rep with $order"
95100
echo "***********************************************"
96-
make clean; make -j 10 || { echo "!!!! $rep with $order and MPI failed during compilation with"; exit 1; }
101+
make -j 8 || finish "!!!! $rep with $order and MPI failed during compilation with"
97102

98103
echo "***********************************************"
99104
echo "Running $rep with $order and MPI"
100105
echo "***********************************************"
101-
mpirun -np 4 ./idefix || { echo "!!!! $rep with $order and MPI failed running "; exit 1; }
106+
mpirun -np 4 ./idefix || finish "!!!! $rep with $order and MPI failed running "
102107

103108
cd python
104109
echo "***********************************************"
105110
echo "Testing $rep with $order and MPI"
106111
echo "***********************************************"
107-
python3 testidefix.py -noplot || { echo "!!!! $rep with $order and MPI failed validation"; exit 1; }
112+
python3 testidefix.py -noplot || finish "!!!! $rep with $order and MPI failed validation"
108113
cd ..
109114

110-
make clean
111115
rm -f *.vtk *.dbl *.dmp
112116
done
113117
echo "***********************************************"
114118
echo "Cleaning $rep in $TMP_DIR"
115119
echo "***********************************************"
116-
rm -rf $TMP_DIR
120+
rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt
117121
done
122+
123+
echo "Test was successfull"
124+
cd $TEST_DIR
125+
rm -rf $TMP_DIR

test/checks_hydro.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,53 @@ set -e
3333
options=$@
3434

3535
# HD tests
36+
TMP_DIR="$(mktemp -d)"
37+
function finish ()
38+
{
39+
echo $1
40+
echo "Cleaning directory $TMP_DIR"
41+
cd $TEST_DIR
42+
rm -rf $TMP_DIR
43+
exit 1
44+
}
45+
3646
for rep in $rep_HD_list; do
37-
TMP_DIR="$(mktemp -d)"
3847
cp -R $TEST_DIR/HD/$rep/* $TMP_DIR
3948
cd $TMP_DIR
4049
echo "***********************************************"
4150
echo "Configuring $rep"
4251
echo "Using $TMP_DIR as working directory"
4352
echo "***********************************************"
44-
rm -f CMakeCache.txt
4553
def_files=$(ls definitions*.hpp)
4654
for def in $def_files; do
4755

48-
cmake $IDEFIX_DIR $options -DIdefix_DEFS=$def|| { echo "!!!! HD $rep failed during configuration"; exit 1; }
56+
cmake $IDEFIX_DIR $options -DIdefix_DEFS=$def|| finish "!!!! HD $rep failed during configuration"
4957
echo "***********************************************"
5058
echo "Making $rep with $def"
5159
echo "***********************************************"
52-
make clean; make -j 10 || { echo "!!!! HD $rep failed during compilation with $def"; exit 1; }
60+
make -j 8 || finish "!!!! HD $rep failed during compilation with $def"
5361

5462
ini_files=$(ls *.ini)
5563
for ini in $ini_files; do
5664
echo "***********************************************"
5765
echo "Running $rep with $ini"
5866
echo "***********************************************"
59-
./idefix -i $ini -nolog || { echo "!!!! HD $rep failed running with $def and $ini"; exit 1; }
67+
./idefix -i $ini -nolog || finish "!!!! HD $rep failed running with $def and $ini"
6068

6169
cd python
6270
echo "***********************************************"
6371
echo "Testing $rep with $ini and $def"
6472
echo "***********************************************"
65-
python3 testidefix.py -noplot || { echo "!!!! HD $rep failed validation with $def and $ini"; exit 1; }
73+
python3 testidefix.py -noplot || finish "!!!! HD $rep failed validation with $def and $ini"
6674
cd ..
6775
done
68-
make clean
6976
rm -f *.vtk *.dbl *.dmp
7077
done
7178
echo "***********************************************"
7279
echo "Cleaning $rep in $TMP_DIR"
7380
echo "***********************************************"
74-
rm -rf $TMP_DIR
81+
rm -rf *.vtk *.dbl *.dmp *.ini python CMakeLists.txt
7582
done
83+
echo "Test was successfull"
84+
cd $TEST_DIR
85+
rm -rf $TMP_DIR

0 commit comments

Comments
 (0)