Skip to content

Commit

Permalink
Add support for Intel MPI
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Oct 20, 2022
1 parent 575215e commit 54af02f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 7 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
mpi:
- mpich
- openmpi
- intelmpi
- msmpi
os:
- ubuntu-22.04
Expand All @@ -32,18 +33,26 @@ jobs:
mpi: msmpi
- os: ubuntu-20.04
mpi: msmpi
- os: macos-12
mpi: intelmpi
- os: macos-12
mpi: msmpi
- os: macos-11
mpi: intelmpi
- os: macos-11
mpi: msmpi
- os: windows-2022
mpi: mpich
- os: windows-2022
mpi: openmpi
- os: windows-2022
mpi: intelmpi
- os: windows-2019
mpi: mpich
- os: windows-2019
mpi: openmpi
- os: windows-2019
mpi: intelmpi

steps:

Expand All @@ -67,6 +76,10 @@ jobs:
run: ompi_info
if: ${{ matrix.mpi == 'openmpi' }}

- name: Show MPI info
run: impi_info
if: ${{ matrix.mpi == 'intelmpi' }}

- name: Show MPI info
run: |
Write-Host MSMPI_BIN=$Env:MSMPI_BIN
Expand All @@ -75,14 +88,23 @@ jobs:
Write-Host MSMPI_LIB64=$Env:MSMPI_LIB64
if: ${{ matrix.mpi == 'msmpi' }}

- name: Show MPI compilers
- name: Show MPI C compiler wrapper
run: |
command -v mpicc
mpicc -show
if: ${{ runner.os != 'Windows' }}

- name: Show MPI C++ compiler wrapper
run: |
command -v mpicxx
mpicxx -show
command -v mpifort
mpifort -show
if: ${{ runner.os != 'Windows' }}

- name: Show MPI Fortran compiler wrapper
run: |
mpifort=$(command -v mpifort || command -v mpifc)
command -v $mpifort
$mpifort -show
if: ${{ runner.os != 'Windows' }}

- name: Help MPI executor
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
mpi: [ 'mpich', 'openmpi' ]
mpi: [ 'mpich', 'openmpi', 'intelmpi']
name: ${{ matrix.mpi }} example
steps:
- name: Checkout
Expand All @@ -39,6 +39,14 @@ jobs:
# Available MPI implementations
* Linux: [MPICH](https://www.mpich.org/) and [Open MPI](https://www.open-mpi.org/) (`apt` install).
* macOS: [MPICH](https://www.mpich.org/) and [Open MPI](https://www.open-mpi.org/) (`brew` install).
* Windows: [Microsoft MPI](https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi).
* Linux:
[MPICH](https://www.mpich.org/),
[Open MPI](https://www.open-mpi.org/), and
[Intel MPI](https://software.intel.com/intel-mpi-library) (`apt` install).

* macOS:
[MPICH](https://www.mpich.org/) and
[Open MPI](https://www.open-mpi.org/) (`brew` install).

* Windows:
[Microsoft MPI](https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi).
35 changes: 35 additions & 0 deletions setup-mpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,31 @@ set -eu

MPI=$(echo "${1:-}" | tr '[:upper:]' '[:lower:]')

setup-apt-intel-oneapi () {
apt_repo_url=https://apt.repos.intel.com/
gpg_key_url=$apt_repo_url/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
keyring=/usr/share/keyrings/oneapi-archive-keyring.gpg
# download the key to system keyring
curl -s $gpg_key_url | gpg --dearmor | sudo tee $keyring > /dev/null
# add signed entry to apt sources
echo "deb [signed-by=${keyring}] ${apt_repo_url}/oneapi all main" | \
sudo tee /etc/apt/sources.list.d/oneAPI.list
# update list of available packages
sudo apt update
}

setup-env-intel-oneapi () {
set +u
source /opt/intel/oneapi/setvars.sh
set -u
echo "${I_MPI_ROOT}/bin" >> $GITHUB_PATH
echo "ONEAPI_ROOT=${ONEAPI_ROOT}" >> $GITHUB_ENV
echo "I_MPI_ROOT=${I_MPI_ROOT}" >> $GITHUB_ENV
echo "FI_PROVIDER_PATH=${FI_PROVIDER_PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> $GITHUB_ENV
}

case $(uname) in

Linux)
Expand All @@ -16,6 +41,11 @@ case $(uname) in
openmpi)
sudo apt install -y -q openmpi-bin libopenmpi-dev
;;
intelmpi)
setup-apt-intel-oneapi
sudo apt install -y -q intel-oneapi-mpi-devel
setup-env-intel-oneapi
;;
*)
echo "Unknown MPI implementation:" $MPI
exit 1
Expand Down Expand Up @@ -77,6 +107,11 @@ case $MPI in
ompi_info --all
echo "::endgroup::"
;;
intelmpi)
echo "::group::Run impi_info -all"
impi_info -all
echo "::endgroup::"
;;
esac

if [ $MPI == openmpi ]; then
Expand Down

0 comments on commit 54af02f

Please sign in to comment.