easybuild-easyblocks icon indicating copy to clipboard operation
easybuild-easyblocks copied to clipboard

imkl pkgconfig files don't work (but can be fixed!)

Open SimonPinches opened this issue 3 years ago • 2 comments
trafficstars

The pkgconfig/*.pc files created by the imkl module reference the $MKLROOT environment variable which is not usable within *.pc files. The solution I adopted was to add a line MKLROOT=${prefix} after the definition of includedir by doing: sed -i '/^includedir=.*/a MKLROOT=${prefix}' /opt/EasyBuild/software/imkl/*/mkl/bin/pkgconfig/*

SimonPinches avatar Mar 24 '22 13:03 SimonPinches

@bartoldeman I thought I remember seeing discussion on this but I can't find it now, is this resolved?

ocaisa avatar Apr 12 '22 07:04 ocaisa

Ah, I found it https://easybuild.slack.com/archives/C34UA1HT7/p1648065346517729 . For completeness I copy the relevant parts of that discussion here


Looks like ${MKLROOT} should be $MKLROOT

cp /work/imas/opt/EasyBuild/software/imkl/2020.4.304-iompi-2020b/mkl/bin/pkgconfig/mkl-static-lp64-seq.pc test.pc
cp test.pc test2.pc; vim test2.pc # change ${MKLROOT} to $MKLROOT

(module load imkl > /dev/null 2>&1; diff test.pc test2.pc; export PKG_CONFIG_PATH=$(pwd); pkg-config test --libs; pkg-config test2 --libs)
26c26
< Libs: -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
---
> Libs: -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_sequential.a $MKLROOT/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
28c28
< Cflags: -I${MKLROOT}/include
---
> Cflags: -I$MKLROOT/include
-Wl,--start-group /lib/intel64/libmkl_intel_lp64.a /lib/intel64/libmkl_sequential.a /lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl 
-Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_sequential.a $MKLROOT/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl 

Are these .pc files coming directly from Intel, or are they made/patched by EB ?

they come directly from Intel
basically they can be patched by replacing MKLROOT by prefix (https://www.intel.com/content/www/us/en/developer/articles/technical/intel-math-kernel-library-intel-mkl-and-pkg-config-tool.html)
or you can set
PKG_CONFIG_MKL_STATIC_LP64_SEQ_MKLROOT=$MKLROOT

IntelIntel
[Intel® Math Kernel Library (Intel® MKL) and pkg-config tool](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-math-kernel-library-intel-mkl-and-pkg-config-tool.html)
    The pkg-config tool[1] is a widely used tool that many users apply to their makefiles. Intel® Math Kernel Library (Intel® (5 kB)
https://www.intel.com/content/www/us/en/developer/articles/technical/intel-math-kernel-library-intel-mkl-and-pkg-config-tool.html[](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-math-kernel-library-intel-mkl-and-pkg-config-tool.html)


it seems though that imkl 2021.4.0 (2021b toolchain) does it correctly. (edited) 

but the EB module for imkl 2021.4.0 doesn't set PKG_CONFIG_PATH since it moved again :disappointed:

https://github.com/easybuilders/easybuild-easyblocks/pull/2701 applies to 2021.4+

ocaisa avatar Apr 12 '22 07:04 ocaisa