Skip to content

Commit 2a3dbd2

Browse files
committed
Create pr and sync (#10)
* removed source setvars and manipulation of DYLD_LIBRARY_PATH 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 * use macos install script for both dmgs, answer y in apt install for act compatibility * remove accidental duplication * reverse order of passed variables in case string is empty * remove pasted garbage in link * rename macos install script * try wo another export of MKLLIB in the action.yml * export mkllib in test * no latest when using MKLROOT for macos * test for macos 14 with latest basekit for all intel comp versions * set conditions to run mkl test in mkl action file * run all tests * exclude lfortran and nvidia from mkl test
1 parent 5436f77 commit 2a3dbd2

File tree

7 files changed

+97
-68
lines changed

7 files changed

+97
-68
lines changed

.github/actions/test-fc/action.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,6 @@ runs:
6161
}
6262
rm hw.exe
6363
64-
- name: Test compile Fortran (pwsh)
65-
working-directory: test
66-
if: ${{ (success() || failure()) && runner.os == 'Windows' }}
67-
shell: pwsh
68-
run: |
69-
${{ env.FC }} -o hw.exe hw.f90
70-
$output=$(& ".\hw.exe")
71-
if ($output -match "hello world") {
72-
write-output $output
73-
} else {
74-
write-output "unexpected output: $output"
75-
exit 1
76-
}
77-
rm hw.exe
78-
79-
8064
- name: Test compile Fortran (powershell)
8165
working-directory: test
8266
if: ${{ (success() || failure()) && runner.os == 'Windows' && inputs.compiler != 'lfortran' }}

.github/actions/test-mkl/action.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,39 @@ runs:
1818
working-directory: test
1919
shell: bash
2020
run: |
21-
if [[ "${{ inputs.compiler }}" =~ "intel" ]] && [[ "${{ inputs.install_mkl }}" == "true" ]] && ([[ "${{ inputs.version }}" != "2021.5" ]] && [[ "$runner.os" != "macOS" ]]); then
21+
# check settings if mkl tests should be run
22+
# mkl cannot be installed for 2021.5 on macos;
23+
# and for macos-14 also not 2021.6-2021.9
24+
mkl_tests=true
25+
echo "$RUNNER_OS"
26+
if [[ "${{ inputs.compiler }}" =~ "gcc" ]]; then mkl_tests=false; fi
27+
if [[ "${{ inputs.compiler }}" =~ "lfortran" ]]; then mkl_tests=false; fi
28+
if [[ "${{ inputs.compiler }}" =~ "nvidia" ]]; then mkl_tests=false; fi
29+
if [[ "${{ inputs.install_mkl }}" == "false" ]]; then mkl_tests=false; fi
30+
if [[ "${{ inputs.version }}" == "2021.5" ]] && [[ "$RUNNER_OS" == "macOS" ]]; then mkl_tests=false; fi
31+
if [[ "$RUNNER_OS" == "macOS" ]]; then
32+
macos_version=$(sw_vers | grep "ProductVersion")
33+
echo "$macos_version"
34+
if [[ "$macos_version" =~ "14." ]] && [[ "${{ inputs.version }}" == '2021.6' || "${{ inputs.version }}" == '2021.7' || "${{ inputs.version }}" == '2021.7.1' || "${{ inputs.version }}" == '2021.8' ]]; then
35+
mkl_tests=false
36+
fi
37+
fi
38+
39+
# # now we know if we should, run the tests
40+
if $mkl_tests; then
2241
if [ "$RUNNER_OS" == "macOS" ]; then
23-
# required for macOS 11, intel-classic 2021.1-2021.10
24-
# required for macOS 12, intel-classic 2021.1, 2021.4, 2021.6, 2021.10
25-
# for all others, setting DYLD path through environment works correctly
26-
export DYLD_LIBRARY_PATH="${{ env.MKLLIB }}:$DYLD_LIBRARY_PATH"
42+
MKLLIB="$MKLROOT/lib"
43+
export DYLD_LIBRARY_PATH="$MKLLIB:$DYLD_LIBRARY_PATH"
44+
elif [ "$RUNNER_OS" == "Linux" ]; then
45+
MKLLIB="$MKLROOT/latest/lib/intel64"
46+
export LD_LIBRARY_PATH="$MKLLIB:$LD_LIBRARY_PATH"
2747
fi
28-
linking="-L${{ env.MKLLIB }} -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"
48+
linking="-L$MKLLIB -lmkl_intel_lp64 -lmkl_sequential -lmkl_core"
2949
# hello world with blas call program
3050
${{ env.FC }} $args $linking -o hw_mkl hw_mkl.f90
3151
output=$(./hw_mkl '2>&1')
3252
[[ "$output" == *"hello world 9.00000000000000"* ]] && echo "$output" || (echo "Unexpected Fortran program 'hw_mkl' output: $output"; exit 1)
3353
rm hw_mkl
54+
else
55+
echo "Skipping MKL tests"
3456
fi

.github/compat/long_compat.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,4 @@ windows-2022,intel,2024.0,✓
234234
windows-2022,intel,2024.1,✓
235235
windows-2022,lfortran,0.31.0,✓
236236
windows-2022,lfortran,0.32.0,✓
237-
windows-2022,lfortran,0.33.0,✓
237+
windows-2022,lfortran,0.33.0,✓

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ jobs:
8787
version: ${{ matrix.toolchain.version }}
8888

8989
- name: Test MKL libraries
90-
if: steps.setup-fortran.outcome == 'success' && runner.os != 'windows'
90+
# we could also exclude 2021.5 for all macos versions here
91+
# this needs refactoring at some point - should the install
92+
# fail if no mkl version exists?
93+
if: steps.setup-fortran.outcome == 'success' && runner.os != 'windows'
9194
uses: ./.github/actions/test-mkl
9295
with:
9396
compiler: ${{ matrix.toolchain.compiler }}

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ runs:
156156
echo FC=$FC>>$GITHUB_ENV
157157
echo CC=$CC>>$GITHUB_ENV
158158
echo CXX=$CXX>>$GITHUB_ENV
159+
echo "MKLLIB=$MKLLIB" >> $GITHUB_ENV
159160
160161
# set fpm env vars
161162
echo FPM_FC=$FC>>$GITHUB_ENV

install-intel-macos.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
install_mkl=$1
2+
MACOS_URL=$2
3+
if [ "$MACOS_URL" == "" ]; then
4+
echo "ERROR: MACOS URL is empty - please check the version mapping for mkl/intel compiler"
5+
echo "SKIPPING MKL/intel installation..."
6+
elif [ "$MACOS_URL" == "2021.5" ] and $install_mkl; then
7+
echo "ERROR: MKL not available for this intel compiler version"
8+
echo "SKIPPING MKL installation..."
9+
else
10+
require_fetch
11+
$fetch $MACOS_URL > m_BASE_HPC_Kit.dmg
12+
hdiutil verify m_BASE_HPC_Kit.dmg
13+
hdiutil attach m_BASE_HPC_Kit.dmg
14+
sudo /Volumes/"$(basename "$MACOS_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
15+
--action install \
16+
--eula=accept \
17+
--continue-with-optional-error=yes \
18+
--log-dir=.
19+
hdiutil detach /Volumes/"$(basename "$MACOS_URL" .dmg)" -quiet
20+
rm m_BASE_HPC_Kit.dmg
21+
fi

setup-fortran.sh

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH
156156
LIBRARY_PATH=$LIBRARY_PATH
157157
INFOPATH=$INFOPATH
158158
MANPATH=$MANPATH
159-
MKLLIB=$MKLLIB
160159
MKLROOT=$MKLROOT
161-
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
162160
ONEAPI_ROOT=$ONEAPI_ROOT
163161
CLASSPATH=$CLASSPATH
164162
CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
@@ -294,20 +292,39 @@ intel_version_map_m()
294292
mkl_version_map_m()
295293
{
296294
local intel_version=$1
297-
case $intel_version in
298-
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2022.2.0 | 2022.3.0 | 2022.3.1 | 2023.0.0 )
299-
mkl_version=2022.2.0
300-
;;
301-
2022.1.0)
302-
mkl_version=""
303-
;;
304-
2023.1.0)
305-
mkl_version=2023.1.0
306-
;;
307-
*)
308-
mkl_version=2023.2.0
309-
;;
310-
esac
295+
macos_version=$(sw_vers | grep "ProductVersion")
296+
echo "Found macos version $macos_version"
297+
if [[ "$macos_version" == *"14"* ]]; then
298+
echo "MacOS 14 requires different basekit versions to work"
299+
case $intel_version in
300+
# compiler versions 2021.1, 2021.2, 2021.3, 2021.4, 2021.10 work with latest basekit
301+
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2023.2.0)
302+
mkl_version=2023.2.0
303+
;;
304+
# compiler versions 2021.5, 2021.6, 2021.7, 2021.7.1, 2021.8, 2021.9 work with other basekits
305+
2023.1.0)
306+
mkl_version=2022.2.0
307+
;;
308+
*)
309+
mkl_version=""
310+
;;
311+
esac
312+
else
313+
case $intel_version in
314+
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2022.2.0 | 2022.3.0 | 2022.3.1 | 2023.0.0 )
315+
mkl_version=2022.2.0
316+
;;
317+
2022.1.0)
318+
mkl_version=""
319+
;;
320+
2023.1.0)
321+
mkl_version=2023.1.0
322+
;;
323+
*)
324+
mkl_version=2023.2.0
325+
;;
326+
esac
327+
fi
311328
}
312329

313330
intel_version_map_w()
@@ -482,36 +499,10 @@ install_intel_dmg()
482499
esac
483500

484501
if $install_mkl; then
485-
if [ "$MACOS_BASEKIT_URL" == "" ]; then
486-
echo "ERROR: MACOS_BASEKIT_URL is empty - please check the version mapping for MKL"
487-
echo "SKIPPING MKL installation..."
488-
else
489-
require_fetch
490-
$fetch $MACOS_BASEKIT_URL > m_BASEKit.dmg
491-
ls -lh
492-
hdiutil verify m_BASEKit.dmg
493-
hdiutil attach m_BASEKit.dmg
494-
sudo /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
495-
--action install \
496-
--eula=accept \
497-
--continue-with-optional-error=yes \
498-
--log-dir=.
499-
hdiutil detach /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)" -quiet
500-
rm m_BASEKit.dmg
501-
fi
502+
source "$GITHUB_ACTION_PATH/install-intel-macos.sh" true $MACOS_BASEKIT_URL
502503
fi
503504

504-
require_fetch
505-
$fetch $MACOS_HPCKIT_URL > m_HPCKit.dmg
506-
hdiutil verify m_HPCKit.dmg
507-
hdiutil attach m_HPCKit.dmg
508-
sudo /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
509-
--action install \
510-
--eula=accept \
511-
--continue-with-optional-error=yes \
512-
--log-dir=.
513-
hdiutil detach /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)" -quiet
514-
rm m_HPCKit.dmg
505+
source "$GITHUB_ACTION_PATH/install-intel-macos.sh" false $MACOS_HPCKIT_URL
515506

516507
source /opt/intel/oneapi/setvars.sh
517508
export_intel_vars
@@ -573,9 +564,11 @@ install_intel()
573564
local platform=$1
574565
local classic=$2
575566
local install_mkl=$3
567+
mkl_subdir=""
576568
case $platform in
577569
linux*)
578570
install_intel_apt $version $classic $install_mkl
571+
mkl_subdir="intel64"
579572
;;
580573
darwin*)
581574
install_intel_dmg $version $install_mkl
@@ -604,6 +597,11 @@ install_intel()
604597
export CC="icx"
605598
export CXX="icpx"
606599
fi
600+
601+
if $install_mkl; then
602+
export MKLLIB="$ONEAPI_ROOT/mkl/latest/lib/$mkl_subdir"
603+
export MKLROOT="$ONEAPI_ROOT/mkl/latest"
604+
fi
607605
}
608606

609607
export_nvidiahpc_vars()

0 commit comments

Comments
 (0)