MCPcopy Create free account
hub / github.com/apache/tvm / find_cuda_path

Function find_cuda_path

python/tvm/support/nvcc.py:701–720  ·  view source on GitHub ↗

Utility function to find CUDA path Returns ------- path : str Path to CUDA root.

()

Source from the content-addressed store, hash-verified

699
700
701def find_cuda_path():
702 """Utility function to find CUDA path
703
704 Returns
705 -------
706 path : str
707 Path to CUDA root.
708 """
709 if "CUDA_PATH" in os.environ:
710 return os.environ["CUDA_PATH"]
711 cmd = ["which", "nvcc"]
712 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
713 (out, _) = proc.communicate()
714 out = out.decode("utf-8", errors="replace")
715 if proc.returncode == 0:
716 return os.path.realpath(os.path.join(str(out).strip(), "../.."))
717 cuda_path = "/usr/local/cuda"
718 if os.path.exists(os.path.join(cuda_path, "bin/nvcc")):
719 return cuda_path
720 raise RuntimeError("Cannot find CUDA path")
721
722
723def get_cuda_version(cuda_path=None):

Callers 5

_compile_cuda_nvccFunction · 0.85
_compile_cuda_nvrtcFunction · 0.85
get_cuda_versionFunction · 0.85
find_nvshmem_pathsFunction · 0.85
find_libdevice_pathFunction · 0.85

Calls 3

strFunction · 0.85
decodeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…