-
In the Java docs, we can add a CUDA GPU with the In its implementation, it seems to first check via Is there a way to expose try {
sessionOptions.addCUDA(0);
} catch (OrtException e) {
sderr("an error occurred, using GPU instead");
} I would prefer try {
if (extractCUDA()) {
sessionOptions.addCUDA(0);
}
} catch (OrtException e) {
sderr("an error occurred, using GPU instead");
} May come in handy when I'm running a program with or without GPU; if it's intended to run on a CPU, it shouldn't raise errors about there being no GPU. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Beta Was this translation helpful? Give feedback.
No, I think trying to add the CUDA EP and catching the exception is the way to check if it's available. Java has no insight into the system dynamic linker which is what makes the decision if it can run CUDA or not.