coforall loops in sequence with Chapel -
i'm working on debugger, using chapel programming language. in code need use coforall loop, unfortunately, can't find way make parallel iterations executed in sequence.
this part of code:
coforall in 1..n -1 { middle = ( ( _delta[i]._sub.length ) / 2 ) : int; if( middle != 0 ) { _delta[2*i ]._sub=_delta[i]._sub[1+middle..]; _delta[2*i-1]._sub=_delta[i]._sub[..middle]; } ... } as can see need iterations of loop executed in parallel , in backward sequence.
is there way so?
a general rule
a code-section, executed in parallel ( par-type of process scheduling ), definition, provides no means become executed on infrastructure of hardware resources in particular "order" ( additionally enforcing kind of seq-type of process scheduling ), including "reverse-(backward-stepping)-order" et al.
as there no such number odd @ same time,
there no chance any par processes-scheduling become also seq at same time.
specific coordination tools "ordering" task execution still possible
for indeed special purpose, there means -- a.k.a. synchronisation primitives -- provide blocking step, 1 part of computation has explicitly wait until receives message / value / kind of mutual synchronisation impulse other process ( task or part of more complex, distributed-system computation graph ).
in cases carefull algorithmisation must, blocking states, in principal, , devastate benefits parallel code-execution may provide.
for details, read chapel synchronisation variables.
epilogue
in case, a design, has resort block ( using kind of barrier, or waiting synchronisation variable, or expecting message csp-channel et al ) ought last option, if other computer science tools , refactoring efforts have failed provide better, , par possible, algorithmisation. besides blocking, per-se, amdahl law ratio goes steeply down, performance of pure seq schedule.
serious hpc not based on using wait-states, opposite.
Comments
Post a Comment