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
0d222d93
Commit
0d222d93
authored
Jun 20, 2018
by
scoder
Committed by
GitHub
Jun 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2370 from gabrieldemarmiesse/test_parallelism_1
Added tests to "Using Parallelism" part 1
parents
1a8ee2f9
43924a98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
docs/examples/userguide/parallelism/simple_sum.pyx
docs/examples/userguide/parallelism/simple_sum.pyx
+10
-0
docs/src/userguide/parallelism.rst
docs/src/userguide/parallelism.rst
+6
-14
No files found.
docs/examples/userguide/parallelism/simple_sum.pyx
0 → 100644
View file @
0d222d93
from
cython.parallel
import
prange
cdef
int
i
cdef
int
n
=
30
cdef
int
sum
=
0
for
i
in
prange
(
n
,
nogil
=
True
):
sum
+=
i
print
(
sum
)
docs/src/userguide/parallelism.rst
View file @
0d222d93
...
...
@@ -79,10 +79,10 @@ It currently supports OpenMP, but later on more backends might be supported.
performance than when the same scheduling policy is statically
configured at compile time.
.. 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.
.. 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 [#]_.
...
...
@@ -97,17 +97,9 @@ It currently supports OpenMP, but later on more backends might be supported.
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:
from cython.parallel import prange
cdef int i
cdef int sum = 0
for i in prange(n, nogil=True):
sum += i
print sum
.. literalinclude:: ../../examples/userguide/parallelism/simple_sum.pyx
Example with a typed memoryview (e.g. a NumPy array)::
...
...
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