Skip to content

Commit 3f449d8

Browse files
committed
Add a multi-node CI job for MPI Shared Memory
1 parent 5182735 commit 3f449d8

File tree

3 files changed

+135
-0
lines changed

3 files changed

+135
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ unstable ]
6+
pull_request:
7+
branches: [ unstable ]
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
env:
12+
CMAKE_C_COMPILER_LAUNCHER: ccache
13+
CMAKE_CXX_COMPILER_LAUNCHER: ccache
14+
CCACHE_COMPILERCHECK: content
15+
CCACHE_BASEDIR: ${{ github.workspace }}
16+
CCACHE_DIR: ${{ github.workspace }}/.ccache
17+
CCACHE_MAXSIZE: 500M
18+
CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime
19+
CCACHE_COMPRESS: "1"
20+
CCACHE_COMPRESSLEVEL: "1"
21+
22+
jobs:
23+
build_multi_node:
24+
25+
strategy:
26+
fail-fast: false
27+
28+
runs-on: ubuntu-24.04
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: actions/cache/restore@v4
34+
with:
35+
path: ${{ env.CCACHE_DIR }}
36+
key: ccache-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}
37+
restore-keys:
38+
ccache-${{ matrix.os }}-${{ matrix.cc }}-
39+
40+
- name: Install ubuntu dependencies
41+
run: >
42+
sudo apt-get update && sudo apt-get install ccache
43+
44+
- name: Build and start Docker Compose
45+
run: |
46+
docker compose build
47+
docker compose up -d
48+
working-directory: .github/workflows/docker
49+
50+
- name: Compile MPI inside the container
51+
run: |
52+
docker exec -t -w ${{ github.workspace }} docker-vm-1 /bin/bash -euxc '
53+
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=$HOME/install -DBuild_Documentation=Off
54+
cmake --build build/ -j2
55+
'
56+
57+
- name: Run tests inside the container
58+
run: |
59+
docker exec -t -w ${{ github.workspace }} docker-vm-1 /bin/bash -euxc '
60+
export CTEST_OUTPUT_ON_FAILURE=1
61+
cmake --build build/ --target test
62+
'
63+
64+
- name: Run tests inside the container
65+
run: |
66+
docker exec -t -w ${{ github.workspace }} docker-vm-1 /bin/bash -euxc '
67+
cat <<EOF | tee hostfile
68+
docker-vm-1 slots=3
69+
docker-vm-2 slots=1
70+
docker-vm-3 slots=2
71+
EOF
72+
73+
# Test the communication
74+
mpirun -hostfile ./hostfile /bin/bash -c "env | grep \"^OMPI_COMM_.*_RANK\""
75+
76+
# Run the actual test
77+
mpirun -hostfile ./hostfile build/test/c++/mpi_window
78+
'
79+
80+
- name: ccache statistics
81+
if: always()
82+
run: ccache -sv
83+
84+
- uses: actions/cache/save@v4
85+
if: always()
86+
with:
87+
path: ${{ env.CCACHE_DIR }}
88+
key: ccache-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ubuntu:24.04
2+
ENV DEBIAN_FRONTEND=noninteractive
3+
RUN apt-get update \
4+
&& apt-get install --no-install-recommends -y \
5+
ca-certificates \
6+
build-essential \
7+
ccache \
8+
cmake \
9+
g++ \
10+
git \
11+
libopenmpi-dev \
12+
openmpi-bin \
13+
openssh-server \
14+
&& rm -rf /var/cache/apt /var/lib/apt/lists
15+
RUN passwd -d root \
16+
&& mkdir -pm0755 /run/sshd \
17+
&& echo "PermitRootLogin yes" >> /etc/ssh/sshd_config.d/99-insecure.conf \
18+
&& echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config.d/99-insecure.conf \
19+
&& echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config.d/99-insecure.conf \
20+
&& echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config.d/99-insecure.conf \
21+
&& echo "LogLevel ERROR" >> /etc/ssh/ssh_config.d/99-insecure.conf
22+
ENV OMPI_ALLOW_RUN_AS_ROOT=1
23+
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
24+
ENV OMPI_MCA_btl_vader_single_copy_mechanism=none
25+
ENV OMPI_MCA_osc=sm,pt2pt
26+
ENV OMPI_MCA_rmaps_base_oversubscribe=yes
27+
CMD ["/usr/sbin/sshd", "-D"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
services:
2+
vm:
3+
build: .
4+
deploy:
5+
mode: replicated
6+
replicas: 3
7+
environment:
8+
CMAKE_C_COMPILER_LAUNCHER: ${CMAKE_C_COMPILER_LAUNCHER}
9+
CMAKE_CXX_COMPILER_LAUNCHER: ${CMAKE_CXX_COMPILER_LAUNCHER}
10+
CCACHE_COMPILERCHECK: ${CCACHE_COMPILERCHECK}
11+
CCACHE_BASEDIR: ${CCACHE_BASEDIR}
12+
CCACHE_DIR: ${CCACHE_DIR}
13+
CCACHE_MAXSIZE: ${CCACHE_MAXSIZE}
14+
CCACHE_SLOPPINESS: ${CCACHE_SLOPPINESS}
15+
CCACHE_COMPRESS: ${CCACHE_COMPRESS}
16+
CCACHE_COMPRESSLEVEL: ${CCACHE_COMPRESSLEVEL}
17+
stdin_open: true
18+
tty: true
19+
volumes:
20+
- ${CCACHE_BASEDIR}:${CCACHE_BASEDIR}:z

0 commit comments

Comments
 (0)