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

Problem with finding lapack #515

Closed
Fabian188 opened this issue Sep 18, 2021 · 8 comments
Closed

Problem with finding lapack #515

Fabian188 opened this issue Sep 18, 2021 · 8 comments

Comments

@Fabian188
Copy link

Fabian188 commented Sep 18, 2021

We have an academic FE code and I want to update from a fairly old ipopt version to 3.14.2.
We have Intel MKL in our code and I build ipopt via cmake external project. This worked out of the box for newest macOS, current openSUSE tumbelweed and Ubunutu 20.04. However I have issues with some runner of our build-pipeline. Unfortunately I have no direct access to this build systems to do experiments.

From https://coin-or.github.io/Ipopt/INSTALL.html I use
configure --with-lapack-lflags="-L${MKL_LIB_DIR} -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm"
And I assert, that ${MKL_LIB_DIR}/libmkl_intel_lp64.a exists.

This is working Ubuntu 20.04

Intel MKL version 2019.0.2 detected
...
checking pkg-config is at least version 0.16.0... yes: 0.29.1
configure: pkg-config path is "/home/<user>/code/master/release/cfsdeps/ipopt/install/lib64/pkgconfig:"
checking for LAPACK... yes: generic module (lapack.pc blas.pc)

This is working macOS

Using Intel MKL version 2020.0.2
...
checking pkg-config is at least version 0.16.0... yes: 0.29.2
configure: pkg-config path is "/Users/<user>/code/master/release/cfsdeps/ipopt/install/lib64/pkgconfig:/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/bin/pkgconfig"
checking for LAPACK... yes: Intel MKL (-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm)

This is a working gitlab runner current openSUSE Leap

Using Intel MKL version 2019.0.2.
...
checking pkg-config is at least version 0.16.0... yes: 0.29.2
configure: pkg-config path is "/home/gitlab-runner/builds/MgcXMMX8/0/cfs/CFS/build/cfsdeps/ipopt/install/lib64/pkgconfig:"
checking for LAPACK... yes: generic library (-llapack -lblas)

This is a failed gitlab runner (centos6)

Using Intel MKL version 2019.0.1.
...
checking pkg-config is at least version 0.16.0... yes: 0.23
configure: pkg-config path is "/builds/cfs/CFS/build/cfsdeps/ipopt/install/lib64/pkgconfig:/opt/rh/rh-python36/root/usr/lib64/pkgconfig"
checking for LAPACK... no
configure: error: Required package LAPACK not found.

Another failed gitlab runner (fedora32)

Using Intel MKL version 2020.0.3.
...
checking pkgconf is at least version 0.16.0... yes: 1.6.3
configure: pkgconf path is "/builds/cfs/CFS/build/cfsdeps/ipopt/install/lib64/pkgconfig:"
checking for LAPACK... no
configure: error: Required package LAPACK not found.

It works also for centos7 with intel compiler and openSUSE tumbleweed.

I have no idea, how it is searched for lapack, strange is, that the results for the given working examples are completely different, whereas I assumend the command line simply tells to use mkl.

checking for LAPACK... yes: generic module (lapack.pc blas.pc)
checking for LAPACK... yes: Intel MKL (-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm)
checking for LAPACK... yes: generic library (-llapack -lblas)

[Edit:] I just realized, that only the variants checking for LAPACK... yes: Intel MKL (-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm) work at runtime and find pardiso_.

How to enforce that mkl is used and found?

Do you have any idea? Thanks a lot.

@svigerske
Copy link
Member

Try adding also --with-lapack. There is a bug that has been fixed in the current branch, but not released yet.

The one where MKL was actually used is the one where MKL is available in the library search path, so configure can find it automatically.

@Fabian188
Copy link
Author

Fabian188 commented Sep 18, 2021

Thanks for your reply!

I tried with a tailing --with-lapack and --with-lapack=yes and got the error

checking for LAPACK... configure: error: Cannot link to user-specified Lapack "-L/opt/intel/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm".

I guess, the new release is not planned within the next days? :)

You mean LD_LIBRARY_PATH? I could set it to /opt/intel/mkl/lib/intel64 as first entry before configure.
[EDIT: I tried to set it (not perfectly sure, if it worked out of cmake) but had no success.

Or is there an as zip downloadable commit I can use instead?

Thanks!

@Fabian188
Copy link
Author

I guess the issue with --with-lapack is, that there is something like a
test -z "$with_lapack_lflags" but I set according to the instructions
--with-lapack-lflags="-L${MKL_LIB_DIR} -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm"
Unfortunately I have a very low understanding from how configure works, as I usually use cmake.

@Fabian188
Copy link
Author

The variable seems to be LIBRARY_PATH (I only knew LD_LIBRARY_PATH).
On the ubuntu 20.04 I sourced mklvars.sh and configure worked. Then I unset more and more variables up to I found LIBRARY_PATH and adding it manually in cmake as
CONFIGURE_COMMAND env "LIBRARY_PATH=${MKL_LIB_DIR}" ${IPOPT_SOURCE}/configure --with-lapack-lflags=....
seems to work.

@svigerske
Copy link
Member

Thanks for your reply!

I tried with a tailing --with-lapack and --with-lapack=yes and got the error

checking for LAPACK... configure: error: Cannot link to user-specified Lapack "-L/opt/intel/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm".

That one means that something is wrong with these flags.
The config.log file should give more details on why the link-check failed.

I guess, the new release is not planned within the next days? :)

You mean LD_LIBRARY_PATH? I could set it to /opt/intel/mkl/lib/intel64 as first entry before configure.
[EDIT: I tried to set it (not perfectly sure, if it worked out of cmake) but had no success.

I meant the path where the compiler/linker is looking for libraries.
https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html mentions LIBRARY_PATH.

Or is there an as zip downloadable commit I can use instead?

Current stable branch: https://github.com/coin-or/Ipopt/archive/refs/heads/stable/3.14.zip

@Fabian188
Copy link
Author

@svigerske Thanks a lot! By your hint I found a good workaround and learned something new about LIBRARY_PATH.

From my point of view this issue could be closed?!

svigerske added a commit that referenced this issue Sep 20, 2021
- add ref to #515
svigerske added a commit that referenced this issue Sep 20, 2021
- set release date
- improve date
- add ref to #515
svigerske added a commit that referenced this issue Sep 20, 2021
- set release date
- improve date
- add ref to #515
@felixcrazzolara
Copy link

This issue shouldn't have been closed, since it's not resolved. I just had the same issue as well. The problem is that the configure script has a bug and passes "-L/opt/intel/mkl/lib/intel64 -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lm" with the quotes.

@svigerske
Copy link
Member

Can you be more specific where in configure it passes something with quotes? How do you call configure exactly and where do the wrong quotes appear?

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

No branches or pull requests

3 participants