-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Orion Poplawski <[email protected]>
- Loading branch information
1 parent
d3362ac
commit e221fee
Showing
3 changed files
with
192 additions
and
157 deletions.
There are no files selected for viewing
169 changes: 169 additions & 0 deletions
169
components/mpi-families/impi-devel/SOURCES/ohpc-update-modules-mpi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
#!/bin/bash | ||
# Don't clobber/overwrite existing files | ||
# Write the new file .rpmnew | ||
testfile () { | ||
if [ -e "$1" ]; then | ||
echo "$1.rpmnew" | ||
else | ||
echo "$1" | ||
fi | ||
} | ||
|
||
# Remove .rpmnew files if they are identical | ||
# otherwise record in manifest | ||
modprocess () { | ||
if [ "${1/.rpmnew/}" != "$1" ]; then | ||
if cmp "${1/.rpmnew/}" "$1"; then | ||
rm "$1" | ||
return | ||
fi | ||
fi | ||
md5sum "${modname}" >> @@oneapi_manifest@@ | ||
} | ||
|
||
# Create an OpenHPC module file for each version found in compilers | ||
rm -f @@oneapi_manifest@@ | ||
|
||
# Regenerate the oneAPI modules directory (since MPI may have just been added) | ||
echo "Generating new oneAPI modulefiles" | ||
/opt/intel/oneapi/modulefiles-setup.sh --ignore-latest --force --output-dir=@@OHPC_MODULEDEPS@@/oneapi/ > /dev/null | ||
if [ ! -d @@OHPC_MODULEDEPS@@/oneapi/compiler ]; then | ||
echo "ERROR: Failed to create oneAPI module directory" | ||
exit 1 | ||
fi | ||
|
||
# Set system defaults for default OBS oneAPI modules | ||
for tool in @@exact_deps@@; do | ||
filename="@@OHPC_MODULEDEPS@@/oneapi/${tool%%/*}/.version" | ||
echo "#%Module1.0" > "${filename}" | ||
echo "set ModulesVersion \"${tool##*/}\"" >> "${filename}" | ||
done | ||
|
||
# Create an OpenHPC module file for each MPI version found | ||
echo "Creating OpenHPC-style modulefiles for local oneAPI MPI installation(s)." | ||
for mpis in @@OHPC_MODULEDEPS@@/oneapi/mpi/2*; do | ||
ver=$(basename "$mpis") | ||
echo "--> Installing modulefile for version=${ver}" | ||
modname=$(testfile @@OHPC_MODULEDEPS@@/intel/impi/"$ver") | ||
|
||
# Get value for MPI_DIR | ||
eval "$(@@OHPC_ADMIN@@/lmod/lmod/libexec/lmod --expert use @@OHPC_MODULEDEPS@@/oneapi)" | ||
eval "$(@@OHPC_ADMIN@@/lmod/lmod/libexec/lmod --expert load mpi/\"$ver\")" | ||
MPIDIR=$I_MPI_ROOT | ||
eval "$(@@OHPC_ADMIN@@/lmod/lmod/libexec/lmod --expert unload mpi/\"$ver\")" | ||
eval "$(@@OHPC_ADMIN@@/lmod/lmod/libexec/lmod --expert unuse @@OHPC_MODULEDEPS@@/oneapi)" | ||
|
||
cat << EOF > "${modname}" | ||
#%Module1.0##################################################################### | ||
set version "$ver" | ||
proc ModulesHelp { } { | ||
global version | ||
puts stderr "\nThis module loads the Intel MPI environment.\n" | ||
puts stderr " mpiifort (Fortran source)" | ||
puts stderr " mpiicc (C source)" | ||
puts stderr " mpiicpc (C++ source)" | ||
puts stderr "\nVersion \$version\n" | ||
} | ||
module-whatis "Name: Intel MPI" | ||
module-whatis "Version: \$version" | ||
module-whatis "Category: library, runtime support" | ||
module-whatis "Description: Intel MPI Library (C/C++/Fortran for x86_64)" | ||
module-whatis "URL: http://software.intel.com/en-us/articles/intel-mpi-library" | ||
# For convenience, redirect standard mpicc/mpicxx/mpifort | ||
# to use oneAPI icc/icpc/ifort instead of gcc/g++/gfortran | ||
setenv I_MPI_CC icx | ||
setenv I_MPI_CXX icpx | ||
setenv I_MPI_FC ifx | ||
setenv I_MPI_F77 ifx | ||
setenv I_MPI_F90 ifx | ||
setenv MPI_DIR "${MPIDIR}" | ||
prepend-path MODULEPATH @@OHPC_MODULEDEPS@@/oneapi | ||
prepend-path MODULEPATH @@OHPC_MODULEDEPS@@/intel-impi | ||
module load "mpi/\$version" | ||
prepend-path LIBRARY_PATH "${MPIDIR}/libfabric/lib" | ||
prepend-path LIBRARY_PATH "${MPIDIR}/lib" | ||
family "MPI" | ||
EOF | ||
|
||
modprocess "${modname}" | ||
|
||
modname=$(testfile @@OHPC_MODULEDEPS@@/gnu/impi/"$ver") | ||
|
||
cat << EOF > "${modname}" | ||
#%Module1.0##################################################################### | ||
set version "$ver" | ||
proc ModulesHelp { } { | ||
global version | ||
puts stderr "\nThis module loads the Intel MPI environment for use with the GNU" | ||
puts stderr "compiler toolchain\n" | ||
puts stderr "mpif90 (Fortran source)" | ||
puts stderr "mpicc (C source)" | ||
puts stderr "mpicxx (C++ source)" | ||
puts stderr "\nVersion \$version\n" | ||
} | ||
module-whatis "Name: Intel MPI" | ||
module-whatis "Version: \$version" | ||
module-whatis "Category: library, runtime support" | ||
module-whatis "Description: Intel MPI Library (C/C++/Fortran for x86_64)" | ||
module-whatis "URL: http://software.intel.com/en-us/articles/intel-mpi-library/" | ||
setenv MPI_DIR "${MPIDIR}" | ||
prepend-path MODULEPATH @@OHPC_MODULEDEPS@@/oneapi | ||
prepend-path MODULEPATH @@OHPC_MODULEDEPS@@/gnu-impi | ||
module load "mpi/\$version" | ||
prepend-path LIBRARY_PATH "${MPIDIR}/libfabric/lib" | ||
prepend-path LIBRARY_PATH "${MPIDIR}/lib" | ||
family "MPI" | ||
EOF | ||
|
||
modprocess "${modname}" | ||
|
||
# support for gnu major version | ||
orig_modname=$modname | ||
modname=$(testfile @@OHPC_MODULEDEPS@@/gnu@@gnu_major_ver@@/impi/"$ver") | ||
cp "${orig_modname}" "${modname}" | ||
sed -i "s,@@OHPC_MODULEDEPS@@/gnu-impi,@@OHPC_MODULEDEPS@@/gnu@@gnu_major_ver@@-impi," "${modname}" | ||
modprocess "${modname}" | ||
|
||
done | ||
|
||
# Default Intel(R) MPI Versions to match OpenHPC build version | ||
modname=$(testfile @@OHPC_MODULEDEPS@@/intel/impi/.version) | ||
|
||
cat << EOF > "${modname}" | ||
#%Module1.0##################################################################### | ||
set ModulesVersion "@@exact_mpi_ver@@" | ||
EOF | ||
|
||
modprocess "${modname}" | ||
|
||
modname=$(testfile @@OHPC_MODULEDEPS@@/gnu/impi/.version) | ||
|
||
cat << EOF > "${modname}" | ||
#%Module1.0##################################################################### | ||
set ModulesVersion "@@exact_mpi_ver@@" | ||
EOF | ||
|
||
modprocess "${modname}" | ||
|
||
# support for gnu major version | ||
orig_modname=$modname | ||
modname=$(testfile @@OHPC_MODULEDEPS@@/gnu@@gnu_major_ver@@/impi/.version) | ||
cp "${orig_modname}" "${modname}" | ||
modprocess "${modname}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.