diff --git a/.github/workflows/actions/pre-install-py-packages/action.yml b/.github/workflows/actions/pre-install-py-packages/action.yml new file mode 100644 index 000000000..2be0d7afd --- /dev/null +++ b/.github/workflows/actions/pre-install-py-packages/action.yml @@ -0,0 +1,15 @@ +name: Install python packages + +description: "Action installing the Idefix python packages before running the tests." + +inputs: {} + +runs: + using: "composite" + steps: + - name: Create venv + shell: bash + run: | + python3 -m venv .venv + source .venv/bin/activate + python3 -m pip install -r ./test/python_requirements.txt diff --git a/.github/workflows/idefix-ci-jobs.yml b/.github/workflows/idefix-ci-jobs.yml index 734390db2..e6996f6c0 100644 --- a/.github/workflows/idefix-ci-jobs.yml +++ b/.github/workflows/idefix-ci-jobs.yml @@ -30,6 +30,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Sod test run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/sod -all $TESTME_OPTIONS - name: Isothermal Sod test @@ -46,6 +48,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Viscous flow past cylinder run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/ViscousFlowPastCylinder -all $TESTME_OPTIONS - name: Viscous disk @@ -60,6 +64,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: MHD Sod test run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/sod -all $TESTME_OPTIONS - name: MHD Isothermal Sod test @@ -80,6 +86,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Ambipolar C Shock run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/AmbipolarCshock -all $TESTME_OPTIONS - name: Ambipolar C Shock 3D @@ -99,6 +107,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Fargo + planet run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/FargoPlanet -all $TESTME_OPTIONS - name: Fargo MHD spherical @@ -112,6 +122,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Hydro shearing box run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/ShearingBox -all $TESTME_OPTIONS - name: MHD shearing box @@ -125,6 +137,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Jeans Instability run: scripts/ci/run-tests $IDEFIX_DIR/test/SelfGravity/JeansInstability -all $TESTME_OPTIONS - name: Random sphere spherical @@ -144,6 +158,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: 3 body run: scripts/ci/run-tests $IDEFIX_DIR/test/Planet/Planet3Body -all $TESTME_OPTIONS - name: migration @@ -165,6 +181,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Energy conservation run: scripts/ci/run-tests $IDEFIX_DIR/test/Dust/DustEnergy -all $TESTME_OPTIONS - name: Dusty wave @@ -178,6 +196,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: MTI run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/MTI -all $TESTME_OPTIONS - name: Spherical anisotropic diffusion @@ -195,6 +215,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Run examples test run: cd test && ./checks_examples.sh $TEST_OPTIONS @@ -206,6 +228,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Lookup table run: scripts/ci/run-tests $IDEFIX_DIR/test/utils/lookupTable -all $TESTME_OPTIONS - name: Dump Image @@ -221,6 +245,8 @@ jobs: uses: actions/checkout@v3 with: submodules: recursive + - name: Prep python + uses: ./.github/workflows/actions/pre-install-py-packages - name: Restart dumps run: scripts/ci/run-tests $IDEFIX_DIR/test/IO/dump -all $TESTME_OPTIONS - name: Pydefix diff --git a/scripts/ci/run-tests b/scripts/ci/run-tests index 329831029..359e1eb14 100755 --- a/scripts/ci/run-tests +++ b/scripts/ci/run-tests @@ -1,7 +1,20 @@ #!/usr/bin/env bash + +# load ICC compiler env if [ "$IDEFIX_COMPILER" == icc ]; then source /opt/intel/oneapi/setvars.sh fi + +# enable bash features set -ue + +# load python venv if present +if [ -d .venv ]; then + source .venv/bin/activate +fi + +# jump in test directory cd "$1" + +# run the test ./testme.py "${@:2}" diff --git a/src/dataBlock/planetarySystem/planetStructs.hpp b/src/dataBlock/planetarySystem/planetStructs.hpp index 3749a34d2..6440daf8f 100644 --- a/src/dataBlock/planetarySystem/planetStructs.hpp +++ b/src/dataBlock/planetarySystem/planetStructs.hpp @@ -19,7 +19,7 @@ struct Force { real f_ex_inner[3]; real f_outer[3]; real f_ex_outer[3]; - KOKKOS_FUNCTION void operator+=(Force const volatile& f) volatile { + KOKKOS_FUNCTION void operator+=(const Force & f) { for (int i = 0; i < 3; ++i) { f_inner[i] += f.f_inner[i]; f_ex_inner[i] += f.f_ex_inner[i]; diff --git a/test/MHD/AmbipolarWind/setup.cpp b/test/MHD/AmbipolarWind/setup.cpp index 78620f6e2..892eeea27 100644 --- a/test/MHD/AmbipolarWind/setup.cpp +++ b/test/MHD/AmbipolarWind/setup.cpp @@ -373,7 +373,7 @@ void ComputeUserVars(DataBlock & data, UserDefVariablesContainer &variables) { IdefixHostArray1D x1=d.x[IDIR]; IdefixHostArray1D x2=d.x[JDIR]; IdefixHostArray4D Vc=d.Vc; - IdefixArray3D::HostMirror scrhHost = Kokkos::create_mirror_view(scrh); + IdefixArray3D::host_mirror_type scrhHost = Kokkos::create_mirror_view(scrh); Kokkos::deep_copy(scrhHost,scrh); for(int k = d.beg[KDIR]; k < d.end[KDIR] ; k++) { diff --git a/test/python_requirements.txt b/test/python_requirements.txt index 77ce6e9c2..f04fc76ed 100644 --- a/test/python_requirements.txt +++ b/test/python_requirements.txt @@ -8,3 +8,6 @@ scipy>=1.2.3 # note that no version of inifix supports Python older than 3.6 inifix>=0.11.2 + +# It supports Python 3.8 as minimum. +pybind11 >= 3.0.4 diff --git a/test/skeleton/main.cpp b/test/skeleton/main.cpp index 4930ecb15..aecadc962 100644 --- a/test/skeleton/main.cpp +++ b/test/skeleton/main.cpp @@ -37,7 +37,7 @@ void testReduction() { // Init an array on device, and image on host IdefixArray3D rho = IdefixArray3D("rho",nx3,nx2,nx1); - IdefixArray3D::HostMirror rhoHost = Kokkos::create_mirror_view(rho); + IdefixArray3D::host_mirror_type rhoHost = Kokkos::create_mirror_view(rho); // Fill the host array, and compute the theoretical results real theoreticalResult = 0; diff --git a/test/utils/columnDensity/setup.cpp b/test/utils/columnDensity/setup.cpp index fe7c57e69..090024abc 100644 --- a/test/utils/columnDensity/setup.cpp +++ b/test/utils/columnDensity/setup.cpp @@ -33,7 +33,7 @@ void Analysis(DataBlock & data) { columnX3Right->ComputeColumn(rho); IdefixArray3D columnDensityLeft, columnDensityRight; - IdefixArray3D::HostMirror columnDensityLeftHost, columnDensityRightHost; + IdefixArray3D::host_mirror_type columnDensityLeftHost, columnDensityRightHost; // IDIR columnDensityLeft = columnX1Left->GetColumn(); columnDensityRight = columnX1Right->GetColumn(); diff --git a/test/utils/lookupTable/main.cpp b/test/utils/lookupTable/main.cpp index 619cae6d2..1fc660cd6 100644 --- a/test/utils/lookupTable/main.cpp +++ b/test/utils/lookupTable/main.cpp @@ -38,7 +38,7 @@ int main( int argc, char* argv[] ) idfx::cout << "--------------------------------------" << std::endl; idfx::cout << "Testing 2D CSV file on device." << std::endl; IdefixArray1D arr = IdefixArray1D("Test",1); - IdefixArray1D::HostMirror arrHost = Kokkos::create_mirror_view(arr); + IdefixArray1D::host_mirror_type arrHost = Kokkos::create_mirror_view(arr); LookupTable<2> csv("toto.csv",',');