Skip to content

Can we instantiate an engine multiple times for concurrent use? #1034

Answered by frankfliu
hmf asked this question in Q&A
Discussion options

You must be logged in to vote

DJL load engine shared library into java process. Once process can only load the library once. So there is one engine in the Java process.

For inference, you can load model once, and use multiple threads to run inference concurrently. DJL make sure it's safe for all the engines that running inference in multithreading fashion.

Training is completely different use case. Especially form MXNet, for the best performance in training, you have to MXNet threaded engine, which is not thread safe. If you want to run training and at the same time run multithreaded inference, you might crash your JVM.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by hmf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants