diff --git a/.github/workflows/step_test.yaml b/.github/workflows/step_test.yaml index b370854a..3ce7d509 100644 --- a/.github/workflows/step_test.yaml +++ b/.github/workflows/step_test.yaml @@ -21,7 +21,7 @@ jobs: - uses: pre-commit/action@v3.0.0 tests: - name: Check on ${{ matrix.toolchain }} toolchain + name: Check on ${{ matrix.toolchain }} toolchain ${{ matrix.mpi }} runs-on: ${{ matrix.os || 'ubuntu-latest' }} container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }} needs: [ pre-commit ] @@ -30,6 +30,7 @@ jobs: fail-fast: false matrix: toolchain: [ gcc, llvm, intel ] + mpi: ['', openmpi, mpich, intel] include: # flang is missing features in 16.0.6 - toolchain: llvm @@ -37,16 +38,33 @@ jobs: steps: - name: Install missing packages run: dnf install -y bzip2 python-unversioned-command + - name: Load mpi module ${{ matrix.mpi }} + run: | + # Get interactive profile to be able to load modules + source /etc/profile + + # Save the current environment since we only want the added difference + printenv > orig_env + + # Load the relevant mpi module + module load mpi/${{ matrix.mpi }} + printenv > module_env + + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV + + # Set MPI flag on + echo "WITH_MPI=ON" >> $GITHUB_ENV + if: ${{ matrix.mpi }} - name: Enable msvc toolchain on windows uses: ilammy/msvc-dev-cmd@v1 if: contains(matrix.os, 'windows') - name: Activate Intel compilers - # Not elegant, it will propagate all environment variable. - # Intel does not provide a way to output the environment variables to a file - # Note: PATH needs to be exported to GITHUB_PATH otherwise it can be overwritten run: | - source /opt/intel/oneapi/setvars.sh - printenv >> $GITHUB_ENV + source /etc/profile + printenv > orig_env + module load compiler + printenv > module_env + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV echo $PATH >> $GITHUB_PATH if: matrix.toolchain == 'intel' - uses: actions/checkout@v3 diff --git a/cmake/CMakePresets-CI.json b/cmake/CMakePresets-CI.json index 0cffa480..e2979c3c 100644 --- a/cmake/CMakePresets-CI.json +++ b/cmake/CMakePresets-CI.json @@ -15,6 +15,10 @@ "WANNIER90_TEST": { "type": "BOOL", "value": true + }, + "WANNIER90_WITH_MPI": { + "type": "BOOL", + "value": "$env{WITH_MPI}" } }, "errors": {