Is it possible for a user of a standalone compiled MATLAB code, which uses the Parallel Computing Toolbox, to define the matlabpool size at run time?
My code queries the local configuration to get the number of workers:
schd = findResource('scheduler', 'configuration', 'local');numWorkers = schd.ClusterSize;
I then allow the user to revise that number down via a GUI contol (so they don't max out their system if they have other stuff running). When processing begins I call:
matlabpool('local', numWorkers)... % do stuff with parformatlabpool close
It works fine on my machine, however, when I compile this code on my machine (where the standard 'local' configuration has 8 workers) and then run it on a machine with only 2 cores, the number of workers gets set to 8, even though only 2 are available. Clearly the Compiler has compiled up and included my 'local' config.
If I don't know in advance how many cores a user will have, how can I access THEIR 'local' matlabpool configuration at runtime, instead of mine?
I'm using R2011a.
Many thanks, Nick
Best Answer