Beispiel #1
0
def transonize():

    from transonic.dist import make_backend_files

    paths = [
        "fluidsim/base/time_stepping/pseudo_spect.py",
        "fluidsim/base/output/increments.py",
        "fluidsim/operators/operators2d.py",
        "fluidsim/operators/operators3d.py",
        "fluidsim/solvers/ns2d/solver.py",
    ]
    make_backend_files([here / path for path in paths])
Beispiel #2
0
def test_detect_backend_extensions():

    shutil.rmtree(path_data_tests / f"__{backend_default}__",
                  ignore_errors=True)

    names = [
        "assign_func_boost.py",
        "assign_func_jit.py",
        "block_fluidsim.py",
        "blocks_type_hints.py",
        "boosted_func_use_import.py",
        # "boosted_class_use_import.py",  # was forgotten...
        "class_blocks.py",
        "classic.py",
        # "class_rec_calls.py",
        # "methods.py",
        "mixed_classic_type_hint.py",
        # "no_arg.py",
        "type_hint_notemplate.py",
        "no_pythran_.py",
    ]

    make_backend_files((path_data_tests / name for name in names))
    ext_names = detect_transonic_extensions(path_data_tests)

    if can_import_accelerator():
        # -2 files (no_pythran.py and assign_fun_jit.py)
        number_not_transonized = 2

        if len(ext_names) != len(names) - number_not_transonized:
            print("ext_names:\n", pformat(sorted(ext_names)), sep="")
            print("names:\n", pformat(sorted(names)), sep="")
            raise RuntimeError

    shutil.rmtree(path_data_tests / f"__{backend_default}__",
                  ignore_errors=True)
Beispiel #3
0
def trasonize():
    from transonic.dist import make_backend_files

    paths = ["fluidsht/sht2d/operators.py"]
    make_backend_files([here / path for path in paths])
Beispiel #4
0
from transonic.dist import make_backend_files, init_transonic_extensions
import numpy as np

here = Path(__file__).parent.absolute()

pack_name = "package_cythran"
pack_dir = here / pack_name

# Get the version from the relevant file
version = run_path(pack_name + "/_version.py")
__version__ = version["__version__"]

install_requires = ["transonic", "numpy", "matplotlib", "numba"]

relative_paths = ["calcul.py"]
make_backend_files([pack_dir / path for path in relative_paths],
                   backend="pythran")

relative_paths = ["util.py"]
make_backend_files([pack_dir / path for path in relative_paths],
                   backend="cython")

relative_paths = ["other.py"]
make_backend_files([pack_dir / path for path in relative_paths],
                   backend="numba")

extensions = []
if "egg_info" not in sys.argv:
    compile_arch = os.getenv("CARCH", "native")
    extensions = init_transonic_extensions(
        pack_name,
        backend="pythran",
Beispiel #5
0
path_sources = Path(__file__).parent.absolute()
include_dirs = [np.get_include()]

try:
    from Cython.Build import cythonize
except ImportError:
    extensions = [
        Extension(
            "add_cython",
            include_dirs=[str(path_sources)] + include_dirs,
            libraries=["m"],
            library_dirs=[],
            sources=[str(path_sources / "add_cython.c")],
        )
    ]
    print(extensions)
else:
    extensions = cythonize(
        Extension("add_cython", ["add_cython.pyx"], include_dirs=include_dirs))

make_backend_files([path_sources / "add.py"])
extensions.extend(init_transonic_extensions(".", include_dirs=include_dirs))

setup(
    name="add",
    ext_modules=extensions,
    script_name="setup.py",
    script_args=["build_ext"],
    cmdclass=dict(build_ext=ParallelBuildExt),
)
Beispiel #6
0
# dependency so that people might install its cythonized version
geo = ["geopandas", "shapely >= 1.0.0"]

install_requires = [x.strip() for x in all_reqs if "git+" not in x]
dependency_links = [
    x.strip().replace("git+", "") for x in all_reqs if x.startswith("git+")
]

if platform.system() == "Windows":
    backend = "numba"
    install_requires.append("numba")
else:
    backend = "pythran"

paths = ["pylandstats/landscape.py"]
make_backend_files([here / path for path in paths], backend=backend)

if platform.system() == "Linux":
    compile_args = ("-O3", "-DUSE_XSIMD")
else:
    compile_args = ("-O3", )

extensions = init_transonic_extensions("pylandstats",
                                       compile_args=compile_args,
                                       backend=backend)

setup(
    name="pylandstats",
    version=__version__,
    description="Open-source Python library to compute landscape metrics",
    long_description=long_description,
Beispiel #7
0
from transonic.dist import make_backend_files, init_transonic_extensions
import numpy as np

here = Path(__file__).parent.absolute()

pack_name = "package_simple"
pack_dir = here / pack_name

# Get the version from the relevant file
version = run_path(pack_name + "/_version.py")
__version__ = version["__version__"]

install_requires = ["transonic", "numpy", "matplotlib"]

relative_paths = ["util.py", "calcul.py"]
make_backend_files([pack_dir / path for path in relative_paths])

extensions = []
if "egg_info" not in sys.argv:
    compile_arch = os.getenv("CARCH", "native")
    extensions = init_transonic_extensions(
        pack_name,
        include_dirs=[np.get_include()],
        compile_args=("-O3", f"-march={compile_arch}", "-DUSE_XSIMD"),
    )

setup(
    version=__version__,
    packages=find_packages(exclude=["doc"]),
    install_requires=install_requires,
    ext_modules=extensions,
Beispiel #8
0
from distutils.core import setup
from pathlib import Path

import numpy as np

from transonic.dist import make_backend_files, init_transonic_extensions

path_here = Path(__file__).parent.absolute()
include_dirs = [np.get_include()]

pack_name = "future"

paths = tuple((path_here / pack_name).glob("*.py"))

for backend in ("pythran", "cython", "numba"):
    make_backend_files(paths, backend=backend)

extensions = []
if "egg_info" not in sys.argv:
    extensions = init_transonic_extensions(
        pack_name,
        backend="pythran",
        include_dirs=[np.get_include()],
        compile_args=("-O3", "-DUSE_XSIMD"),
        inplace=True,
    )
    extensions.extend(
        init_transonic_extensions(pack_name,
                                  backend="cython",
                                  inplace=True,
                                  annotate=True))