Skip to content

Commit

Permalink
removed source setvars and manipulation of DYLD_LIBRARY_PATH
Browse files Browse the repository at this point in the history
move macos mkl install into separate script

move variable export to main calling function

set lib env export in action

source instead of execute

set MKLLIB per case, skip 2021.5 macos mkl
  • Loading branch information
iulusoy committed Mar 20, 2024
1 parent 428a567 commit 0e8b621
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 46 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ runs:
echo "FC=${FC}" >> $GITHUB_ENV
echo "CC=${CC}" >> $GITHUB_ENV
echo "CXX=${CXX}" >> $GITHUB_ENV
echo "MKLLIB=${MKLLIB}" >> $GITHUB_ENV
# save oneAPI cache and activate environment
- name: Save cache
Expand Down Expand Up @@ -134,6 +135,7 @@ runs:
echo FC=$FC>>$GITHUB_ENV
echo CC=$CC>>$GITHUB_ENV
echo CXX=$CXX>>$GITHUB_ENV
echo "MKLLIB=$MKLLIB" >> $GITHUB_ENV
# set fpm env vars
echo FPM_FC=$FC>>$GITHUB_ENV
Expand All @@ -144,6 +146,7 @@ runs:
echo fc=$FC>>$GITHUB_OUTPUT
echo cc=$CC>>$GITHUB_OUTPUT
echo cxx=$CXX>>$GITHUB_OUTPUT
echo MKLLIB=$MKLLIB>>$GITHUB_OUTPUT
# GitHub Actions prepends GNU linker to the PATH before all bash steps, hide it so MSVC linker is found
- name: Hide GNU linker (Windows)
Expand Down
22 changes: 22 additions & 0 deletions install-mkl-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MACOS_BASEKIT_URL=$1

if [ "$MACOS_BASEKIT_URL" == "" ]; then
echo "ERROR: MACOS_BASEKIT_URL is empty - please check the version mapping for MKL"
echo "SKIPPING MKL installation..."
elif [ "$MACOS_BASEKIT_URL" == "2021.5" ]; then
echo "ERROR: MKL not available for this intel compiler version"
echo "SKIPPING MKL installation..."
else
require_fetch
$fetch $MACOS_BASEKIT_URL > m_BASEKit.dmg
ls -lh
hdiutil verify m_BASEKit.dmg
hdiutil attach m_BASEKit.dmg
sudo /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
--action install \
--eula=accept \
--continue-with-optional-error=yes \
--log-dir=.
hdiutil detach /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)" -quiet
rm m_BASEKit.dmg
fi
55 changes: 9 additions & 46 deletions setup-fortran.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,9 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH
LIBRARY_PATH=$LIBRARY_PATH
INFOPATH=$INFOPATH
MANPATH=$MANPATH
MKLLIB=$MKLLIB
MKLROOT=$MKLROOT
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
ONEAPI_ROOT=$ONEAPI_ROOT
MKLLIB=$MKLLIB
CLASSPATH=$CLASSPATH
CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
OCL_ICD_FILENAMES=$OCL_ICD_FILENAMES
Expand Down Expand Up @@ -397,21 +396,6 @@ install_intel_apt()
fi

source /opt/intel/oneapi/setvars.sh
# these exports have been removed in later versions of the action?
if $classic; then
export FC="ifort"
export CC="icc"
export CXX="icpc"
else
export FC="ifx"
export CC="icx"
export CXX="icpx"
fi
if $install_mkl; then
export MKLLIB="$ONEAPI_ROOT/mkl/latest/lib/intel64"
export MKLROOT="$ONEAPI_ROOT/mkl/latest"
fi

export_intel_vars
}

Expand Down Expand Up @@ -480,23 +464,7 @@ install_intel_dmg()
esac

if $install_mkl; then
if [ "$MACOS_BASEKIT_URL" == "" ]; then
echo "ERROR: MACOS_BASEKIT_URL is empty - please check the version mapping for MKL"
echo "SKIPPING MKL installation..."
else
require_fetch
$fetch $MACOS_BASEKIT_URL > m_BASEKit.dmg
ls -lh
hdiutil verify m_BASEKit.dmg
hdiutil attach m_BASEKit.dmg
sudo /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
--action install \
--eula=accept \
--continue-with-optional-error=yes \
--log-dir=.
hdiutil detach /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)" -quiet
rm m_BASEKit.dmg
fi
source "$GITHUB_ACTION_PATH/install-mkl-macos.sh" $MACOS_BASEKIT_URL
fi

require_fetch
Expand All @@ -512,18 +480,6 @@ install_intel_dmg()
rm m_HPCKit.dmg

source /opt/intel/oneapi/setvars.sh

# these exports have been removed in later versions of the action?
export FC="ifort"
export CC="icc"
export CXX="icpc"

if $install_mkl; then
export MKLLIB="$ONEAPI_ROOT/mkl/latest/lib"
export MKLROOT="$ONEAPI_ROOT/mkl/latest"
export DYLD_LIBRARY_PATH="$MKLLIB":$DYLD_LIBRARY_PATH
fi

export_intel_vars
}

Expand Down Expand Up @@ -579,9 +535,11 @@ install_intel()
local platform=$1
local classic=$2
local install_mkl=$3
mkl_subdir=""
case $platform in
linux*)
install_intel_apt $version $classic $install_mkl
mkl_subdir="intel64"
;;
darwin*)
install_intel_dmg $version $install_mkl
Expand Down Expand Up @@ -610,6 +568,11 @@ install_intel()
export CC="icx"
export CXX="icpx"
fi

if $install_mkl; then
export MKLLIB="$ONEAPI_ROOT/mkl/latest/lib/$mkl_subdir"
export MKLROOT="$ONEAPI_ROOT/mkl/latest"
fi
}

export_nvidiahpc_vars()
Expand Down

0 comments on commit 0e8b621

Please sign in to comment.