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

Compilation fails with Intel OneApi MKL 2024.1 #2441

Closed
kaiserls opened this issue May 13, 2024 · 2 comments · Fixed by #2443
Closed

Compilation fails with Intel OneApi MKL 2024.1 #2441

kaiserls opened this issue May 13, 2024 · 2 comments · Fixed by #2443
Assignees
Labels
cmake CMake related issue

Comments

@kaiserls
Copy link

kaiserls commented May 13, 2024

What did you expect to happen?
I expected the build script to find the includes and libraries to link, including the linking commands.

What has happened instead?

/usr/bin/ld: /home/lars/Git/AMICI/build/libamici.a(cblas.cpp.o): in function `amici::amici_dgemm(amici::BLASLayout, amici::BLASTranspose, amici::BLASTranspose, int, int, int, double, double const*, int, double const*, int, double, double*, int)':
/home/lars/Git/AMICI/src/cblas.cpp:27:(.text+0x5): undefined reference to `cblas_dgemm'
...

To Reproduce
Steps to reproduce the behavior

sudo apt install intel-oneapi-mkl-devel
source /opt/intel/oneapi/setvars.sh intel64`
./scripts/buildSuiteSparse.sh
./scripts/buildSundials.sh
./scripts/buildAmici.sh

AMICI version and system environment

  • OS and version: Ubuntu 24.04
  • AMICI interface: C++, but actually I want to build the amici Python Interface via pip install amici
  • AMICI version: master / v0.25.0 (tested on both)
  • Additional information: gcc (Ubuntu 13.2.0-23ubuntu4) 13.2.0, python 3.12, intel oneapi mkl (blas)
MKLROOT=/opt/intel/oneapi/mkl/2024.1
LIBRARY_PATH=/opt/intel/oneapi/tbb/2021.12/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mkl/2024.1/lib/:/opt/intel/oneapi/compiler/2024.1/lib
LD_LIBRARY_PATH=/opt/intel/oneapi/tbb/2021.12/env/../lib/intel64/gcc4.8:/opt/intel/oneapi/mkl/2024.1/lib:/opt/intel/oneapi/compiler/2024.1/opt/compiler/lib:/opt/intel/oneapi/compiler/2024.1/lib:/usr/local/cuda-12.4/lib64
CPATH=/opt/intel/oneapi/tbb/2021.12/env/../include:/opt/intel/oneapi/mkl/2024.1/include:/opt/intel/oneapi/mkl/2024.1/include:/opt/intel/oneapi/tbb/2021.12/env/../include:/opt/intel/oneapi/mkl/2024.1/include:

How to fix
Do you know how to resolve the problem?

find_package(MKL CONFIG REQUIRED PATHS $ENV{MKLROOT})
  target_link_libraries(BLAS INTERFACE
    mkl_scalapack_ilp64
    mkl_cdft_core
    mkl_intel_ilp64
    mkl_intel_thread
    mkl_core
    mkl_blacs_intelmpi_ilp64
    iomp5
  ) 

Can you submit a pull request?
I don't know enough about the amici library and the reasons for the design of the AmiciFindBLAS.cmake file to open a pull request. Maybe after some feedback, I could open one. I would try to rely more on find(BLAS ...) from CMake or find(MKL ...) from Intel. I would test it using docker containers.

@kaiserls kaiserls added the new Newly created label May 13, 2024
@dweindl dweindl self-assigned this May 14, 2024
dweindl added a commit to dweindl/AMICI that referenced this issue May 14, 2024
If MKLROOT is set (e.g., `source /opt/intel/oneapi/setvars.sh` will do that), first try FindBLAS instead of just relying on MKL_INCDIR and MKL_LIB.

Fixes AMICI-dev#2441.
@dweindl
Copy link
Member

dweindl commented May 14, 2024

Thanks for reporting @kaiserls .

#2443 should fix that.

Does pip3 install -e git+https://github.com/dweindl/amici.git@fix_mkl#egg=amici\&subdirectory=python/sdist work for you (after source /opt/intel/oneapi/setvars.sh)?

`

@dweindl dweindl linked a pull request May 14, 2024 that will close this issue
@dweindl dweindl added cmake CMake related issue and removed new Newly created labels May 14, 2024
@kaiserls
Copy link
Author

Yeah, that fixed it for me. Thank you for the fast help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake CMake related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants