Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pr and sync #10

Merged
merged 17 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .github/actions/test-fc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,6 @@ runs:
}
rm hw.exe
- name: Test compile Fortran (pwsh)
working-directory: test
if: ${{ (success() || failure()) && runner.os == 'Windows' }}
shell: pwsh
run: |
${{ env.FC }} -o hw.exe hw.f90
$output=$(& ".\hw.exe")
if ($output -match "hello world") {
write-output $output
} else {
write-output "unexpected output: $output"
exit 1
}
rm hw.exe
- name: Test compile Fortran (powershell)
working-directory: test
if: ${{ (success() || failure()) && runner.os == 'Windows' && inputs.compiler != 'lfortran' }}
Expand Down
34 changes: 28 additions & 6 deletions .github/actions/test-mkl/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,39 @@ runs:
working-directory: test
shell: bash
run: |
if [[ "${{ inputs.compiler }}" =~ "intel" ]] && [[ "${{ inputs.install_mkl }}" == "true" ]] && ([[ "${{ inputs.version }}" != "2021.5" ]] && [[ "$runner.os" != "macOS" ]]); then
# check settings if mkl tests should be run
# mkl cannot be installed for 2021.5 on macos;
# and for macos-14 also not 2021.6-2021.9
mkl_tests=true
echo "$RUNNER_OS"
if [[ "${{ inputs.compiler }}" =~ "gcc" ]]; then mkl_tests=false; fi
if [[ "${{ inputs.compiler }}" =~ "lfortran" ]]; then mkl_tests=false; fi
if [[ "${{ inputs.compiler }}" =~ "nvidia" ]]; then mkl_tests=false; fi
if [[ "${{ inputs.install_mkl }}" == "false" ]]; then mkl_tests=false; fi
if [[ "${{ inputs.version }}" == "2021.5" ]] && [[ "$RUNNER_OS" == "macOS" ]]; then mkl_tests=false; fi
if [[ "$RUNNER_OS" == "macOS" ]]; then
macos_version=$(sw_vers | grep "ProductVersion")
echo "$macos_version"
if [[ "$macos_version" =~ "14." ]] && [[ "${{ inputs.version }}" == '2021.6' || "${{ inputs.version }}" == '2021.7' || "${{ inputs.version }}" == '2021.7.1' || "${{ inputs.version }}" == '2021.8' ]]; then
mkl_tests=false
fi
fi
# # now we know if we should, run the tests
if $mkl_tests; then
if [ "$RUNNER_OS" == "macOS" ]; then
# required for macOS 11, intel-classic 2021.1-2021.10
# required for macOS 12, intel-classic 2021.1, 2021.4, 2021.6, 2021.10
# for all others, setting DYLD path through environment works correctly
export DYLD_LIBRARY_PATH="${{ env.MKLLIB }}:$DYLD_LIBRARY_PATH"
MKLLIB="$MKLROOT/lib"
export DYLD_LIBRARY_PATH="$MKLLIB:$DYLD_LIBRARY_PATH"
elif [ "$RUNNER_OS" == "Linux" ]; then
MKLLIB="$MKLROOT/latest/lib/intel64"
export LD_LIBRARY_PATH="$MKLLIB:$LD_LIBRARY_PATH"
fi
linking="-L${{ env.MKLLIB }} -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"
linking="-L$MKLLIB -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"
# hello world with blas call program
${{ env.FC }} $args $linking -o hw_mkl hw_mkl.f90
output=$(./hw_mkl '2>&1')
[[ "$output" == *"hello world 9.00000000000000"* ]] && echo "$output" || (echo "Unexpected Fortran program 'hw_mkl' output: $output"; exit 1)
rm hw_mkl
else
echo "Skipping MKL tests"
fi
2 changes: 1 addition & 1 deletion .github/compat/long_compat.csv
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ windows-2022,intel,2023.2,✓
windows-2022,intel,2024.0,✓
windows-2022,lfortran,0.31.0,✓
windows-2022,lfortran,0.32.0,✓
windows-2022,lfortran,0.33.0,✓
windows-2022,lfortran,0.33.0,✓
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ jobs:
version: ${{ matrix.toolchain.version }}

- name: Test MKL libraries
if: steps.setup-fortran.outcome == 'success' && runner.os != 'windows'
# we could also exclude 2021.5 for all macos versions here
# this needs refactoring at some point - should the install
# fail if no mkl version exists?
if: steps.setup-fortran.outcome == 'success' && runner.os != 'windows'
uses: ./.github/actions/test-mkl
with:
compiler: ${{ matrix.toolchain.compiler }}
Expand Down
1 change: 1 addition & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,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 Down
21 changes: 21 additions & 0 deletions install-intel-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
install_mkl=$1
MACOS_URL=$2
if [ "$MACOS_URL" == "" ]; then
echo "ERROR: MACOS URL is empty - please check the version mapping for mkl/intel compiler"
echo "SKIPPING MKL/intel installation..."
elif [ "$MACOS_URL" == "2021.5" ] and $install_mkl; then
echo "ERROR: MKL not available for this intel compiler version"
echo "SKIPPING MKL installation..."
else
require_fetch
$fetch $MACOS_URL > m_BASE_HPC_Kit.dmg
hdiutil verify m_BASE_HPC_Kit.dmg
hdiutil attach m_BASE_HPC_Kit.dmg
sudo /Volumes/"$(basename "$MACOS_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
--action install \
--eula=accept \
--continue-with-optional-error=yes \
--log-dir=.
hdiutil detach /Volumes/"$(basename "$MACOS_URL" .dmg)" -quiet
rm m_BASE_HPC_Kit.dmg
fi
90 changes: 44 additions & 46 deletions setup-fortran.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ 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
CLASSPATH=$CLASSPATH
CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
Expand Down Expand Up @@ -297,20 +295,39 @@ intel_version_map_m()
mkl_version_map_m()
{
local intel_version=$1
case $intel_version in
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2022.2.0 | 2022.3.0 | 2022.3.1 | 2023.0.0 )
mkl_version=2022.2.0
;;
2022.1.0)
mkl_version=""
;;
2023.1.0)
mkl_version=2023.1.0
;;
*)
mkl_version=2023.2.0
;;
esac
macos_version=$(sw_vers | grep "ProductVersion")
echo "Found macos version $macos_version"
if [[ "$macos_version" == *"14"* ]]; then
echo "MacOS 14 requires different basekit versions to work"
case $intel_version in
# compiler versions 2021.1, 2021.2, 2021.3, 2021.4, 2021.10 work with latest basekit
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2023.2.0)
mkl_version=2023.2.0
;;
# compiler versions 2021.5, 2021.6, 2021.7, 2021.7.1, 2021.8, 2021.9 work with other basekits
2023.1.0)
mkl_version=2022.2.0
;;
*)
mkl_version=""
;;
esac
else
case $intel_version in
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2022.2.0 | 2022.3.0 | 2022.3.1 | 2023.0.0 )
mkl_version=2022.2.0
;;
2022.1.0)
mkl_version=""
;;
2023.1.0)
mkl_version=2023.1.0
;;
*)
mkl_version=2023.2.0
;;
esac
fi
}

intel_version_map_w()
Expand Down Expand Up @@ -388,11 +405,11 @@ install_intel_apt()
esac

if $install_mkl; then
sudo apt-get install \
sudo apt-get install -y \
intel-oneapi-compiler-{fortran,"$cpp_name"}-$version \
intel-oneapi-mkl-$mkl_version
else
sudo apt-get install \
sudo apt-get install -y \
intel-oneapi-compiler-{fortran,"$cpp_name"}-$version
fi

Expand Down Expand Up @@ -465,36 +482,10 @@ 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-intel-macos.sh" true $MACOS_BASEKIT_URL
fi

require_fetch
$fetch $MACOS_HPCKIT_URL > m_HPCKit.dmg
hdiutil verify m_HPCKit.dmg
hdiutil attach m_HPCKit.dmg
sudo /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
--action install \
--eula=accept \
--continue-with-optional-error=yes \
--log-dir=.
hdiutil detach /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)" -quiet
rm m_HPCKit.dmg
source "$GITHUB_ACTION_PATH/install-intel-macos.sh" false $MACOS_HPCKIT_URL

source /opt/intel/oneapi/setvars.sh
export_intel_vars
Expand Down Expand Up @@ -552,9 +543,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 @@ -583,6 +576,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
Loading