Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 52a269c

Browse files
committed
feat: add cupy for build
1 parent 0d76435 commit 52a269c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@
1313
print("Error: version of setuptools is too old (<42)!")
1414
sys.exit(1)
1515

16+
def get_cupy() -> str:
17+
CUDA_VERSION = os.environ.get("CUDA_VERSION", None)
18+
if CUDA_VERSION>="11.2": # after 11.2 use
19+
cupy_pack = f"cupy-cuda{CUDA_VERSION[:2]}x"
20+
else:
21+
cupy_pack = f"cupy-cuda{CUDA_VERSION[:4].replace('.','')}"
22+
return cupy_pack
1623

1724
if __name__ == "__main__":
1825
import skbuild
1926

27+
cupy = get_cupy()
2028
PytorchNvCodec = "PytorchNvCodec @ git+https://github.com/NVIDIA/VideoProcessingFramework.git#subdirectory=src/PytorchNvCodec/"
2129
skbuild.setup(
2230
name="PyNvCodec",
@@ -28,7 +36,7 @@
2836
extras_require={
2937
# , "PyOpenGL-accelerate" # does not compile on 3.10
3038
"dev": ["pycuda", "pyopengl", "torch", "torchvision", "opencv-python", "onnx", "tensorrt", f"PytorchNvCodec @ file://{os.getcwd()}/src/PytorchNvCodec/"],
31-
"samples": ["pycuda", "pyopengl", "torch", "torchvision", "opencv-python", "onnx", "tensorrt", "tqdm", PytorchNvCodec],
39+
"samples": ["pycuda", "pyopengl", "torch", "torchvision", "opencv-python", "onnx", "tensorrt", "tqdm", cupy, PytorchNvCodec],
3240
"tests": ["pycuda", "pyopengl", "torch", "torchvision", "opencv-python", PytorchNvCodec],
3341
"torch": ["torch", "torchvision", "opencv-python", PytorchNvCodec],
3442
"tensorrt": ["torch", "torchvision", PytorchNvCodec],

0 commit comments

Comments
 (0)