Skip to content

Commit 88cbce8

Browse files
committed
Please consider the following formatting changes
1 parent b437e38 commit 88cbce8

9 files changed

Lines changed: 77 additions & 61 deletions

File tree

Common/ML/include/ML/OrtInterface.h

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@
2626
// O2 includes
2727
#include "Framework/Logger.h"
2828

29-
namespace Ort {
30-
struct SessionOptions;
31-
struct MemoryInfo;
32-
}
29+
namespace Ort
30+
{
31+
struct SessionOptions;
32+
struct MemoryInfo;
33+
} // namespace Ort
3334

3435
namespace o2
3536
{
@@ -44,7 +45,8 @@ class OrtModel
4445
// Constructors & destructors
4546
OrtModel() = default;
4647
OrtModel(std::unordered_map<std::string, std::string> optionsMap) { init(optionsMap); }
47-
void init(std::unordered_map<std::string, std::string> optionsMap) {
48+
void init(std::unordered_map<std::string, std::string> optionsMap)
49+
{
4850
initOptions(optionsMap);
4951
initEnvironment();
5052
}
@@ -71,8 +73,18 @@ class OrtModel
7173
void setDeviceId(int32_t id) { deviceId = id; }
7274
void setIO();
7375
void setActiveThreads(int threads) { intraOpNumThreads = threads; }
74-
void setIntraOpNumThreads(int threads) { if(deviceType == "CPU") { intraOpNumThreads = threads; } }
75-
void setInterOpNumThreads(int threads) { if(deviceType == "CPU") { interOpNumThreads = threads; } }
76+
void setIntraOpNumThreads(int threads)
77+
{
78+
if (deviceType == "CPU") {
79+
intraOpNumThreads = threads;
80+
}
81+
}
82+
void setInterOpNumThreads(int threads)
83+
{
84+
if (deviceType == "CPU") {
85+
interOpNumThreads = threads;
86+
}
87+
}
7688

7789
// Conversion
7890
template <class I, class O>

Common/ML/src/OrtInterface.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void OrtModel::initOptions(std::unordered_map<std::string, std::string> optionsM
9898

9999
void OrtModel::initEnvironment()
100100
{
101-
if(allocateDeviceMemory) {
101+
if (allocateDeviceMemory) {
102102
memoryOnDevice(deviceId);
103103
}
104104
pImplOrt->env = std::make_shared<Ort::Env>(
@@ -181,7 +181,8 @@ std::vector<O> OrtModel::v2v(std::vector<I>& input, bool clearInput)
181181
}
182182
}
183183

184-
void OrtModel::setIO() {
184+
void OrtModel::setIO()
185+
{
185186
for (size_t i = 0; i < (pImplOrt->session)->GetInputCount(); ++i) {
186187
mInputNames.push_back((pImplOrt->session)->GetInputNameAllocated(i, pImplOrt->allocator).get());
187188
}

GPU/GPUTracking/Base/GPUReconstructionCPU.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
#include "GPUReconstructionKernelIncludes.h"
2525
#include "GPUReconstructionKernels.h"
2626

27-
namespace Ort {
28-
struct SessionOptions;
27+
namespace Ort
28+
{
29+
struct SessionOptions;
2930
}
3031

3132
namespace o2::gpu

GPU/GPUTracking/Base/GPUReconstructionProcessing.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
#include <functional>
2323
#include <atomic>
2424

25-
namespace Ort {
25+
namespace Ort
26+
{
2627
struct SessionOptions;
2728
}
2829

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ extern "C" __declspec(dllexport) o2::gpu::GPUReconstruction* GPUReconstruction_C
2525
extern "C" o2::gpu::GPUReconstruction* GPUReconstruction_Create_CUDA(const o2::gpu::GPUSettingsDeviceBackend& cfg);
2626
#endif
2727

28-
namespace Ort {
29-
struct SessionOptions;
28+
namespace Ort
29+
{
30+
struct SessionOptions;
3031
}
3132

3233
namespace o2::gpu

GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,16 +665,16 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
665665
clustererNN.mISector = sector;
666666
clustererNN.nnClusterizerTotalClusters = processors()->tpcClusterer[lane].mNMaxClusters;
667667
nnApplications[lane].initClusterizer(nn_settings, clustererNN);
668-
if (doGPU){
668+
if (doGPU) {
669669
clustererNNShadow.deviceId = deviceId;
670670
clustererNNShadow.mISector = sector;
671671
clustererNNShadow.nnClusterizerTotalClusters = processors()->tpcClusterer[lane].mNMaxClusters;
672672
nnApplications[lane].initClusterizer(nn_settings, clustererNNShadow);
673673
}
674674
AllocateRegisteredMemory(clustererNN.mMemoryId);
675675
});
676-
if (doGPU){
677-
WriteToConstantMemory(RecoStep::TPCClusterFinding, (char*)&processors()->tpcNNClusterer - (char*)processors(), &processorsShadow()->tpcNNClusterer, sizeof(GPUTPCNNClusterizer)*NSECTORS, mRec->NStreams() - 1, &mEvents->init);
676+
if (doGPU) {
677+
WriteToConstantMemory(RecoStep::TPCClusterFinding, (char*)&processors()->tpcNNClusterer - (char*)processors(), &processorsShadow()->tpcNNClusterer, sizeof(GPUTPCNNClusterizer) * NSECTORS, mRec->NStreams() - 1, &mEvents->init);
678678
}
679679
}
680680
#endif

GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class GPUTPCNNClusterizer : public GPUProcessor
5252
int nnClusterizerModelClassNumOutputNodes = -1;
5353
int nnClusterizerModelReg1NumOutputNodes = -1;
5454
int nnClusterizerModelReg2NumOutputNodes = -1;
55-
int nnInferenceInputDType = 0; // 0: float16, 1: float32
55+
int nnInferenceInputDType = 0; // 0: float16, 1: float32
5656
int nnInferenceOutputDType = 0; // 0: float16, 1: float32
5757
int mISector = -1;
5858
int deviceId = -1;

GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizerHost.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class GPUTPCNNClusterizerHost
4545

4646
std::unordered_map<std::string, std::string> OrtOptions;
4747
o2::ml::OrtModel model_class, model_reg_1, model_reg_2; // For splitting clusters
48-
std::vector<bool> modelsUsed = {false, false, false}; // 0: class, 1: reg_1, 2: reg_2
48+
std::vector<bool> modelsUsed = {false, false, false}; // 0: class, 1: reg_1, 2: reg_2
4949
int32_t deviceId = -1;
5050
std::vector<std::string> reg_model_paths;
5151

GPU/GPUTracking/TPCClusterFinder/GPUTPCNNClusterizerKernels.cxx

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::fil
147147
bool is_row_boundary = ((row + r) > (o2::tpc::constants::MAXGLOBALPADROW - 1)) || ((row + r) < 0);
148148
if (is_row_boundary) {
149149
if (dtype == 0) {
150-
clustererNN.inputData_16[base_idx*clustererNN.nnClusterizerElementSize + transient_index] = (OrtDataType::Float16_t)(static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue));
150+
clustererNN.inputData_16[base_idx * clustererNN.nnClusterizerElementSize + transient_index] = (OrtDataType::Float16_t)(static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue));
151151
} else {
152-
clustererNN.inputData_32[base_idx*clustererNN.nnClusterizerElementSize + transient_index] = static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue);
152+
clustererNN.inputData_32[base_idx * clustererNN.nnClusterizerElementSize + transient_index] = static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue);
153153
}
154154
} else {
155155
int row_offset = GPUTPCNNClusterizerKernels::rowOffset(row, clustererNN.nnClusterizerSizeInputRow);
@@ -163,15 +163,15 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::fil
163163
int t = (rest_1 % (2 * clustererNN.nnClusterizerSizeInputTime + 1)) - clustererNN.nnClusterizerSizeInputTime;
164164
ChargePos tmp_pos(row + r, pad + p, time + t);
165165
if (dtype == 0) {
166-
clustererNN.inputData_16[base_idx*clustererNN.nnClusterizerElementSize + transient_index] = (OrtDataType::Float16_t)(static_cast<float>(chargeMap[tmp_pos].unpack()) / central_charge);
166+
clustererNN.inputData_16[base_idx * clustererNN.nnClusterizerElementSize + transient_index] = (OrtDataType::Float16_t)(static_cast<float>(chargeMap[tmp_pos].unpack()) / central_charge);
167167
} else if (dtype == 1) {
168-
clustererNN.inputData_32[base_idx*clustererNN.nnClusterizerElementSize + transient_index] = static_cast<float>(chargeMap[tmp_pos].unpack()) / central_charge;
168+
clustererNN.inputData_32[base_idx * clustererNN.nnClusterizerElementSize + transient_index] = static_cast<float>(chargeMap[tmp_pos].unpack()) / central_charge;
169169
}
170170
} else {
171171
if (dtype == 0) {
172-
clustererNN.inputData_16[base_idx*clustererNN.nnClusterizerElementSize + transient_index] = (OrtDataType::Float16_t)(static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue));
172+
clustererNN.inputData_16[base_idx * clustererNN.nnClusterizerElementSize + transient_index] = (OrtDataType::Float16_t)(static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue));
173173
} else {
174-
clustererNN.inputData_32[base_idx*clustererNN.nnClusterizerElementSize + transient_index] = static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue);
174+
clustererNN.inputData_32[base_idx * clustererNN.nnClusterizerElementSize + transient_index] = static_cast<float>(clustererNN.nnClusterizerBoundaryFillValue);
175175
}
176176
}
177177
}
@@ -266,20 +266,20 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::pub
266266

267267
if (dtype == 0) {
268268
pc.setFull(central_charge * clustererNN.outputDataReg1_16[model_output_index + 4].ToFloat(),
269-
static_cast<float>(peak.pad()) + clustererNN.outputDataReg1_16[model_output_index].ToFloat(),
270-
clustererNN.outputDataReg1_16[model_output_index + 2].ToFloat(),
271-
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg1_16[model_output_index + 1].ToFloat(),
272-
clustererNN.outputDataReg1_16[model_output_index + 3].ToFloat(),
273-
clustererNN.clusterFlags[2 * glo_idx],
274-
clustererNN.clusterFlags[2 * glo_idx + 1]);
269+
static_cast<float>(peak.pad()) + clustererNN.outputDataReg1_16[model_output_index].ToFloat(),
270+
clustererNN.outputDataReg1_16[model_output_index + 2].ToFloat(),
271+
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg1_16[model_output_index + 1].ToFloat(),
272+
clustererNN.outputDataReg1_16[model_output_index + 3].ToFloat(),
273+
clustererNN.clusterFlags[2 * glo_idx],
274+
clustererNN.clusterFlags[2 * glo_idx + 1]);
275275
} else if (dtype == 1) {
276276
pc.setFull(central_charge * clustererNN.outputDataReg1_32[model_output_index + 4],
277-
static_cast<float>(peak.pad()) + clustererNN.outputDataReg1_32[model_output_index],
278-
clustererNN.outputDataReg1_32[model_output_index + 2],
279-
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg1_32[model_output_index + 1],
280-
clustererNN.outputDataReg1_32[model_output_index + 3],
281-
clustererNN.clusterFlags[2 * glo_idx],
282-
clustererNN.clusterFlags[2 * glo_idx + 1]);
277+
static_cast<float>(peak.pad()) + clustererNN.outputDataReg1_32[model_output_index],
278+
clustererNN.outputDataReg1_32[model_output_index + 2],
279+
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg1_32[model_output_index + 1],
280+
clustererNN.outputDataReg1_32[model_output_index + 3],
281+
clustererNN.clusterFlags[2 * glo_idx],
282+
clustererNN.clusterFlags[2 * glo_idx + 1]);
283283
}
284284

285285
tpc::ClusterNative myCluster;
@@ -359,20 +359,20 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::pub
359359
// Cluster 1
360360
if (dtype == 0) {
361361
pc.setFull(central_charge * clustererNN.outputDataReg2_16[model_output_index + 8].ToFloat(),
362-
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_16[model_output_index].ToFloat(),
363-
clustererNN.outputDataReg2_16[model_output_index + 4].ToFloat(),
364-
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_16[model_output_index + 2].ToFloat(),
365-
clustererNN.outputDataReg2_16[model_output_index + 6].ToFloat(),
366-
clustererNN.clusterFlags[2 * glo_idx],
367-
clustererNN.clusterFlags[2 * glo_idx + 1]);
362+
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_16[model_output_index].ToFloat(),
363+
clustererNN.outputDataReg2_16[model_output_index + 4].ToFloat(),
364+
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_16[model_output_index + 2].ToFloat(),
365+
clustererNN.outputDataReg2_16[model_output_index + 6].ToFloat(),
366+
clustererNN.clusterFlags[2 * glo_idx],
367+
clustererNN.clusterFlags[2 * glo_idx + 1]);
368368
} else if (dtype == 1) {
369369
pc.setFull(central_charge * clustererNN.outputDataReg2_32[model_output_index + 8],
370-
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_32[model_output_index],
371-
clustererNN.outputDataReg2_32[model_output_index + 4],
372-
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_32[model_output_index + 2],
373-
clustererNN.outputDataReg2_32[model_output_index + 6],
374-
clustererNN.clusterFlags[2 * glo_idx],
375-
clustererNN.clusterFlags[2 * glo_idx + 1]);
370+
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_32[model_output_index],
371+
clustererNN.outputDataReg2_32[model_output_index + 4],
372+
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_32[model_output_index + 2],
373+
clustererNN.outputDataReg2_32[model_output_index + 6],
374+
clustererNN.clusterFlags[2 * glo_idx],
375+
clustererNN.clusterFlags[2 * glo_idx + 1]);
376376
}
377377

378378
tpc::ClusterNative myCluster;
@@ -404,20 +404,20 @@ GPUdii() void GPUTPCNNClusterizerKernels::Thread<GPUTPCNNClusterizerKernels::pub
404404
// Cluster 2
405405
if (dtype == 0) {
406406
pc.setFull(central_charge * clustererNN.outputDataReg2_16[model_output_index + 9].ToFloat(),
407-
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_16[model_output_index + 1].ToFloat(),
408-
clustererNN.outputDataReg2_16[model_output_index + 5].ToFloat(),
409-
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_16[model_output_index + 3].ToFloat(),
410-
clustererNN.outputDataReg2_16[model_output_index + 7].ToFloat(),
411-
clustererNN.clusterFlags[2 * glo_idx],
412-
clustererNN.clusterFlags[2 * glo_idx + 1]);
407+
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_16[model_output_index + 1].ToFloat(),
408+
clustererNN.outputDataReg2_16[model_output_index + 5].ToFloat(),
409+
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_16[model_output_index + 3].ToFloat(),
410+
clustererNN.outputDataReg2_16[model_output_index + 7].ToFloat(),
411+
clustererNN.clusterFlags[2 * glo_idx],
412+
clustererNN.clusterFlags[2 * glo_idx + 1]);
413413
} else if (dtype == 1) {
414414
pc.setFull(central_charge * clustererNN.outputDataReg2_32[model_output_index + 9],
415-
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_32[model_output_index + 1],
416-
clustererNN.outputDataReg2_32[model_output_index + 5],
417-
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_32[model_output_index + 3],
418-
clustererNN.outputDataReg2_32[model_output_index + 7],
419-
clustererNN.clusterFlags[2 * glo_idx],
420-
clustererNN.clusterFlags[2 * glo_idx + 1]);
415+
static_cast<float>(peak.pad()) + clustererNN.outputDataReg2_32[model_output_index + 1],
416+
clustererNN.outputDataReg2_32[model_output_index + 5],
417+
(clusterer.mPmemory->fragment).start + static_cast<float>(peak.time()) + clustererNN.outputDataReg2_32[model_output_index + 3],
418+
clustererNN.outputDataReg2_32[model_output_index + 7],
419+
clustererNN.clusterFlags[2 * glo_idx],
420+
clustererNN.clusterFlags[2 * glo_idx + 1]);
421421
}
422422

423423
rejectCluster = !pc.toNative(peak, central_charge, myCluster, clusterer.Param(), chargeMap);

0 commit comments

Comments
 (0)