Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fluiddyn
transonic
Commits
60e2196d7157
Commit
28b6076c
authored
Sep 21, 2019
by
Pierre Augier
Browse files
Update the documentation on how to choose the backend
parent
8de0943befee
Changes
4
Hide whitespace changes
Inline
Side-by-side
doc/backends.rst
View file @
60e2196d
...
...
@@ -4,9 +4,28 @@ Backends (Pythran, Cython, Numba, ...)
Transonic can use different tools to accelerate the code. We use the name
"backend".
The default backend is Pythran and currently, one can choose other backends
with the environment variable :code:`TRANSONIC_BACKEND` (which has to be
"pythran", "cython", "numba" or "python").
The default backend is Pythran and currently, there are 3 other backends
("cython", "numba" or "python"). (The "python" backend is mainly used for
internal testing.)
There are different methods to choose which backend is used:
- An environment variable :code:`TRANSONIC_BACKEND` (which has to be "pythran",
"cython", "numba" or "python") should be used to change the backend globally
for one process.
- The ``transonic`` commandline has an option ``-b`` (``--backend``).
- The functions :func:`transonic.backends.make_backend_files` and
:func:`transonic.dist.init_transonic_extensions` have an optional argument
``backend``. Note that these functions should be imported from the
:mod:`transonic.dist` package.
- There are two functions :func:`transonic.config.set_backend` and
:func:`transonic.backends.set_backend_for_this_module`. Note that these
functions can be imported from the :mod:`transonic` package.
- The ``boost`` and ``jit`` decorators have an optional argument ``backend``.
.. toctree::
:maxdepth: 2
...
...
transonic/backends/__init__.py
View file @
60e2196d
...
...
@@ -21,9 +21,6 @@ User API
.. autofunction:: set_backend_for_this_module
Internal API
------------
.. autofunction:: make_backend_files
"""
...
...
transonic/config.py
View file @
60e2196d
...
...
@@ -33,6 +33,11 @@ For Linux, I use:
CC=clang-6.0
blas=openblas
User API
--------
.. autofunction:: set_backend
"""
import
os
...
...
@@ -49,6 +54,7 @@ backend_set_by_user = False
def
set_backend
(
backend
:
str
):
"""Set the "global variable" backend_default"""
backend
=
backend
.
lower
()
supported_backends
=
[
"pythran"
,
"cython"
,
"numba"
,
"python"
]
...
...
transonic/dist.py
View file @
60e2196d
...
...
@@ -9,6 +9,8 @@ setup.py.
.. autofunction:: detect_transonic_extensions
.. autofunction:: init_transonic_extensions
"""
import
os
...
...
@@ -53,6 +55,7 @@ __all__ = [
"can_import_pythran"
,
"detect_transonic_extensions"
,
"init_pythran_extensions"
,
"init_transonic_extensions"
,
"get_logger"
,
"ParallelBuildExt"
,
"make_backend_files"
,
...
...
@@ -141,6 +144,11 @@ def init_transonic_extensions(
Package to be recursively scanned for Pythran extensions.
backend : str
Only initialize extensions for this backend. If None, initialize
extensions for the default backend (set by an environment variable).
include_dirs:
Directories to include while building extensions, for e.g.:
...
...
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