MATLAB on linux is usually pretty robust, despite the often minor rendering issues. This one is very insidious and has pretty far-reaching consequences.
I installed MATLAB R2014a today. Running a script that worked perfectly previously in R2011b gives me an error, which is traced to the builtin function “bar.m“, used to make bar plots. Everything is fine if the input is a one-dimensional vector. However, executing the example code for “bar graph of a 2D array”:
c = load('count.dat'); Y = c(1:6,:); figure; bar(Y);
gives a plot with a 1×1 blue block with the bottom-left corner at the origin, no matter how much you zoom out. No error was encountered, however.
Rebooting made this work again…magically. Continuing on with my work later, I ran into an “out of memory” error, which was not surprising as I was operating on a very large file. However, the results of using the bar command again regressed to the MATLAB blue block of death! After roughly 5 reboots, the problem persisted (no magic this time).
I then tried to use “hist” to make my plots. This time, I get the following error:
Error using *
BLAS loading error:
dlopen: cannot load any more object with static TLS
This might be behind my bar problem? Searching this error it led me to this stackoverflow post, which leads to this Mathworks workaround. The solution is to download a recompiled libiomp5.so, and replace that in the Matlab installation directory. With this work around, hist works, as well as bar.
The insidious thing is, while the official bug report presents this as a linear algebra operation error, its root is actually in the population of the “dynamic thread vector” (DTV), as explained in the stackoverflow post. It vaguely makes sense to me why it would effect the usage of “bars” without throwing errors. I’m fortunate to have tried histc and ran into the BLAS loading error.