forked from danielcamposramos/Knowledge3D
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_nvcc_backend.py
More file actions
37 lines (29 loc) · 1.13 KB
/
test_nvcc_backend.py
File metadata and controls
37 lines (29 loc) · 1.13 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
#!/usr/bin/env python3
"""Test if CuPy can use nvcc instead of NVRTC."""
def main() -> int:
import os
from pathlib import Path
# Set environment to use nvcc
os.environ["CUPY_CACHE_DIR"] = str(Path(__file__).parent / ".cupy_cache")
os.environ["CUPY_DUMP_CUDA_SOURCE_ON_ERROR"] = "1"
print("Testing CuPy with different backends...")
import cupy as cp
print(f"CuPy version: {cp.__version__}")
print(f"CUDA available: {cp.cuda.is_available()}")
# Try the failing linalg.norm operation
print("\nTesting cp.linalg.norm (the operation that fails)...")
try:
vec = cp.random.rand(10, 3).astype(cp.float32)
norms = cp.linalg.norm(vec, axis=1)
print(f"✓ SUCCESS: linalg.norm worked! Result shape: {norms.shape}")
return 0
except Exception as e:
error_msg = str(e)
if "hypotf" in error_msg or "atan2" in error_msg:
print("✗ FAILED: GCC 15 incompatibility")
print(f" Error: {error_msg[:200]}...")
else:
print(f"✗ FAILED: {error_msg[:200]}")
return 1
if __name__ == "__main__":
raise SystemExit(main())