-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-mpi.sh
167 lines (153 loc) · 4.91 KB
/
setup-mpi.sh
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
#!/bin/bash
set -eu
MPI=$(echo "${1:-}" | tr '[:upper:]' '[:lower:]')
setup-apt-intel-oneapi () {
apt_repo_url=https://apt.repos.intel.com/
gpg_key_url=$apt_repo_url/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
keyring=/usr/share/keyrings/oneapi-archive-keyring.gpg
# download the key to system keyring
curl -s $gpg_key_url | gpg --dearmor | sudo tee $keyring > /dev/null
# add signed entry to apt sources
echo "deb [signed-by=${keyring}] ${apt_repo_url}/oneapi all main" | \
sudo tee /etc/apt/sources.list.d/oneAPI.list
# update list of available packages
sudo apt update
}
setup-env-intel-oneapi () {
set +u
source /opt/intel/oneapi/setvars.sh
set -u
echo "${I_MPI_ROOT}/bin" >> $GITHUB_PATH
echo "ONEAPI_ROOT=${ONEAPI_ROOT}" >> $GITHUB_ENV
echo "I_MPI_ROOT=${I_MPI_ROOT}" >> $GITHUB_ENV
echo "FI_PROVIDER_PATH=${FI_PROVIDER_PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> $GITHUB_ENV
}
setup-win-intel-oneapi-mpi () {
baseurl=https://registrationcenter-download.intel.com
subpath=akdlm/irc_nas/19160
version=2021.8.0 build=25543
package=w_mpi_oneapi_p_${version}.${build}_offline.exe
set -x
curl -sO $baseurl/$subpath/$package
./$package -s -a --silent --eula accept
set +x
}
setup-win-intel-oneapi-mpi-env () {
ONEAPI_ROOT="C:\Program Files (x86)\Intel\oneAPI"
I_MPI_ROOT="${ONEAPI_ROOT}\mpi\latest"
echo "ONEAPI_ROOT=${ONEAPI_ROOT}" >> $GITHUB_ENV
echo "I_MPI_ROOT=${I_MPI_ROOT}" >> $GITHUB_ENV
echo "${I_MPI_ROOT}\bin" >> $GITHUB_PATH
echo "${I_MPI_ROOT}\bin\release" >> $GITHUB_PATH
echo "${I_MPI_ROOT}\libfabric\bin" >> $GITHUB_PATH
echo "${I_MPI_ROOT}\libfabric\bin\utils" >> $GITHUB_PATH
ONEAPI_ROOT="/c/Program Files (x86)/Intel/oneAPI"
I_MPI_ROOT="${ONEAPI_ROOT}/mpi/latest"
export PATH="${I_MPI_ROOT}/bin:$PATH"
export PATH="${I_MPI_ROOT}/bin/release:$PATH"
export PATH="${I_MPI_ROOT}/bin/libfabric/bin:$PATH"
impi_info=impi_info.exe
}
case $(uname) in
Linux)
MPI="${MPI:-mpich}"
echo "::group::Installing $MPI with apt"
sudo apt update
case $MPI in
mpich)
sudo apt install -y -q mpich libmpich-dev
;;
openmpi)
sudo apt install -y -q openmpi-bin libopenmpi-dev
;;
intelmpi)
setup-apt-intel-oneapi
sudo apt install -y -q intel-oneapi-mpi-devel
setup-env-intel-oneapi
;;
*)
echo "Unknown MPI implementation:" $MPI
exit 1
;;
esac
echo "::endgroup::"
;;
Darwin)
MPI="${MPI:-mpich}"
echo "::group::Installing $MPI with brew"
case $MPI in
mpich)
brew install mpich
;;
openmpi)
brew install openmpi
;;
*)
echo "Unknown MPI implementation:" $MPI
exit 1
;;
esac
echo "::endgroup::"
;;
Windows* | MINGW* | MSYS*)
MPI="${MPI:-msmpi}"
echo "::group::Installing $MPI"
case $MPI in
msmpi)
sdir=$(dirname "${BASH_SOURCE[0]}")
pwsh "${sdir}\\setup-${MPI}.ps1"
;;
intelmpi)
setup-win-intel-oneapi-mpi
setup-win-intel-oneapi-mpi-env
hydra_service.exe -install
;;
*)
echo "Unknown MPI implementation:" $MPI
exit 1
;;
esac
echo "::endgroup::"
;;
*)
echo "Unknown OS kernel:" $(uname)
exit 1
;;
esac
echo "mpi=${MPI}" >> $GITHUB_OUTPUT
case $MPI in
mpich)
echo "::group::Run mpichversion"
mpichversion
echo "::endgroup::"
;;
openmpi)
echo "::group::Run ompi_info --all"
ompi_info --all
echo "::endgroup::"
;;
intelmpi)
echo "::group::Run impi_info -all"
${impi_info:-impi_info} -all
echo "::endgroup::"
;;
esac
if [ $MPI == openmpi ]; then
openmpi_mca_params=$HOME/.openmpi/mca-params.conf
mkdir -p $(dirname $openmpi_mca_params)
echo plm=isolated >> $openmpi_mca_params
echo rmaps_base_oversubscribe=true >> $openmpi_mca_params
echo btl_base_warn_component_unused=false >> $openmpi_mca_params
echo btl_vader_single_copy_mechanism=none >> $openmpi_mca_params
if [[ $(uname) == Darwin ]]; then
# open-mpi/ompi#7516
echo gds=hash >> $openmpi_mca_params
# open-mpi/ompi#5798
echo btl_vader_backing_directory=/tmp >> $openmpi_mca_params
fi
echo "::group::Configure ${openmpi_mca_params}"
cat $openmpi_mca_params
echo "::endgroup::"
fi