Matrix multiply crashes Matlab 2014a on a AMD A6-1450 APU, under either Windows 8.1 64-bit or Linux 64-bit

10 views (last 30 days)
Attempting to run the following function in Matlab 2014a 64-bit under Windows 8.1 64-bit crashes Matlab (the crash has occurred on all 5 attempts):
function matrix_multiply_crashes_matlab
weights = rand([8 5]);
samples = rand([1024 8]);
output = samples * weights;
end
From stepping in the debugger, the crash happens in the matrix multiply. After the crash Matlab doesn't appear to report a stack dump, I just get a Windows "MATLAB (R2014a) has stopped working dialogue:
Running the same function in Matlab 2014a 64-bit under Linux 64-bit (CentOS 6.5) doesn't cause Matlab to crash.
  3 Comments
James Tursa
James Tursa on 30 Jun 2014
Have you replaced the MATLAB supplied BLAS/LAPACK library with a different one? E.g., did MATLAB come with one library (not MKL), but you are using an MKL library instead?
Chester Gillon
Chester Gillon on 30 Jun 2014
I have edited the title of the question as on further investigation the crash is related to the processor type rather than the Windows version of Matlab 2014a since:
a) The matrix multiply worked in Matlab 2014a 64-bit under Linux 64-bit on a dual AMD Operton 250 system.
b) The matrix multiply crashed in Matlab 2014a 64-bit under Windows 64-bit on a quad-core AMD A6-1450 APU system (Acer Aspire V5-122P)
c) The matrix multipl y crashed in Matlab 2014a 64-bit under Linux 64-bit on the same quad-core AMD A6-1450 APU system which crashed under Windows. The Matlab crash dumps are attached. The Linux version looks to be crashing inside a MKL function, as was the Windows version of Matlab 2014a.
In all these installations I haven't replaced Matlab supplied BLAS/LAPACK libraries with different ones.

Sign in to comment.

Accepted Answer

Chester Gillon
Chester Gillon on 13 Jul 2014
On further investigation:
1) The MATLAB crash was occurring inside the Intel Math Kernel library version 11.0.5 used by MATLAB 2014a.
2) Creating a standalone C test program for the cblas_dgemm function in the Intel Math Kernel library version 11.0.5 crashed with an illegal instruction on the AMD A6-1450 APU based machine in the same way as MATLAB 2014a crashed when the matrix multiply was used.
3) While setting the environment variable MKL_CBWR=AVX prevented the Intel Math Kernel library from crashing. However, when the cblas_dgemm test program was run under the opcodemix example from the Intel PIN tool ( https://software.intel.com/en-us/articles/pin-a-dynamic-binary-instrumentation-tool ) no AVX instructions were reported as being executed - see the attached opcodemix_MKL_CBWR-AVX.txt
4) As another workaround found that setting the environment variable MKL_DEBUG_CPU_TYPE=4 prevented the crashed and caused AVX instructions to be used by the Intel Math Kernel library - see the attached opcodemix_MKL_DEBUG_CPU_TYPE-4.txt
The conclusion in that the crash is due to the Intel Math Kernel library used by MATLAB 2014a, rather than code which MathWorks have written.
  3 Comments
Julianna Ianni
Julianna Ianni on 28 Sep 2015
Edited: Julianna Ianni on 28 Sep 2015
Thanks! I had the same problem with R2015b and an AMD A8-6410 on Windows 8 and setting MKL_DEBUG_CPU_TYPE=4 seems to work.
Ammar Dabaan
Ammar Dabaan on 13 Jun 2022
Thanks! i got here a lenovo legion 5 with amd 4600h ryzen 5 cpu, and i've been having craches messages all over the place with matlab 2015a, and setting the mkl environment variable, they are gone.
Thanks again, you saved my day!

Sign in to comment.

More Answers (4)

Star Strider
Star Strider on 29 Jun 2014
I ran your statements in R2014a, Windows 8 64 and it executed without problems.
Since I can’t reproduce your error, perhaps the memory function can provide a clue.
  2 Comments
Chester Gillon
Chester Gillon on 29 Jun 2014
The memory function reported the following after starting Matlab, and prior to executing the function which caused the crash:
>> memory
Maximum possible array: 2043 MB (2.142e+09 bytes) *
Memory available for all arrays: 2043 MB (2.142e+09 bytes) *
Memory used by MATLAB: 689 MB (7.225e+08 bytes)
Physical Memory (RAM): 3525 MB (3.696e+09 bytes)
* Limited by System Memory (physical + swap file) available.
The crash looks to be happening inside a thread created by mkl.dll, which I think is the Intel Math Kernel Library. The crash is occurring on a 4-core AMD A6-1450 APU machine. From a brief investigation the MKL can take different code paths depending upon the processor instruction set architecture (ISA), so maybe the crash is dependent upon the ISA in use.
Star Strider
Star Strider on 29 Jun 2014
I have a -year old HP AMD A10 Vision Dual Graphics Enabled machine. I had to look up the Intel Math Kernel Library because I’d heard (on gaming sites - guilty pleasure) that it doesn’t always work and play well with non-Intel machines (see ‘Criticisms’ on that link).
This Answer: AMD vs Intel (MKL.DLL vs ACML.DLL) and BLAS.SPEC help might also shed some light on the problem.
That said, I’m not certain how to advise you to proceed. I have no idea what the differences might be between your machine and mine. (It’s obvious that memory is not the problem.) It would likely be worthwhile to search the AMD FORUMS to see if that provides the information you need. (While you’re there, check to be sure you have the latest drivers.) If it doesn’t, contact AMD Tech Support to see what help they can offer. The AMD library is free, but I have no idea how to configure it so that your processor and C++ compilers automatically implement it rather than the Intel version.
I’ll help as I can, but in the interim, I can only wish you good luck!

Sign in to comment.


Image Analyst
Image Analyst on 29 Jun 2014
  2 Comments
Chester Gillon
Chester Gillon on 29 Jun 2014
Thanks for that link. That FAQ says Matlab crashs should be reported directly to Mathworks.
However, I have a home license and https://www.mathworks.co.uk/store/link/faq#home says:
_Q. Is technical support available for the MATLAB Home license?
A. No. Please refer to MATLAB Answers for your technical questions._
Is MATLAB Answers the correct place to report crashes for those with a home license?
Image Analyst
Image Analyst on 29 Jun 2014
I would think that not being able to run basic simple MATLAB code without crashing is an installation problem and they would offer free help. Student editions don't get free help either but if they can't even run the program they can get free help. I would try on Monday to call them. There are hundreds of reasons why MATLAB could crash and answers folks don't know all of them or have the resources to fix them for you like the Mathworks does.
By the way, the code runs for me on Windows 7 just fine.

Sign in to comment.


Chester Gillon
Chester Gillon on 30 Jun 2014
I used Visual Studio to attach to Matlab, and then run the matrix multiply example on the 4-core AMD A6-1450 APU based machine which caused Matlab 2014a to crash.
The Visual Studio debugger reported an Illegal Instruction exception on the following from inside the mkl.dll file:
00000000AD7E2162 vfmaddpd ymm0,ymm13,ymm12,ymm0
vfmaddpd is a FMA4 fused multiply–add instruction - see http://en.wikipedia.org/wiki/FMA_instruction_set#Excerpt_from_FMA4
According to http://www.cpu-world.com/CPUs/Jaguar/AMD-A6-Series%20A6-1450.html the AMD A6-1450 APU doesn't support FMA4 instructions. Therefore, it looks to be a problem in the mkl.dll shipped with Matlab 2014a which attempts to execute a non-existent FMA4 instruction on an AMD A6-1450.
  2 Comments
Chester Gillon
Chester Gillon on 30 Jun 2014
As a work-around found that setting the environment variable MKL_CBWR=AVX before starting Matlab prevented the Matlab 2014a crash on both Windows 64-bit and Linux 64-bit on the AMD A6-1450. Where the MKL_CBWR environment variable controls the MKL code branch as per https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_userguide_lnx/GUID-DCB010F6-DDBF-4A00-8BB3-049BEFDC2ED2.htm
I have now raised support case 01017131. Thanks to the others for showing that the matrix multiply didn't crash on their systems.

Sign in to comment.


Walter Roberson
Walter Roberson on 12 Nov 2016
A bug report was created. The situation affected AMD Jaguar CPU.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!