Matlab crushes when trying to run java code that contains function calls to JBLAS

1 visualización (últimos 30 días)
I have a Java code that uses JBLAS for matrix computations and in Java side everything runs fine. However for debugging purposes, visualization etc., I pack the java code to jar-file and run It from Matlab. Everything works fine until the program reaches code that uses JBLAS. First I get errors like "Intel MKL ERROR: Parameter 3 was incorrect on entry to DGEMM", but this does not yet crush Matlab. However when the code reaches a function call to JBLAS routine Solve.pinv() the Matlab crushes. In terminal I got message like
"# A fatal error has been detected by the Java Runtime Environment: # Internal Error (safepoint.cpp:687), pid=7302, tid=140358050563840 # fatal error: Deadlock in safepoint code. Should have called back to the VM before blocking. #"
In hs_error_xxx.log file I see traces from JBLAS pinv method to NativeBlas.dgelsd method. I think the problem may be related to dynamic linking of lapack-libraries, but not sure??
  1 comentario
Kirby Fears
Kirby Fears el 3 de Dic. de 2015
Focus on the original error: First I get errors like "Intel MKL ERROR: Parameter 3 was incorrect on entry to DGEMM"
Can you identify what Parameter 3 is? You may be passing a Matlab data type into Java which cannot be handled.

Iniciar sesión para comentar.

Respuesta aceptada

Rutuja Shirali
Rutuja Shirali el 7 de Dic. de 2015
Hi Vili,
MATLAB's BLAS and LAPACK libraries differ in one important way from many other BLAS/LAPACK libraries: we use 64-bit integers wherever the functions expect integers whereas most other implementations still use 32-bit integers (even on 64-bit systems). If your library which probably works with 32-bit integers then calls our BLAS/LAPACK implementations which expect to see 64-bit integers, MATLAB may very well crash.
Luckily MATLAB is also able to work with other BLAS/LAPACK implementations though, even ones which work with 32-bit integers. So what you could try to do to work around this issue, is make MATLAB use your system's BLAS and LAPACK implementations. To do so you would need to point the BLAS_VERSION and LAPACK_VERSION environment variables to those other implementations.And then start MATLAB from this same shell. Once inside MATLAB you can use:
version -lapack
And:
version -blas
To verify that MATLAB is indeed using a different implementation (i.e. these should no longer return "Intel® Math Kernel Library Version....").
Note, you always need to change both the LAPACK and BLAS implementation, changing only one of them will cause crashes in MATLAB when performing matrix and vector operations.
I hope this helps resolving the crash. If this was not the issue, please raise a help ticket with the MathWokrs Technical Support Department along with the crash dump to help understand the issue better.
-Rutuja
  1 comentario
Vili
Vili el 9 de Dic. de 2015
Thanks a lot for the answer. This was definitely the problem. However I was force to discard JBLAS anyways because it caused also other problems. I circumvented the problem by changing from JBLAS to EJML which is a pure java-based matrix library (code can be run from Matlab without problems). Your solution would have solve the original problem so I mark this as an accepted answer.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by