Question

I want to launch a number of parallel jobs in matlab exploiting the power of gnu-parallel.

In my folder I have the test.m file:

function test(a)
while 1
disp(a);
end
exit;

I'm used to launching multiple parallel session of matlab in this way:

for i in `seq 1 10`; do
  nohup matlab -singleCompThread -nodesktop -nosplash -r "test($i,43))" &
done

but what if I want to adapt this script to gnu-parallel? I've tried with:

parallel "matlab -nodisplay -nodesktop -nojvm -nosplash -r 'test({1})'" ::: 1 2 3 4

but this doesn't work at all. Using gnu-parallel for me should be of great help because it's able to balance computation and processes much better than my previous solution does.

Some ideas?

Était-ce utile?

La solution

This ought to work (I do not have access to a matlab installation):

seq 1 10 | parallel 'matlab -singleCompThread -nodesktop -nosplash -r "test({},43))"'
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top