Skip to content
Snippets Groups Projects
Commit 0f393d46 authored by Martin Beyer's avatar Martin Beyer Committed by Florian Uhlig
Browse files

mRich: fix ONNX Runtime crash using slurm

parent 2395232c
No related branches found
No related tags found
1 merge request!1853mRich: fix ONNX Runtime crash using slurm
Pipeline #29721 passed
......@@ -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();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment