matlab hangs while loading libacml_mp.so

I am running Linux on a machine with 2 dual-core Opterons. I’d like to make use of all 4 cores for matrix multiplication in matlab, and PGI’s acml looks promising. When I tell matlab to use the PGI libacml.so, everything works, but (obviously) stays on one processor. When I switch to libacml_mp.so, matlab hangs during startup, while loading the library.

The strace output looks normal for a few thousand lines, and then starts printing

    sched_yield()                           = 0
    sched_yield()                           = 0
    sched_yield()                           = 0
    ...

over and over, no end in sight.

Ideas?

Hi Mike,

I personally have not used Matlab so don’t know how Matlab does it’s loading of dynamic objects. However, what might be occuring is that the ACML’s dependent libraries, libpgmp.so and libpgc.so, are not being loaded. Assuming Matlab uses the “ld” loader, try setting the following environment variables to capture the loader’s debug information:

export LD_DEBUG=all
export LD_DEBUG_OUTPUT="/tmp/ld.log"   (or other log file name)

Another user was able to use his own auto-parrallelized library (See here), which uses the same underlying PGI libraries as the openMP AMCL. While the library did load and run correctly, Matlab crashed while unloading the library. Chris contacted Matlab about the problem and they responded:

matlab is single-threaded and trying to use multi-threaded code produces undefined behavior.

  • Mat

Mat,

Thanks for your prompt response. The LD_DEBUG thing is a handy trick!

The ld debug output shows libpgmp.so and libpgc.so load successfully from the right place (same directory as the PGI libacml_mp.so). There are no errors or warnings in the output.

It seems unlikely that I’ll be able to get to the bottom of this without a sizable time commitment, so I’ll have to settle for a single-threaded ACML.

My impression is that, in spite of the answer Chris got from the Matlab folks, there should be a way to get a multithreaded ACML working with Matlab. Intel’s MKL does this sucessfully, and I don’t see any reason Matlab should know or care whether there are multiple threads under the hood when it makes a LAPACK/BLAS call.


Has PGI considered deliberately targetting Matlab users with their ACML? I don’t know what PGI’s consumer demograhics are like, but multi-core amd64 systems and Matlab go really well together – or would, if there were a multithreaded amd64 ACML implementation Matlab could handle. If PGI could work out the kinks with Matlab, they would have a (rapidly growing) captive audience.