Skip to content

Commit 254d64e

Browse files
committed
GPU: improve some variable names, fix compiler warnings
1 parent d54f084 commit 254d64e

13 files changed

Lines changed: 47 additions & 47 deletions

GPU/GPUTracking/Base/GPUReconstruction.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,9 +1195,9 @@ int32_t GPUReconstruction::CheckErrorCodes(bool cpuOnly, bool forceShowErrors, s
11951195
return retVal;
11961196
}
11971197

1198-
int32_t GPUReconstruction::GPUChkErrA(const int64_t error, const char* file, int32_t line, bool failOnError)
1198+
int32_t GPUReconstruction::GPUChkErrA(const int64_t retval, const char* file, int32_t line, bool failOnError)
11991199
{
1200-
if (error == 0 || !GPUChkErrInternal(error, file, line)) {
1200+
if (retval == 0 || !GPUChkErrInternal(retval, file, line)) {
12011201
return 0;
12021202
}
12031203
if (failOnError) {

GPU/GPUTracking/Base/GPUReconstruction.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ class GPUReconstruction
9898
static constexpr GeometryType geometryType = GeometryType::O2;
9999
#endif
100100

101-
enum retValValue : uint32_t { ok = 0,
102-
error = 1,
103-
doExit = 2,
104-
nonFatalErrorCode = 3,
105-
abort = 4 };
101+
enum retValValue : uint32_t { retOk = 0,
102+
retError = 1,
103+
retDoExit = 2,
104+
retNonFatalErrorCode = 3,
105+
retAbort = 4 };
106106
static DeviceType GetDeviceType(const char* type);
107107
enum InOutPointerType : uint32_t { CLUSTER_DATA = 0,
108108
SECTOR_OUT_TRACK = 1,
@@ -280,7 +280,7 @@ class GPUReconstruction
280280
void UpdateMaxMemoryUsed();
281281
int32_t EnqueuePipeline(bool terminate = false);
282282
GPUChain* GetNextChainInQueue();
283-
virtual int32_t GPUChkErrInternal(const int64_t error, const char* file, int32_t line) const { return 0; }
283+
virtual int32_t GPUChkErrInternal(const int64_t retval, const char* file, int32_t line) const { return 0; }
284284

285285
virtual int32_t registerMemoryForGPU_internal(const void* ptr, size_t size) = 0;
286286
virtual int32_t unregisterMemoryForGPU_internal(const void* ptr) = 0;

GPU/GPUTracking/Base/GPUReconstructionCPU.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ int32_t GPUReconstructionCPU::RunChains()
245245
retVal = mChains[i]->RunChain();
246246
}
247247
}
248-
if (retVal != GPUReconstruction::retValValue::ok && retVal != GPUReconstruction::retValValue::doExit) {
248+
if (retVal != GPUReconstruction::retValValue::retOk && retVal != GPUReconstruction::retValValue::retDoExit) {
249249
return retVal;
250250
}
251251
mTimerTotal.Stop();

GPU/GPUTracking/Base/GPUReconstructionDeviceBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class GPUReconstructionDeviceBase : public GPUReconstructionCPU
4242
virtual int32_t InitDevice_Runtime() = 0;
4343
int32_t ExitDevice() override;
4444
virtual int32_t ExitDevice_Runtime() = 0;
45-
virtual int32_t GPUChkErrInternal(const int64_t error, const char* file, int32_t line) const override = 0;
45+
virtual int32_t GPUChkErrInternal(const int64_t retval, const char* file, int32_t line) const override = 0;
4646
int32_t registerMemoryForGPU_internal(const void* ptr, size_t size) override;
4747
int32_t unregisterMemoryForGPU_internal(const void* ptr) override;
4848
void unregisterRemainingRegisteredMemory();

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ GPUReconstructionCUDA::~GPUReconstructionCUDA()
8484
}
8585

8686
static_assert(sizeof(cudaError_t) <= sizeof(int64_t) && cudaSuccess == 0);
87-
int32_t GPUReconstructionCUDA::GPUChkErrInternal(const int64_t error, const char* file, int32_t line) const
87+
int32_t GPUReconstructionCUDA::GPUChkErrInternal(const int64_t retval, const char* file, int32_t line) const
8888
{
89-
return internal::GPUReconstructionCUDAChkErr(error, file, line);
89+
return internal::GPUReconstructionCUDAChkErr(retval, file, line);
9090
}
9191

9292
GPUReconstruction* GPUReconstruction_Create_CUDA(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionCUDA(cfg); }

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class GPUReconstructionCUDA : public GPUReconstructionProcessing::KernelInterfac
4242
~GPUReconstructionCUDA() override;
4343

4444
void PrintKernelOccupancies() override;
45-
virtual int32_t GPUChkErrInternal(const int64_t error, const char* file, int32_t line) const override;
45+
virtual int32_t GPUChkErrInternal(const int64_t retval, const char* file, int32_t line) const override;
4646

4747
template <class T, int32_t I = 0, typename... Args>
4848
void runKernelBackend(const krnlSetupTime& _xyz, const Args&... args);

GPU/GPUTracking/Base/cuda/GPUReconstructionCUDAHelpers.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
namespace o2::gpu::internal
2222
{
23-
int32_t __attribute__((weak)) GPUReconstructionCUDAChkErr(const int64_t error, const char* file, int32_t line)
23+
int32_t __attribute__((weak)) GPUReconstructionCUDAChkErr(const int64_t retVal, const char* file, int32_t line)
2424
{
25-
if (error != cudaSuccess) {
26-
GPUError("CUDA Error: %ld / %s (%s:%d)", error, cudaGetErrorString((cudaError_t)error), file, line);
25+
if (retVal != cudaSuccess) {
26+
GPUError("CUDA Error: %ld / %s (%s:%d)", retVal, cudaGetErrorString((cudaError_t)retVal), file, line);
2727
}
28-
return error != cudaSuccess;
28+
return retVal != cudaSuccess;
2929
}
3030
} // namespace o2::gpu::internal
3131

GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ GPUReconstructionOCL::~GPUReconstructionOCL()
5252
}
5353

5454
static_assert(sizeof(cl_int) <= sizeof(int64_t) && CL_SUCCESS == 0);
55-
int32_t GPUReconstructionOCL::GPUChkErrInternal(const int64_t error, const char* file, int32_t line) const
55+
int32_t GPUReconstructionOCL::GPUChkErrInternal(const int64_t retval, const char* file, int32_t line) const
5656
{
5757
// Check for OPENCL Error and in the case of an error display the corresponding error string
58-
if (error != CL_SUCCESS) {
59-
GPUError("OpenCL Error: %ld / %s (%s:%d)", error, convertErrorToString(error), file, line);
58+
if (retval != CL_SUCCESS) {
59+
GPUError("OpenCL Error: %ld / %s (%s:%d)", retval, convertErrorToString(retval), file, line);
6060
}
61-
return error != CL_SUCCESS;
61+
return retval != CL_SUCCESS;
6262
}
6363

6464
int32_t GPUReconstructionOCL::InitDevice_Runtime()

GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class GPUReconstructionOCL : public GPUReconstructionProcessing::KernelInterface
4040
int32_t InitDevice_Runtime() override;
4141
int32_t ExitDevice_Runtime() override;
4242

43-
virtual int32_t GPUChkErrInternal(const int64_t error, const char* file, int32_t line) const override;
43+
virtual int32_t GPUChkErrInternal(const int64_t retval, const char* file, int32_t line) const override;
4444

4545
void SynchronizeGPU() override;
4646
int32_t GPUDebug(const char* state = "UNKNOWN", int32_t stream = -1, bool force = false) override;

GPU/GPUTracking/Global/GPUChainTracking.cxx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ int32_t GPUChainTracking::RunChain()
677677
const bool needQA = GPUQA::QAAvailable() && (GetProcessingSettings().runQA || (GetProcessingSettings().eventDisplay && (mIOPtrs.nMCInfosTPC || GetProcessingSettings().runMC)));
678678
if (needQA && GetQA()->IsInitialized() == false) {
679679
if (GetQA()->InitQA(GetProcessingSettings().runQA <= 0 ? -GetProcessingSettings().runQA : gpudatatypes::gpuqa::tasksAutomatic)) {
680-
return GPUReconstruction::retValValue::error;
680+
return GPUReconstruction::retValValue::retError;
681681
}
682682
}
683683
if (needQA) {
@@ -693,7 +693,7 @@ int32_t GPUChainTracking::RunChain()
693693
mRec->PrepareEvent();
694694
} catch (const std::bad_alloc& e) {
695695
GPUError("Memory Allocation Error");
696-
return GPUReconstruction::retValValue::error;
696+
return GPUReconstruction::retValValue::retError;
697697
}
698698
mRec->getGeneralStepTimer(GeneralStep::Prepare).Stop();
699699

@@ -707,11 +707,11 @@ int32_t GPUChainTracking::RunChain()
707707

708708
if (mIOPtrs.tpcCompressedClusters) {
709709
if (runRecoStep(RecoStep::TPCDecompression, &GPUChainTracking::RunTPCDecompression)) {
710-
return GPUReconstruction::retValValue::error;
710+
return GPUReconstruction::retValValue::retError;
711711
}
712712
} else if (mIOPtrs.tpcPackedDigits || mIOPtrs.tpcZS) {
713713
if (runRecoStep(RecoStep::TPCClusterFinding, &GPUChainTracking::RunTPCClusterizer, false)) {
714-
return GPUReconstruction::retValValue::error;
714+
return GPUReconstruction::retValValue::retError;
715715
}
716716
}
717717

@@ -720,17 +720,17 @@ int32_t GPUChainTracking::RunChain()
720720
}
721721

722722
if (mIOPtrs.clustersNative && runRecoStep(RecoStep::TPCConversion, &GPUChainTracking::ConvertNativeToClusterData)) {
723-
return GPUReconstruction::retValValue::error;
723+
return GPUReconstruction::retValValue::retError;
724724
}
725725

726726
mRec->PushNonPersistentMemory(qStr2Tag("TPCSLCD1")); // 1st stack level for TPC tracking sector data
727727
mTPCSectorScratchOnStack = true;
728728
if (runRecoStep(RecoStep::TPCSectorTracking, &GPUChainTracking::RunTPCTrackingSectors)) {
729-
return GPUReconstruction::retValValue::error;
729+
return GPUReconstruction::retValValue::retError;
730730
}
731731

732732
if (runRecoStep(RecoStep::TPCMerging, &GPUChainTracking::RunTPCTrackingMerger, false)) {
733-
return GPUReconstruction::retValValue::error;
733+
return GPUReconstruction::retValValue::retError;
734734
}
735735
if (mTPCSectorScratchOnStack) {
736736
mRec->PopNonPersistentMemory(RecoStep::TPCSectorTracking, qStr2Tag("TPCSLCD1")); // Release 1st stack level, TPC sector data not needed after merger
@@ -750,16 +750,16 @@ int32_t GPUChainTracking::RunChain()
750750
}
751751
}
752752
if (runRecoStep(RecoStep::TPCCompression, &GPUChainTracking::RunTPCCompression)) {
753-
return GPUReconstruction::retValValue::error;
753+
return GPUReconstruction::retValValue::retError;
754754
}
755755
}
756756

757757
if (runRecoStep(RecoStep::TRDTracking, &GPUChainTracking::RunTRDTracking)) {
758-
return GPUReconstruction::retValValue::error;
758+
return GPUReconstruction::retValValue::retError;
759759
}
760760

761761
if (runRecoStep(RecoStep::Refit, &GPUChainTracking::RunRefit)) {
762-
return GPUReconstruction::retValValue::error;
762+
return GPUReconstruction::retValValue::retError;
763763
}
764764

765765
if (!GetProcessingSettings().doublePipeline) { // Synchronize with output copies running asynchronously
@@ -770,9 +770,9 @@ int32_t GPUChainTracking::RunChain()
770770
mRec->SetNActiveThreads(-1);
771771
}
772772

773-
int32_t retVal = GPUReconstruction::retValValue::ok;
773+
int32_t retVal = GPUReconstruction::retValValue::retOk;
774774
if (CheckErrorCodes(false, false, mRec->getErrorCodeOutput())) { // TODO: Eventually, we should use GPUReconstruction::CheckErrorCodes
775-
retVal = GPUReconstruction::retValValue::nonFatalErrorCode;
775+
retVal = GPUReconstruction::retValValue::retNonFatalErrorCode;
776776
if (!GetProcessingSettings().ignoreNonFatalGPUErrors) {
777777
return retVal;
778778
}
@@ -820,7 +820,7 @@ int32_t GPUChainTracking::RunChainFinalize()
820820
GPUInfo("Starting Event Display...");
821821
if (mEventDisplay->StartDisplay()) {
822822
GPUError("Error starting Event Display");
823-
return GPUReconstruction::retValValue::error;
823+
return GPUReconstruction::retValValue::retError;
824824
}
825825
mDisplayRunning = true;
826826
} else {
@@ -857,15 +857,15 @@ int32_t GPUChainTracking::RunChainFinalize()
857857
mDisplayRunning = false;
858858
GetProcessingSettings().eventDisplay->DisplayExit();
859859
const_cast<GPUSettingsProcessing&>(GetProcessingSettings()).eventDisplay = nullptr; // TODO: fixme - eventDisplay should probably not be put into ProcessingSettings in the first place
860-
return GPUReconstruction::retValValue::doExit;
860+
return GPUReconstruction::retValValue::retDoExit;
861861
}
862862
GetProcessingSettings().eventDisplay->setDisplayControl(0);
863863
GPUInfo("Loading next event...");
864864

865865
mEventDisplay->BlockTillNextEvent();
866866
}
867867

868-
return GPUReconstruction::retValValue::ok;
868+
return GPUReconstruction::retValValue::retOk;
869869
}
870870

871871
int32_t GPUChainTracking::FinalizePipelinedProcessing()

0 commit comments

Comments
 (0)