Skip to content

Commit 8f0cdce

Browse files
Add callable workflows for building OpenMPI and MPICH from source (#5051)
1 parent d8c9b66 commit 8f0cdce

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Build MPICH from source using the latest commit on the
2+
# 'main' branch and cache the results. The result is installed
3+
# to (or restored to) '${{ runner.workspace }}/mpich'.
4+
5+
# Triggers the workflow on a call from another workflow
6+
on:
7+
workflow_call:
8+
inputs:
9+
build_mode:
10+
description: "production vs. debug build"
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
ubuntu_gcc_build_and_test:
19+
name: "Build MPICH ${{ inputs.build_mode }} (GCC)"
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Install Linux dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install build-essential libtool libtool-bin
28+
29+
- name: Get MPICH source
30+
uses: actions/[email protected]
31+
with:
32+
repository: 'pmodels/mpich'
33+
path: 'mpich'
34+
submodules: recursive
35+
36+
- name: Get MPICH commit hash
37+
shell: bash
38+
id: get-sha
39+
run: |
40+
cd $GITHUB_WORKSPACE/mpich
41+
export MPICH_SHA=$(git rev-parse HEAD)
42+
echo "MPICH_SHA=$MPICH_SHA" >> $GITHUB_ENV
43+
echo "sha=$MPICH_SHA" >> $GITHUB_OUTPUT
44+
# Output SHA for debugging
45+
echo "MPICH_SHA=$MPICH_SHA"
46+
47+
- name: Cache MPICH (GCC) installation
48+
id: cache-mpich-ubuntu-gcc
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ runner.workspace }}/mpich
52+
key: ${{ runner.os }}-${{ runner.arch }}-gcc-mpich-${{ steps.get-sha.outputs.sha }}-${{ inputs.build_mode }}
53+
54+
# Enable threads=multiple for testing with Subfiling and
55+
# VOL connectors that require MPI_THREAD_MULTIPLE
56+
- name: Install MPICH (GCC) (Production)
57+
if: ${{ steps.cache-mpich-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode != 'debug') }}
58+
run: |
59+
cd $GITHUB_WORKSPACE/mpich
60+
./autogen.sh
61+
./configure \
62+
CC=gcc \
63+
--prefix=${{ runner.workspace }}/mpich \
64+
--enable-threads=multiple
65+
make -j2
66+
make install
67+
68+
# Enable threads=multiple for testing with Subfiling and
69+
# VOL connectors that require MPI_THREAD_MULTIPLE
70+
- name: Install MPICH (GCC) (Debug)
71+
if: ${{ steps.cache-mpich-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode == 'debug') }}
72+
run: |
73+
cd $GITHUB_WORKSPACE/mpich
74+
./autogen.sh
75+
./configure \
76+
CC=gcc \
77+
--prefix=${{ runner.workspace }}/mpich \
78+
--enable-g=most \
79+
--enable-debuginfo \
80+
--enable-threads=multiple
81+
make -j2
82+
make install
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Build OpenMPI from source using the latest commit on the
2+
# 'main' branch and cache the results. The result is installed
3+
# to (or restored to) '${{ runner.workspace }}/openmpi'.
4+
5+
# Triggers the workflow on a call from another workflow
6+
on:
7+
workflow_call:
8+
inputs:
9+
build_mode:
10+
description: "production vs. debug build"
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
ubuntu_gcc_build_and_test:
19+
name: "Build OpenMPI ${{ inputs.build_mode }} (GCC)"
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Install Linux dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install build-essential libtool libtool-bin
28+
29+
- name: Get OpenMPI source
30+
uses: actions/[email protected]
31+
with:
32+
repository: 'open-mpi/ompi'
33+
path: 'ompi'
34+
submodules: recursive
35+
36+
- name: Get OpenMPI commit hash
37+
shell: bash
38+
id: get-sha
39+
run: |
40+
cd $GITHUB_WORKSPACE/ompi
41+
export OPENMPI_SHA=$(git rev-parse HEAD)
42+
echo "OPENMPI_SHA=$OPENMPI_SHA" >> $GITHUB_ENV
43+
echo "sha=$OPENMPI_SHA" >> $GITHUB_OUTPUT
44+
# Output SHA for debugging
45+
echo "OPENMPI_SHA=$OPENMPI_SHA"
46+
47+
- name: Cache OpenMPI (GCC) installation
48+
id: cache-openmpi-ubuntu-gcc
49+
uses: actions/cache@v4
50+
with:
51+
path: ${{ runner.workspace }}/openmpi
52+
key: ${{ runner.os }}-${{ runner.arch }}-gcc-openmpi-${{ steps.get-sha.outputs.sha }}-${{ inputs.build_mode }}
53+
54+
- name: Install OpenMPI (GCC) (Production)
55+
if: ${{ steps.cache-openmpi-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode != 'debug') }}
56+
run: |
57+
cd $GITHUB_WORKSPACE/ompi
58+
./autogen.pl
59+
./configure \
60+
CC=gcc \
61+
--prefix=${{ runner.workspace }}/openmpi
62+
make -j2
63+
make install
64+
65+
- name: Install OpenMPI (GCC) (Debug)
66+
if: ${{ steps.cache-openmpi-ubuntu-gcc.cache-hit != 'true' && (inputs.build_mode == 'debug') }}
67+
run: |
68+
cd $GITHUB_WORKSPACE/ompi
69+
./autogen.pl
70+
./configure \
71+
CC=gcc \
72+
--prefix=${{ runner.workspace }}/openmpi \
73+
--enable-debug
74+
make -j2
75+
make install

0 commit comments

Comments
 (0)