Repository navigation
GH-1389, GH-1390: Let SentenceVectorsDL run on a GPU and fix the first CUDA request in a fresh JVM - #1462
Open
mawiesne wants to merge 1 commit into
Open
GH-1389, GH-1390: Let SentenceVectorsDL run on a GPU and fix the first CUDA request in a fresh JVM#1462mawiesne wants to merge 1 commit into
mawiesne wants to merge 1 commit into
Conversation
rzo1
marked this pull request as draft
October 9, 2026 09:31
rzo1
force-pushed
the
OPENNLP-1982-sentence-vectors-inference-options
branch
from
October 9, 2026 09:33
3d7395d to
fb06aef
Compare
mawiesne
commented
Oct 9, 2026
Contributor
Author
Contributor
|
I'll get this out of draft tonight. Thanks for pushing it. It's a cool feature |
Contributor
|
Working through this now. |
krickert
force-pushed
the
OPENNLP-1982-sentence-vectors-inference-options
branch
from
October 11, 2026 01:55
fb06aef to
576206d
Compare
krickert
marked this pull request as ready for review
October 11, 2026 02:06
krickert
force-pushed
the
OPENNLP-1982-sentence-vectors-inference-options
branch
from
October 11, 2026 10:03
ea2c0a8 to
bfaf52b
Compare
rzo1
requested changes
Oct 11, 2026
krickert
force-pushed
the
OPENNLP-1982-sentence-vectors-inference-options
branch
from
October 11, 2026 22:22
bfaf52b to
880b364
Compare
krickert
force-pushed
the
OPENNLP-1982-sentence-vectors-inference-options
branch
from
October 12, 2026 01:16
880b364 to
528974d
Compare
rzo1
requested changes
Oct 13, 2026
…t CUDA request in a fresh JVM SentenceVectorsDL always created default session options, so it ran on the CPU even with opennlp-dl-gpu. A new constructor takes InferenceOptions, like NameFinderDL and DocumentCategorizerDL, and uses the GPU settings and the lower case setting from them; a lower case setting in the options takes precedence over the lowerCase argument. The existing constructors keep their behavior. AbstractDL.sessionOptions added the CUDA provider before any OrtEnvironment existed. Loading the provider needs ONNX Runtime's default logger, which only exists once an environment does, so the first GPU request in a fresh JVM failed with "Attempt to use DefaultLogger but none has been registered". The environment is now created first. This affects NameFinderDL and DocumentCategorizerDL as well. When the provider cannot be added, the session options created for the request are closed before the exception is thrown. A test makes the first CUDA request of a child JVM and requires that the provider is added or rejected for a reason other than the missing default logger; it runs in opennlp-dl-gpu and fails with the AbstractDL of main. Other tests request a device id no machine has and check that ONNX Runtime rejects it for SentenceVectorsDL, NameFinderDL and DocumentCategorizerDL, and compare vectors on CUDA device 0 with the CPU session (skipped without a CUDA provider or device). The tiny model test fixtures are shared in TinyVectorModels. The opennlp-dl-gpu test classpath no longer has the CPU onnxruntime next to onnxruntime_gpu. Since onnxruntime_gpu has native libraries for linux-x64 and win-x64 only, the opennlp-dl-gpu tests are skipped on macOS and aarch64. The machine learning chapter documents the GPU setup and the supported platforms. Fixes #1389 Fixes #1390 Co-authored-by: Richard Zowalla <rzo1@apache.org> Co-authored-by: Martin Wiesner <mawiesne@apache.org> Signed-off-by: Kristian Rickert <kristian@apache.org> Co-authored-by: Claude Code 2.1.296 (Opus 5.5)
krickert
force-pushed
the
OPENNLP-1982-sentence-vectors-inference-options
branch
from
October 13, 2026 19:22
528974d to
aeac043
Compare
Contributor
|
Pushed the second round. opennlp-dl-gpu passes 1205 tests with none skipped on an RTX 4080 SUPER with CUDA 13 and cuDNN 9, including the cold start and CPU/GPU parity tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SentenceVectorsDL always created default session options, so it ran on the CPU even with opennlp-dl-gpu. A new constructor takes InferenceOptions, like NameFinderDL and DocumentCategorizerDL, and uses the GPU settings and the lower case setting from them. A lower case setting in the options takes precedence over the lowerCase argument. The existing constructors keep their behavior.
AbstractDL.sessionOptions added the CUDA provider before any OrtEnvironment existed. Loading the provider needs ONNX Runtime's default logger, which only exists once an environment does, so the first GPU request in a fresh JVM failed with "Attempt to use DefaultLogger but none has been registered". The environment is now created first. This affects NameFinderDL and DocumentCategorizerDL as well.
A test runs the first CUDA request in a child JVM. Other tests request a device id no machine has and check that ONNX Runtime rejects it, and compare vectors on CUDA device 0 with the CPU session (skipped without a CUDA provider or device). The opennlp-dl-gpu test classpath no longer has the CPU onnxruntime next to onnxruntime_gpu. The machine learning chapter documents the GPU setup. ONNX Runtime does not fall back to the CPU when CUDA or the device is unavailable; the constructor throws.
Tested in opennlp-dl-gpu on an RTX 4080 SUPER inside nvidia/cuda:12.8.1-cudnn with --gpus all: all 1214 tests pass and none are skipped. A host with CUDA 12.4 cannot load the ONNX Runtime 1.30 GPU build.
Fixes #1389
Fixes #1390