Matlab crashing due to covariance command

I am attempting to compute the covariance matrix of a 200x644 matrix as part of PCA analysis. I know the code works as it runs on the main computers within the university but the cov() command appears to keep crashing my laptop.
I'm assuming this is a result of my laptop's performance not being as good as the main PC, but I'm not sure what part (e.g. lack of RAM) is likely to be the issue.
Can anyone suggest a possible cause?

3 Commenti

Can you share the crash dump?
Hi Andreas, how do I do that?
Hi Andreas,
This is the crash dump, not sure how much you wanted but this is about a third of it:
Illegal instruction detected at Tue Feb 03 20:24:11 2015
------------------------------------------------------------------------
Configuration: Crash Decoding : Disabled Default Encoding : windows-1252 Graphics card 1 : Advanced Micro Devices, Inc. ( 0x1002 ) AMD Radeon HD 8400 Version 13.152.1.1400 MATLAB Architecture: win64 MATLAB Root : C:\Program Files\MATLAB\R2014b MATLAB Version : 8.4.0.150421 (R2014b) Operating System : Microsoft Windows 8.1 Processor ID : x86 Family 127 Model 0 Stepping 1, AuthenticAMD Software OpenGL : 0 Virtual Machine : Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot™ 64-Bit Server VM mixed mode Window System : Version 6.3 (Build 9600)
Fault Count: 3
Abnormal termination: Illegal instruction
Register State (from fault): RAX = 000000007c3e7000 RBX = 000000007c3ff000 RCX = 000000007d0ff470 RDX = 000000007d0ff8b0 RSP = 000000007d0ff280 RBP = 00000000040335f0 RSI = 00000000040335d8 RDI = 000000000f79e0c0
R8 = 0000000000001900 R9 = 000000007c3ff000
R10 = 0000000000000c00 R11 = 0000000000000400
R12 = 00000000000000c8 R13 = 0000000000000030
R14 = 0000000000000030 R15 = 00000000000000c8
RIP = 000000000e5ea342 EFL = 00010216
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault): [ 0] 0x000000000e5ea342 C:\Program Files\MATLAB\R2014b\bin\win64\mkl.dll+26387266 xerbla+23942290 [ 1] 0x000000000db639ea C:\Program Files\MATLAB\R2014b\bin\win64\mkl.dll+15350250 xerbla+12905274 [ 2] 0x000000000db51ec1 C:\Program Files\MATLAB\R2014b\bin\win64\mkl.dll+15277761 xerbla+12832785 [ 3] 0x000000000dbdafc4 C:\Program Files\MATLAB\R2014b\bin\win64\mkl.dll+15839172 xerbla+13394196 [ 4] 0x000000000cdff16c C:\Program Files\MATLAB\R2014b\bin\win64\mkl.dll+01306988 mkl_cbwr_set+00936236 [ 5] 0x0000000007c0fb2c C:\Program Files\MATLAB\R2014b\bin\win64\libiomp5md.dll+00654124 _kmp_invoke_microtask+00000140 [ 6] 0x0000000007be0c3a C:\Program Files\MATLAB\R2014b\bin\win64\libiomp5md.dll+00461882 _kmp_release+00015930 [ 7] 0x0000000007bde0ca C:\Program Files\MATLAB\R2014b\bin\win64\libiomp5md.dll+00450762 _kmp_release+00004810 [ 8] 0x0000000007c10b47 C:\Program Files\MATLAB\R2014b\bin\win64\libiomp5md.dll+00658247 _kmp_launch_worker+00000423 [ 9] 0x00007ff8c3c716ad C:\windows\system32\KERNEL32.DLL+00005805 BaseThreadInitThunk+00000013 [ 10] 0x00007ff8c6214409 C:\windows\SYSTEM32\ntdll.dll+00345097 RtlUserThreadStart+00000029

Accedi per commentare.

Risposte (2)

John D'Errico
John D'Errico il 3 Feb 2015
Modificato: John D'Errico il 3 Feb 2015
I think it is more important that we are told...
What version of MATLAB are you running? What does this tell you:
ver
Are you merely trying to execute cov(X), where x is a 200x644 matrix? Or are you doing something slightly different that would cause cov to try to create a matrix of size (128800x128800)? Note that 128800=200*644.
Do you have something called cov defined? What does MATLAB tell you when you type
which cov -all
The answers to these questions would lead me to conclude various possibilities as the answer.
1. You have insufficient RAM. Older MATLAB releases that do not work in 64 bits will fail here often. This is not a big problem, but for a machine with little RAM and an old release that cannot use virtual memory, hey, there are limits. And if you have defined other moderately large variables, then it just runs out of room.
2. You have some other function called cov which you have created. Since you may have done anything here, I cannot say how it might be causing a problem. But overloading existing MATLAB functions will surely cause problems, and MANY people do this accidentally, at least at first.
3. Your system is having "issues", probably in the form of a corrupted disk.
4. MATLAB was improperly installed, in some unknown and random way.
So it is likely one of the above possibilities. I've listed them in decreasing order of probability, from my point of view.

3 Commenti

Hi John,
I'm running the latest version of MatLab on Windows 8 (64-bit).
I have not previously defined anything as cov() and it is X that is a 200x644 matrix. My laptop as 8GB of RAM, which I thought would be sufficient. Is it likely to need more?
I know the version is uploaded correctly as I have used it previously for other programs, it just seems to happen with cov() on this program.
Thanks for responding,
Carl
Ok, so a non-64 bit release is out of the question. And I'm feeling mentally lazy right now, so I let MATLAB do this next step for me. :)
A = cov(rand(200,644));
whos A
Name Size Bytes Class Attributes
A 644x644 3317888 double
So the covariance matrix would take up only 3 megabytes, a tiny thing really.
If MATLAB is actually crashing, as opposed to running a long time and heavily swapping to disk... Well actually the latter case is not an issue, since again, this matrix is literally tiny by today's standards. And you did say crash after all.
So while more RAM is never a bad thing, I doubt it is an issue. You might try a pack command, or checking the available memory, but I think that is simply not the issue here.
I don't know enough about Windoze to know where the crash dump will live. But I expect the file name will be something roughly like
matlab_crash_dump.259-1
At least that is how it appears on my Mac.
Hi John,
I've pasted a section of the crash dump above in response to Andreas.
As a test, I ran the cov() command on a 2x2 matrix and it worked so it is definitely not the command.
Thanks,
Carl

Accedi per commentare.

Andreas Goser
Andreas Goser il 5 Feb 2015
My first guess is this bug report. Please try the work around and feed back.

Richiesto:

il 3 Feb 2015

Risposto:

il 5 Feb 2015

Community Treasure Hunt

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

Start Hunting!

Translated by