One syntax to write parallel algorithms.
This syntax comes from the observation that arrays are representation of sequences, but sequences could be represented by linkded list or trees.
In this case, if we draw a tree like this:
- a
- b
- c
- b
- d
- e
- f
- g
- h
- e
We are sure that a
, is a requirement for b
, and b
a requirement for c
.
And d
doesn't require a
, b
, or c
.
But but e
and g
, requires d
.
With that, the only missing part is tell that next expression i
will depend on a
and d
, by adding a barrier instruction.
- a
- b
- c
- b
- d
- e
- f
- g
- h
- e
- i
- New line with indentation is sequential;
- New line without indentation is parallel;
- Except for the expecial barrier instruction;
- This is a continuation passing style by identation;
- Ultra wide monitors are not enough anymore;
- It could be paralellized, doesn't mean it will be.
- Exceptions handling
- Loops
- Early returns
- Shared data