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

include mkl libraries for intel compiler on linux and macOS #72

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
56f36a1
install intel mkl libraries in addition to the compiler (#1)
iulusoy Sep 13, 2023
adbf96a
Update action.yml
iulusoy Sep 13, 2023
f731ad7
Update compatibility matrix (#3)
github-actions[bot] Sep 14, 2023
687069d
Update compatibility matrix (#2)
github-actions[bot] Sep 14, 2023
81c4847
V0 (#4)
iulusoy Sep 14, 2023
3dacbb4
merge
iulusoy Feb 22, 2024
2b7dceb
Merge branch 'fortran-lang-main'
iulusoy Feb 22, 2024
646b405
fix failing macos tests (#6)
iulusoy Mar 7, 2024
d712ae0
Merge branch 'fortran-lang:main' into main
iulusoy Mar 7, 2024
3b77edb
Check usage of marketplace action (#7)
iulusoy Mar 11, 2024
281d495
Sync fork (#8)
iulusoy Mar 14, 2024
428a567
Merge branch 'main' into create-PR-and-sync
iulusoy Mar 14, 2024
0e8b621
removed source setvars and manipulation of DYLD_LIBRARY_PATH
iulusoy Mar 20, 2024
2e936a9
use macos install script for both dmgs, answer y in apt install for a…
iulusoy Mar 27, 2024
940e8cb
remove accidental duplication
iulusoy Mar 27, 2024
847d447
reverse order of passed variables in case string is empty
iulusoy Mar 27, 2024
c594266
remove pasted garbage in link
iulusoy Mar 27, 2024
dc2ccc7
rename macos install script
iulusoy Mar 27, 2024
0bcfd2f
try wo another export of MKLLIB in the action.yml
iulusoy Mar 27, 2024
2e74f55
Merge branch 'main' into create-PR-and-sync
iulusoy Mar 27, 2024
67c9148
export mkllib in test
iulusoy Mar 27, 2024
9a69df5
no latest when using MKLROOT for macos
iulusoy Mar 27, 2024
6894565
Merge branch 'main' into create-PR-and-sync
iulusoy Mar 27, 2024
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: 16 additions & 0 deletions .github/actions/test-fc/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ runs:
}
rm hw.exe

- name: Test compile Fortran (pwsh)
iulusoy marked this conversation as resolved.
Show resolved Hide resolved
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' }}
Expand Down
34 changes: 34 additions & 0 deletions .github/actions/test-mkl/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test mkl
description: Test installation of mkl libraries
inputs:
compiler:
description: "Toolchain or compiler to install"
required: true
version:
description: "Version of toolchain or compiler"
required: true
install_mkl:
description: "If MKL should be installed along with the compiler"
required: false
default: "false"
runs:
using: "composite"
steps:
- name: Test compile and link mkl (bash)
working-directory: test
shell: bash
run: |
if [[ "${{ inputs.compiler }}" =~ "intel" ]] && [[ "${{ inputs.install_mkl }}" == "true" ]] && ([[ "${{ inputs.version }}" != "2021.5" ]] && [[ "$runner.os" != "macOS" ]]); 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"
fi
linking="-L${{ env.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
fi
1 change: 1 addition & 0 deletions .github/compat/long_compat.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
runner,compiler,version,support
macos-13,intel-classic,2021.5,✓runner,compiler,version,support
iulusoy marked this conversation as resolved.
Show resolved Hide resolved
macos-11,gcc,10,✓
macos-11,gcc,11,✓
macos-11,gcc,12,✓
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
install_mkl: true

# - name: Debug with tmate
# uses: mxschmitt/action-tmate@v3
Expand All @@ -85,6 +86,14 @@ jobs:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}

- name: Test MKL libraries
if: steps.setup-fortran.outcome == 'success' && runner.os != 'windows'
uses: ./.github/actions/test-mkl
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
install_mkl: true

- name: Test C compiler
continue-on-error: true
if: needs.options.outputs.mode == 'report' && steps.setup-fortran.outcome == 'success'
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- {compiler: gcc, version: 13}
- {compiler: intel, version: '2023.2'}
- {compiler: intel-classic, version: '2021.10'}
- {compiler: intel-classic, version: '2021.10'}
- {compiler: nvidia-hpc, version: '23.11'}
include:
- os: ubuntu-latest
Expand All @@ -48,11 +49,13 @@ jobs:
toolchain: {compiler: nvidia-hpc, version: '23.11'}

steps:
- uses: fortran-lang/setup-fortran@v1
- uses: ssciwr/setup-fortran@v0.1
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
install_mkl: "true"


- run: |
${{ env.FC }} ... # environment vars FC, CC, and CXX are set
Expand All @@ -68,6 +71,7 @@ jobs:
- *intel-classic* (for `ifort`)
- *nvidia-hpc* (for `nvfortran`)
- *version*: Version of the compiler toolchain. See [runner compatibility](#runner-compatibility) charts below.
- *install_mkl*: If MKL libraries should be installed alongsider the intel compiler. Defaults to `false`.


## Outputs
Expand Down Expand Up @@ -116,6 +120,8 @@ Toolchain support varies across GitHub-hosted runner images.

**Note:** Intel's `ifx` compiler is not supported on macOS, so the `intel` option redirects to `intel-classic` (`ifort`).

**Note:** MKL libraries can only be installed for the Intel Fortran compiler, and only on linux and MacOS operating systems; with the exception of intel-classic 2021.5, for which no compatible library is available.

## License

Licensed under the Apache License, Version 2.0 (the “License”);
Expand Down
11 changes: 8 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Setup Fortran"
name: "Setup Fortran and libraries"
description: "Setup Fortran compiler and toolchain"
inputs:
compiler:
Expand All @@ -8,6 +8,10 @@ inputs:
version:
description: "Version of toolchain or compiler"
required: false
install_mkl:
description: "If MKL should be installed along with the compiler"
required: false
default: "false"
outputs:
fc:
description: "Path to Fortran compiler"
Expand Down Expand Up @@ -50,6 +54,7 @@ runs:
env:
COMPILER: ${{ inputs.compiler }}
VERSION: ${{ inputs.version }}
INSTALL_MKL: ${{ inputs.install_mkl }}
run: |
action_path=$(echo '/${{ github.action_path }}' | sed -e 's/\\/\//g' -e 's/://')
source "$action_path/setup-fortran.sh"
Expand All @@ -69,11 +74,11 @@ runs:
;;
intel-classic)
version=${VERSION:-2023.2.0}
install_intel $platform true
install_intel $platform true ${{ inputs.install_mkl }}
;;
intel)
version=${VERSION:-2024.0}
install_intel $platform false
install_intel $platform false ${{ inputs.install_mkl }}
;;
nvidia-hpc)
version=${VERSION:-23.11}
Expand Down
Loading
Loading