I am using JNI to run a torch function which seems to be using MKL. Note, that I am not using MKL myself but torch does. However, I seem to have trouble with the linking of MKL so I figured someone in here might be able to help me out.
I have created a minimal working example and minimal non working example which can be found here:
https://github.com/jparsert/MinExample
The following error message is what I get:
INTEL MKL ERROR: /opt/intel/mkl/lib/intel64/libmkl_vml_avx2.so: undefined symbol: mkl_lapack_dspevd.
Intel MKL FATAL ERROR: cannot load libmkl_vml_avx2.so or libmkl_vml_def.so.
The Readme goes into a bit of detail and shows how to reproduce the problem. Anyways the core points being:
1. Everything seems to work fine (compilation and runnning) as long as I stay completely in C++ this is the workingExampleWithoutJNI in the above link.
2. When I invoke a native function from java that does simple Torch things that do not require mkl everything also works.
3. When I invoke a native function from java that uses a torch function that depends on an MKL function (so it seems) I get an INTEL MKL ERROR … undefined symbol: mkl_lapack_dspevd
So basically, when running a native function from JNI the mkl/lapack library seems to not be loaded properly, while when running it with CPP it seems to work.
I see how this may be more of a JNI problem than a MKL problem but maybe someone has a guess where I may be making a mistake.