-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
85 lines (81 loc) · 3.15 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2021 Pi-Yueh Chuang <[email protected]>
#
# Distributed under terms of the BSD 3-Clause license.
"""Install TorchSWE.
Notes
-----
Configuration of the package/project has been migrated to setup.cfg. Only extension modules (i.e.,
those require being compiled first) remain here.
"""
import numpy
from setuptools import setup, Extension
from Cython.Build import cythonize, build_ext
exts = [
Extension(
name="torchswe.kernels.cython", sources=["torchswe/kernels/cython_kernels.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.kernels.cupy", sources=["torchswe/kernels/cupy_kernels.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cython_outflow", sources=["torchswe/bcs/cython_outflow.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cython_linear_extrap", sources=["torchswe/bcs/cython_linear_extrap.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cython_const_val", sources=["torchswe/bcs/cython_const_val.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cython_inflow", sources=["torchswe/bcs/cython_inflow.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cupy_outflow", sources=["torchswe/bcs/cupy_outflow.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cupy_linear_extrap", sources=["torchswe/bcs/cupy_linear_extrap.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cupy_const_val", sources=["torchswe/bcs/cupy_const_val.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
Extension(
name="torchswe.bcs._cupy_inflow", sources=["torchswe/bcs/cupy_inflow.pyx"],
include_dirs=[numpy.get_include()], language="c",
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")]
),
]
setup(
cmdclass={"build_ext": build_ext},
ext_modules=cythonize(
exts,
include_path=["torchswe/bcs"],
compiler_directives={
"language_level": "3",
"boundscheck": False,
"wraparound": False,
"initializedcheck": False
},
)
)