Skip to content
Permalink
Browse files

upd pynvml.py

  • Loading branch information...
iperov committed Apr 5, 2019
1 parent 406ef91 commit 41601f50b84c02bc32cd55943adb0b6df31d404b
Showing with 12 additions and 5 deletions.
  1. +12 −5 nnlib/pynvml.py
@@ -636,9 +636,16 @@ def _LoadNvmlLibrary():
if (nvmlLib == None):
try:
if (sys.platform[:3] == "win"):
# cdecl calling convention
# load nvml.dll from %ProgramFiles%/NVIDIA Corporation/NVSMI/nvml.dll
nvmlLib = CDLL(os.path.join(os.getenv("ProgramFiles", "C:/Program Files"), "NVIDIA Corporation/NVSMI/nvml.dll"))
searchPaths = [
os.path.join(os.getenv("ProgramFiles", r"C:\Program Files"), r"NVIDIA Corporation\NVSMI\nvml.dll"),
os.path.join(os.getenv("WinDir", r"C:\Windows"), r"System32\nvml.dll"),
]
nvmlPath = next((x for x in searchPaths if os.path.isfile(x)), None)
if (nvmlPath == None):
_nvmlCheckReturn(NVML_ERROR_LIBRARY_NOT_FOUND)
else:
# cdecl calling convention
nvmlLib = CDLL(nvmlPath)
else:
# assume linux
nvmlLib = CDLL("libnvidia-ml.so.1")
@@ -1668,7 +1675,7 @@ def nvmlSystemGetTopologyGpuSet(cpuNumber):

if ret != NVML_SUCCESS:
raise NVMLError(ret)
print ("c_count.value")
print(c_count.value)
# call again with a buffer
device_array = c_nvmlDevice_t * c_count.value
c_devices = device_array()
@@ -1717,4 +1724,4 @@ def nvmlDeviceGetCudaComputeCapability(device):
if (ret != NVML_SUCCESS):
raise NVMLError(ret)

return c_major.value, c_minor.value
return c_major.value, c_minor.value

0 comments on commit 41601f5

Please sign in to comment.
You can’t perform that action at this time.