Caffe2 - Python API
A deep learning, cross platform ML framework
nvtoolext.py
1 import os
2 import platform
3 import ctypes.util
4 from subprocess import Popen, PIPE
5 
6 from .cuda import USE_CUDA
7 
8 WINDOWS_HOME = 'C:/Program Files/NVIDIA Corporation/NvToolsExt'
9 
10 if not USE_CUDA:
11  NVTOOLEXT_HOME = None
12 else:
13  # We use nvcc path on Linux and cudart path on macOS
14  osname = platform.system()
15  if osname != 'Windows':
16  NVTOOLEXT_HOME = None
17  else:
18  NVTOOLEXT_HOME = os.getenv('NVTOOLSEXT_PATH', WINDOWS_HOME).replace('\\', '/')
19  if not os.path.exists(NVTOOLEXT_HOME):
20  NVTOOLEXT_HOME = ctypes.util.find_library('nvToolsExt64_1')
21  if NVTOOLEXT_HOME is not None:
22  NVTOOLEXT_HOME = os.path.dirname(NVTOOLEXT_HOME)
23  else:
24  NVTOOLEXT_HOME = None