-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a Java accessor for GetVersionString #14876
Conversation
version = initialiseVersion(); | ||
if (version == null) { | ||
throw new IllegalStateException("Failed to load version string from native library"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not generally fail, it does not even return an error code. However, I feel that running this and caching it and risking potential failure, even though most of the people do not need it, is not practical. We only had 1 GH issue that requested it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's there to catch the native code returning null, but if that can't happen I'll remove this.
(void)clazz; // required JNI parameter not needed by functions which don't access their host class. | ||
const char* version = OrtGetApiBase()->GetVersionString(); | ||
jstring versionStr = NULL; | ||
if (version != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'll remove that and see if the asserts are available from there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
I've updated it to simplify things assuming that GetVersionString never returns null. I tried to use the idiom suggested here for the unused parameters, but my IDE and clang think that's a C2x extension which isn't finalized yet, so it uses the old idiom. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/azp run MacOS CI Pipeline, Windows CPU CI Pipeline, Windows GPU CI Pipeline, Windows GPU TensorRT CI Pipeline, ONNX Runtime Web CI Pipeline, onnxruntime-python-checks-ci-pipeline |
Azure Pipelines successfully started running 6 pipeline(s). |
/azp run Linux CPU CI Pipeline, Linux CPU Minimal Build E2E CI Pipeline, Linux GPU CI Pipeline, Linux GPU TensorRT CI Pipeline, Linux Nuphar CI Pipeline, Linux OpenVINO CI Pipeline |
Azure Pipelines successfully started running 5 pipeline(s). |
/azp run orttraining-amd-gpu-ci-pipeline, orttraining-linux-ci-pipeline, orttraining-linux-gpu-ci-pipeline, orttraining-ortmodule-distributed, onnxruntime-binary-size-checks-ci-pipeline |
Azure Pipelines successfully started running 5 pipeline(s). |
### Description Java part of #14873.
Description
Java part of #14873.