forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
186 lines (173 loc) · 5 KB
/
setup.py
File metadata and controls
186 lines (173 loc) · 5 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# Copyright 2021 NVIDIA Corporation. All rights reserved.
#
# Please refer to the NVIDIA end user license agreement (EULA) associated
# with this source code for terms and conditions that govern your use of
# this software. Any use, reproduction, disclosure, or distribution of
# this software and related documentation outside the terms of the EULA
# is strictly prohibited.
import os
import shutil
import sys
import sysconfig
from setuptools import find_packages, setup
from setuptools.extension import Extension
from Cython.Build import cythonize
from distutils.sysconfig import get_python_lib
import versioneer
install_requires = ["cython"]
try:
nthreads = int(os.environ.get("PARALLEL_LEVEL", "0") or "0")
except Exception:
nthreads = 0
include_dirs = [
os.path.dirname(sysconfig.get_path("include")),
]
library_dirs = [get_python_lib(), os.path.join(os.sys.prefix, "lib")]
extra_cythonize_kwargs = {}
if sys.platform == 'win32':
extra_compile_args = []
else:
extra_compile_args = [
'-std=c++14',
'-fpermissive',
'-Wno-deprecated-declarations',
'-D _GLIBCXX_ASSERTIONS'
]
if '--debug' in sys.argv:
extra_cythonize_kwargs['gdb_debug'] = True
extra_compile_args += ['-g', '-O0']
else:
extra_compile_args += ['-O3']
# private
extensions = cythonize(
[
Extension(
"*",
sources=["cuda/_cuda/*.pyx"],
include_dirs=[],
library_dirs=[],
runtime_library_dirs=[],
libraries=[],
language="c++",
extra_compile_args=extra_compile_args,
)
],
nthreads=nthreads,
compiler_directives=dict(
profile=True, language_level=3, embedsignature=True, binding=True
),
**extra_cythonize_kwargs
)
# utils
extensions += cythonize(
[
Extension(
"*",
sources=["cuda/_lib/*.pyx", "cuda/_lib/param_packer.cpp"],
include_dirs=include_dirs,
library_dirs=library_dirs,
runtime_library_dirs=[],
libraries=[],
language="c++",
extra_compile_args=extra_compile_args,
)
],
nthreads=nthreads,
compiler_directives=dict(
profile=True, language_level=3, embedsignature=True, binding=True
),
**extra_cythonize_kwargs
)
extensions += cythonize(
[
Extension(
"*",
sources=["cuda/_lib/ccudart/*.pyx"],
include_dirs=include_dirs,
library_dirs=library_dirs,
runtime_library_dirs=[],
libraries=[],
language="c++",
extra_compile_args=extra_compile_args,
)
],
nthreads=nthreads,
compiler_directives=dict(
profile=True, language_level=3, embedsignature=True, binding=True
),
**extra_cythonize_kwargs
)
# public
extensions += cythonize(
[
Extension(
"*",
sources=["cuda/*.pyx"],
include_dirs=include_dirs,
library_dirs=library_dirs,
runtime_library_dirs=[],
libraries=[],
language="c++",
extra_compile_args=extra_compile_args,
)
],
nthreads=nthreads,
compiler_directives=dict(
profile=True, language_level=3, embedsignature=True, binding=True
),
**extra_cythonize_kwargs
)
# tests:
extensions += cythonize(
[
Extension(
"*",
sources=["cuda/tests/*.pyx"],
include_dirs=include_dirs,
library_dirs=library_dirs,
runtime_library_dirs=[],
libraries=[],
language="c++",
extra_compile_args=["-std=c++14"],
)
],
nthreads=nthreads,
compiler_directives=dict(
profile=True, language_level=3, embedsignature=True, binding=True
),
)
setup(
name="cuda",
version=versioneer.get_version(),
description="CUDA for Python",
url="",
author="NVIDIA Corporation",
license="Other",
license_files = ('LICENCE',),
classifiers=[
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Scientific/Engineering",
"License :: Other/Proprietary License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Environment :: GPU :: NVIDIA CUDA",
"Environment :: GPU :: NVIDIA CUDA :: 11.0",
"Environment :: GPU :: NVIDIA CUDA :: 11.1",
"Environment :: GPU :: NVIDIA CUDA :: 11.2",
"Environment :: GPU :: NVIDIA CUDA :: 11.3",
"Environment :: GPU :: NVIDIA CUDA :: 11.4",
],
# Include the separately-compiled shared library
setup_requires=["cython"],
ext_modules=extensions,
packages=find_packages(include=["cuda", "cuda.*"]),
package_data=dict.fromkeys(
find_packages(include=["cuda", "cuda.*"]),
["*.pxd", "*.pyx", "*.h", "*.cpp"],
),
cmdclass=versioneer.get_cmdclass(),
install_requires=install_requires,
zip_safe=False,
)