Skip to content

Commit 90c5eb9

Browse files
Document PARALLEL
1 parent 1ff5b61 commit 90c5eb9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

SPECIFICATION.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,12 @@
422422
- `MPROD(TNS: t1, ..., TNS: tN):TNS` Elementwise product across tensors. Shapes must match; elements must be all `INT` or all `FLT` (no mixing).
423423
- `TADD/TSSUB/TMUL/TDIV/TPOW(TNS: x, INT|FLT: y):TNS` Tensor-scalar arithmetic. Tensor elements and scalar must both be `INT` or both be `FLT` (no mixing). Division by zero is an error.
424424

425+
### Concurrency
426+
427+
- `PARALLEL(TNS: functions):INT` Execute each element of `functions` in parallel. Each element must evaluate to a `FUNC` value; the interpreter invokes each function with no arguments (in separate worker threads) and waits for all workers to complete. Returns `INT` 0 on success. If any element is not a `FUNC` or any worker raises an error, `PARALLEL` raises a runtime error (rewrite: `PARALLEL`) and the failing worker's error is propagated.
428+
429+
- `PARALLEL(FUNC: f1, FUNC: f2, ...):INT` — Variadic form: accept one or more `FUNC` values as direct arguments. Behaviour is equivalent to the tensor form: each supplied function is invoked in parallel with no arguments and the call waits for completion; returns `INT` 0 on success or raises on error.
430+
425431
### Logarithms
426432
- `LOG(INT: a):INT` ; floor(log2(a)) for a > 0
427433
- `LOG(FLT: a):FLT` ; floor(log2(a)) for a > 0

0 commit comments

Comments
 (0)