-
Notifications
You must be signed in to change notification settings - Fork 915
/
setup.py
96 lines (80 loc) · 2.54 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
86
87
88
89
90
91
92
93
94
95
96
# Copyright (c) 2019-2021, NVIDIA CORPORATION.
import os
import re
import shutil
from setuptools import find_packages, setup
import versioneer
install_requires = [
"cudf",
"dask==2021.4.0",
"distributed>=2.22.0,<=2021.4.0",
"fsspec>=0.6.0",
"numpy",
"pandas>=1.0,<=1.2.4",
]
extras_require = {
"test": [
"numpy",
"pandas>=1.0,<=1.2.4",
"pytest",
"numba>=0.49.0,!=0.51.0",
"dask==2021.4.0",
"distributed>=2.22.0,<=2021.4.0",
]
}
def get_cuda_version_from_header(cuda_include_dir, delimeter=""):
cuda_version = None
with open(
os.path.join(cuda_include_dir, "cuda.h"), "r", encoding="utf-8"
) as f:
for line in f.readlines():
if re.search(r"#define CUDA_VERSION ", line) is not None:
cuda_version = line
break
if cuda_version is None:
raise TypeError("CUDA_VERSION not found in cuda.h")
cuda_version = int(cuda_version.split()[2])
return "%d%s%d" % (
cuda_version // 1000,
delimeter,
(cuda_version % 1000) // 10,
)
CUDA_HOME = os.environ.get("CUDA_HOME", False)
if not CUDA_HOME:
path_to_cuda_gdb = shutil.which("cuda-gdb")
if path_to_cuda_gdb is None:
raise OSError(
"Could not locate CUDA. "
"Please set the environment variable "
"CUDA_HOME to the path to the CUDA installation "
"and try again."
)
CUDA_HOME = os.path.dirname(os.path.dirname(path_to_cuda_gdb))
if not os.path.isdir(CUDA_HOME):
raise OSError(f"Invalid CUDA_HOME: directory does not exist: {CUDA_HOME}")
cuda_include_dir = os.path.join(CUDA_HOME, "include")
cupy_package_name = "cupy-cuda" + get_cuda_version_from_header(
cuda_include_dir
)
install_requires.append(cupy_package_name)
setup(
name="dask-cudf",
version=versioneer.get_version(),
description="Utilities for Dask and cuDF interactions",
url="https://github.com/rapidsai/cudf",
author="NVIDIA Corporation",
license="Apache 2.0",
classifiers=[
"Intended Audience :: Developers",
"Topic :: Database",
"Topic :: Scientific/Engineering",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=find_packages(exclude=["tests", "tests.*"]),
cmdclass=versioneer.get_cmdclass(),
install_requires=install_requires,
extras_require=extras_require,
)