Skip to content

Commit 9e746f7

Browse files
committed
misc: Refactor long conditional
1 parent 970769e commit 9e746f7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

devito/arch/archinfo.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,10 +657,11 @@ def check_cuda_runtime():
657657
runtime_version = ctypes.c_int()
658658

659659
# Check the get*Version call succeeds and is a non-zero value
660-
if cuda.cudaDriverGetVersion(ctypes.byref(driver_version)) == 0 \
661-
and cuda.cudaRuntimeGetVersion(ctypes.byref(runtime_version)) == 0 \
662-
and driver_version.value:
660+
call_success = cuda.cudaDriverGetVersion(ctypes.byref(driver_version)) == 0
661+
call_success &= cuda.cudaRuntimeGetVersion(ctypes.byref(runtime_version)) == 0
662+
call_success &= bool(driver_version.value)
663663

664+
if call_success:
664665
driver_v = parse(str(driver_version.value/1000))
665666
runtime_v = parse(str(runtime_version.value/1000))
666667
# First check the "major" version, known to be incompatible

0 commit comments

Comments
 (0)