'Using MPI on a Github Action
I'm working on a C++ project which uses MPI and OMP for some parallel stuff. The thing is that I'd like to include a Github Action in the repo which compiles the code and run the tests after each push on master. I have already use Travis CI as a CI tool and it worked perfectly (both compiling and running the tests), but for some reason I cannot configure the action properly. Every time I push to master it appears the following error when the compiling stage reaches a file which uses MPI:
/home/runner//.file.cpp:14:10: fatal error: mpi.h: No such file or directory 14 | #include <mpi.h> | ^~~~~~~
The action.yml file is as following:
name: CMake
on:
push:
branches:
- master
- develop
pull_request:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: egor-tensin/setup-gcc@v1
with:
version: 10
platform: x64
- uses: mpi4py/setup-mpi@v1
with:
mpi: 'mpich'
- name: Compile
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
export CC=cc
export CXX=CC
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target all -- -j 14
- name: Run Tests
run:
./${{github.workspace}}/bin/tests
I had tried to change the configuration several times using other MPI versions but the problem always appears.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|