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.

Eldo Control Language<br />

Parallel Operation<br />

Example: use of ijob() inside a step parallel loop:<br />

.define_task t_step_para<br />

set i = 0<br />

para_step (type=step,<br />

+ param=i,<br />

+ start=100k,<br />

+ stop=10k,<br />

+ step=-10k)<br />

fprint(stdout,<br />

+ "Beginning run %d with i=%.2g.\n",<br />

+ ijob(),<br />

+ i)<br />

end_para_step<br />

.end_define_task<br />

.t_step_para<br />

The output of this example may be:<br />

Beginning run 1 with i=1e+05.<br />

Beginning run 3 with i=8e+04.<br />

Beginning run 2 with i=9e+04.<br />

Beginning run 4 with i=7e+04.<br />

Beginning run 6 with i=5e+04.<br />

Beginning run 5 with i=6e+04.<br />

Beginning run 7 with i=4e+04.<br />

Beginning run 9 with i=2e+04.<br />

Beginning run 8 with i=3e+04.<br />

Beginning run 10 with i=1e+04.<br />

Concurrency Issues<br />

To prevent concurrency issues from occurring, ECL is very strict about code that is allowed to<br />

be parallelized inside loops. By default, no scalar variable can be assigned inside a parallel loop<br />

(otherwise a syntax error is generated). It is only possible to store values inside arrays. During<br />

execution, ECL checks that no value of an array is accessed by more than one job in write mode.<br />

If more than one job accesses the same value (inside an array) in write mode, then an error<br />

occurs at run time. It is strongly recommended to store results inside arrays indexed by the<br />

index of the current job.<br />

Example: a step parallel loop running simulations:<br />

Eldo® User's Manual, 15.3 1047

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

Saved successfully!

Ooh no, something went wrong!