File tree 5 files changed +244
-1
lines changed
5 files changed +244
-1
lines changed Original file line number Diff line number Diff line change
1
+ name : ci
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ pull_request :
8
+ branches :
9
+ - master
10
+ workflow_dispatch :
11
+
12
+ jobs :
13
+
14
+ test :
15
+ runs-on : ${{ matrix.os }}
16
+ strategy :
17
+ fail-fast : false
18
+ matrix :
19
+ mpi :
20
+ - mpich
21
+ - openmpi
22
+ - msmpi
23
+ os :
24
+ - ubuntu-20.04
25
+ - ubuntu-18.04
26
+ - macos-10.15
27
+ - windows-2019
28
+ exclude :
29
+ - os : ubuntu-20.04
30
+ mpi : msmpi
31
+ - os : ubuntu-18.04
32
+ mpi : msmpi
33
+ - os : macos-10.15
34
+ mpi : msmpi
35
+ - os : windows-2019
36
+ mpi : mpich
37
+ - os : windows-2019
38
+ mpi : openmpi
39
+
40
+ steps :
41
+
42
+ - name : Checkout
43
+ uses : actions/checkout@v2
44
+
45
+ - name : Setup MPI
46
+ uses : ./
47
+ with :
48
+ mpi : ${{ matrix.mpi }}
49
+
50
+ - name : Show MPI info
51
+ run : mpichversion
52
+ if : ${{ matrix.mpi == 'mpich' }}
53
+
54
+ - name : Show MPI info
55
+ run : ompi_info
56
+ if : ${{ matrix.mpi == 'openmpi' }}
57
+
58
+ - name : Show MPI info
59
+ run : |
60
+ Write-Host MSMPI_BIN=$Env:MSMPI_BIN
61
+ Write-Host MSMPI_INC=$Env:MSMPI_INC
62
+ Write-Host MSMPI_LIB32=$Env:MSMPI_LIB32
63
+ Write-Host MSMPI_LIB64=$Env:MSMPI_LIB64
64
+ if : ${{ matrix.mpi == 'msmpi' }}
65
+
66
+ - name : Show MPI compilers
67
+ run : |
68
+ command -v mpicc
69
+ mpicc -show
70
+ command -v mpicxx
71
+ mpicxx -show
72
+ command -v mpifort
73
+ mpifort -show
74
+ if : ${{ runner.os != 'Windows' }}
75
+
76
+ - name : Help MPI executor
77
+ run : |
78
+ command -v mpiexec
79
+ mpiexec --help
80
+ if : ${{ runner.os != 'Windows' }}
81
+
82
+ - name : Help MPI executor
83
+ run : |
84
+ mpiexec /help2
85
+ mpiexec /help3
86
+ if : ${{ runner.os == 'Windows' }}
Original file line number Diff line number Diff line change 1
1
# setup-mpi
2
- Set up your GitHub Actions workflow to use MPI.
2
+
3
+ Set up your GitHub Actions workflow to use [ MPI] ( https://www.mpi-forum.org/ ) .
4
+
5
+ # Usage
6
+
7
+ See [ action.yml] ( action.yml )
8
+
9
+ Basic:
10
+
11
+ ``` yaml
12
+ steps :
13
+ - uses : actions/checkout@v2
14
+ - uses : mpi4py/setup-mpi@v1
15
+ - run : mpicc helloworld.c -o helloworld
16
+ - run : mpiexec -n 2 ./helloworld
17
+ ` ` `
18
+
19
+ Matrix Testing:
20
+
21
+ ` ` ` yaml
22
+ jobs :
23
+ build :
24
+ runs-on : ubuntu-latest
25
+ strategy :
26
+ matrix :
27
+ mpi : [ 'mpich', 'openmpi' ]
28
+ name : ${{ matrix.mpi }} example
29
+ steps :
30
+ - name : Checkout
31
+ - uses : actions/checkout@v2
32
+ - name : Setup MPI
33
+ uses : mpi4py/setup-mpi@v1
34
+ with :
35
+ mpi : ${{ matrix.mpi }}
36
+ - run : mpicc helloworld.c -o helloworld
37
+ - run : mpiexec -n 2 ./helloworld
38
+ ` ` `
39
+
40
+ # Available MPI implementations
41
+
42
+ * Linux: [MPICH](https://www.mpich.org/) and [Open MPI](https://www.open-mpi.org/) (` apt` install).
43
+ * macOS: [MPICH](https://www.mpich.org/) and [Open MPI](https://www.open-mpi.org/) (`brew` install).
44
+ * Windows: [Microsoft MPI](https://docs.microsoft.com/en-us/message-passing-interface/microsoft-mpi).
Original file line number Diff line number Diff line change
1
+ ---
2
+ name : ' Setup MPI'
3
+ description : ' Set up a specific MPI implementation.'
4
+ author : ' Lisandro Dalcin'
5
+ inputs :
6
+ mpi :
7
+ description : " MPI implementation name."
8
+ required : false
9
+ default : ' ' # Linux/macOS: 'mpich', Windows: 'msmpi'
10
+ outputs :
11
+ mpi :
12
+ description : " The installed MPI implementation name."
13
+ value : ${{ steps.setup-mpi.outputs.mpi }}
14
+ runs :
15
+ using : ' composite'
16
+ steps :
17
+ - id : setup-mpi
18
+ run : ${GITHUB_ACTION_PATH}/setup-mpi.sh ${{ inputs.mpi }}
19
+ shell : bash
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -eu
3
+
4
+ MPI=$( echo " ${1:- } " | tr ' [:upper:]' ' [:lower:]' )
5
+
6
+ case $( uname) in
7
+
8
+ Linux)
9
+ MPI=" ${MPI:- mpich} "
10
+ echo " Installing $MPI with apt"
11
+ case $MPI in
12
+ mpich)
13
+ sudo apt install -y -q mpich libmpich-dev
14
+ ;;
15
+ openmpi)
16
+ sudo apt install -y -q openmpi-bin libopenmpi-dev
17
+ ;;
18
+ * )
19
+ echo " Unknown MPI implementation:" $MPI
20
+ exit 1
21
+ ;;
22
+ esac
23
+ ;;
24
+
25
+ Darwin)
26
+ MPI=" ${MPI:- mpich} "
27
+ echo " Installing $MPI with brew"
28
+ case $MPI in
29
+ mpich)
30
+ brew install mpich
31
+ ;;
32
+ openmpi)
33
+ brew install openmpi
34
+ ;;
35
+ * )
36
+ echo " Unknown MPI implementation:" $MPI
37
+ exit 1
38
+ ;;
39
+ esac
40
+ ;;
41
+
42
+ Windows* | MINGW* | MSYS* )
43
+ MPI=" ${MPI:- msmpi} "
44
+ echo " Installing $MPI "
45
+ case $MPI in
46
+ msmpi)
47
+ sdir=$( dirname " ${BASH_SOURCE[0]} " )
48
+ pwsh " ${sdir} \\ setup-${MPI} .ps1"
49
+ ;;
50
+ * )
51
+ echo " Unknown MPI implementation:" $MPI
52
+ exit 1
53
+ ;;
54
+ esac
55
+ ;;
56
+
57
+ * )
58
+ echo " Unknown OS kernel:" $( uname)
59
+ exit 1
60
+ ;;
61
+ esac
62
+
63
+ echo " ::set-output name=mpi::${MPI} "
Original file line number Diff line number Diff line change
1
+ $ErrorActionPreference = " Stop"
2
+
3
+ $rooturl = " https://github.com/microsoft/Microsoft-MPI/releases/download"
4
+ $version = " 10.1.1"
5
+ $baseurl = " $rooturl /v$version "
6
+
7
+ $tempdir = $Env: RUNNER_TEMP
8
+ $msmpisdk = Join-Path $tempdir msmpisdk.msi
9
+ $msmpisetup = Join-Path $tempdir msmpisetup.exe
10
+
11
+ Write-Host " Downloading Microsoft MPI $version "
12
+ Invoke-WebRequest " $baseurl /msmpisdk.msi" - OutFile $msmpisdk
13
+ Invoke-WebRequest " $baseurl /msmpisetup.exe" - OutFile $msmpisetup
14
+
15
+ Write-Host " Installing Microsoft MPI $version "
16
+ Start-Process msiexec.exe - ArgumentList " /quiet /passive /qn /i $msmpisdk " - Wait
17
+ Start-Process $msmpisetup - ArgumentList " -unattend" - Wait
18
+
19
+ if ($Env: GITHUB_ENV ) {
20
+ Write-Host ' Adding environment variables to $GITHUB_ENV'
21
+ $envlist = @ (" MSMPI_BIN" , " MSMPI_INC" , " MSMPI_LIB32" , " MSMPI_LIB64" )
22
+ foreach ($name in $envlist ) {
23
+ $value = [Environment ]::GetEnvironmentVariable($name , " Machine" )
24
+ Write-Host " $name =$value "
25
+ Add-Content $Env: GITHUB_ENV " $name =$value "
26
+ }
27
+ }
28
+
29
+ if ($Env: GITHUB_PATH ) {
30
+ Write-Host ' Adding $MSMPI_BIN to $GITHUB_PATH'
31
+ $MSMPI_BIN = [Environment ]::GetEnvironmentVariable(" MSMPI_BIN" , " Machine" )
32
+ Add-Content $Env: GITHUB_PATH $MSMPI_BIN
33
+ }
You can’t perform that action at this time.
0 commit comments