Skip to content

Commit 44e8930

Browse files
authored
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 e775f91 commit 44e8930

File tree

7 files changed

+99
-70
lines changed

7 files changed

+99
-70
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
@@ -237,4 +237,4 @@ windows-2022,intel,2023.2,✓
237237
windows-2022,intel,2024.0,✓
238238
windows-2022,lfortran,0.31.0,✓
239239
windows-2022,lfortran,0.32.0,✓
240-
windows-2022,lfortran,0.33.0,✓
240+
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
@@ -145,6 +145,7 @@ runs:
145145
echo FC=$FC>>$GITHUB_ENV
146146
echo CC=$CC>>$GITHUB_ENV
147147
echo CXX=$CXX>>$GITHUB_ENV
148+
echo "MKLLIB=$MKLLIB" >> $GITHUB_ENV
148149
149150
# set fpm env vars
150151
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: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH
171171
LIBRARY_PATH=$LIBRARY_PATH
172172
INFOPATH=$INFOPATH
173173
MANPATH=$MANPATH
174-
MKLLIB=$MKLLIB
175174
MKLROOT=$MKLROOT
176-
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
177175
ONEAPI_ROOT=$ONEAPI_ROOT
178176
CLASSPATH=$CLASSPATH
179177
CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH
@@ -297,20 +295,39 @@ intel_version_map_m()
297295
mkl_version_map_m()
298296
{
299297
local intel_version=$1
300-
case $intel_version in
301-
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2022.2.0 | 2022.3.0 | 2022.3.1 | 2023.0.0 )
302-
mkl_version=2022.2.0
303-
;;
304-
2022.1.0)
305-
mkl_version=""
306-
;;
307-
2023.1.0)
308-
mkl_version=2023.1.0
309-
;;
310-
*)
311-
mkl_version=2023.2.0
312-
;;
313-
esac
298+
macos_version=$(sw_vers | grep "ProductVersion")
299+
echo "Found macos version $macos_version"
300+
if [[ "$macos_version" == *"14"* ]]; then
301+
echo "MacOS 14 requires different basekit versions to work"
302+
case $intel_version in
303+
# compiler versions 2021.1, 2021.2, 2021.3, 2021.4, 2021.10 work with latest basekit
304+
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2023.2.0)
305+
mkl_version=2023.2.0
306+
;;
307+
# compiler versions 2021.5, 2021.6, 2021.7, 2021.7.1, 2021.8, 2021.9 work with other basekits
308+
2023.1.0)
309+
mkl_version=2022.2.0
310+
;;
311+
*)
312+
mkl_version=""
313+
;;
314+
esac
315+
else
316+
case $intel_version in
317+
2021.1.0 | 2021.2.0 | 2021.3.0 | 2021.4.0 | 2022.2.0 | 2022.3.0 | 2022.3.1 | 2023.0.0 )
318+
mkl_version=2022.2.0
319+
;;
320+
2022.1.0)
321+
mkl_version=""
322+
;;
323+
2023.1.0)
324+
mkl_version=2023.1.0
325+
;;
326+
*)
327+
mkl_version=2023.2.0
328+
;;
329+
esac
330+
fi
314331
}
315332

316333
intel_version_map_w()
@@ -388,11 +405,11 @@ install_intel_apt()
388405
esac
389406

390407
if $install_mkl; then
391-
sudo apt-get install \
408+
sudo apt-get install -y \
392409
intel-oneapi-compiler-{fortran,"$cpp_name"}-$version \
393410
intel-oneapi-mkl-$mkl_version
394411
else
395-
sudo apt-get install \
412+
sudo apt-get install -y \
396413
intel-oneapi-compiler-{fortran,"$cpp_name"}-$version
397414
fi
398415

@@ -465,36 +482,10 @@ install_intel_dmg()
465482
esac
466483

467484
if $install_mkl; then
468-
if [ "$MACOS_BASEKIT_URL" == "" ]; then
469-
echo "ERROR: MACOS_BASEKIT_URL is empty - please check the version mapping for MKL"
470-
echo "SKIPPING MKL installation..."
471-
else
472-
require_fetch
473-
$fetch $MACOS_BASEKIT_URL > m_BASEKit.dmg
474-
ls -lh
475-
hdiutil verify m_BASEKit.dmg
476-
hdiutil attach m_BASEKit.dmg
477-
sudo /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
478-
--action install \
479-
--eula=accept \
480-
--continue-with-optional-error=yes \
481-
--log-dir=.
482-
hdiutil detach /Volumes/"$(basename "$MACOS_BASEKIT_URL" .dmg)" -quiet
483-
rm m_BASEKit.dmg
484-
fi
485+
source "$GITHUB_ACTION_PATH/install-intel-macos.sh" true $MACOS_BASEKIT_URL
485486
fi
486487

487-
require_fetch
488-
$fetch $MACOS_HPCKIT_URL > m_HPCKit.dmg
489-
hdiutil verify m_HPCKit.dmg
490-
hdiutil attach m_HPCKit.dmg
491-
sudo /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s \
492-
--action install \
493-
--eula=accept \
494-
--continue-with-optional-error=yes \
495-
--log-dir=.
496-
hdiutil detach /Volumes/"$(basename "$MACOS_HPCKIT_URL" .dmg)" -quiet
497-
rm m_HPCKit.dmg
488+
source "$GITHUB_ACTION_PATH/install-intel-macos.sh" false $MACOS_HPCKIT_URL
498489

499490
source /opt/intel/oneapi/setvars.sh
500491
export_intel_vars
@@ -552,9 +543,11 @@ install_intel()
552543
local platform=$1
553544
local classic=$2
554545
local install_mkl=$3
546+
mkl_subdir=""
555547
case $platform in
556548
linux*)
557549
install_intel_apt $version $classic $install_mkl
550+
mkl_subdir="intel64"
558551
;;
559552
darwin*)
560553
install_intel_dmg $version $install_mkl
@@ -583,6 +576,11 @@ install_intel()
583576
export CC="icx"
584577
export CXX="icpx"
585578
fi
579+
580+
if $install_mkl; then
581+
export MKLLIB="$ONEAPI_ROOT/mkl/latest/lib/$mkl_subdir"
582+
export MKLROOT="$ONEAPI_ROOT/mkl/latest"
583+
fi
586584
}
587585

588586
export_nvidiahpc_vars()

0 commit comments

Comments
 (0)