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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
43924a98
Commit
43924a98
authored
Jun 17, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved a block of code to the examples directory and fixed a rendering issue in parallelism.rst.
parent
5c04c1a8
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 @
43924a98
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 @
43924a98
...
@@ -79,10 +79,10 @@ It currently supports OpenMP, but later on more backends might be supported.
...
@@ -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
performance than when the same scheduling policy is statically
configured at compile time.
configured at compile time.
.. 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 default schedule is implementation defined. For more information consult
the OpenMP specification [#]_.
the OpenMP specification [#]_.
...
@@ -97,17 +97,9 @@ It currently supports OpenMP, but later on more backends might be supported.
...
@@ -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,
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:
from cython.parallel import prange
.. literalinclude:: ../../examples/userguide/parallelism/simple_sum.pyx
cdef int i
cdef int sum = 0
for i in prange(n, nogil=True):
sum += i
print sum
Example with a typed memoryview (e.g. a NumPy array)::
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