[Rd] hand compile; link to MKL fails at BLAS zdotu
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Sat Mar 30 19:28:30 CET 2024
В Sat, 30 Mar 2024 20:31:25 +0300
Ivan Krylov via R-devel <r-devel using r-project.org> пишет:
> It seems to crash inside MKL!
Should have read some more about mkl_gf_lp64 before posting. According
to the Intel forums, it is indeed required in order to work with the
GFortran calling convention, but if you're linking against it, you also
have to add the rest of the linker command line, i.e.:
-lmkl_gf_lp64 -lmkl_core -lmkl_sequential
-Wl,--no-as-needed -lpthread -lm -ldl
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/ARPACK-with-MKL-crashes-when-calling-zdotc/m-p/1054316
Maybe it's even documented somewhere, but Intel makes it too annoying
to read their documentation, and they definitely don't mention it in
the link line advisor. There's also the ominous comment saying that
>> you cannot call standard BLAS [c,z]dot[c,u] functions from C/C++
>> because the interface library that is linked is specific for
>> GFortran which has a different calling convention of returning a
>> Complex type and would cause issues
I'm not seeing any calls to [c,z]dot[c,u] from inside R's C code (which
is why R seems to work when running with libmkl_rt.so), and the
respective declarations in R_ext/BLAS.h have an appropriate warning:
>> WARNING! The next two return a value that may not be compatible
>> between C and Fortran, and even if it is, this might not be the
>> right translation to C.
...so it's likely that everything will keep working.
Indeed, R configured with
--with-blas='-lmkl_gf_lp64 -lmkl_core -lmkl_sequential'
--with-lapack='-lmkl_gf_lp64 -lmkl_core -lmkl_sequential'
seems to work with MKL.
--
Best regards,
Ivan
More information about the R-devel
mailing list