MCPcopy Create free account
hub / github.com/NVIDIA/DALI / get_nvjpeg_ver

Function get_nvjpeg_ver

dali/test/python/test_utils.py:1073–1100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1071
1072
1073def get_nvjpeg_ver():
1074 nvjpeg_ver_major, nvjpeg_ver_minor, nvjpeg_ver_patch = (
1075 ctypes.c_int(),
1076 ctypes.c_int(),
1077 ctypes.c_int(),
1078 )
1079 try:
1080 nvjpeg_libname = "libnvjpeg.so"
1081 nvjpeg_lib = ctypes.CDLL(nvjpeg_libname)
1082 nvjpeg_lib.nvjpegGetProperty(0, ctypes.byref(nvjpeg_ver_major))
1083 nvjpeg_lib.nvjpegGetProperty(1, ctypes.byref(nvjpeg_ver_minor))
1084 nvjpeg_lib.nvjpegGetProperty(2, ctypes.byref(nvjpeg_ver_patch))
1085 except Exception:
1086 cuda_root = os.environ.get("CUDA_PATH") or os.environ.get("CUDA_HOME") or "/usr/local/cuda"
1087 cuda_lib_dir = os.path.join(cuda_root, "lib64")
1088 if not os.path.isdir(cuda_lib_dir):
1089 return nvjpeg_ver_major.value, nvjpeg_ver_minor.value, nvjpeg_ver_patch.value
1090 for file in os.listdir(cuda_lib_dir):
1091 try:
1092 if file.startswith("libnvjpeg.so"):
1093 nvjpeg_lib = ctypes.CDLL(os.path.join(cuda_lib_dir, file))
1094 nvjpeg_lib.nvjpegGetProperty(0, ctypes.byref(nvjpeg_ver_major))
1095 nvjpeg_lib.nvjpegGetProperty(1, ctypes.byref(nvjpeg_ver_minor))
1096 nvjpeg_lib.nvjpegGetProperty(2, ctypes.byref(nvjpeg_ver_patch))
1097 break
1098 except Exception:
1099 continue
1100 return nvjpeg_ver_major.value, nvjpeg_ver_minor.value, nvjpeg_ver_patch.value

Callers 5

test_image_decoder_fusedFunction · 0.90
test_fancy_upsamplingFunction · 0.90
test_image_decoder_fusedFunction · 0.90
test_fancy_upsamplingFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected