microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.87k stars 2.94k forks source link

auto_set_affinity can't be set to true for parallel executor #11205

Open mmorlonDeezer opened 2 years ago

mmorlonDeezer commented 2 years ago

i'm trying to understang cpu affinity settings by reading the code :

i'm a noob in C++ and the ort code base but it seems strange : if my guess is right => line 309 is always false because of line 302

https://github.com/microsoft/onnxruntime/blob/9707181257391323dfe7170d506650ded04dc59c/onnxruntime/core/session/inference_session.cc#L302-L309

snnn commented 2 years ago

"to.thread_pool_size == 0" . It could be non-zero.

glutamatt commented 2 years ago

image

  1. (line 302) we enter the if block because because session_options_.execution_mode == ExecutionMode::ORT_PARALLEL
  2. (line 309) session_options_.execution_mode == ExecutionMode::ORT_SEQUENTIAL is always false so to.thread_pool_size == 0 && session_options_.execution_mode == ExecutionMode::ORT_SEQUENTIAL is always false
  3. (line 308) to.auto_set_affinity always is set to false whatever the to.thread_pool_size value is