diff --git a/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml b/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml new file mode 100644 index 000000000000..54a479f18f37 --- /dev/null +++ b/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml @@ -0,0 +1,7 @@ +title: Fix for GPU vector indexing silently falling back to using CPU instead +type: fixed +authors: + - name: Rahul Goswami +links: + - name: SOLR-18210 + url: https://issues.apache.org/jira/browse/SOLR-18210 diff --git a/solr/modules/cuvs/src/java/org/apache/solr/cuvs/GpuMetricsService.java b/solr/modules/cuvs/src/java/org/apache/solr/cuvs/GpuMetricsService.java index 9156a55841c4..02268a373688 100644 --- a/solr/modules/cuvs/src/java/org/apache/solr/cuvs/GpuMetricsService.java +++ b/solr/modules/cuvs/src/java/org/apache/solr/cuvs/GpuMetricsService.java @@ -77,6 +77,17 @@ public static synchronized GpuMetricsService getInstance() { public void initialize(CoreContainer coreContainer) { if (initialized.compareAndSet(false, true)) { + // Ensure CUDA runtime is loaded before any cuVS provider access + try { + System.loadLibrary("cudart"); + } catch (UnsatisfiedLinkError e) { + String msg = e.getMessage(); + if (msg != null && msg.contains("already loaded in another classloader")) { + // cudart is available, just loaded elsewhere - safe to continue + } else { + log.warn("Could not load CUDA runtime library (libcudart not available) ", e); + } + } this.metricManager = coreContainer.getMetricManager(); startBackgroundService(); log.info("GPU metrics service initialized");