Sunday, May 01, 2005

Matlab 7.0 and MultiThreading with Intel's MKL

So just the other day I was complaining that Matlab did not have multithreading support built into it. In my office I have a Dell Precision 650 system, a dual Xeon hyperthreaded system that shows 4 little CPU boxes in my task manager, and during a hefty Matlab sim, only one of those boxes shows any activity. Thus, despite all my computing power, a Matlab sim can only take advantage of 25% of my resources at BEST.

So I went searching, and I found out that Matlab 7 (R14) finally supports multithreading.

Multithreading Disabled in Intel Math Kernel Library (MKL) BLAS

All you need to do is set the OMP_NUM_THREADS environment variable to the number of processors on the system (in my case, I'd try 2 and 4 and compare performance).

I'm so excited! I can't wait to give it a shot.

However, I'm a little upset that I can't do my own multithreading within the script. If I'm willing to deal with the locking/semaphore issues, then I think I should be given the ability to parallelize my process a bit more. I guess I could always try starting another MATLAB instance on another processor (i.e., starting a second MATLAB at JUST the right instant that it gets scheduled onto another processor) but that's so GHETTO!

Anyway, I'm telling everyone, so I figured I'd post something here. Hopefully that can help some readers out (though I know most of the people who read this blog AND run simulations have unfortunately decided to use some other backwards package, like R or Maple or Mathematica, that clearly is inferior... but oh well...).

No comments: