-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenmpi-4.1.5.def
178 lines (156 loc) · 4.84 KB
/
openmpi-4.1.5.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
Bootstrap: docker
From: ubuntu:22.04
%environment
# Basic OpenMPI paths
export OMPI_DIR=/opt/ompi
export PATH="/opt/ompi/bin:$PATH"
export LD_LIBRARY_PATH="/opt/ompi/lib:$LD_LIBRARY_PATH"
export MANPATH="/opt/ompi/share/man:$MANPATH"
export PKG_CONFIG_PATH="/opt/ompi/lib/pkgconfig:$PKG_CONFIG_PATH"
# UCX/OpenMPI specific settings
export UCX_IB_ENABLE_CUDA_AFFINITY=n
export UCX_NET_DEVICES=mlx5_0:1
export UCX_IB_REG_METHODS=direct
export OMPI_MCA_btl_openib_allow_ib=1
export OMPI_MCA_btl_openib_if_include="mlx5_0:1"
export OMPI_MCA_pml=ucx
export OMPI_MCA_osc=ucx
export OMPI_MCA_btl=^openib
# PMI settings
export PMIX_MCA_psec=native
export OMPI_MCA_btl_vader_single_copy_mechanism=none
# Make sure we have reasonable default paths
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
%post
# Install essential build tools and dependencies
apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
wget \
git \
tar \
gzip \
perl \
python3 \
python-is-python3 \
automake \
autoconf \
libtool \
flex \
hwloc \
pkg-config \
zlib1g-dev \
libnuma-dev \
libhwloc-dev \
libslurm-dev \
slurm-wlm \
libpmi2-0 \
libpmi0 \
libpmi2-0-dev \
libpmi0-dev \
libslurm-dev \
rdma-core \
libibverbs1 \
libibverbs-dev \
ibverbs-providers \
librdmacm1 \
librdmacm-dev \
perftest \
libevent-dev \
libevent-core-2.1-7 \
libevent-extra-2.1-7 \
libevent-openssl-2.1-7 \
libevent-pthreads-2.1-7 \
libev-dev \
libssl-dev \
openssl \
gfortran \
&& rm -rf /var/lib/apt/lists/*
# Create IB related symlinks if they don't exist
mkdir -p /etc/libibverbs.d
ln -sf /usr/lib/x86_64-linux-gnu/libibverbs.so.1 /usr/lib/libibverbs.so
ln -sf /usr/lib/x86_64-linux-gnu/librdmacm.so.1 /usr/lib/librdmacm.so
# Install libevent from source to ensure all components are available
cd /tmp
wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
tar xzf libevent-2.1.12-stable.tar.gz
cd libevent-2.1.12-stable
./configure --prefix=/usr
make -j$(nproc)
make install
ldconfig
# Create symlinks for PMI libraries
ln -sf /usr/lib/x86_64-linux-gnu/libpmi2.so.0 /usr/lib/libpmi2.so
ln -sf /usr/lib/x86_64-linux-gnu/libpmi.so.0 /usr/lib/libpmi.so
# Install UCX with proper IB support
export UCX_VERSION=1.14.1
cd /tmp
wget https://github.com/openucx/ucx/releases/download/v${UCX_VERSION}/ucx-${UCX_VERSION}.tar.gz
tar -xvf ucx-${UCX_VERSION}.tar.gz
cd ucx-${UCX_VERSION}
./configure --prefix=/usr \
--enable-optimizations \
--enable-mt \
--enable-numa \
--with-verbs \
--with-rdmacm \
--enable-gdr \
--enable-mlx5-dv
make -j$(nproc)
make install
ldconfig
# Install PMIx
cd /tmp
wget https://github.com/openpmix/openpmix/releases/download/v4.2.7/pmix-4.2.7.tar.gz
tar -xvf pmix-4.2.7.tar.gz
cd pmix-4.2.7
./configure --prefix=/usr \
--disable-python-bindings \
--with-libevent=/usr \
--with-libevent-libdir=/usr/lib
make -j$(nproc)
make install
ldconfig
# Build and install OpenMPI
cd /tmp
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz
tar -xvf openmpi-4.1.5.tar.gz
cd openmpi-4.1.5
# Configure OpenMPI with updated options for IB support
./configure --prefix=/opt/ompi \
--with-ucx=/usr \
--with-slurm=/usr \
--with-pmix=/usr \
--with-pmi=/usr \
--with-verbs=/usr \
--with-verbs-libdir=/usr/lib/x86_64-linux-gnu \
--enable-mpirun-prefix-by-default \
--enable-orterun-prefix-by-default \
--with-pmi-libdir=/usr/lib/x86_64-linux-gnu \
--enable-mpi1-compatibility \
--with-hwloc=/usr \
--enable-builtin-atomics \
--with-zlib \
--enable-heterogeneous \
--enable-mpi-fortran=yes \
--enable-static=no
make -j$(nproc)
make install
# Cleanup
cd /
rm -rf /tmp/ompi /tmp/pmix* /tmp/ucx* /tmp/libevent*
%labels
Author Dinindu Senanayake
Version v1.0
OpenMPI_Version 4.1.5
%help
This container provides OpenMPI 4.1.5 built with:
- Slurm support with PMIx
- PMI/PMI2 support
- Infiniband support
- UCX support
- Hardware locality (hwloc) support
To build:
$ apptainer build openmpi.sif openmpi.def
To run:
$ srun --mpi=pmix apptainer exec openmpi.sif ./your_mpi_program