[Mobile] Correct Understanding Of Multi-Processing/Multi-threading Concept And General Performance Of onnxruntime-react-native #13593
Unanswered
jackylu0124
asked this question in
General
Replies: 1 comment 1 reply
-
Could anyone please provide some clarifications on this? Any insights would be hugely appreciated. Thanks a lot in advance! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the issue
I have a few questions on the concept of multi-processing/multi-threading and also on general performance in
onnxruntime-react-native
's inference session creation and run:onnxruntime-react-native
relies on the onnxruntime Java API for its native code on Android and relies on the onnxruntime C/C++ API (through Objective C interop) for its native code on iOS, wouldonnxruntime-react-native
's functions be executed on a separate process from the main React Native app's process?create()
(https://onnxruntime.ai/docs/api/js/interfaces/InferenceSessionFactory.html#create) andrun()
(https://onnxruntime.ai/docs/api/js/interfaces/InferenceSession.html#run) synchronous/blocking with respect to the main logic that invoke those functions in the React Native app? (By main logic, I mean, for example, the code that handles preprocessing and postprocessing of the tensor data in pure JavaScript and the code that controls the button's reaction in React Native) My understanding is that thoseonnxruntime-react-native
functions are not blocking because I checked the Native Modules files for theonnxruntime-react-native
module, and I don't see the functions annotated with@ReactMethod(isBlockingSynchronousMethod = true)
on Android and annotated withRCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD
in Objective C (reference: https://reactnative.dev/docs/native-modules-android#synchronous-methods and https://reactnative.dev/docs/native-modules-ios#synchronous-methods), but please correct me if I am wrong.interOpNumThreads
andintraOpNumThreads
inSessionOptions
as well as"sequential"
and"parallel"
mode for theexecutionMode
, but they have very little impact, if any, on the inference time of models on my Android phone (Samsung 9) in comparison to not passingSessionOptions
into thecreate()
function when creating inference sessions. Is this expected?To reproduce
I used
implementation "com.microsoft.onnxruntime:onnxruntime-android:latest.integration@aar"
in thebuild.gradle
file in theonnxruntime-react-native
module in order to be able to use the full build.Urgency
High
Platform
React Native
OS Version
N/A
ONNX Runtime Installation
Released Package
Compiler Version (if 'Built from Source')
No response
Package Name (if 'Released Package')
onnxruntime-react-native
ONNX Runtime Version or Commit ID
1.13.1
ONNX Runtime API
JavaScript
Architecture
Other / Unknown
Execution Provider
Default CPU
Execution Provider Library Version
No response
Beta Was this translation helpful? Give feedback.
All reactions