Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
8eeea273
Commit
8eeea273
authored
Jul 07, 2018
by
scoder
Committed by
GitHub
Jul 07, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2390 from gabrieldemarmiesse/rendering_parameters
Changed the organisation of prange.
parents
eb294a56
aa8f3b1c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
60 deletions
+77
-60
docs/src/userguide/parallelism.rst
docs/src/userguide/parallelism.rst
+77
-60
No files found.
docs/src/userguide/parallelism.rst
View file @
8eeea273
...
@@ -21,9 +21,7 @@ It currently supports OpenMP, but later on more backends might be supported.
...
@@ -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
This function can be used for parallel loops. OpenMP automatically
starts a thread pool and distributes the work according to the schedule
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
used.
GIL released. If ``nogil`` is true, the loop will be wrapped in a nogil
section.
Thread-locality and reductions are automatically inferred for variables.
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.
...
@@ -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
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.
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:
The ``schedule`` is passed to OpenMP and can be one of the following:
static:
static:
...
@@ -78,30 +92,33 @@ It currently supports OpenMP, but later on more backends might be supported.
...
@@ -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
the scheduling code itself and may therefore show a slightly worse
performance than when the same scheduling policy is statically
performance than when the same scheduling policy is statically
configured at compile time.
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
.. auto The decision regarding scheduling is delegated to the
.. compiler and/or runtime system. The programmer gives
.. compiler and/or runtime system. The programmer gives
.. the implementation the freedom to choose any possible
.. the implementation the freedom to choose any possible
.. mapping of iterations to threads in the team.
.. 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,
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
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
the machine. However, this may be controlled through the ``omp_set_num_threads()`` function, or
through the ``OMP_NUM_THREADS`` environment variable.
through the ``OMP_NUM_THREADS`` environment variable.
:param chunksize:
The ``chunksize`` argument indicates the chunksize to be used for dividing the iterations among threads.
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
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,
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).
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
from cython.parallel import prange
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment