Commit 116ae127 authored by one's avatar one
Browse files

Simplify install-mpi.sh

parent 91f9b5a1
#!/bin/bash
install_dir=/opt
with_rocm=/opt/dtk
ucx_version=1.20.0
ompi_version=5.0.8
ompi_version=5.0.9
with_rocm=/opt/dtk
ompi_prefix=${install_dir}/mpi
install_dir=/opt
ucx_prefix=${install_dir}/ucx
ompi_prefix=${install_dir}/mpi
exit_with_error( )
{
......@@ -72,52 +72,50 @@ install_openmpi( )
}
# OpenMPI and UCX install to one of these locations depending on OS
ucx_lib_folder=${ucx_prefix}/lib
ompi_lib_folder=${ompi_prefix}/lib
ucx_lib64_folder=${ucx_prefix}/lib64
ompi_lib64_folder=${ompi_prefix}/lib64
ucx_build_cmd="./contrib/configure-release --prefix=${ucx_prefix} \
--enable-cma --enable-mt \
--with-mlx5 --with-rc --with-ud --with-dc --with-dm --with-ib_hw_tm \
--with-verbs=/usr/include --with-rdmacm=/usr \
--with-rocm=${with_rocm} \
--without-knem --without-cuda --without-java"
if [ ! -d "./ucx" ]; then
ucx_src=ucx-${ucx_version}
ucx_tarball=${ucx_src}.tar.gz
local ucx_lib_folder=${ucx_prefix}/lib
local ompi_lib_folder=${ompi_prefix}/lib
local ucx_lib64_folder=${ucx_prefix}/lib64
local ompi_lib64_folder=${ompi_prefix}/lib64
local src_dir=${PWD}
local ucx_src=${src_dir}/ucx-${ucx_version}
local ucx_tarball=ucx-${ucx_version}.tar.gz
local ompi_src=${src_dir}/openmpi-${ompi_version}
local ompi_tarball=openmpi-${ompi_version}.tar.gz
# Download UCX on demand
if [ ! -d "${ucx_src}" ]; then
if [ ! -f "${ucx_tarball}" ]; then
wget https://github.com/openucx/ucx/releases/download/v${ucx_version}/${ucx_tarball}
fi
check_exit_code 2
tar -zxf ${ucx_tarball}
check_exit_code 2
mv ${ucx_src} ucx
check_exit_code 2
cd ucx;
check_exit_code 2
${ucx_build_cmd}
check_exit_code 2
make -j$(nproc)
check_exit_code 2
make install
fi
# Download OpenMPI on demand
if [ ! -d "${ompi_src}" ]; then
if [ ! -f "${ompi_tarball}" ]; then
wget https://download.open-mpi.org/release/open-mpi/v${ompi_version%.*}/${ompi_tarball}
fi
check_exit_code 2
cd ..
elif ([ ! -f "${ucx_lib_folder}/libucm.so" ] || [ ! -f "${ucx_lib_folder}/libucp.so" ] || \
[ ! -f "${ucx_lib_folder}/libucs.so" ] || [ ! -f "${ucx_lib_folder}/libuct.so" ]) && \
([ ! -f "${ucx_lib64_folder}/libucm.so" ] || [ ! -f "${ucx_lib64_folder}/libucp.so" ] || \
[ ! -f "${ucx_lib64_folder}/libucs.so" ] || [ ! -f "${ucx_lib64_folder}/libuct.so" ]); then
cd ucx;
tar -zxf ${ompi_tarball}
check_exit_code 2
${ucx_build_cmd}
fi
# Build UCX
cd ${ucx_src};
./contrib/configure-release --prefix=${ucx_prefix} \
--enable-cma --enable-mt \
--with-mlx5 --with-rc --with-ud --with-dc --with-dm --with-ib_hw_tm \
--with-verbs=/usr/include --with-rdmacm=/usr \
--with-rocm=${with_rocm} \
--without-knem --without-cuda --without-java
check_exit_code 2
make -j$(nproc)
check_exit_code 2
make install
check_exit_code 2
cd ..
fi
# Check for successful build
if ([ ! -f "${ucx_lib_folder}/libucm.so" ] || [ ! -f "${ucx_lib_folder}/libucp.so" ] || \
......@@ -132,44 +130,20 @@ install_openmpi( )
export LIBRARY_PATH="${ucx_prefix}/lib:${ucx_prefix}/lib64:${LIBRARY_PATH}"
export CPATH="${ucx_prefix}/include:${CPATH}"
ompi_build_cmd="./configure --prefix=${ompi_prefix} \
# Build OpenMPI
cd ${ompi_src}
./configure --prefix=${ompi_prefix} \
--with-ucx=${ucx_prefix} \
--with-rocm=${with_rocm} \
--enable-builtin-atomics \
--enable-wrapper-rpath \
--without-verbs --enable-mca-no-build=btl-uct"
if [ ! -d "./openmpi" ]; then
ompi_src=openmpi-${ompi_version}
ompi_tarball=${ompi_src}.tar.gz
if [ ! -f "${ompi_tarball}" ]; then
wget https://download.open-mpi.org/release/open-mpi/v${ompi_version%.*}/${ompi_tarball}
fi
check_exit_code 2
tar -zxf ${ompi_tarball}
check_exit_code 2
mv ${ompi_src} openmpi
check_exit_code 2
cd openmpi
check_exit_code 2
${ompi_build_cmd}
check_exit_code 2
make -j$(nproc)
check_exit_code 2
make install
check_exit_code 2
cd ..
elif [ ! -f "${ompi_lib_folder}/libmpi.so" ] && [ ! -f "${ompi_lib64_folder}/libmpi.so" ]; then
cd openmpi
check_exit_code 2
${ompi_build_cmd}
--without-verbs --enable-mca-no-build=btl-uct
check_exit_code 2
make -j$(nproc)
check_exit_code 2
make install
check_exit_code 2
cd ..
fi
# Check for successful build
if [ ! -f "${ompi_lib_folder}/libmpi.so" ] && [ ! -f "${ompi_lib64_folder}/libmpi.so" ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment