diff options
author | Mamy Ratsimbazafy <mratsim@users.noreply.github.com> | 2019-03-22 23:38:43 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-03-22 23:38:43 +0100 |
commit | 25649616ea5b6aba575149df3f9943f48a5ece31 (patch) | |
tree | 30da754b1ec901a7fe6f0b7894789ee61d9fc52e /lib | |
parent | 04ad200b403f1c4908a1a043e1f27b111298e1f3 (diff) | |
download | Nim-25649616ea5b6aba575149df3f9943f48a5ece31.tar.gz |
Add OpenMP overload with stepping (#10891)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system.nim | 18 |
1 files changed, 18 insertions, 0 deletions
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 + ## <https://www.openmp.org/wp-content/uploads/OpenMP-4.5-1115-CPP-web.pdf>`_ + ## 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 |