parallel_run and unix_g
Antoine Monmayrant
antoine.monmayrant at laas.fr
Fri Mar 23 17:19:13 CET 2012
Hi everyone,
I would like to know whether it's possible to run "unix_g" inside a
function that is called by parallel_run.
I need to do this as I repeatedly call a TSP sorting algorithm (LKH
http://www.akira.ruc.dk/~keld/research/LKH/ ) using unix_g on huge
datasets that I cannot process with scilab. I would like to get several
calls in parallel to reduce the time it takes to sort all my datasets.
It does not seem to work, is this a limitation of parallel_run?
Here is a short script to show my problem:
//////////////////////////////////////////////////////////////////////////
//dummy function calling unix_g
function res=g(i)
res=unix_g("echo i="+string(i))
endfunction
//result when called in a loop
good_res=[];
for i=[1:3]
disp(i);
good_res=[good_res,g(i)];
end
//here good_res=["i=1","i=2","i=3"]
//result when called with parallel_run
bad_res=parallel_run(1:3, g);
//here bad_res=[0,0,0]
bad_res
good_res
//////////////////////////////////////////////////////////////////////////
Any workaround?
Antoine
More information about the users
mailing list