Skip to content

Commit e358016

Browse files
authored
Merge branch 'AliceO2Group:dev' into dev
2 parents 8f3d9ee + 606a14e commit e358016

File tree

183 files changed

+2699
-18650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+2699
-18650
lines changed

.cmake-format.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,6 @@
6666
"HEADERS": '*',
6767
}
6868
},
69-
"o2_target_man_page": {
70-
"kwargs": {
71-
"NAME": '+',
72-
"SECTION": '*',
73-
}
74-
},
7569
"add_root_dictionary": {
7670
"kwargs": {
7771
"LINKDEF": '+',

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
# Dependabot configuration
3+
# Reference: https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
4+
5+
version: 2
6+
updates:
7+
- package-ecosystem: "github-actions" # See documentation for possible values
8+
directory: "/" # Location of package manifests
9+
schedule:
10+
interval: "weekly"

Algorithm/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111

1212
o2_add_header_only_library(Algorithm INTERFACE_LINK_LIBRARIES O2::Headers)
1313

14-
o2_target_man_page(Algorithm NAME Algorithm SECTION 3)
15-
o2_target_man_page(Algorithm NAME algorithm_parser SECTION 3)
16-
1714
o2_add_test(o2formatparser
1815
SOURCES test/o2formatparser.cxx
1916
COMPONENT_NAME Algorithm

Algorithm/doc/Algorithm.3.in

Lines changed: 0 additions & 12 deletions
This file was deleted.

Algorithm/doc/algorithm_parser.3.in

Lines changed: 0 additions & 135 deletions
This file was deleted.

CCDB/src/CcdbApi.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,14 +958,14 @@ void* CcdbApi::extractFromLocalFile(std::string const& filename, std::type_info
958958

959959
bool CcdbApi::initTGrid() const
960960
{
961-
if (mNeedAlienToken && !mAlienInstance) {
961+
if (mNeedAlienToken && !gGrid) {
962962
static bool allowNoToken = getenv("ALICEO2_CCDB_NOTOKENCHECK") && atoi(getenv("ALICEO2_CCDB_NOTOKENCHECK"));
963963
if (!allowNoToken && !checkAlienToken()) {
964964
LOG(fatal) << "Alien Token Check failed - Please get an alien token before running with https CCDB endpoint, or alice-ccdb.cern.ch!";
965965
}
966-
mAlienInstance = TGrid::Connect("alien");
966+
TGrid::Connect("alien");
967967
static bool errorShown = false;
968-
if (!mAlienInstance && errorShown == false) {
968+
if (!gGrid && errorShown == false) {
969969
if (allowNoToken) {
970970
LOG(error) << "TGrid::Connect returned nullptr. May be due to missing alien token";
971971
} else {
@@ -974,7 +974,7 @@ bool CcdbApi::initTGrid() const
974974
errorShown = true;
975975
}
976976
}
977-
return mAlienInstance != nullptr;
977+
return gGrid != nullptr;
978978
}
979979

980980
void* CcdbApi::downloadFilesystemContent(std::string const& url, std::type_info const& tinfo, std::map<string, string>* headers) const

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ include(O2AddTestRootMacro)
8686
include(O2ReportNonTestedMacros)
8787
include(O2TargetRootDictionary)
8888
include(O2DataFile)
89-
include(O2TargetManPage)
9089
include(O2AddWorkflow)
9190
include(O2SetROOTPCMDependencies)
9291
include(O2AddHipifiedExecutable)
@@ -117,10 +116,6 @@ endif()
117116

118117
add_subdirectory(config)
119118

120-
add_custom_target(man ALL)
121-
o2_target_man_page(man NAME o2)
122-
o2_target_man_page(man NAME FairMQDevice)
123-
124119
# Testing and packaging only needed if we are the top level directory
125120
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
126121
# Documentation

Common/DCAFitter/include/DCAFitter/DCAFitterN.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ class DCAFitterN
142142
FailInv2ndDeriv, // inversion of 2nd derivatives failed
143143
FailCorrTracks, // correction of tracks to updated x failed
144144
FailCloserAlt, // alternative PCA is closer
145+
//
146+
NStatusesDefined
145147
};
146148

147149
static constexpr int getNProngs() { return N; }
@@ -989,7 +991,7 @@ GPUd() bool DCAFitterN<N, Args...>::minimizeChi2()
989991
}
990992

991993
if (mMaxDZIni > 0 && !roughDZCut()) { // apply rough cut on tracks Z difference
992-
mFitStatus[mCurHyp] = FitStatus::RejTrackX;
994+
mFitStatus[mCurHyp] = FitStatus::RejTrackRoughZ;
993995
return false;
994996
}
995997

@@ -1063,7 +1065,7 @@ GPUd() bool DCAFitterN<N, Args...>::minimizeChi2NoErr()
10631065
setTrackPos(mTrPos[mCurHyp][i], mCandTr[mCurHyp][i]); // prepare positions
10641066
}
10651067
if (mMaxDZIni > 0 && !roughDZCut()) { // apply rough cut on tracks Z difference
1066-
mFitStatus[mCurHyp] = FitStatus::RejTrackX;
1068+
mFitStatus[mCurHyp] = FitStatus::RejTrackRoughZ;
10671069
return false;
10681070
}
10691071

Common/ML/include/ML/OrtInterface.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,10 @@ class OrtModel
4545

4646
public:
4747
// Constructors & destructors
48-
OrtModel() = default;
49-
OrtModel(std::unordered_map<std::string, std::string> optionsMap) { init(optionsMap); }
50-
void init(std::unordered_map<std::string, std::string> optionsMap)
51-
{
52-
initOptions(optionsMap);
53-
initEnvironment();
54-
}
55-
virtual ~OrtModel() = default;
48+
OrtModel();
49+
OrtModel(std::unordered_map<std::string, std::string> optionsMap);
50+
void init(std::unordered_map<std::string, std::string> optionsMap);
51+
virtual ~OrtModel();
5652

5753
// General purpose
5854
void initOptions(std::unordered_map<std::string, std::string> optionsMap);
@@ -113,7 +109,7 @@ class OrtModel
113109
private:
114110
// ORT variables -> need to be hidden as pImpl
115111
struct OrtVariables;
116-
OrtVariables* mPImplOrt;
112+
std::unique_ptr<OrtVariables> mPImplOrt;
117113

118114
// Input & Output specifications of the loaded network
119115
std::vector<const char*> mInputNamesChar, mOutputNamesChar;

Common/ML/src/OrtInterface.cxx

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ namespace o2
2727
namespace ml
2828
{
2929

30+
OrtModel::OrtModel() = default;
31+
OrtModel::OrtModel(std::unordered_map<std::string, std::string> optionsMap) { init(optionsMap); }
32+
OrtModel::~OrtModel() = default;
33+
void OrtModel::init(std::unordered_map<std::string, std::string> optionsMap)
34+
{
35+
initOptions(optionsMap);
36+
initEnvironment();
37+
}
38+
3039
struct OrtModel::OrtVariables { // The actual implementation is hidden in the .cxx file
3140
// ORT runtime objects
3241
Ort::RunOptions runOptions;
33-
std::shared_ptr<Ort::Env> env = nullptr;
34-
std::shared_ptr<Ort::Session> session = nullptr; ///< ONNX session
42+
std::unique_ptr<Ort::Env> env = nullptr;
43+
std::unique_ptr<Ort::Session> session = nullptr; ///< ONNX session
3544
Ort::SessionOptions sessionOptions;
3645
Ort::AllocatorWithDefaultOptions allocator;
3746
Ort::MemoryInfo memoryInfo = Ort::MemoryInfo("Cpu", OrtAllocatorType::OrtDeviceAllocator, 0, OrtMemType::OrtMemTypeDefault);
@@ -41,7 +50,7 @@ struct OrtModel::OrtVariables { // The actual implementation is hidden in the .c
4150
// General purpose
4251
void OrtModel::initOptions(std::unordered_map<std::string, std::string> optionsMap)
4352
{
44-
mPImplOrt = new OrtVariables();
53+
mPImplOrt = std::make_unique<OrtVariables>();
4554

4655
// Load from options map
4756
if (!optionsMap.contains("model-path")) {
@@ -101,7 +110,7 @@ void OrtModel::initOptions(std::unordered_map<std::string, std::string> optionsM
101110

102111
void OrtModel::initEnvironment()
103112
{
104-
mPImplOrt->env = std::make_shared<Ort::Env>(
113+
mPImplOrt->env = std::make_unique<Ort::Env>(
105114
OrtLoggingLevel(mLoggingLevel),
106115
(mEnvName.empty() ? "ORT" : mEnvName.c_str()),
107116
// Integrate ORT logging into Fairlogger
@@ -129,7 +138,7 @@ void OrtModel::initSession()
129138
if (mAllocateDeviceMemory) {
130139
memoryOnDevice(mDeviceId);
131140
}
132-
mPImplOrt->session = std::make_shared<Ort::Session>(*mPImplOrt->env, mModelPath.c_str(), mPImplOrt->sessionOptions);
141+
mPImplOrt->session = std::make_unique<Ort::Session>(*mPImplOrt->env, mModelPath.c_str(), mPImplOrt->sessionOptions);
133142
mPImplOrt->ioBinding = std::make_unique<Ort::IoBinding>(*mPImplOrt->session);
134143

135144
setIO();
@@ -147,12 +156,12 @@ void OrtModel::memoryOnDevice(int32_t deviceIndex)
147156
(mPImplOrt->sessionOptions).AddConfigEntry("session.use_env_allocators", "1"); // This should enable to use the volatile memory allocation defined in O2/GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizerHost.cxx; not working yet: ONNX still assigns new memory at init time
148157
(mPImplOrt->sessionOptions).AddConfigEntry("session_options.enable_cpu_mem_arena", "0"); // This should enable to use the volatile memory allocation defined in O2/GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizerHost.cxx; not working yet: ONNX still assigns new memory at init time
149158
// Arena memory shrinkage comes at performance cost
150-
/// For now prefer to use single allocation, enabled by O2/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu -> SetONNXGPUStream -> rocm_options.arena_extend_strategy = 0;
151-
// (mPImplOrt->runOptions).AddConfigEntry("memory.enable_memory_arena_shrinkage", ("gpu:" + std::to_string(deviceIndex)).c_str()); // See kOrtRunOptionsConfigEnableMemoryArenaShrinkage, https://github.com/microsoft/onnxruntime/blob/90c263f471bbce724e77d8e62831d3a9fa838b2f/include/onnxruntime/core/session/onnxruntime_run_options_config_keys.h#L27
159+
// For now prefer to use single allocation, enabled by O2/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu -> SetONNXGPUStream -> rocm_options.arena_extend_strategy = 0;
160+
(mPImplOrt->runOptions).AddConfigEntry("memory.enable_memory_arena_shrinkage", ("gpu:" + std::to_string(deviceIndex)).c_str()); // See kOrtRunOptionsConfigEnableMemoryArenaShrinkage, https://github.com/microsoft/onnxruntime/blob/90c263f471bbce724e77d8e62831d3a9fa838b2f/include/onnxruntime/core/session/onnxruntime_run_options_config_keys.h#L27
152161

153162
std::string dev_mem_str = "";
154163
if (mDeviceType == "ROCM") {
155-
dev_mem_str = "Hip";
164+
dev_mem_str = "HipPinned";
156165
}
157166
if (mDeviceType == "CUDA") {
158167
dev_mem_str = "Cuda";
@@ -166,7 +175,7 @@ void OrtModel::memoryOnDevice(int32_t deviceIndex)
166175

167176
void OrtModel::resetSession()
168177
{
169-
mPImplOrt->session = std::make_shared<Ort::Session>(*(mPImplOrt->env), mModelPath.c_str(), mPImplOrt->sessionOptions);
178+
mPImplOrt->session = std::make_unique<Ort::Session>(*(mPImplOrt->env), mModelPath.c_str(), mPImplOrt->sessionOptions);
170179
}
171180

172181
// Getters
@@ -252,7 +261,7 @@ void OrtModel::setIO()
252261

253262
void OrtModel::setEnv(Ort::Env* env)
254263
{
255-
mPImplOrt->env = std::shared_ptr<Ort::Env>(env);
264+
mPImplOrt->env.reset(env);
256265
}
257266

258267
// Inference
@@ -308,6 +317,14 @@ void OrtModel::inference(I* input, int64_t input_size, O* output)
308317
(mPImplOrt->ioBinding)->BindOutput(mOutputNames[0].c_str(), outputTensor);
309318

310319
(mPImplOrt->session)->Run(mPImplOrt->runOptions, *mPImplOrt->ioBinding);
320+
// mPImplOrt->session->Run(
321+
// mPImplOrt->runOptions,
322+
// mInputNamesChar.data(),
323+
// &inputTensor,
324+
// mInputNamesChar.size(),
325+
// mOutputNamesChar.data(),
326+
// &outputTensor,
327+
// mOutputNamesChar.size());
311328
}
312329

313330
template void OrtModel::inference<OrtDataType::Float16_t, OrtDataType::Float16_t>(OrtDataType::Float16_t*, int64_t, OrtDataType::Float16_t*);
@@ -427,10 +444,7 @@ template std::vector<OrtDataType::Float16_t> OrtModel::inference<OrtDataType::Fl
427444
// Release session
428445
void OrtModel::release(bool profilingEnabled)
429446
{
430-
// if (profilingEnabled) {
431-
// mPImplOrt->session->EndProfiling();
432-
// }
433-
LOG(info) << "(ORT) Size of mPImplOrt: " << sizeof(*mPImplOrt) << " bytes";
447+
mPImplOrt.reset();
434448
}
435449

436450
// private

0 commit comments

Comments
 (0)