From 25649616ea5b6aba575149df3f9943f48a5ece31 Mon Sep 17 00:00:00 2001 From: Mamy Ratsimbazafy Date: Fri, 22 Mar 2019 23:38:43 +0100 Subject: Add OpenMP overload with stepping (#10891) --- lib/system.nim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/system.nim b/lib/system.nim index 090c6359c..016675d55 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2681,6 +2681,24 @@ iterator `||`*[S, T](a: S, b: T, annotation: static string = "parallel for"): T ## and GC. discard +iterator `||`*[S, T](a: S, b: T, step: Positive, annotation: static string = "parallel for"): T {. + inline, magic: "OmpParFor", sideEffect.} = + ## OpenMP parallel loop iterator with stepping. + ## Same as `countup` but the loop may run in parallel. + ## + ## `annotation` is an additional annotation for the code generator to use. + ## The default annotation is `parallel for`. + ## Please refer to the `OpenMP Syntax Reference + ## `_ + ## for further information. + ## + ## Note that the compiler maps that to + ## the ``#pragma omp parallel for`` construct of `OpenMP`:idx: and as + ## such isn't aware of the parallelism in your code! Be careful! Later + ## versions of ``||`` will get proper support by Nim's code generator + ## and GC. + discard + {.push stackTrace:off.} proc min*(x, y: int): int {.magic: "MinI", noSideEffect.} = if x <= y: x else: y -- cgit 1.4.1-2-gfad0