Commit 8eeea273 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2390 from gabrieldemarmiesse/rendering_parameters

Changed the organisation of prange.
parents eb294a56 aa8f3b1c
......@@ -21,9 +21,7 @@ It currently supports OpenMP, but later on more backends might be supported.
This function can be used for parallel loops. OpenMP automatically
starts a thread pool and distributes the work according to the schedule
used. ``step`` must not be 0. This function can only be used with the
GIL released. If ``nogil`` is true, the loop will be wrapped in a nogil
section.
used.
Thread-locality and reductions are automatically inferred for variables.
......@@ -36,6 +34,22 @@ It currently supports OpenMP, but later on more backends might be supported.
Variables assigned to in a parallel with block will be private and unusable
after the block, as there is no concept of a sequentially last value.
:param start:
The index indicating the start of the loop (same as the start argument in range).
:param stop:
The index indicating when to stop the loop (same as the stop argument in range).
:param step:
An integer giving the step of the sequence (same as the step argument in range).
It must not be 0.
:param nogil:
This function can only be used with the GIL released.
If ``nogil`` is true, the loop will be wrapped in a nogil section.
:param schedule:
The ``schedule`` is passed to OpenMP and can be one of the following:
static:
......@@ -78,30 +92,33 @@ It currently supports OpenMP, but later on more backends might be supported.
the scheduling code itself and may therefore show a slightly worse
performance than when the same scheduling policy is statically
configured at compile time.
The default schedule is implementation defined. For more information consult
the OpenMP specification [#]_.
.. auto The decision regarding scheduling is delegated to the
.. compiler and/or runtime system. The programmer gives
.. the implementation the freedom to choose any possible
.. mapping of iterations to threads in the team.
The default schedule is implementation defined. For more information consult
the OpenMP specification [#]_.
:param num_threads:
The ``num_threads`` argument indicates how many threads the team should consist of. If not given,
OpenMP will decide how many threads to use. Typically this is the number of cores available on
the machine. However, this may be controlled through the ``omp_set_num_threads()`` function, or
through the ``OMP_NUM_THREADS`` environment variable.
:param chunksize:
The ``chunksize`` argument indicates the chunksize to be used for dividing the iterations among threads.
This is only valid for ``static``, ``dynamic`` and ``guided`` scheduling, and is optional. Different chunksizes
may give substantially different performance results, depending on the schedule, the load balance it provides,
the scheduling overhead and the amount of false sharing (if any).
Example with a reduction:
Example with a reduction:
.. literalinclude:: ../../examples/userguide/parallelism/simple_sum.pyx
.. literalinclude:: ../../examples/userguide/parallelism/simple_sum.pyx
Example with a typed memoryview (e.g. a NumPy array)::
Example with a typed memoryview (e.g. a NumPy array)::
from cython.parallel import prange
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment