Skip to content

Commit ab8abc7

Browse files
committed
GPU: Do not use printf in GPU code if GPUCA_GPU_DEBUG_PRINT is not defined
1 parent 35d6be7 commit ab8abc7

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

Common/MathUtils/include/MathUtils/SMatrixGPU.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "GPUCommonArray.h"
3333
#include "GPUCommonMath.h"
3434
#include "GPUCommonAlgorithm.h"
35+
#include "GPUCommonLogger.h"
3536

3637
namespace o2::math_utils
3738
{
@@ -980,7 +981,7 @@ GPUdi() void Inverter<D, N>::InvertBunchKaufman(MatRepSymGPU<T, D>& rhs, int& if
980981
// invert D(j:j+1,j:j+1)
981982
temp2 = *mjj * *(mjj + j + 1) - *(mjj + j) * *(mjj + j);
982983
if (temp2 == 0) {
983-
printf("SymMatrix::bunch_invert: error in pivot choice");
984+
LOGF(error, "SymMatrix::bunch_invert: error in pivot choice");
984985
}
985986
temp2 = 1. / temp2;
986987
// this quotient is guaranteed to exist by the choice
@@ -1070,7 +1071,7 @@ GPUdi() void Inverter<D, N>::InvertBunchKaufman(MatRepSymGPU<T, D>& rhs, int& if
10701071
} else // 2x2 pivot, compute columns j and j-1 of the inverse
10711072
{
10721073
if (piv[j - 1] != 0) {
1073-
printf("error in piv %lf \n", static_cast<T>(piv[j - 1]));
1074+
LOGF(error, "error in piv %lf \n", static_cast<T>(piv[j - 1]));
10741075
}
10751076
s = 2;
10761077
if (j < nrow) {

DataFormats/Reconstruction/src/TrackParametrization.cxx

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -589,15 +589,9 @@ GPUd() void TrackParametrization<value_T>::printParam() const
589589
// print parameters
590590
#ifndef GPUCA_ALIGPUCODE
591591
printf("%s\n", asString().c_str());
592-
#else
592+
#elif !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
593593
printf("X:%+.4e Alp:%+.3e Par: %+.4e %+.4e %+.4e %+.4e %+.4e |Q|:%d %s",
594-
getX(), getAlpha(), getY(), getZ(), getSnp(), getTgl(), getQ2Pt(), getAbsCharge(),
595-
#if !defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT)
596-
getPID().getName()
597-
#else
598-
""
599-
#endif
600-
);
594+
getX(), getAlpha(), getY(), getZ(), getSnp(), getTgl(), getQ2Pt(), getAbsCharge(), getPID().getName());
601595
#endif
602596
}
603597

@@ -608,7 +602,7 @@ GPUd() void TrackParametrization<value_T>::printParamHexadecimal()
608602
// print parameters
609603
#ifndef GPUCA_ALIGPUCODE
610604
printf("%s\n", asStringHexadecimal().c_str());
611-
#else
605+
#elif !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
612606
printf("X:%x Alp:%x Par: %x %x %x %x %x |Q|:%x %s",
613607
gpu::CAMath::Float2UIntReint(getX()),
614608
gpu::CAMath::Float2UIntReint(getAlpha()),
@@ -618,12 +612,7 @@ GPUd() void TrackParametrization<value_T>::printParamHexadecimal()
618612
gpu::CAMath::Float2UIntReint(getTgl()),
619613
gpu::CAMath::Float2UIntReint(getQ2Pt()),
620614
gpu::CAMath::Float2UIntReint(getAbsCharge()),
621-
#if !defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT)
622-
getPID().getName()
623-
#else
624-
""
625-
#endif
626-
);
615+
getPID().getName());
627616
#endif
628617
}
629618

DataFormats/Reconstruction/src/TrackParametrizationWithError.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ GPUd() void TrackParametrizationWithError<value_T>::print() const
12141214
// print parameters
12151215
#ifndef GPUCA_ALIGPUCODE
12161216
printf("%s\n", asString().c_str());
1217-
#else
1217+
#elif !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
12181218
TrackParametrization<value_T>::printParam();
12191219
printf(
12201220
"\nCov: [%+.3e] [%+.3e %+.3e] [%+.3e %+.3e %+.3e] [%+.3e %+.3e %+.3e %+.3e] [%+.3e %+.3e %+.3e %+.3e %+.3e]",
@@ -1231,7 +1231,7 @@ GPUd() void TrackParametrizationWithError<value_T>::printHexadecimal()
12311231
// print parameters
12321232
#ifndef GPUCA_ALIGPUCODE
12331233
printf("%s\n", asStringHexadecimal().c_str());
1234-
#else
1234+
#elif !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
12351235
TrackParametrization<value_T>::printParamHexadecimal();
12361236
printf(
12371237
"\nCov: [%x] [%x %x] [%x %x %x] [%x %x %x %x] [%x %x %x %x %x]",

Detectors/ITSMFT/ITS/tracking/include/ITStracking/Cluster.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ struct Cluster final {
5454

5555
GPUhdi() void Cluster::print() const
5656
{
57+
#if !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
5758
printf("Cluster: %f %f %f %f %f %d %d\n", xCoordinate, yCoordinate, zCoordinate, phi, radius, clusterId, indexTableBinIndex);
59+
#endif
5860
}
5961

6062
struct TrackingFrameInfo {
@@ -70,10 +72,12 @@ struct TrackingFrameInfo {
7072
o2::gpu::gpustd::array<float, 3> covarianceTrackingFrame = {999., 999., 999.};
7173
GPUdi() void print() const
7274
{
75+
#if !defined(GPUCA_GPUCODE_DEVICE) || (!defined(__OPENCL__) && defined(GPUCA_GPU_DEBUG_PRINT))
7376
printf("x: %f y: %f z: %f xTF: %f alphaTF: %f posTF: %f %f covTF: %f %f %f\n",
7477
xCoordinate, yCoordinate, zCoordinate, xTrackingFrame, alphaTrackingFrame,
7578
positionTrackingFrame[0], positionTrackingFrame[1],
7679
covarianceTrackingFrame[0], covarianceTrackingFrame[1], covarianceTrackingFrame[2]);
80+
#endif
7781
}
7882

7983
ClassDefNV(TrackingFrameInfo, 1);

0 commit comments

Comments
 (0)