Skip to content

ONNX Runtime Thread Safety #10107

Answered by Craigacp
genbattle asked this question in Other Q&A
Dec 22, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

In the Java API (which uses the C API) we have a singleton environment shared between all threads, and sessions themselves are thread safe after construction. We test the thread safety of Session.Run in our unit tests - https://github.com/microsoft/onnxruntime/blob/master/java/src/test/java/ai/onnxruntime/InferenceTest.java#L614. I'm not sure how this interacts with some of the more complicated bits of the API around custom allocators, but we haven't exposed those in Java yet.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kashev
Comment options

Answer selected by genbattle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants