Skip to content

Commit bd9fa53

Browse files
committed
handle when cuda devices in powered down state
1 parent 73cc61c commit bd9fa53

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

version.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,14 @@ def non_free_opencv_algorithms_present():
8888

8989
#####################################################################
9090

91-
for gpu in range(cv2.cuda.getCudaEnabledDeviceCount()):
92-
print("CUDA enabled GPU device index: " + str(gpu) + " ")
93-
cv2.cuda.printShortCudaDeviceInfo(gpu)
94-
print()
91+
try:
92+
for gpu in range(cv2.cuda.getCudaEnabledDeviceCount()):
93+
print("CUDA enabled GPU device index: " + str(gpu) + " ")
94+
cv2.cuda.printShortCudaDeviceInfo(gpu)
95+
print()
96+
except BaseException:
97+
print("No CUDA enabled devices found : " +
98+
"[none present or in powered down state]")
9599

96100
#####################################################################
97101

0 commit comments

Comments
 (0)