Minimizing memory usage with ORT models using Ort::SessionOptions, RunOptions, Allocator, etc. #22763
Unanswered
sevagh
asked this question in
Performance Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In a memory-constrained environment (e.g. WebAssembly with a max of 4 GB), I would like to reduce the memory usage of my ORT model as much as possible.
Note that I am building onnxruntime for WASM with only simd128, no pthread (I do my own threading with my web worker by splitting the workload among multiple module instantiations).
These are my current settings:
I also have a global Allocator object at the top of my cpp file which I use for creating tensors, etc.:
So far from my experiments, this has reached the best/lowest memory usage (e.g. enabling CPU memory arena blows up the memory usage right off the bat).
Are there other options I could be using? How about
RunOptions
? Is there anallocator.AggressiveCleanup()
I should use after callingsession.Run()
? Etc.My model only loads a single Ort::Session once, uses it for 1 or many passes of inference.
Any help is appreciated!
Beta Was this translation helpful? Give feedback.
All reactions