Skip to content

Commit 21db385

Browse files
committed
Hotfix broken MPICH package in Ubuntu 24.04 LTS
1 parent 4a16f37 commit 21db385

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

.github/workflows/ci.yml

+28
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,31 @@ jobs:
2424
os:
2525
- ubuntu-24.04
2626
- ubuntu-22.04
27+
- ubuntu-24.04-arm
28+
- ubuntu-22.04-arm
29+
- macos-15
2730
- macos-14
2831
- macos-13
32+
- windows-2025
2933
- windows-2022
3034
- windows-2019
3135
exclude:
3236
- os: ubuntu-24.04
3337
mpi: msmpi
3438
- os: ubuntu-22.04
3539
mpi: msmpi
40+
- os: ubuntu-24.04-arm
41+
mpi: intelmpi
42+
- os: ubuntu-22.04-arm
43+
mpi: intelmpi
44+
- os: ubuntu-24.04-arm
45+
mpi: msmpi
46+
- os: ubuntu-22.04-arm
47+
mpi: msmpi
48+
- os: macos-15
49+
mpi: intelmpi
50+
- os: macos-15
51+
mpi: msmpi
3652
- os: macos-14
3753
mpi: intelmpi
3854
- os: macos-14
@@ -41,6 +57,10 @@ jobs:
4157
mpi: intelmpi
4258
- os: macos-13
4359
mpi: msmpi
60+
- os: windows-2025
61+
mpi: mpich
62+
- os: windows-2025
63+
mpi: openmpi
4464
- os: windows-2022
4565
mpi: mpich
4666
- os: windows-2022
@@ -120,6 +140,14 @@ jobs:
120140
mpiexec /help3
121141
if: ${{ runner.os == 'Windows' && matrix.mpi == 'msmpi' }}
122142

143+
- name: Build MPI application
144+
run: mpicc helloworld.c -o helloworld.exe
145+
if: ${{ runner.os != 'Windows' }}
146+
147+
- name: Execute MPI application
148+
run: mpiexec -n 5 ./helloworld.exe
149+
if: ${{ runner.os != 'Windows' }}
150+
123151
Linux:
124152
runs-on: ubuntu-latest
125153
steps:

helloworld.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <mpi.h>
2+
#include <stdio.h>
3+
4+
int main(int argc, char *argv[])
5+
{
6+
int size, rank, len;
7+
char name[MPI_MAX_PROCESSOR_NAME];
8+
9+
MPI_Init(&argc, &argv);
10+
MPI_Comm_size(MPI_COMM_WORLD, &size);
11+
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
12+
MPI_Get_processor_name(name, &len);
13+
14+
if (rank != 0)
15+
MPI_Recv(name, 0 , MPI_BYTE, rank-1, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
16+
17+
printf("Hello, World! I am process %d of %d on %s.\n", rank, size, name);
18+
19+
if (rank != size - 1)
20+
MPI_Send(name, 0 , MPI_BYTE, rank+1, 0, MPI_COMM_WORLD);
21+
22+
MPI_Finalize();
23+
return 0;
24+
}

setup-mpi.sh

+25
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,30 @@ sudo () {
2323
"$@"
2424
}
2525

26+
hotfix-apt-ubuntu-noble-mpich() {
27+
grep -q 'ID=ubuntu' /etc/os-release || return 0
28+
grep -q 'VERSION_CODENAME=noble' /etc/os-release || return 0
29+
command -v curl > /dev/null || apt install -y -q curl
30+
echo "Hotfix broken MPICH package in Ubuntu 24.04 LTS"
31+
echo "https://bugs.launchpad.net/ubuntu/+source/mpich/+bug/2072338"
32+
case "$(arch)" in
33+
aarch64) arch=arm64 repo=https://ports.ubuntu.com/ubuntu-ports;;
34+
x86_64) arch=amd64 repo=https://archive.ubuntu.com/ubuntu;;
35+
esac
36+
libucx0=libucx0_1.17.0+ds-3build1_$arch.deb
37+
libmpich12=libmpich12_4.2.0-14_$arch.deb
38+
curl -sSO $repo/pool/universe/u/ucx/$libucx0
39+
curl -sSO $repo/pool/universe/m/mpich/$libmpich12
40+
tmpdir=$(mktemp -d)
41+
dpkg-deb -x $libucx0 $tmpdir
42+
dpkg-deb -x $libmpich12 $tmpdir
43+
libdir=/usr/lib/$(arch)-linux-gnu
44+
sudo cp -r $tmpdir$libdir/ucx $libdir
45+
sudo cp $tmpdir$libdir/libuc[mpst]*.so.0.*.* $libdir
46+
sudo cp $tmpdir$libdir/libmpich*.so.12.*.* $libdir
47+
rm -rf $tmpdir $libucx0 $libmpich12
48+
}
49+
2650
setup-apt-intel-oneapi () {
2751
# ensure the required packages are installed
2852
sudo apt update
@@ -106,6 +130,7 @@ case $(uname) in
106130
case $MPI in
107131
mpich)
108132
sudo apt install -y -q mpich libmpich-dev
133+
hotfix-apt-ubuntu-noble-mpich
109134
;;
110135
openmpi)
111136
sudo apt install -y -q openmpi-bin libopenmpi-dev

0 commit comments

Comments
 (0)