Commit 03c6a75e308 by Ashwin Vishnu

Mention other major subpackages, add tests

parent f6928ea9d40
Pipeline #3633 failed with stage
in 3 minutes 25 seconds
import cython
import numpy as np
cimport numpy as np
cpdef test_np_fft(np.ndarray[np.float_t, ndim=1] u)
cpdef test_np_linalg_random(np.ndarray[np.float_t, ndim=2] u)
try:
import cython
except ImportError:
from transonic_cl import cython
from numpy.fft import rfft
from numpy.random import randn
from numpy.linalg import matrix_power
def test_np_fft(u):
u_fft = rfft(u)
return u_fft
def test_np_linalg_random(u):
(nx, ny) = u.shape
u[:] = randn(nx, ny)
u2 = u.T * u
u4 = matrix_power(u2, 2)
return u4
__transonic__ = ("0.4.2",)
# __protected__ from numba import njit
from numpy.fft import rfft
from numpy.random import randn
from numpy.linalg import matrix_power
# __protected__ @njit
def test_np_fft(u):
u_fft = rfft(u)
return u_fft
# __protected__ @njit
def test_np_linalg_random(u):
(nx, ny) = u.shape
u[:] = randn(nx, ny)
u2 = u.T * u
u4 = matrix_power(u2, 2)
return u4
__transonic__ = ("0.4.2",)
from numpy.fft import rfft
from numpy.random import randn
from numpy.linalg import matrix_power
def test_np_fft(u):
u_fft = rfft(u)
return u_fft
def test_np_linalg_random(u):
(nx, ny) = u.shape
u[:] = randn(nx, ny)
u2 = u.T * u
u4 = matrix_power(u2, 2)
return u4
__transonic__ = ("0.4.2",)
export test_np_fft(float64[:])
export test_np_linalg_random(float64[:, :])
export __transonic__
from numpy.fft import rfft
from numpy.linalg import matrix_power
from numpy.random import randn
# TODO: requires test dependency scipy
# from scipy.special import jv
from transonic import boost
@boost
def test_np_fft(u: "float[]"):
u_fft = rfft(u)
return u_fft
@boost
def test_np_linalg_random(u: "float[:,:]"):
nx, ny = u.shape
u[:] = randn(nx, ny)
u2 = u.T * u
u4 = matrix_power(u2, 2)
return u4
# @boost
# def test_sp_special(v:int, x:float):
# return jv(v, x)
......@@ -186,7 +186,10 @@ packages_supported_by_pythran = [
"cmath",
"numpy",
"numpy.fft",
"numpy.linalg",
"numpy.random",
"scipy",
"scipy.special",
]
......
......@@ -125,3 +125,11 @@ def test_create_trans_classic():
sys.argv = f"transonic -nc {path_file_pythran}".split()
run()
@pytest.mark.skipif(not path_data_tests.exists(), reason="no data tests")
@pytest.mark.skipif(nb_proc > 1, reason="No commandline in MPI")
def test_create_pythran_subpackages():
path_file = path_data_tests / "subpackages.py"
sys.argv = f"transonic -nc {path_file}".split()
run()
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