Skip to content

Hotfix broken MPICH package in Ubuntu 24.04 LTS #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,31 @@ jobs:
os:
- ubuntu-24.04
- ubuntu-22.04
- ubuntu-24.04-arm
- ubuntu-22.04-arm
- macos-15
- macos-14
- macos-13
- windows-2025
- windows-2022
- windows-2019
exclude:
- os: ubuntu-24.04
mpi: msmpi
- os: ubuntu-22.04
mpi: msmpi
- os: ubuntu-24.04-arm
mpi: intelmpi
- os: ubuntu-22.04-arm
mpi: intelmpi
- os: ubuntu-24.04-arm
mpi: msmpi
- os: ubuntu-22.04-arm
mpi: msmpi
- os: macos-15
mpi: intelmpi
- os: macos-15
mpi: msmpi
- os: macos-14
mpi: intelmpi
- os: macos-14
Expand All @@ -41,6 +57,10 @@ jobs:
mpi: intelmpi
- os: macos-13
mpi: msmpi
- os: windows-2025
mpi: mpich
- os: windows-2025
mpi: openmpi
- os: windows-2022
mpi: mpich
- os: windows-2022
Expand Down Expand Up @@ -120,6 +140,14 @@ jobs:
mpiexec /help3
if: ${{ runner.os == 'Windows' && matrix.mpi == 'msmpi' }}

- name: Build MPI application
run: mpicc helloworld.c -o helloworld.exe
if: ${{ runner.os != 'Windows' }}

- name: Execute MPI application
run: mpiexec -n 5 ./helloworld.exe
if: ${{ runner.os != 'Windows' }}

Linux:
runs-on: ubuntu-latest
steps:
Expand Down
24 changes: 24 additions & 0 deletions helloworld.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <mpi.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
int size, rank, len;
char name[MPI_MAX_PROCESSOR_NAME];

MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Get_processor_name(name, &len);

if (rank != 0)
MPI_Recv(name, 0 , MPI_BYTE, rank-1, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);

printf("Hello, World! I am process %d of %d on %s.\n", rank, size, name);

if (rank != size - 1)
MPI_Send(name, 0 , MPI_BYTE, rank+1, 0, MPI_COMM_WORLD);

MPI_Finalize();
return 0;
}
25 changes: 25 additions & 0 deletions setup-mpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,30 @@ sudo () {
"$@"
}

hotfix-apt-ubuntu-noble-mpich() {
grep -q 'ID=ubuntu' /etc/os-release || return 0
grep -q 'VERSION_CODENAME=noble' /etc/os-release || return 0
command -v curl > /dev/null || apt install -y -q curl
echo "Hotfix broken MPICH package in Ubuntu 24.04 LTS"
echo "https://bugs.launchpad.net/ubuntu/+source/mpich/+bug/2072338"
case "$(arch)" in
aarch64) arch=arm64 repo=https://ports.ubuntu.com/ubuntu-ports;;
x86_64) arch=amd64 repo=https://archive.ubuntu.com/ubuntu;;
esac
libucx0=libucx0_1.17.0+ds-3build1_$arch.deb
libmpich12=libmpich12_4.2.0-14_$arch.deb
curl -sSO $repo/pool/universe/u/ucx/$libucx0
curl -sSO $repo/pool/universe/m/mpich/$libmpich12
tmpdir=$(mktemp -d)
dpkg-deb -x $libucx0 $tmpdir
dpkg-deb -x $libmpich12 $tmpdir
libdir=/usr/lib/$(arch)-linux-gnu
sudo cp -r $tmpdir$libdir/ucx $libdir
sudo cp $tmpdir$libdir/libuc[mpst]*.so.0.*.* $libdir
sudo cp $tmpdir$libdir/libmpich*.so.12.*.* $libdir
rm -rf $tmpdir $libucx0 $libmpich12
}

setup-apt-intel-oneapi () {
# ensure the required packages are installed
sudo apt update
Expand Down Expand Up @@ -106,6 +130,7 @@ case $(uname) in
case $MPI in
mpich)
sudo apt install -y -q mpich libmpich-dev
hotfix-apt-ubuntu-noble-mpich
;;
openmpi)
sudo apt install -y -q openmpi-bin libopenmpi-dev
Expand Down