How can I limit the number of threads created when running a compiled MATLAB executable?

4 Ansichten (letzte 30 Tage)
I'm working on a Linux machine with 48 cores (4CPUs x 12 cores) and for my application it is much more efficient to executes 48 simulations in parallel than letting MATLAB use multiple threads per simulation.
I compiled the executable with "-R -singleCompThread" and this effectively limits the number of used threads to one. But each process spawns 60 threads, 59 of them are idling but nevertheless they occupy system resources. With 48*60 threads on the machine I run into trouble and get error messages like: "Cannot create GC thread. Out of system resources."
Is there a way to avoid those useless threads?
  2 Kommentare
Danila
Danila am 20 Sep. 2012
I have the same question. I had even submitted it to Mathworks Support - still waiting for the reply.
Mark
Mark am 27 Nov. 2012
I had the same problem until I tried using the compile options "-R -singleCompThread -R -nojvm -R -nodisplay"
I was trying to run multiple MATLAB binaries on a Linux server with 80 cores, and without the nojvm option I was getting 80 threads, one for each core. With the options listed above, I only get 4 threads now, which avoids the server error out of resources where it can't create any more threads.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Norman Scheel
Norman Scheel am 2 Apr. 2019
Hi everyone,
it turns out that I have the exact same problem, I tried to use the -nojvm option, this effectively brings down the number of spawned processes but in turn, most of the code being run then fails because it uses code that actually needs the jvm ... is there another way around this?
Thank you!
Norman

Kategorien

Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by