Skip to content

Commit

Permalink
ENH: add Intel MKL support for Trilinos build
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian-Diaz committed Oct 15, 2024
1 parent ce95c17 commit 1ee9321
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 19 deletions.
21 changes: 20 additions & 1 deletion scripts/build-matar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ show_help() {
echo " --kokkos_build_type=<none|serial|openmp|pthreads|cuda|hip|serial_mpi|openmp_mpi|cuda_mpi|hip_mpi|>. Default is 'serial'"
echo " --build_action=<full-app|set-env|install-kokkos|install-matar|matar>. Default is 'full-app'"
echo " --machine=<darwin|chicoma|linux|mac>. Default is 'linux'"
echo " --intel_mkl=<enabled|disabled>. Default is 'disabled'"
echo " --build_cores=<Integers greater than 0>. Default is set 1"
echo " --help: Display this help message"
echo " "
Expand Down Expand Up @@ -44,6 +45,11 @@ show_help() {
echo " linux A general linux machine (that does not use modules)"
echo " mac A Mac computer. This option does not allow for cuda and hip builds, and build_cores will be set to 1"
echo " "
echo " --intel_mkl Decides whether to build Trilinos using the Intel MKL library"
echo " "
echo " enabled Links and builds Trilinos with the Intel MKL library"
echo " disabled Links and builds Trilinos using LAPACK and BLAS"
echo " "
echo " --build_cores The number of build cores to be used by make and make install commands. The default is 1"
echo " "
echo " --trilinos Decides if Trilinos is available for certain MATAR functionality"
Expand All @@ -61,13 +67,15 @@ machine="linux"
kokkos_build_type="serial"
build_cores="1"
trilinos="disabled"
intel_mkl="disabled"

# Define arrays of valid options
valid_build_action=("full-app" "set-env" "install-matar" "install-kokkos" "matar")
valid_execution=("examples" "test" "benchmark")
valid_kokkos_build_types=("none" "serial" "openmp" "pthreads" "cuda" "hip" "serial_mpi" "openmp_mpi" "cuda_mpi" "hip_mpi")
valid_machines=("darwin" "chicoma" "linux" "mac")
valid_trilinos=("disabled" "enabled")
valid_intel_mkl=("disabled" "enabled")

# Parse command line arguments
for arg in "$@"; do
Expand Down Expand Up @@ -132,6 +140,16 @@ for arg in "$@"; do
return 1
fi
;;
--intel_mkl=*)
option="${arg#*=}"
if [[ " ${valid_intel_mkl[*]} " == *" $option "* ]]; then
intel_mkl="$option"
else
echo "Error: Invalid --intel_mkl specified."
show_help
return 1
fi
;;
--help)
show_help
return 1
Expand Down Expand Up @@ -175,6 +193,7 @@ echo "Execution - ${execution}"
echo "Kokkos backend - ${kokkos_build_type}"
echo "make -j ${build_cores}"
echo "Trilinos - ${trilinos}"
echo "Intel MKL library - ${intel_mkl}"

cd "$( dirname "${BASH_SOURCE[0]}" )"

Expand All @@ -192,7 +211,7 @@ if [ "$build_action" = "full-app" ]; then
if [ "$trilinos" = "disabled" ]; then
source kokkos-install.sh ${kokkos_build_type}
elif [ "$trilinos" = "enabled" ]; then
source trilinos-install.sh ${kokkos_build_type}
source trilinos-install.sh ${kokkos_build_type} ${intel_mkl}
fi
source matar-install.sh ${kokkos_build_type} ${trilinos}
source cmake_build_${execution}.sh ${kokkos_build_type} ${trilinos}
Expand Down
37 changes: 19 additions & 18 deletions scripts/trilinos-install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash -e

kokkos_build_type="${1}"
intel_mkl="${2}"

# If all arguments are valid, you can use them in your script as needed
echo "Trilinos Kokkos Build Type: $kokkos_build_type"
Expand Down Expand Up @@ -113,24 +114,24 @@ ${ADDITIONS[@]}
)

# Flags for building with Intel MKL library
#INTEL_MKL_ADDITIONS=(
#-D TPL_ENABLE_MKL=ON
#-D BLAS_LIBRARY_NAMES="libmkl_rt.so"
#-D BLAS_LIBRARY_DIRS="$MKLROOT/lib/intel64"
#-D LAPACK_LIBRARY_NAMES="libmkl_rt.so"
#-D LAPACK_LIBRARY_DIRS="$MKLROOT/lib/intel64"
#-D MKL_LIBRARY_DIRS="$MKLROOT/lib/intel64"
#-D MKL_LIBRARY_NAMES="mkl_rt"
#-D MKL_INCLUDE_DIRS="$MKLROOT/include"
#)

#echo "**** Intel MKL = ${intel_mkl} ****"
#if [ "$intel_mkl" = "enabled" ]; then
#echo "**** assuming MKL installation at $MKLROOT ****"
#cmake_options+=(
#${INTEL_MKL_ADDITIONS[@]}
#)
#fi
INTEL_MKL_ADDITIONS=(
-D TPL_ENABLE_MKL=ON
-D BLAS_LIBRARY_NAMES="libmkl_rt.so"
-D BLAS_LIBRARY_DIRS="$MKLROOT/lib/intel64"
-D LAPACK_LIBRARY_NAMES="libmkl_rt.so"
-D LAPACK_LIBRARY_DIRS="$MKLROOT/lib/intel64"
-D MKL_LIBRARY_DIRS="$MKLROOT/lib/intel64"
-D MKL_LIBRARY_NAMES="mkl_rt"
-D MKL_INCLUDE_DIRS="$MKLROOT/include"
)

echo "**** Intel MKL = ${intel_mkl} ****"
if [ "$intel_mkl" = "enabled" ]; then
echo "**** assuming MKL installation at $MKLROOT ****"
cmake_options+=(
${INTEL_MKL_ADDITIONS[@]}
)
fi

if [ "$kokkos_build_type" = "openmp" ] || [ "$kokkos_build_type" = "openmp_mpi" ]; then
cmake_options+=(
Expand Down

0 comments on commit 1ee9321

Please sign in to comment.