Skip to content
Snippets Groups Projects

mRich: fix ONNX Runtime crash using slurm

Merged Martin Beyer requested to merge ma.beyer/cbmroot:ort_fix into master
1 file
+ 7
7
Compare changes
  • Side-by-side
  • Inline
@@ -28,13 +28,6 @@ void CbmRichMCbmDenoiseCnn::Init()
fOrtEnv = std::make_unique<Ort::Env>(ORT_LOGGING_LEVEL_WARNING, GetName());
fOrtSessionOptions = std::make_unique<Ort::SessionOptions>();
fOrtSession = std::make_unique<Ort::Session>(*fOrtEnv, fOnnxFilePath.c_str(), *fOrtSessionOptions);
fOrtRunOptions = std::make_unique<Ort::RunOptions>(nullptr);
fOrtAllocatorInfo = std::make_unique<Ort::MemoryInfo>(Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeCPU));
fOrtInput = std::make_unique<Ort::Value>(Ort::Value::CreateTensor<float>(
*fOrtAllocatorInfo, fInput.data(), fInput.size(), fInputShape.data(), fInputShape.size()));
// Thread numbers need to be explicitly set. With the current Ort version it can't detect
// the numbers on the cluster, should be fixed in a later version.
fOrtSessionOptions->SetIntraOpNumThreads(1);
@@ -42,6 +35,13 @@ void CbmRichMCbmDenoiseCnn::Init()
fOrtSessionOptions->SetExecutionMode(ORT_SEQUENTIAL);
fOrtSessionOptions->SetGraphOptimizationLevel(ORT_ENABLE_ALL);
fOrtSession = std::make_unique<Ort::Session>(*fOrtEnv, fOnnxFilePath.c_str(), *fOrtSessionOptions);
fOrtRunOptions = std::make_unique<Ort::RunOptions>(nullptr);
fOrtAllocatorInfo = std::make_unique<Ort::MemoryInfo>(Ort::MemoryInfo::CreateCpu(OrtDeviceAllocator, OrtMemTypeCPU));
fOrtInput = std::make_unique<Ort::Value>(Ort::Value::CreateTensor<float>(
*fOrtAllocatorInfo, fInput.data(), fInput.size(), fInputShape.data(), fInputShape.size()));
fCbmRichDigiMapManager = &CbmRichDigiMapManager::GetInstance();
}
Loading