10.06.2016 Views

eldo_user

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Concurrency Issues<br />

Eldo Control Language<br />

Parallel Operation<br />

When using the function para(), concurrency issues can emerge if some output results are stored<br />

inside the same variable. If this happens, then ECL will generate an error. Therefore it is<br />

strongly recommended to store results inside arrays indexed by the index of the current job.<br />

Example: ECL issues an error because the variable res is accessed in write mode by two<br />

different jobs:<br />

.define_task t_assign_value (in=0, @out=0)<br />

out=in<br />

.end_define_task<br />

.define_task t_main_para<br />

set res = 0<br />

para(t_assign_value(in=1, res=@out),<br />

+ t_assign_value(in=2, res=@out))<br />

fprint(stdout, "res: %d\n", res)<br />

.end_define_task<br />

.t_main_para<br />

Example: fix the concurrency issue using an array.<br />

.define_task t_assign_value (in=0, @out=0)<br />

out=in.end_define_task<br />

.define_task t_main_para<br />

set res[] = 0<br />

set i = 0<br />

para(t_assign_value(in=1, res[ijob()]=@out),<br />

+ t_assign_value(in=2, res[ijob()]=@out))<br />

for (i=res.imin; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!