Skip to content

Commit 4a680a0

Browse files
committed
cudaGetDeviceProperties 12/13 fallback based on symbol presence
1 parent 2c0e124 commit 4a680a0

File tree

1 file changed

+2
-6
lines changed
  • java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/common

1 file changed

+2
-6
lines changed

java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/common/Util.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,11 @@ private Util() {}
6565
LINKER.downcallHandle(
6666
cudaMemcpyAsync$address(), cudaMemcpyAsync$descriptor(), Linker.Option.critical(true));
6767

68-
private static final String cudaGetDevicePropertiesSymbolName =
69-
"12".equals(System.getenv("RAPIDS_CUDA_MAJOR"))
70-
? "cudaGetDeviceProperties_v2"
71-
: "cudaGetDeviceProperties";
72-
7368
private static final MethodHandle cudaGetDeviceProperties$mh =
7469
LINKER.downcallHandle(
7570
SYMBOL_LOOKUP
76-
.find(cudaGetDevicePropertiesSymbolName)
71+
.find("cudaGetDeviceProperties") // CUDA 13+ symbol name
72+
.or(() -> SYMBOL_LOOKUP.find("cudaGetDeviceProperties_v2")) // CUDA 12 symbol name
7773
.orElseThrow(UnsatisfiedLinkError::new),
7874
FunctionDescriptor.of(headers_h.C_INT, headers_h.C_POINTER, headers_h.C_INT));
7975

0 commit comments

Comments
 (0)