Skip to content

Commit

Permalink
Merge branch 'topic/default/metadata_in_functions' into 'branch/default'
Browse files Browse the repository at this point in the history
Metadata in functions to avoid issues with Pythran and Windows

See merge request fluiddyn/transonic!144
  • Loading branch information
paugier committed Aug 26, 2024
2 parents bb318a9 + 161a31b commit afa75ce
Show file tree
Hide file tree
Showing 105 changed files with 395 additions and 170 deletions.
7 changes: 6 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Release notes

See also the
[unreleased changes](https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.7.1...branch%2Fdefault).
[unreleased changes](https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.7.2...branch%2Fdefault).

## [0.7.2] (2024-08-26)

- Metadata stored in functions to avoid issues with Pythran on Windows

## [0.7.1] (2024-07-24)

Expand Down Expand Up @@ -280,3 +284,4 @@ See also the
[0.6.4]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.6.3...0.6.4
[0.7.0]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.6.4...0.7.0
[0.7.1]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.7.0...0.7.1
[0.7.2]: https://foss.heptapod.net/fluiddyn/transonic/-/compare/0.7.1...0.7.2
6 changes: 5 additions & 1 deletion data_tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

clean:
rm -rf __cython__ __numba__ __pythran__ __python__
rm -rf __cython__ __numba__ __pythran__ __python__ __jax__

all:
transonic -b pythran -nc *.py
transonic -b python -nc *.py
transonic -b cython -nc *.py
transonic -b numba -nc *.py
transonic -b jax -nc *.py

meld_pythran:
meld __pythran__ saved__backend__/pythran
Expand All @@ -20,6 +21,9 @@ meld_cython:
meld_numba:
meld __numba__ saved__backend__/numba

meld_jax:
meld __numba__ saved__backend__/numba

saved__backend__/%: __%__ FORCE
rsync -aP $< $@

Expand Down
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/add_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ def use_add(n=10000):
return tmp


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/assign_func_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ def func(x):
return x**2


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
17 changes: 13 additions & 4 deletions data_tests/saved__backend__/cython/block_fluidsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ def rk2_step0(state_spect_n12, state_spect, tendencies_n, diss2, dt):
state_spect_n12[:] = (state_spect + dt / 2 * tendencies_n) * diss2


arguments_blocks = {
"rk2_step0": ["state_spect_n12", "state_spect", "tendencies_n", "diss2", "dt"]
}
def arguments_blocks():
return {
"rk2_step0": [
"state_spect_n12",
"state_spect",
"tendencies_n",
"diss2",
"dt",
]
}

__transonic__ = ("0.3.3",)

def __transonic__():
return "0.7.1"
7 changes: 5 additions & 2 deletions data_tests/saved__backend__/cython/blocks_type_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def block0(a, b, n):
return result


arguments_blocks = {"block0": ["a", "b", "n"]}
def arguments_blocks():
return {"block0": ["a", "b", "n"]}

__transonic__ = ("0.3.3",)

def __transonic__():
return "0.7.1"
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ def __for_method__MyClass2__myfunc(self_attr0, self_attr1, arg):
return self_attr1 + self_attr0 + np.abs(arg) + func_import()


__code_new_method__MyClass2__myfunc = """
def __code_new_method__MyClass2__myfunc():
return """
def new_method(self, arg):
return backend_func(self.attr0, self.attr1, arg)
"""

__transonic__ = ("0.3.3",)

def __transonic__():
return "0.7.1"
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ def func(a, b):
return (a * np.log(b)).max() + func_import()


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
7 changes: 5 additions & 2 deletions data_tests/saved__backend__/cython/class_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def block1(a, b, n):
return result


arguments_blocks = {"block0": ["a", "b", "n"], "block1": ["a", "b", "n"]}
def arguments_blocks():
return {"block0": ["a", "b", "n"], "block1": ["a", "b", "n"]}

__transonic__ = ("0.3.3",)

def __transonic__():
return "0.7.1"
7 changes: 5 additions & 2 deletions data_tests/saved__backend__/cython/class_rec_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ def __for_method__Myclass__func(self_attr, self_attr2, arg):
)


__code_new_method__Myclass__func = """
def __code_new_method__Myclass__func():
return """
def new_method(self, arg):
return backend_func(self.attr, self.attr2, arg)
"""

__transonic__ = ("0.3.3",)

def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ def func(a, b):
return (a * np.log(b)).max()


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/default_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ def func(a=1, b=None, c=1.0):
return a + c


__transonic__ = ("0.4.0",)
def __transonic__():
return "0.7.1"
7 changes: 5 additions & 2 deletions data_tests/saved__backend__/cython/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ def __for_method__Transmitter____call__(self_arr, self_freq, inp):
return (inp * np.exp(np.arange(len(inp)) * self_freq * 1j), self_arr)


__code_new_method__Transmitter____call__ = """
def __code_new_method__Transmitter____call__():
return """
def new_method(self, inp):
return backend_func(self.arr, self.freq, inp)
"""

__transonic__ = ("0.3.3",)

def __transonic__():
return "0.7.1"
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ def func1(a, b):
return a * np.cos(b)


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/no_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ def func2():
return 1


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/row_sum_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ def row_sum_loops(arr, columns):
return res


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
5 changes: 3 additions & 2 deletions data_tests/saved__backend__/cython/subpackages.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_np_fft(u):


def test_np_linalg_random(u):
(nx, ny) = u.shape
nx, ny = u.shape
u[:] = randn(nx, ny)
u2 = u.T * u
u4 = matrix_power(u2, 2)
Expand All @@ -26,4 +26,5 @@ def test_sp_special(v, x):
return jv(v, x)


__transonic__ = ("0.4.2",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/cython/type_hint_notemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ def compute(a, b, c, d, e):
return tmp


__transonic__ = ("0.3.3",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/add_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ def use_add(n=10000):
return tmp


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/assign_func_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ def func(x):
return x**2


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
18 changes: 14 additions & 4 deletions data_tests/saved__backend__/jax/block_fluidsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ def rk2_step0(state_spect_n12, state_spect, tendencies_n, diss2, dt):
state_spect_n12[:] = (state_spect + dt / 2 * tendencies_n) * diss2


arguments_blocks = {
"rk2_step0": ["state_spect_n12", "state_spect", "tendencies_n", "diss2", "dt"]
}
__transonic__ = "0.6.4"
def arguments_blocks():
return {
"rk2_step0": [
"state_spect_n12",
"state_spect",
"tendencies_n",
"diss2",
"dt",
]
}


def __transonic__():
return "0.7.1"
8 changes: 6 additions & 2 deletions data_tests/saved__backend__/jax/blocks_type_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ def block0(a, b, n):
return result


arguments_blocks = {"block0": ["a", "b", "n"]}
__transonic__ = "0.6.4"
def arguments_blocks():
return {"block0": ["a", "b", "n"]}


def __transonic__():
return "0.7.1"
8 changes: 6 additions & 2 deletions data_tests/saved__backend__/jax/boosted_class_use_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ def __for_method__MyClass2__myfunc(self_attr0, self_attr1, arg):
return self_attr1 + self_attr0 + np.abs(arg) + func_import()


__code_new_method__MyClass2__myfunc = "\n\ndef new_method(self, arg):\n return backend_func(self.attr0, self.attr1, arg)\n\n"
__transonic__ = "0.6.4"
def __code_new_method__MyClass2__myfunc():
return "\n\ndef new_method(self, arg):\n return backend_func(self.attr0, self.attr1, arg)\n\n"


def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/boosted_func_use_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ def func(a, b):
return (a * np.log(b)).max() + func_import()


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
8 changes: 6 additions & 2 deletions data_tests/saved__backend__/jax/class_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ def block1(a, b, n):
return result


arguments_blocks = {"block0": ["a", "b", "n"], "block1": ["a", "b", "n"]}
__transonic__ = "0.6.4"
def arguments_blocks():
return {"block0": ["a", "b", "n"], "block1": ["a", "b", "n"]}


def __transonic__():
return "0.7.1"
8 changes: 6 additions & 2 deletions data_tests/saved__backend__/jax/class_rec_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ def __for_method__Myclass__func(self_attr, self_attr2, arg):
)


__code_new_method__Myclass__func = "\n\ndef new_method(self, arg):\n return backend_func(self.attr, self.attr2, arg)\n\n"
__transonic__ = "0.6.4"
def __code_new_method__Myclass__func():
return "\n\ndef new_method(self, arg):\n return backend_func(self.attr, self.attr2, arg)\n\n"


def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ def func(a, b):
return (a * np.log(b)).max()


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/default_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ def func(a=1, b=None, c=1.0):
return a + c


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
8 changes: 6 additions & 2 deletions data_tests/saved__backend__/jax/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ def __for_method__Transmitter____call__(self_arr, self_freq, inp):
return (inp * np.exp(np.arange(len(inp)) * self_freq * 1j), self_arr)


__code_new_method__Transmitter____call__ = "\n\ndef new_method(self, inp):\n return backend_func(self.arr, self.freq, inp)\n\n"
__transonic__ = "0.6.4"
def __code_new_method__Transmitter____call__():
return "\n\ndef new_method(self, inp):\n return backend_func(self.arr, self.freq, inp)\n\n"


def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/mixed_classic_type_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ def func1(a, b):
return a * np.cos(b)


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/no_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ def func2():
return 1


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/row_sum_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ def row_sum_loops(arr, columns):
return res


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
5 changes: 3 additions & 2 deletions data_tests/saved__backend__/jax/subpackages.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_np_fft(u):


def test_np_linalg_random(u):
(nx, ny) = u.shape
nx, ny = u.shape
u[:] = randn(nx, ny)
u2 = u.T * u
u4 = matrix_power(u2, 2)
Expand All @@ -30,4 +30,5 @@ def test_sp_special(v, x):
return jv(v, x)


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/jax/type_hint_notemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ def compute(a, b, c, d, e):
return tmp


__transonic__ = "0.6.4"
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/numba/add_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ def use_add(n=10000):
return tmp


__transonic__ = ("0.4.7",)
def __transonic__():
return "0.7.1"
3 changes: 2 additions & 1 deletion data_tests/saved__backend__/numba/assign_func_boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ def func(x):
return x**2


__transonic__ = ("0.4.7",)
def __transonic__():
return "0.7.1"
Loading

0 comments on commit afa75ce

Please sign in to comment.