From 6f9ed1c7fdb518db3268c3ae75419b61113ec8d4 Mon Sep 17 00:00:00 2001 From: Rahul Goswami Date: Thu, 23 Apr 2026 18:01:27 -0400 Subject: [PATCH 1/6] fix CUDA runtime not being available upon first call --- .../src/java/org/apache/solr/cuvs/GpuMetricsService.java | 7 +++++++ 1 file changed, 7 insertions(+) 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..380e61a6277c 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,13 @@ 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) { + log.warn( + "Could not load CUDA runtime library (libcudart not available): {}", e.getMessage()); + } this.metricManager = coreContainer.getMetricManager(); startBackgroundService(); log.info("GPU metrics service initialized"); From fa6d1a3054fa5d01e17a7f7713a46655d605f671 Mon Sep 17 00:00:00 2001 From: Rahul Goswami Date: Thu, 23 Apr 2026 18:55:58 -0400 Subject: [PATCH 2/6] changelog --- .../SOLR-18210-fix-GPU-vector-indexing.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml 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..fafad52d5df9 --- /dev/null +++ b/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml @@ -0,0 +1,31 @@ +# (DELETE ALL COMMENTS UP HERE AFTER FILLING THIS IN + +# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc + +# If the change is minor, don't bother adding a changelog entry. +# For `other` type entries, the threshold to bother with a changelog entry should be even higher. + +# title: +# * The audience is end-users and administrators, not committers. +# * Be short and focused on the user impact. Multiple sentences is fine! +# * For technical/geeky details, prefer the commit message instead of changelog. +# * Reference JIRA issues like `SOLR-12345`, or if no JIRA but have a GitHub PR then `PR#12345`. + +# type: +# `added` for new features/improvements, opt-in by the user typically documented in the ref guide +# `changed` for improvements; not opt-in +# `fixed` for improvements that are deemed to have fixed buggy behavior +# `deprecated` for marking things deprecated +# `removed` for code removed +# `dependency_update` for updates to dependencies +# `other` for anything else, like large/significant refactorings, build changes, +# test infrastructure, or documentation. +# Most such changes are too small/minor to bother with a changelog entry. + +title: Fix GPU vector indexing +type: fixed +authors: + - name: Rahul Goswami +links: + - name: SOLR-18210 + url: https://issues.apache.org/jira/browse/SOLR-18210 From a5ba39de8b31d0d245acb65dfa5369f82ea29e72 Mon Sep 17 00:00:00 2001 From: Rahul Goswami Date: Thu, 23 Apr 2026 18:59:21 -0400 Subject: [PATCH 3/6] changelog edit --- .../SOLR-18210-fix-GPU-vector-indexing.yml | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml b/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml index fafad52d5df9..54a479f18f37 100644 --- a/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml +++ b/changelog/unreleased/SOLR-18210-fix-GPU-vector-indexing.yml @@ -1,28 +1,4 @@ -# (DELETE ALL COMMENTS UP HERE AFTER FILLING THIS IN - -# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc - -# If the change is minor, don't bother adding a changelog entry. -# For `other` type entries, the threshold to bother with a changelog entry should be even higher. - -# title: -# * The audience is end-users and administrators, not committers. -# * Be short and focused on the user impact. Multiple sentences is fine! -# * For technical/geeky details, prefer the commit message instead of changelog. -# * Reference JIRA issues like `SOLR-12345`, or if no JIRA but have a GitHub PR then `PR#12345`. - -# type: -# `added` for new features/improvements, opt-in by the user typically documented in the ref guide -# `changed` for improvements; not opt-in -# `fixed` for improvements that are deemed to have fixed buggy behavior -# `deprecated` for marking things deprecated -# `removed` for code removed -# `dependency_update` for updates to dependencies -# `other` for anything else, like large/significant refactorings, build changes, -# test infrastructure, or documentation. -# Most such changes are too small/minor to bother with a changelog entry. - -title: Fix GPU vector indexing +title: Fix for GPU vector indexing silently falling back to using CPU instead type: fixed authors: - name: Rahul Goswami From cf7c3b0be2e7ef705f6cab3567d5f53ad68b192b Mon Sep 17 00:00:00 2001 From: Rahul Goswami Date: Mon, 27 Apr 2026 00:29:46 -0400 Subject: [PATCH 4/6] use exception object in log call instead of e.getMessage --- .../src/java/org/apache/solr/cuvs/GpuMetricsService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 380e61a6277c..0f1d49805081 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 @@ -81,8 +81,9 @@ public void initialize(CoreContainer coreContainer) { try { System.loadLibrary("cudart"); } catch (UnsatisfiedLinkError e) { - log.warn( - "Could not load CUDA runtime library (libcudart not available): {}", e.getMessage()); + if (log.isWarnEnabled()) { + log.warn("Could not load CUDA runtime library (libcudart not available) ", e); + } } this.metricManager = coreContainer.getMetricManager(); startBackgroundService(); From a4b3ef31b5ca854e87b6efb7cf5595f56500de92 Mon Sep 17 00:00:00 2001 From: Rahul Goswami Date: Mon, 27 Apr 2026 01:09:08 -0400 Subject: [PATCH 5/6] tidy --- .../cuvs/src/java/org/apache/solr/cuvs/GpuMetricsService.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 0f1d49805081..391cfde42ac1 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 @@ -81,9 +81,7 @@ public void initialize(CoreContainer coreContainer) { try { System.loadLibrary("cudart"); } catch (UnsatisfiedLinkError e) { - if (log.isWarnEnabled()) { - log.warn("Could not load CUDA runtime library (libcudart not available) ", e); - } + log.warn("Could not load CUDA runtime library (libcudart not available) ", e); } this.metricManager = coreContainer.getMetricManager(); startBackgroundService(); From c149436c060560ae072db978bcc3c8189f54c1ba Mon Sep 17 00:00:00 2001 From: Rahul Goswami Date: Tue, 5 May 2026 10:07:26 -0400 Subject: [PATCH 6/6] More precise warning for cudart load call --- .../src/java/org/apache/solr/cuvs/GpuMetricsService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 391cfde42ac1..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 @@ -81,7 +81,12 @@ public void initialize(CoreContainer coreContainer) { try { System.loadLibrary("cudart"); } catch (UnsatisfiedLinkError e) { - log.warn("Could not load CUDA runtime library (libcudart not available) ", 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();