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

Conversation

iulusoy
Copy link

@iulusoy iulusoy commented Mar 14, 2024

Add math library support with the new keyword install_mkl.

  • include mkl libraries for all intel compiler versions on linux
  • include mkl libraries for all ìntel-classic` versions on macOS EXCEPT version 2021.5
    • for some reason, installing the intel base-kit alongside the hpc-kit breaks the compiler set-up for version 2021.5
    • the exporting of DYLD_LIBRARY_PATH arbitrarily works on some runners and not on others, randomly fails for some version. If it is exported manually in the github action by setting it to $MKLLIB, the linking of the libraries works though. I could not test this much as the only macs I have for testing are the GitHub runners.

Initially I had wanted to only support linux. But then I tried to include mkl also for macOS - I consider this a starting point for future improvement. I am unfamiliar with windows, and the Fortran code I am working with has not been tested on Windows so far, so I did not include it.

Ideally, one would also want to install BLAS and LAPACK for the gnu compiler suite.

mpi support was also mentioned in #55

iulusoy and others added 12 commits September 13, 2023 14:09
* also install intel mkl libraries in apt

* trigger checks

* trigger checks
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* add version number to apt mkl install

* hpc basekit for macos
* info-on-mac

* set mkl version explicitly

* more debug on mac

* fix variable typo for linux mkl version

* only test on ubuntu

* matrix

* matrix

* fix version selection

* check both classic and new

* verify dmg

* check hpckit

* check hpckit

* restrict basekit versions

* pass install_mkl and test mkl

* set input in main action

* set input in main action

* set input in script

* fix typo

* change linker options

* source env

* export DYLD path for Mac

* include explicit library path in linker

* export mklroot in script

* export mklroot to GH env

* export mklroot to GH env

* export mklroot in script

* correct typo

* another typo

* debug env vars

* debug env vars

* debug env vars

* debug env vars

* debug env vars

* debug env vars

* debug env vars

* debug env vars

* typo and relative reference mklroot

* debug mklroot path

* debug mklroot path

* typo

* find include dir

* find include dir

* debug mac os dyld path

* check all ubuntu

* no mkl for gcc and nvidia-hpc

* mkl lates

* check compiler vars

* mkl dir for macos

* debug

* debug

* adapt test structure

* remove double testing

* conditional in bash

* conditional in bash

* conditional in bash

* conditional in bash

* typo

* pass missing variable

* test them all

* test them all

* check macos mkl path

* set full library path in script

* export DYLD in env

* test them all

* exclude mkl tests on windows

* exclude mkl tests on windows

* check for dyld

* rename mkllib in gh env

* shuffle version mapping for mac

* export DYLD in script

* shuffle mkl version numbers

* find installed mkl version

* try without mkl

* try without mkl

* find installed mkl version

* find installed mkl version

* shuffle mkl vs ifort version

* find mkl for 2021.5

* skip mkl for 2021.5 macos and remove double export of dyld

* less chatty, .5 exception

* last changes?

* test 2021.5 only

* test them all

* export dyld in action
* correct passsing of include_mkl in example

* don't source intel set vars

* run setvars, set MKLLIB
* feat: set FPM environment variables (fortran-lang#63)

* set FPM_FC/FPM_CC/FPM_CXX matching FC/CC/CXX
* consolidate env var assignment in setup script

* feat: support intel 2024.0 on linux and windows (fortran-lang#64)

* fix(mac/gcc): always create unversioned gcc/g++/gfortran links (fortran-lang#65)

* brew doesn't link gcc/g++ without version number like it does for gfortran
* this was causing default mac gcc/g++ to be discovered on PATH
* fix readme auto-update PR conditionals in reporting mode

* Update compatibility matrix (fortran-lang#66)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* ci: don't trigger when tags are pushed (fortran-lang#67)

* correct typo

* fix variable name

* pass cpp_name

* pass cpp_name

---------

Co-authored-by: wpbonelli <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
setup-fortran.sh Outdated Show resolved Hide resolved
setup-fortran.sh Outdated Show resolved Hide resolved
setup-fortran.sh Outdated Show resolved Hide resolved
@wpbonelli
Copy link
Contributor

wpbonelli commented Mar 16, 2024

thanks for this @iulusoy I think if we can also support windows, we might as well include mkl by default and not have a separate input? it might be tricky to find the oneAPI basekit links for older versions, it is unfortunate that mkl is not in the hpckit

@iulusoy
Copy link
Author

iulusoy commented Mar 18, 2024

Unfortunately I have no experience with windows, I can try but it will have to be in three-four weeks.

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
@iulusoy
Copy link
Author

iulusoy commented Mar 20, 2024

Incorporated the requested changes so far, could you please re-review @wpbonelli ?
Windows not incorporated yet.

install-mkl-macos.sh Outdated Show resolved Hide resolved
@@ -0,0 +1,13 @@
program hello
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good to include math ops in the test program. If we include mkl by default, we can just roll this into the existing fortran test program/action.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but that would also require installing BLAS/LAPACK for the gnu compilers - for now I would leave it separate, and make the optional math library install the default version once there is something for all compilers/OS.

action.yml Show resolved Hide resolved
@wpbonelli
Copy link
Contributor

thanks @iulusoy. I might take a shot at Windows if I have a chance in the meantime

@iulusoy
Copy link
Author

iulusoy commented Mar 27, 2024

Addressed the comments, imo the next steps would be (if math libraries are to be installed as default):

  • include mkl install for Windows
  • include BLAS/LAPACK install for gnu compilers: Linux, MacOS, Windows
    I would suggest doing those in separate PRs to minimize complexity.

@wpbonelli
Copy link
Contributor

wpbonelli commented Mar 27, 2024

@iulusoy yes, we'd also want to look at nvidia and lfortran too. Agreed on keeping PRs small. I think a lot of people use @main instead of the tags so I think it's best to wait for all platforms/toolchains before merging here. I made a math branch we can use for prototyping, if you want to move this PR over there?

@iulusoy iulusoy closed this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants