提交 6633f6fd authored 作者: Frederic's avatar Frederic

Add doc about OpenMP ops.

上级 ae997472
......@@ -183,3 +183,30 @@ distribution here::
.. note::
In all cases, you must reuse the same interface as NumPy for compatibility.
.. _openmp_ops:
OpenMP Ops
==========
To allow consistent interface of Ops that support OpenMP, we have some
helper code. Doing this also allow to enable/disable OpenMP globally
or per op for fine grin control.
Your Op need to inherit from ``theano.gof.OpenMPOp``. If it override
the ``__init__()`` method, it must have an ``openmp=None`` parameter
and must call ``super(MyOpClass, self).__init__(openmp=openmp)``.
The ``OpenMPOp`` class also implement ``c_compile_args`` and
``make_thunk``. This make it add the correct g++ flag to compile with
OpenMP. It also disable OpenMP and print a warning if the version of
g++ don't support it.
The Theano flag ``openmp`` is currently False by default as we don't
have code that get speed up with it. The only current implementation
is ConvOp. It speed up some cases, but slow down others. That is why
we disable it by default. But we have all the code to have it enabled
by default if there is more then 1 cores and that the environment
variable OMP_NUM_THREADS isn't 1. This allow Theano to respect the
current convention.
......@@ -439,8 +439,6 @@ The section :ref:`Other ops <other_ops>` include more instruction for specific c
- :ref:`sparse ops <sparse_ops>`
- :ref:`random ops <random_ops>`.
If you want c code speed without doing c code for a new ops, you can check using Numba with Theano :
See :ref:`metadocumentation`, for some information on how to generate
the documentation.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论