From bd00e60afb6a04be0c3198e03105e2a552e2c312 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 1 Sep 2024 21:40:09 -0400 Subject: [PATCH] disable threadpools (causes deadlocks in onnxruntime::InferenceSession::~InferenceSession()) --- src/algorithms/onnx/InclusiveKinematicsML.cc | 2 ++ src/algorithms/onnx/ONNXInference.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/algorithms/onnx/InclusiveKinematicsML.cc b/src/algorithms/onnx/InclusiveKinematicsML.cc index 2483d6c62..091e637ef 100644 --- a/src/algorithms/onnx/InclusiveKinematicsML.cc +++ b/src/algorithms/onnx/InclusiveKinematicsML.cc @@ -34,6 +34,8 @@ namespace eicrecon { // onnxruntime setup m_env = Ort::Env(ORT_LOGGING_LEVEL_WARNING, "inclusive-kinematics-ml"); Ort::SessionOptions session_options; + session_options.SetInterOpNumThreads(1); + session_options.SetIntraOpNumThreads(1); try { m_session = Ort::Session(m_env, m_cfg.modelPath.c_str(), session_options); diff --git a/src/algorithms/onnx/ONNXInference.cc b/src/algorithms/onnx/ONNXInference.cc index 2fa80cdb7..00665cd85 100644 --- a/src/algorithms/onnx/ONNXInference.cc +++ b/src/algorithms/onnx/ONNXInference.cc @@ -54,6 +54,8 @@ namespace eicrecon { // onnxruntime setup m_env = Ort::Env(ORT_LOGGING_LEVEL_WARNING, name().data()); Ort::SessionOptions session_options; + session_options.SetInterOpNumThreads(1); + session_options.SetIntraOpNumThreads(1); try { m_session = Ort::Session(m_env, m_cfg.modelPath.c_str(), session_options); Ort::AllocatorWithDefaultOptions allocator;