Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tsoc
spack-configs
Commits
116ae127
Commit
116ae127
authored
Feb 20, 2026
by
one
Browse files
Simplify install-mpi.sh
parent
91f9b5a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
76 deletions
+50
-76
scripts/install-mpi.sh
scripts/install-mpi.sh
+50
-76
No files found.
scripts/install-mpi.sh
View file @
116ae127
#!/bin/bash
#!/bin/bash
install_dir
=
/opt
with_rocm
=
/opt/dtk
ucx_version
=
1.20.0
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
ucx_prefix
=
${
install_dir
}
/ucx
ompi_prefix
=
${
install_dir
}
/mpi
exit_with_error
(
)
exit_with_error
(
)
{
{
...
@@ -72,53 +72,51 @@ install_openmpi( )
...
@@ -72,53 +72,51 @@ install_openmpi( )
}
}
# OpenMPI and UCX install to one of these locations depending on OS
# OpenMPI and UCX install to one of these locations depending on OS
ucx_lib_folder
=
${
ucx_prefix
}
/lib
local
ucx_lib_folder
=
${
ucx_prefix
}
/lib
ompi_lib_folder
=
${
ompi_prefix
}
/lib
local
ompi_lib_folder
=
${
ompi_prefix
}
/lib
ucx_lib64_folder
=
${
ucx_prefix
}
/lib64
local
ucx_lib64_folder
=
${
ucx_prefix
}
/lib64
ompi_lib64_folder
=
${
ompi_prefix
}
/lib64
local
ompi_lib64_folder
=
${
ompi_prefix
}
/lib64
ucx_build_cmd
=
"./contrib/configure-release --prefix=
${
ucx_prefix
}
\
local
src_dir
=
${
PWD
}
--enable-cma --enable-mt
\
local
ucx_src
=
${
src_dir
}
/ucx-
${
ucx_version
}
--with-mlx5 --with-rc --with-ud --with-dc --with-dm --with-ib_hw_tm
\
local
ucx_tarball
=
ucx-
${
ucx_version
}
.tar.gz
--with-verbs=/usr/include --with-rdmacm=/usr
\
local
ompi_src
=
${
src_dir
}
/openmpi-
${
ompi_version
}
--with-rocm=
${
with_rocm
}
\
local
ompi_tarball
=
openmpi-
${
ompi_version
}
.tar.gz
--without-knem --without-cuda --without-java"
# Download UCX on demand
if
[
!
-d
"./ucx"
]
;
then
if
[
!
-d
"
${
ucx_src
}
"
]
;
then
ucx_src
=
ucx-
${
ucx_version
}
ucx_tarball
=
${
ucx_src
}
.tar.gz
if
[
!
-f
"
${
ucx_tarball
}
"
]
;
then
if
[
!
-f
"
${
ucx_tarball
}
"
]
;
then
wget https://github.com/openucx/ucx/releases/download/v
${
ucx_version
}
/
${
ucx_tarball
}
wget https://github.com/openucx/ucx/releases/download/v
${
ucx_version
}
/
${
ucx_tarball
}
fi
fi
check_exit_code 2
check_exit_code 2
tar
-zxf
${
ucx_tarball
}
tar
-zxf
${
ucx_tarball
}
check_exit_code 2
check_exit_code 2
mv
${
ucx_src
}
ucx
fi
check_exit_code 2
# Download OpenMPI on demand
cd
ucx
;
if
[
!
-d
"
${
ompi_src
}
"
]
;
then
check_exit_code 2
if
[
!
-f
"
${
ompi_tarball
}
"
]
;
then
${
ucx_build_cmd
}
wget https://download.open-mpi.org/release/open-mpi/v
${
ompi_version
%.*
}
/
${
ompi_tarball
}
check_exit_code 2
fi
make
-j
$(
nproc
)
check_exit_code 2
make
install
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
;
check_exit_code 2
${
ucx_build_cmd
}
check_exit_code 2
make
-j
$(
nproc
)
check_exit_code 2
check_exit_code 2
make
inst
all
tar
-zxf
${
ompi_tarb
all
}
check_exit_code 2
check_exit_code 2
cd
..
fi
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
..
# Check for successful build
# Check for successful build
if
([
!
-f
"
${
ucx_lib_folder
}
/libucm.so"
]
||
[
!
-f
"
${
ucx_lib_folder
}
/libucp.so"
]
||
\
if
([
!
-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_lib_folder
}
/libucs.so"
]
||
[
!
-f
"
${
ucx_lib_folder
}
/libuct.so"
])
&&
...
@@ -132,44 +130,20 @@ install_openmpi( )
...
@@ -132,44 +130,20 @@ install_openmpi( )
export
LIBRARY_PATH
=
"
${
ucx_prefix
}
/lib:
${
ucx_prefix
}
/lib64:
${
LIBRARY_PATH
}
"
export
LIBRARY_PATH
=
"
${
ucx_prefix
}
/lib:
${
ucx_prefix
}
/lib64:
${
LIBRARY_PATH
}
"
export
CPATH
=
"
${
ucx_prefix
}
/include:
${
CPATH
}
"
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-ucx
=
${
ucx_prefix
}
\
--with-rocm
=
${
with_rocm
}
\
--with-rocm
=
${
with_rocm
}
\
--enable-builtin-atomics
\
--enable-builtin-atomics
\
--enable-wrapper-rpath
\
--enable-wrapper-rpath
\
--without-verbs --enable-mca-no-build=btl-uct"
--without-verbs
--enable-mca-no-build
=
btl-uct
check_exit_code 2
if
[
!
-d
"./openmpi"
]
;
then
make
-j
$(
nproc
)
ompi_src
=
openmpi-
${
ompi_version
}
check_exit_code 2
ompi_tarball
=
${
ompi_src
}
.tar.gz
make
install
if
[
!
-f
"
${
ompi_tarball
}
"
]
;
then
check_exit_code 2
wget https://download.open-mpi.org/release/open-mpi/v
${
ompi_version
%.*
}
/
${
ompi_tarball
}
cd
..
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
}
check_exit_code 2
make
-j
$(
nproc
)
check_exit_code 2
make
install
check_exit_code 2
cd
..
fi
# Check for successful build
# Check for successful build
if
[
!
-f
"
${
ompi_lib_folder
}
/libmpi.so"
]
&&
[
!
-f
"
${
ompi_lib64_folder
}
/libmpi.so"
]
;
then
if
[
!
-f
"
${
ompi_lib_folder
}
/libmpi.so"
]
&&
[
!
-f
"
${
ompi_lib64_folder
}
/libmpi.so"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment