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
20c501a3
Commit
20c501a3
authored
May 16, 2016
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modernise setup.py example in OpenMP docs
parent
84ae8c4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
docs/src/userguide/parallelism.rst
docs/src/userguide/parallelism.rst
+16
-27
No files found.
docs/src/userguide/parallelism.rst
View file @
20c501a3
...
@@ -160,48 +160,37 @@ It currently supports OpenMP, but later on more backends might be supported.
...
@@ -160,48 +160,37 @@ It currently supports OpenMP, but later on more backends might be supported.
Returns the id of the thread. For n threads, the ids will range from 0 to
Returns the id of the thread. For n threads, the ids will range from 0 to
n-1.
n-1.
Compiling
Compiling
=========
=========
To actually use the OpenMP support, you need to tell the C or C++ compiler to
To actually use the OpenMP support, you need to tell the C or C++ compiler to
enable OpenMP. For gcc this can be done as follows in a setup.py::
enable OpenMP.
For gcc this can be done as follows in a setup.py::
from distutils.core import setup
from distutils.core import setup
from distutils.extension import Extension
from distutils.extension import Extension
from Cython.
Distutils import build_ext
from Cython.
Build import cythonize
ext_module = Extension(
ext_modules = [
"hello",
Extension(
["hello.pyx"],
"hello",
extra_compile_args=['-fopenmp'],
["hello.pyx"],
extra_link_args=['-fopenmp'],
extra_compile_args=['-fopenmp'],
)
extra_link_args=['-fopenmp'],
)
]
setup(
setup(
name = 'Hello world app',
name='hello-parallel-world',
cmdclass = {'build_ext': build_ext},
ext_modules=cythonize(ext_modules),
ext_modules = [ext_module],
)
)
For Microsoft Visual C++ compiler
::
For Microsoft Visual C++ compiler
, use ``'/openmp'`` instead of ``'-fopenmp'``.
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_module = Extension(
"hello",
["hello.pyx"],
extra_compile_args=['/openmp'],
)
setup(
name = 'Hello world app',
cmdclass = {'build_ext': build_ext},
ext_modules = [ext_module],
)
Breaking out of loops
Breaking out of loops
=====================
=====================
The parallel with and prange blocks support the statements break, continue and
The parallel with and prange blocks support the statements break, continue and
return in nogil mode. Additionally, it is valid to use a ``with gil`` block
return in nogil mode. Additionally, it is valid to use a ``with gil`` block
inside these blocks, and have exceptions propagate from them.
inside these blocks, and have exceptions propagate from them.
...
...
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