Read about our upcoming Code of Conduct on this issue

Commit e796b74f authored by Pierre Augier's avatar Pierre Augier
Browse files

Improve doc

parent 717032705c56
......@@ -22,8 +22,9 @@ FluidPythran: easily speedup your Python code with Pythran
FluidPythran is still in a quite early stage. Remarks and suggestions are
very welcome.
FluidPythran is used "in production" in `FluidSim
<https://bitbucket.org/fluiddyn/fluidsim>`_ (see examples for `blocks
However, FluidPythran is now really usable and used "in production" in
`FluidSim <https://bitbucket.org/fluiddyn/fluidsim>`_ (see examples for
`blocks
<https://bitbucket.org/fluiddyn/fluidsim/src/default/fluidsim/base/time_stepping/pseudo_spect.py>`_,
`@boost
<https://bitbucket.org/fluiddyn/fluidsim/src/default/fluidsim/operators/operators3d.py>`_
......@@ -120,12 +121,18 @@ that the developers can still read the Pythran files if needed.
- The whole code can be gathered in one Python file.
- With the :code:`@cachedjit` decorator, we don't need to add the types!
- With the :code:`@cachedjit` decorator, we don't need to add the types and
to launch compilation commands!
- Even without :code:`@cachedjit` (i.e. with AOT compilation), it is easy to
trigger a mode in which FluidPythran automatically takes care of all
compilation steps (see `set_pythranize_at_import <pythranize-at-import_>`__).
.. note ::
FluidPythran can be used in libraries and applications using MPI (as
`FluidSim <https://bitbucket.org/fluiddyn/fluidsim>`_).
Installation
------------
......@@ -190,8 +197,9 @@ The previous example can be rewritten without Pythran commands:
...
Nice but very limited... So one can also elegantly define many Pythran
signatures with type variables (see `these examples in the documentation
Nice (shorter and clearer than with the Pythran command) but very limited... So
one can also elegantly define many Pythran signatures using in the annotations
type variables and Pythran types in strings (see `these examples
<https://fluidpythran.readthedocs.io/en/latest/examples/type_hints.html>`_).
Moreover, it is possible to mix type hints and :code:`# pythran def` commands.
......@@ -226,9 +234,6 @@ Note that the :code:`@cachedjit` decorator takes into account type hints (see
`the example in the documentation
<https://fluidpythran.readthedocs.io/en/latest/examples/using_cachedjit.html>`_).
If the environment variable :code:`PYTHRANIZE_AT_IMPORT` is set, fluidpythran
compiles at import time the functions with type hints.
**Implementation details for just-in-time compilation:** A Pythran file is
produced for each "cachedjited" function (function decorated with
:code:`@cachedjit`). The file is compiled at the first call of the function and
......
......@@ -24,15 +24,8 @@ class MyClass:
if fp.is_transpiled:
result = fp.use_pythranized_block("block0")
else:
# pythran block (
# A a, b; A1 c;
# int n
# ) -> result
# pythran block (
# int a, b, c;
# float n
# ) -> result
# pythran block (A a, b; A1 c; int n) -> result
# pythran block (int a, b, c; float n) -> result
result = np.zeros_like(a)
for _ in range(n):
......
......@@ -16,6 +16,12 @@ With FluidPythran, one can easily use Pythran for methods:
:code:`@boost` or :code:`@cachedjit`) and the classes (with
:code:`@boost`)...
.. warning ::
One has to be very carreful with assignation in methods. For example,
:code:`self.attr = 1` does not work but :code:`self.myarray[:] = 1` should
work (because it is not a real assignation).
.. warning ::
Calling another method in a pythranized method is *not yet* supported!
......@@ -26,4 +32,4 @@ Function calls in methods are supported!
We can also use the :code:`cachedjit` decorator for methods!
.. literalinclude:: methods_cachedjit.py
\ No newline at end of file
.. literalinclude:: methods_cachedjit.py
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment