Skip to content

Commit 9ed60e9

Browse files
committed
Please consider the following formatting changes
1 parent e7cd6fa commit 9ed60e9

File tree

4 files changed

+49
-49
lines changed

4 files changed

+49
-49
lines changed

GPU/GPUTracking/DataTypes/ORTRootSerializer.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ namespace o2::tpc
2525

2626
class ORTRootSerializer
2727
{
28-
public:
29-
ORTRootSerializer() = default;
30-
~ORTRootSerializer() = default;
28+
public:
29+
ORTRootSerializer() = default;
30+
~ORTRootSerializer() = default;
3131

32-
void setOnnxModel(const char* onnxModel, uint32_t size);
33-
const char* getONNXModel() const { return mModelBuffer.data(); }
34-
uint32_t getONNXModelSize() const { return static_cast<uint32_t>(mModelBuffer.size()); }
32+
void setOnnxModel(const char* onnxModel, uint32_t size);
33+
const char* getONNXModel() const { return mModelBuffer.data(); }
34+
uint32_t getONNXModelSize() const { return static_cast<uint32_t>(mModelBuffer.size()); }
3535

36-
private:
37-
std::vector<char> mModelBuffer; ///< buffer for serialization
38-
ClassDefNV(ORTRootSerializer, 1);
36+
private:
37+
std::vector<char> mModelBuffer; ///< buffer for serialization
38+
ClassDefNV(ORTRootSerializer, 1);
3939
};
4040

4141
} // namespace o2::tpc

GPU/GPUTracking/utils/convert_onnx_to_root_serialized.C

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -111,44 +111,44 @@ void rootToOnnx(std::string infile, std::string outfile, std::string key)
111111
/// Upload the ONNX model to CCDB from an ONNX file
112112
/// !!! Adjust the metadata, path and validity !!!
113113
void uploadToCCDBFromONNX(std::string onnxFile,
114-
const std::map<std::string, std::string>& metadata,
115-
// { // some example metadata entries
116-
// "nnCCDBLayerType": "FC",
117-
// "nnCCDBWithMomentum": "0",
118-
// "inputDType": "FP16",
119-
// "nnCCDBInteractionRate": "500",
120-
// "outputDType": "FP16",
121-
// "nnCCDBEvalType": "regression_c1",
122-
// "nnCCDBBeamType": "pp",
123-
// "partName": "blob",
124-
// "quality": "3"
125-
// }
126-
long tsMin /* = 1 */,
127-
long tsMax /* = 4108971600000 */,
128-
std::string ccdbPath /* = "Users/c/csonnabe/TPC/Clusterization" */,
129-
std::string objname /* = "net_regression_r1.root" */,
130-
std::string ccdbUrl /* = "http://alice-ccdb.cern.ch" */)
114+
const std::map<std::string, std::string>& metadata,
115+
// { // some example metadata entries
116+
// "nnCCDBLayerType": "FC",
117+
// "nnCCDBWithMomentum": "0",
118+
// "inputDType": "FP16",
119+
// "nnCCDBInteractionRate": "500",
120+
// "outputDType": "FP16",
121+
// "nnCCDBEvalType": "regression_c1",
122+
// "nnCCDBBeamType": "pp",
123+
// "partName": "blob",
124+
// "quality": "3"
125+
// }
126+
long tsMin /* = 1 */,
127+
long tsMax /* = 4108971600000 */,
128+
std::string ccdbPath /* = "Users/c/csonnabe/TPC/Clusterization" */,
129+
std::string objname /* = "net_regression_r1.root" */,
130+
std::string ccdbUrl /* = "http://alice-ccdb.cern.ch" */)
131131
{
132132
readOnnxModelFromFile(onnxFile);
133133

134134
o2::ccdb::CcdbApi api;
135135
api.init(ccdbUrl);
136136

137137
// build full CCDB path including filename
138-
const std::string fullPath = ccdbPath;//.back() == '/' ? (ccdbPath + objname) : (ccdbPath + "/" + objname);
138+
const std::string fullPath = ccdbPath; //.back() == '/' ? (ccdbPath + objname) : (ccdbPath + "/" + objname);
139139

140140
api.storeAsTFileAny(&serializer, fullPath, metadata, tsMin, tsMax);
141141
}
142142

143143
/// Upload the ONNX model to CCDB from a ROOT file
144144
/// !!! Adjust the metadata, path and validity !!!
145145
void uploadToCCDBFromROOT(std::string rootFile,
146-
const std::map<std::string, std::string>& metadata,
147-
long tsMin /* = 1 */,
148-
long tsMax /* = 4108971600000 */,
149-
std::string ccdbPath /* = "Users/c/csonnabe/TPC/Clusterization" */,
150-
std::string objname /* = "net_regression_r1.root" */,
151-
std::string ccdbUrl /* = "http://alice-ccdb.cern.ch" */)
146+
const std::map<std::string, std::string>& metadata,
147+
long tsMin /* = 1 */,
148+
long tsMax /* = 4108971600000 */,
149+
std::string ccdbPath /* = "Users/c/csonnabe/TPC/Clusterization" */,
150+
std::string objname /* = "net_regression_r1.root" */,
151+
std::string ccdbUrl /* = "http://alice-ccdb.cern.ch" */)
152152
{
153153
// read ROOT file, extract ORTRootSerializer object and upload via storeAsTFileAny
154154
TFile inRootFile(rootFile.c_str());
@@ -170,23 +170,23 @@ void uploadToCCDBFromROOT(std::string rootFile,
170170
api.init(ccdbUrl);
171171

172172
// build full CCDB path including filename
173-
const std::string fullPath = ccdbPath;//.back() == '/' ? (ccdbPath + objname) : (ccdbPath + "/" + objname);
173+
const std::string fullPath = ccdbPath; //.back() == '/' ? (ccdbPath + objname) : (ccdbPath + "/" + objname);
174174

175175
api.storeAsTFileAny(&serializer, fullPath, metadata, tsMin, tsMax);
176176

177177
inRootFile.Close();
178178
}
179179

180180
void convert_onnx_to_root_serialized(const std::string& onnxFile,
181-
const std::string& rootFile,
182-
int mode = 0,
183-
int ccdbUpload = 0,
184-
const std::string& metadataStr = "nnCCDBLayerType=FC/nnCCDBWithMomentum=0/inputDType=FP16/nnCCDBInteractionRate=500/outputDType=FP16/nnCCDBEvalType=regression_c1/nnCCDBBeamType=pp/partName=blob/quality=3",
185-
long tsMin = 1,
186-
long tsMax = 4108971600000,
187-
std::string ccdbPath = "Users/c/csonnabe/TPC/Clusterization",
188-
std::string objname = "net_regression_r1.root",
189-
std::string ccdbUrl = "http://alice-ccdb.cern.ch")
181+
const std::string& rootFile,
182+
int mode = 0,
183+
int ccdbUpload = 0,
184+
const std::string& metadataStr = "nnCCDBLayerType=FC/nnCCDBWithMomentum=0/inputDType=FP16/nnCCDBInteractionRate=500/outputDType=FP16/nnCCDBEvalType=regression_c1/nnCCDBBeamType=pp/partName=blob/quality=3",
185+
long tsMin = 1,
186+
long tsMax = 4108971600000,
187+
std::string ccdbPath = "Users/c/csonnabe/TPC/Clusterization",
188+
std::string objname = "net_regression_r1.root",
189+
std::string ccdbUrl = "http://alice-ccdb.cern.ch")
190190
{
191191
// parse metadataStr of the form key=value/key2=value2/...
192192
std::map<std::string, std::string> metadata;
@@ -206,12 +206,12 @@ void convert_onnx_to_root_serialized(const std::string& onnxFile,
206206
start = sep + 1;
207207
}
208208

209-
if (ccdbUpload == 0){
209+
if (ccdbUpload == 0) {
210210
if (mode == 0)
211211
onnxToRoot(onnxFile, rootFile, o2::ccdb::CcdbApi::CCDBOBJECT_ENTRY);
212212
else if (mode == 1)
213213
rootToOnnx(rootFile, onnxFile, o2::ccdb::CcdbApi::CCDBOBJECT_ENTRY);
214-
} else if (ccdbUpload == 1){
214+
} else if (ccdbUpload == 1) {
215215
if (mode == 0)
216216
uploadToCCDBFromROOT(rootFile, metadata, tsMin, tsMax, ccdbPath, objname, ccdbUrl);
217217
else if (mode == 1)

GPU/Workflow/src/GPUWorkflowSpec.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,11 +1278,11 @@ Inputs GPURecoWorkflowSpec::inputs()
12781278
printSettings(metadata);
12791279
}
12801280

1281-
if(mSpecConfig.nnEvalMode[0] == "c1") {
1281+
if (mSpecConfig.nnEvalMode[0] == "c1") {
12821282
metadata["nnCCDBEvalType"] = "classification_c1";
12831283
convert_map_to_metadata(metadata, ccdb_metadata);
12841284
inputs.emplace_back("nn_classification_c1", gDataOriginTPC, "NNCLUSTERIZER_C1", 0, Lifetime::Condition, ccdbParamSpec(nnClusterizerSettings.nnCCDBPath + "/" + metadata["nnCCDBEvalType"], ccdb_metadata, 0));
1285-
} else if(mSpecConfig.nnEvalMode[0] == "c2") {
1285+
} else if (mSpecConfig.nnEvalMode[0] == "c2") {
12861286
metadata["nnCCDBLayerType"] = nnClusterizerSettings.nnCCDBRegressionLayerType;
12871287
metadata["nnCCDBEvalType"] = "classification_c2";
12881288
convert_map_to_metadata(metadata, ccdb_metadata);
@@ -1294,7 +1294,7 @@ Inputs GPURecoWorkflowSpec::inputs()
12941294
convert_map_to_metadata(metadata, ccdb_metadata);
12951295
inputs.emplace_back("nn_regression_c1", gDataOriginTPC, "NNCLUSTERIZER_R1", 0, Lifetime::Condition, ccdbParamSpec(nnClusterizerSettings.nnCCDBPath + "/" + metadata["nnCCDBEvalType"], ccdb_metadata, 0));
12961296

1297-
if(mSpecConfig.nnEvalMode[1] == "r2") {
1297+
if (mSpecConfig.nnEvalMode[1] == "r2") {
12981298
metadata["nnCCDBEvalType"] = "regression_c2";
12991299
convert_map_to_metadata(metadata, ccdb_metadata);
13001300
inputs.emplace_back("nn_regression_c2", gDataOriginTPC, "NNCLUSTERIZER_R2", 0, Lifetime::Condition, ccdbParamSpec(nnClusterizerSettings.nnCCDBPath + "/" + metadata["nnCCDBEvalType"], ccdb_metadata, 0));

GPU/Workflow/src/GPUWorkflowTPC.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void GPURecoWorkflowSpec::finaliseCCDBTPC(ConcreteDataMatcher& matcher, void* ob
300300
} else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "NNCLUSTERIZER_C2", 0)) {
301301
mConfig->configCalib.nnClusterizerNetworks[0] = static_cast<o2::tpc::ORTRootSerializer*>(obj);
302302
LOG(info) << "(NN CLUS) " << (mConfig->configCalib.nnClusterizerNetworks[0])->getONNXModelSize() << " bytes loaded for NN clusterizer: classification_c2";
303-
} else if(matcher == ConcreteDataMatcher(gDataOriginTPC, "NNCLUSTERIZER_R1", 0)){
303+
} else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "NNCLUSTERIZER_R1", 0)) {
304304
mConfig->configCalib.nnClusterizerNetworks[1] = static_cast<o2::tpc::ORTRootSerializer*>(obj);
305305
LOG(info) << "(NN CLUS) " << (mConfig->configCalib.nnClusterizerNetworks[1])->getONNXModelSize() << " bytes loaded for NN clusterizer: regression_c1";
306306
} else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "NNCLUSTERIZER_R2", 0)) {

0 commit comments

Comments
 (0)