transonic issueshttps://foss.heptapod.net/fluiddyn/transonic/-/issues2020-02-12T22:35:21Zhttps://foss.heptapod.net/fluiddyn/transonic/-/issues/22Add njit decorator?2020-02-12T22:35:21ZBitbucket ImporterAdd njit decorator?*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
See [https://bitbucket.org/fluiddyn/transonic/issues/19/change-default-arguments-of-jit-decorator](https:/...*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
See [https://bitbucket.org/fluiddyn/transonic/issues/19/change-default-arguments-of-jit-decorator](https://bitbucket.org/fluiddyn/transonic/issues/19/change-default-arguments-of-jit-decorator)https://foss.heptapod.net/fluiddyn/transonic/-/issues/6Alternative syntax for blocks with decorator and context manager2020-06-13T19:10:14ZBitbucket ImporterAlternative syntax for blocks with decorator and context manager*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
I'd like to support such things:
### for functions:
```python
from transonic import with_blocks, block
...*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
I'd like to support such things:
### for functions:
```python
from transonic import with_blocks, block
@with_blocks
def func(arg: int):
a = non_pythranizable(arg)
with block():
a: float
tmp = a + arg
return non_pythranizable(tmp)
```
I think supporting `return` in a block is going to be difficult.
### for classes:
```python
from transonic import boost, with_blocks, block
@boost
class MyClass:
attr0: int
@with_blocks
def func(self, arg: int):
a = non_pythranizable(arg)
with block():
a: float
tmp = a + arg + self.attr0
return non_pythranizable(tmp)
```
- We could also support block signatures `# transonic block (int: a, b; A: c, d, e)` in the block.https://foss.heptapod.net/fluiddyn/transonic/-/issues/55AttributeError: 'CommentLine' object has no attribute 'value'2023-10-06T14:51:05ZMartí BoschAttributeError: 'CommentLine' object has no attribute 'value'Hello,
pylandstats' builds started getting this "AttributeError: 'CommentLine' object has no attribute 'value'". See build logs for the full traceback at:
https://github.com/martibosch/pylandstats/actions/runs/6340622438/job/17222439515...Hello,
pylandstats' builds started getting this "AttributeError: 'CommentLine' object has no attribute 'value'". See build logs for the full traceback at:
https://github.com/martibosch/pylandstats/actions/runs/6340622438/job/17222439515?pr=45
It seems that the error is raised already when running "pip install numpy pythran 'setuptools>=61.0' 'transonic>=0.4.0' wheel".
As you can see, the error is raised by beniget but it seems related to a former issue: https://github.com/serge-sans-paille/beniget/issues/14, supposedly fixed in transonic some years ago: https://github.com/serge-sans-paille/beniget/pull/15#issuecomment-531128678.
I have not changed the build-related code. I suppose this is due to some change in pythran 0.14.0 but it is very hard for me to infer what this may be from the changelog. Any help will be greatly appreciated. Otherwise I can try upper-bounding pythran to 0.13.x
Thank you in advance. Best,
Martíhttps://foss.heptapod.net/fluiddyn/transonic/-/issues/10Be able to define PyCapsule2020-02-12T22:35:14ZBitbucket ImporterBe able to define PyCapsule*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
See
- https://serge-sans-paille.github.io/pythran-stories/the-capsule-corporation.html
- https://nu...*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
See
- https://serge-sans-paille.github.io/pythran-stories/the-capsule-corporation.html
- https://numba.pydata.org/numba-doc/dev/user/cfunc.html
And also: http://www.stochasticlifestyle.com/why-numba-and-cython-are-not-substitutes-for-julia/https://foss.heptapod.net/fluiddyn/transonic/-/issues/47boundscheck ignored?2021-12-29T12:38:13ZNeal Beckerboundscheck ignored?In this test, it seems boundscheck is ignored?
A "constellation" object is created, which is basically just a numpy array. It overloads __call__, which just redirects to __getitem__. When called with a scalar arg (no __len__), it shoul...In this test, it seems boundscheck is ignored?
A "constellation" object is created, which is basically just a numpy array. It overloads __call__, which just redirects to __getitem__. When called with a scalar arg (no __len__), it should call call1, which should have boundscheck. It does not appear to work. In the last test case in test_constellation.py, we have an array of size 2, but calling c[10] returns random data instead of an error.
https://gist.github.com/nbecker/76ac6e37652e7b0424886f5c9cbfa33dhttps://foss.heptapod.net/fluiddyn/transonic/-/issues/46Codecov Python package deprecated2021-12-01T10:10:27ZAshwin V. MohananCodecov Python package deprecatedThe codecov Python uploader will be discontinued in a few months. See
- https://docs.codecov.com/docs/codecov-uploader
- https://about.codecov.io/blog/introducing-codecovs-new-uploader/
This can be also fixed in !95 or laterThe codecov Python uploader will be discontinued in a few months. See
- https://docs.codecov.com/docs/codecov-uploader
- https://about.codecov.io/blog/introducing-codecovs-new-uploader/
This can be also fixed in !95 or laterMaintainencehttps://foss.heptapod.net/fluiddyn/transonic/-/issues/29Default parameters2020-02-12T22:35:24ZBitbucket ImporterDefault parameters*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
@boost
def func(a: int = 1, b: int = 2):
return a+b
```
In Pythran it should give:
```
# ...*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
@boost
def func(a: int = 1, b: int = 2):
return a+b
```
In Pythran it should give:
```
# pythran export func()
# pythran export func(int)
# pythran export func(int, int)
```
https://foss.heptapod.net/fluiddyn/transonic/-/issues/7Detect unsupported assignment self.attr = 12020-02-12T22:35:12ZBitbucket ImporterDetect unsupported assignment self.attr = 1*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
https://foss.heptapod.net/fluiddyn/transonic/-/issues/2HPC related qustions on fresh install and JIT compilation on jobs2020-02-12T22:35:08ZBitbucket ImporterHPC related qustions on fresh install and JIT compilation on jobs*Created originally on Bitbucket by [avmo (Ashwin Vishnu)](https://bitbucket.org/%7Bbd72905e-cf99-4847-84c2-998104370f6e%7D/)*
Some of my jobs were frozen during JIT compilation, and it was never released, even after 24 hrs. It was prob...*Created originally on Bitbucket by [avmo (Ashwin Vishnu)](https://bitbucket.org/%7Bbd72905e-cf99-4847-84c2-998104370f6e%7D/)*
Some of my jobs were frozen during JIT compilation, and it was never released, even after 24 hrs. It was probably because I had the environment variable `OMP_NUM_THREADS=1` on. Nevertheless, would it be possible to check if the threads are released after JIT compilation is done.https://foss.heptapod.net/fluiddyn/transonic/-/issues/28https://github.com/pyccel/pyccel2020-11-11T09:25:43ZBitbucket Importerhttps://github.com/pyccel/pyccel*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
We could have a backend for pyccel*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
We could have a backend for pyccelhttps://foss.heptapod.net/fluiddyn/transonic/-/issues/57Implement Jax backend2024-03-14T21:24:51ZAshwin V. MohananImplement Jax backendIn the simplest terms, to support Jax we have to
* add a `@jit` decorator like in Numba and
* optimistically replace `import numpy as np` with `import jax.numpy as np`
The API has of course some deviations, but for many cases this sh...In the simplest terms, to support Jax we have to
* add a `@jit` decorator like in Numba and
* optimistically replace `import numpy as np` with `import jax.numpy as np`
The API has of course some deviations, but for many cases this should work. Shall we add it here, alongside the Numba backend implementation?
* https://jax.readthedocs.io/en/latest/notebooks/thinking_in_jax.html#jax-vs-numpy
* https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.htmlAshwin V. MohananAshwin V. Mohananhttps://foss.heptapod.net/fluiddyn/transonic/-/issues/11Implement keyword `or` in block signatures2020-02-12T22:35:14ZBitbucket ImporterImplement keyword `or` in block signatures*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
if ts.is_transpiled:
result = ts.use_block("myblock")
else:
# transonic block (int or floa...*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
if ts.is_transpiled:
result = ts.use_block("myblock")
else:
# transonic block (int or float a, b)
```https://foss.heptapod.net/fluiddyn/transonic/-/issues/23Issues with jit and exterior code2021-12-30T11:55:31ZBitbucket ImporterIssues with jit and exterior code*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
@{5aed8fd1347761310e25811e} can you please list them here ?*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
@{5aed8fd1347761310e25811e} can you please list them here ?https://foss.heptapod.net/fluiddyn/transonic/-/issues/43@jit runs uncompiled code at first execution2021-05-17T16:05:15Zrqwa@jit runs uncompiled code at first executionThis ticket is related to this [stackoverflow question](https://stackoverflow.com/questions/64857530/transonic-run-python-code-instead-of-pythran).
I use an adapted version of the bug.py from #40 .
```
import numpy as np
from transonic...This ticket is related to this [stackoverflow question](https://stackoverflow.com/questions/64857530/transonic-run-python-code-instead-of-pythran).
I use an adapted version of the bug.py from #40 .
```
import numpy as np
from transonic import jit,boost
from transonic.util import timeit_verbose
def norming(np_array: "float[:,:]"):
norm_array = np.linalg.norm(np_array, axis=1)
return norm_array
norming_pythran = jit(norming)
in_arr = np.random.rand(20000, 5)
def timeit(statement, norm=None):
return timeit_verbose(statement, globals=globals(), norm=norm)
norm = timeit("norming(in_arr)")
timeit("norming_pythran(in_arr)", norm=norm)
```
I run two versions of the code, once with `in_arr = np.random.rand(20000, 5)` and once with `in_arr = np.random.rand(20000, 500)`. Between the two versions I delete ` ~/.transonic/pythran/__jit__/bug`.
Output (20000,5):
```
% python bug.py
norming : 1 * norm
norm = 0.000448 s
Schedule pythranization: norming.py
INFO: Schedule pythranization: norming.py
norming_pythran : 1.03 * norm
% python bug.py
norming : 1 * norm
norm = 0.000449 s
norming_pythran : 0.287 * norm
```
Output (20000,500):
```
% python bug.py 0 [9:44:54]
norming : 1 * norm
norm = 0.0513 s
Schedule pythranization: norming.py
INFO: Schedule pythranization: norming.py
norming_pythran : 1.03 * norm
% python bug.py 0 [9:45:03]
norming : 1 * norm
norm = 0.0673 s
norming_pythran : 0.198 * norm
```
The first code execution shows no acceleration from pyhtran. It seems like only for all following executions the compiled code is used. Is this the expected behavior?
The configuration can be found [here](https://gist.github.com/rqwa/b0e0bcbe8ec9d41563c58c8c405e1e90).https://foss.heptapod.net/fluiddyn/transonic/-/issues/30Making sdist of a package using transonic.boost packages __pythran__ directories2020-02-12T22:35:25ZBitbucket ImporterMaking sdist of a package using transonic.boost packages __pythran__ directories*Created originally on Bitbucket by [avmo (Ashwin Vishnu)](https://bitbucket.org/%7Bbd72905e-cf99-4847-84c2-998104370f6e%7D/)*
Even if I clean the package, while running `python setup.py sdist` on fluidsht, it packages the `__pythran__`...*Created originally on Bitbucket by [avmo (Ashwin Vishnu)](https://bitbucket.org/%7Bbd72905e-cf99-4847-84c2-998104370f6e%7D/)*
Even if I clean the package, while running `python setup.py sdist` on fluidsht, it packages the `__pythran__` directory containing:
```
$ make deploy
rm -rf build dist
find fluidsht -name "*.pyc" -delete
find fluidsht -name "__pycache__" -type d | xargs rm -rf
find fluidsht -name "__pythran__" -type d | xargs rm -rf
python setup.py sdist
INFO: Running fluidsht setup.py on platform linux
INFO:
__ _ _ _ _ _
/ _| | (_) | | | | | |
| |_| |_ _ _ __| |___| |__ | |_
| _| | | | | |/ _` / __| '_ \| __|
| | | | |_| | | (_| \__ \ | | | |_
|_| |_|\__,_|_|\__,_|___/_| |_|\__|
v. 0.0.4a0
INFO /home/avmo/src/gfdyn/fluidsht/fluidsht/sht2d/__pythran__/operators.py written
INFO /home/avmo/src/gfdyn/fluidsht/fluidsht/sht2d/__pythran__/operators.pythran written
INFO File /home/avmo/src/gfdyn/fluidsht/fluidsht/sht2d/__pythran__/operators.py updated
WARNING 1 files created or updated needs to be pythranized
INFO: Extension has to be built: fluidsht/sht2d/__pythran__/operators.py -> operators.cpython-37m-x86_64-linux-gnu.so
running sdist
running egg_info
writing fluidsht.egg-info/PKG-INFO
writing dependency_links to fluidsht.egg-info/dependency_links.txt
writing requirements to fluidsht.egg-info/requires.txt
writing top-level names to fluidsht.egg-info/top_level.txt
writing manifest file 'fluidsht.egg-info/SOURCES.txt'
running check
warning: Check: missing required meta-data: url
creating fluidsht-0.0.4a0
creating fluidsht-0.0.4a0/.ci
creating fluidsht-0.0.4a0/doc
creating fluidsht-0.0.4a0/doc/install
creating fluidsht-0.0.4a0/fluidsht
creating fluidsht-0.0.4a0/fluidsht.egg-info
creating fluidsht-0.0.4a0/fluidsht/sht2d
creating fluidsht-0.0.4a0/fluidsht/sht2d/__pythran__
...
copying fluidsht/sht2d/__pythran__/operators.cpp -> fluidsht-0.0.4a0/fluidsht/sht2d/__pythran__
...
```
Should or can transonic avoid building while running sdist?https://foss.heptapod.net/fluiddyn/transonic/-/issues/48NotImplementedError: self.call1 used but call1 not in class annotations2022-03-09T05:57:47ZNeal BeckerNotImplementedError: self.call1 used but call1 not in class annotationsThis code results in the error when compiled:
https://gist.github.com/nbecker/66b76d4464352eb8669903d0b77396d4
NotImplementedError: self.call1 used but call1 not in class annotations
Does the code need some modification?This code results in the error when compiled:
https://gist.github.com/nbecker/66b76d4464352eb8669903d0b77396d4
NotImplementedError: self.call1 used but call1 not in class annotations
Does the code need some modification?https://foss.heptapod.net/fluiddyn/transonic/-/issues/35polymorphic methods supported?2020-05-05T20:41:08ZNeal Beckerpolymorphic methods supported?The following simple test seems to indicate that polymorphic class members are not supported.
It seems only the 2nd overload of __call__ works.
Is there a workaround?
---- constellation.py ---
```import numpy as np
from transonic impor...The following simple test seems to indicate that polymorphic class members are not supported.
It seems only the 2nd overload of __call__ works.
Is there a workaround?
---- constellation.py ---
```import numpy as np
from transonic import boost
A = "complex[:]"
S = "int[:]"
@boost
class constellation:
map: A
def __init__(self, map: A):
self.map = map
@boost
def __call__(self, s: int):
return self.map[s]
@boost
def __call__(self, syms: S):
out = np.empty(len(syms), dtype=complex)
for i in range (len (syms)):
out[i] = self.map[syms[i]]
return out
```
--- test_constellation.py ---
```
from constellation import constellation
import numpy as np
A = np.array
u = A([1+0j, -1+0j])
c = constellation (u)
syms = A ([0,1])
xconst = c(syms)
x = c(0)
```
```
---> 11 x = c(0)
<string> in new_method(self, syms)
TypeError: Invalid call to pythranized function `__for_method__constellation____call__(complex128[:], int)'
Candidates are:
- __for_method__constellation____call__(complex128[:], int[:])
```https://foss.heptapod.net/fluiddyn/transonic/-/issues/25Raise error when no signature found for boosted function/methods2020-02-12T22:35:22ZBitbucket ImporterRaise error when no signature found for boosted function/methods*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
from transonic import boost
@boost
def func(a, b):
return a + b
```*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
from transonic import boost
@boost
def func(a, b):
return a + b
```https://foss.heptapod.net/fluiddyn/transonic/-/issues/27transonic.dataclass for numba.jitclass and cython cdef class2020-02-12T22:35:23ZBitbucket Importertransonic.dataclass for numba.jitclass and cython cdef class*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
from transonic import dataclass, boost
@dataclass
class MyStruc:
attr: int
def co...*Created originally on Bitbucket by [paugier (Pierre Augier)](https://bitbucket.org/%7Beb327c54-cadd-4fce-9edd-f8fe047a9b93%7D/)*
```
from transonic import dataclass, boost
@dataclass
class MyStruc:
attr: int
def compute(self, arg: int):
return self.attr + arg
def modify(self, arg: int):
self.attr = arg
@boost
def func(o: MyStruct, a: int):
o.modify(a)
return o
@boost
def func1(o: MyStruct, a: int):
return o.compute(a)
```
See [https://github.com/serge-sans-paille/pythran/issues/1116](https://github.com/serge-sans-paille/pythran/issues/1116)
and what is done in [https://github.com/ogrisel/pygbm/blob/master/pygbm/splitting.py#L21](https://github.com/ogrisel/pygbm/blob/master/pygbm/splitting.py#L21)https://foss.heptapod.net/fluiddyn/transonic/-/issues/5Transonic jit compilation+mpi blocks simulations2020-02-12T22:35:11ZBitbucket ImporterTransonic jit compilation+mpi blocks simulations*Created originally on Bitbucket by [avmo (Ashwin Vishnu)](https://bitbucket.org/%7Bbd72905e-cf99-4847-84c2-998104370f6e%7D/)*
## Issue
Simulations are frozen if attempted to launch with MPI from a fresh installation of `fluidsim`.
...*Created originally on Bitbucket by [avmo (Ashwin Vishnu)](https://bitbucket.org/%7Bbd72905e-cf99-4847-84c2-998104370f6e%7D/)*
## Issue
Simulations are frozen if attempted to launch with MPI from a fresh installation of `fluidsim`.
## Reproduce
* make a fresh virtualenv with the following requirements:
```
Cython==0.29.4
decorator==4.3.2
gast==0.2.2
mpi4py==3.0.0
networkx==2.2
numpy==1.16.1
ply==3.11
pythran==0.9.1.post0
six==1.12.0
```
```pip install -r requirements.txt```
* Install `fluidfft` and `fluiddyn` using `make develop` from the respective repos.
* Clear cache:
```sh
TRANSONIC_DIR=$FLUIDSIM_PATH/.transonic transonic -cc fluidsim.solvers.sw1l
```
* Run a set of tests with mpi and jit compilation
```sh
TRANSONIC_COMPILE_JIT=1 mpirun -n 2 fluidsim-test -m fluidsim.solvers.sw1l
```