Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Common/MathUtils/include/MathUtils/SMatrixGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "GPUCommonMath.h"
#include "GPUCommonAlgorithm.h"
#include "GPUCommonLogger.h"
#include "GPUCommonTypeTraits.h"

namespace o2::math_utils::detail
{
Expand Down Expand Up @@ -468,6 +469,9 @@ class SMatrixGPU
GPUd() const T& operator()(unsigned int i, unsigned int j) const;
GPUd() T& operator()(unsigned int i, unsigned int j);

template <typename Y, typename X>
GPUd() friend X& operator<<(Y& y, const SMatrixGPU&);

class SMatrixRowGPU
{
public:
Expand Down Expand Up @@ -512,6 +516,15 @@ class SMatrixGPU
R mRep;
};

#ifndef __OPENCL__ // TODO: current C++ for OpenCL 2021 is at C++17, so no concepts. But we don't need this trick for OpenCL anyway, so we can just hide it.
template <class T, unsigned int D1, unsigned int D2, class R, typename Y, typename X = Y>
requires(sizeof(typename X::traits_type::pos_type) != 0) // do not provide a template to fair::Logger, etc... (pos_type is a member type of all std::ostream classes)
GPUd() X& operator<<(Y& y, const SMatrixGPU<T, D1, D2, R>&)
{
return y;
}
#endif

template <class T, unsigned int D1, unsigned int D2, class R>
GPUdi() SMatrixGPU<T, D1, D2, R>::SMatrixGPU(SMatrixIdentity)
{
Expand Down
2 changes: 1 addition & 1 deletion GPU/Common/GPUCommonConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "GPUCommonDef.h"

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
namespace GPUCA_NAMESPACE::gpu::gpu_common_constants
{
static CONSTEXPR const float kCLight = 0.000299792458f;
Expand Down
4 changes: 2 additions & 2 deletions GPU/Common/GPUCommonDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//Some GPU configuration settings, must be included first
#include "GPUCommonDefSettings.h"

#if (!defined(__OPENCL__) || defined(__OPENCLCPP__)) && (!(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__)) && defined(__cplusplus) && __cplusplus >= 201103L
#if !defined(__OPENCL1__) && (!(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__)) && defined(__cplusplus) && __cplusplus >= 201103L
#define GPUCA_NOCOMPAT // C++11 + No old ROOT5 + No old OpenCL
#ifndef __OPENCL__
#define GPUCA_NOCOMPAT_ALLOPENCL // + No OpenCL at all
Expand Down Expand Up @@ -82,7 +82,7 @@
#define GPUCA_NAMESPACE o2
#endif

#if (defined(__CUDACC__) && defined(GPUCA_CUDA_NO_CONSTANT_MEMORY)) || (defined(__HIPCC__) && defined(GPUCA_HIP_NO_CONSTANT_MEMORY)) || (defined(__OPENCL__) && !defined(__OPENCLCPP__) && defined(GPUCA_OPENCL_NO_CONSTANT_MEMORY)) || (defined(__OPENCLCPP__) && defined(GPUCA_OPENCLCPP_NO_CONSTANT_MEMORY))
#if (defined(__CUDACC__) && defined(GPUCA_CUDA_NO_CONSTANT_MEMORY)) || (defined(__HIPCC__) && defined(GPUCA_HIP_NO_CONSTANT_MEMORY)) || (defined(__OPENCL1__) && defined(GPUCA_OPENCL_NO_CONSTANT_MEMORY)) || (defined(__OPENCLCPP__) && defined(GPUCA_OPENCLCPP_NO_CONSTANT_MEMORY))
#define GPUCA_NO_CONSTANT_MEMORY
#elif defined(__CUDACC__) || defined(__HIPCC__)
#define GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM
Expand Down
10 changes: 5 additions & 5 deletions GPU/Common/GPUCommonMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <cstdint>
#endif

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
namespace GPUCA_NAMESPACE
{
namespace gpu
Expand Down Expand Up @@ -220,7 +220,7 @@ GPUdi() uint32_t GPUCommonMath::Float2UIntReint(const float& x)
{
#if defined(GPUCA_GPUCODE_DEVICE) && (defined(__CUDACC__) || defined(__HIPCC__))
return __float_as_uint(x);
#elif defined(GPUCA_GPUCODE_DEVICE) && (defined(__OPENCL__) || defined(__OPENCLCPP__))
#elif defined(GPUCA_GPUCODE_DEVICE) && defined(__OPENCL__)
return as_uint(x);
#else
return reinterpret_cast<const uint32_t&>(x);
Expand Down Expand Up @@ -289,7 +289,7 @@ GPUhdi() void GPUCommonMath::SinCosd(double x, double& s, double& c)

GPUdi() uint32_t GPUCommonMath::Clz(uint32_t x)
{
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && (!defined(__OPENCL__) || defined(__OPENCLCPP__))
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && !defined(__OPENCL1__)
return x == 0 ? 32 : CHOICE(__builtin_clz(x), __clz(x), __builtin_clz(x)); // use builtin if available
#else
for (int32_t i = 31; i >= 0; i--) {
Expand All @@ -303,7 +303,7 @@ GPUdi() uint32_t GPUCommonMath::Clz(uint32_t x)

GPUdi() uint32_t GPUCommonMath::Popcount(uint32_t x)
{
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && (!defined(__OPENCL__) /*|| defined(__OPENCLCPP__)*/) // TODO: remove OPENCLCPP workaround when reported SPIR-V bug is fixed
#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && (!defined(__OPENCL__) /* !defined(__OPENCL1__)*/) // TODO: exclude only OPENCLC (not CPP) when reported SPIR-V bug is fixed
// use builtin if available
return CHOICE(__builtin_popcount(x), __popc(x), __builtin_popcount(x));
#else
Expand Down Expand Up @@ -563,7 +563,7 @@ GPUdii() void GPUCommonMath::AtomicMinInternal(GPUglobalref() GPUgeneric() GPUAt

#undef CHOICE

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
}
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions GPU/Common/GPUCommonRtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
#if defined(GPUCA_STANDALONE) || (defined(GPUCA_O2_LIB) && !defined(GPUCA_O2_INTERFACE)) || defined(GPUCA_GPUCODE) // clang-format off
#if !defined(ROOT_Rtypes) && !defined(__CLING__)
#define GPUCOMMONRTYPES_H_ACTIVE
struct MUST_NOT_USE_Rtypes_h {};
typedef MUST_NOT_USE_Rtypes_h TClass;
#define ClassDef(name,id)
#define ClassDefNV(name, id)
#define ClassDefOverride(name, id)
#define ClassImp(name)
#define templateClassImp(name)
#ifndef GPUCA_GPUCODE_DEVICE
// typedef uint64_t ULong64_t;
// typedef uint32_t UInt_t;
#include <iostream>
#endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion GPU/Common/GPUCommonTypeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#ifndef GPUCA_GPUCODE_COMPILEKERNELS
#include <type_traits>
#endif
#elif !defined(__OPENCL__) || defined(__OPENCLCPP__)
#elif !defined(__OPENCL1__)
// We just reimplement some type traits in std for the GPU
namespace std
{
Expand Down
2 changes: 1 addition & 1 deletion GPU/Common/GPUROOTSMatrixFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ template <class T, uint32_t D1, uint32_t D2>
class MatRepStdGPU;
} // namespace detail

#if !defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE)
#if !defined(GPUCA_STANDALONE) && !defined(GPUCA_GPUCODE) && !defined(GPUCOMMONRTYPES_H_ACTIVE)
template <typename T, uint32_t N>
using SVector = ROOT::Math::SVector<T, N>;
template <class T, uint32_t D1, uint32_t D2, class R>
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/Base/GPUParam.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "GPUParam.h"
#include "GPUTPCGMMergedTrackHit.h"
#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
#include "GPUTPCClusterOccupancyMap.h"
#endif

Expand Down Expand Up @@ -228,7 +228,7 @@ GPUdi() void MEM_LG(GPUParam)::UpdateClusterError2ByState(int16_t clusterState,
MEM_CLASS_PRE()
GPUdi() float MEM_LG(GPUParam)::GetUnscaledMult(float time) const
{
#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
if (!occupancyMap) {
return 0.f;
}
Expand Down
5 changes: 5 additions & 0 deletions GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

// clang-format off
#define __OPENCL__
#if defined(__cplusplus) && __cplusplus >= 201703L
#define __OPENCLCPP__
#else
#define __OPENCL1__
#endif
#define GPUCA_GPUTYPE_OPENCL

#ifdef __OPENCLCPP__
Expand Down
2 changes: 0 additions & 2 deletions GPU/GPUTracking/Base/opencl2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ set(OCL_DEFINECL "-D$<JOIN:$<TARGET_PROPERTY:O2::GPUTracking,COMPILE_DEFINITIONS
-I${CMAKE_SOURCE_DIR}/Detectors/TRD/base/src
-I${CMAKE_SOURCE_DIR}/Detectors/Base/src
-I${CMAKE_SOURCE_DIR}/DataFormats/Reconstruction/src
-I${CMAKE_SOURCE_DIR}/Detectors/ITSMFT/ITS/tracking/cuda/include
-D__OPENCLCPP__
)

set(SRCS GPUReconstructionOCL2.cxx)
Expand Down
5 changes: 2 additions & 3 deletions GPU/GPUTracking/DataTypes/CalibdEdxContainer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
/// \file CalibdEdxContainer.cxx
/// \author Matthias Kleiner <[email protected]>

#include "CalibdEdxContainer.h"

#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
#if !defined(GPUCA_STANDALONE)
#include "TFile.h"
#include "TPCBase/CalDet.h"
#include "Framework/Logger.h"
#include "clusterFinderDefs.h"
#endif
#include "CalibdEdxContainer.h"

using namespace GPUCA_NAMESPACE::gpu;
using namespace o2::tpc;
Expand Down
2 changes: 2 additions & 0 deletions GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologyPol.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "Rtypes.h"
#include "CalibdEdxTrackTopologyPol.h"

#include <cstddef>
Expand All @@ -20,6 +21,7 @@
using namespace o2::tpc;

#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
#include "NDPiecewisePolynomials.inc"
void CalibdEdxTrackTopologyPol::dumpToTree(const uint32_t nSamplingPoints[/* Dim */], const char* outName) const
{
for (uint32_t i = 0; i < FFits; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
///
/// \author Matthias Kleiner <[email protected]>

#include "CalibdEdxTrackTopologySpline.h"

#if !defined(GPUCA_STANDALONE)
#include "TFile.h"
#endif
#include "CalibdEdxTrackTopologySpline.h"

using namespace GPUCA_NAMESPACE::gpu;
using namespace o2::tpc;
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologySpline.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

#include "FlatObject.h"
#include "Spline.h"
#include "GPUCommonRtypes.h"
#ifdef GPUCA_HAVE_O2HEADERS
#include "DataFormatsTPC/Defs.h"
#endif

#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) // code invisible on GPU and in the standalone compilation
#include "Rtypes.h" // for ClassDefNV
#include <fmt/format.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/DataTypes/GPUDataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace gpu
#define GPUCA_RECO_STEP GPUDataTypes
#endif

#if defined(__OPENCL__) && !defined(__OPENCLCPP__)
#if defined(__OPENCL1__)
MEM_CLASS_PRE() // Macro with some template magic for OpenCL 1.2
#endif
class GPUTPCTrack;
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/DataTypes/GPUO2DataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// Pull in several O2 headers with basic data types, or load a header with empty fake classes if O2 headers not available

#if defined(GPUCA_HAVE_O2HEADERS) && (!defined(__OPENCL__) || defined(__OPENCLCPP__))
#if defined(GPUCA_HAVE_O2HEADERS) && !defined(__OPENCL1__)
#include "DataFormatsTPC/ClusterNative.h"
#include "DataFormatsTPC/Digit.h"
#include "DetectorsBase/MatLayerCylSet.h"
Expand All @@ -27,7 +27,7 @@
#include "GPUO2FakeClasses.h"
#endif

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
#include "GPUdEdxInfo.h"
#endif

Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/DataTypes/GPUSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GPUSettings
RejectionStrategyA = 1,
RejectionStrategyB = 2 };

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
static CONSTEXPR const uint32_t TPC_MAX_TF_TIME_BIN = ((256 * 3564 + 2 * 8 - 2) / 8);
#endif
};
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace gpu
class GPUTPCGMPolynomialField
{
public:
#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
GPUTPCGMPolynomialField() : mNominalBz(0.f)
{
Reset();
Expand Down Expand Up @@ -94,7 +94,7 @@ class GPUTPCGMPolynomialField
float mItsBz[NITSM];
};

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)

inline void GPUTPCGMPolynomialField::Reset()
{
Expand Down
10 changes: 5 additions & 5 deletions GPU/GPUTracking/DataTypes/GPUTPCGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace gpu
// Should be unified, but cannot take the contants from the official headers for now, since we want it to be constexpr
class GPUTPCGeometry // TODO: Make values constexpr
{
#if defined(__OPENCL__) && !defined(__OPENCLCPP__)
#if defined(__OPENCL1__)
GPUTPCGeometry(); // Fake constructor declaration for OpenCL due to static members, does not exist!
#endif
#ifdef GPUCA_TPC_GEOMETRY_O2
Expand Down Expand Up @@ -63,7 +63,7 @@ class GPUTPCGeometry // TODO: Make values constexpr
const float mPadHeight[10] GPUCA_CPP11_INIT(= {.75f, .75f, .75f, .75f, 1.f, 1.f, 1.2f, 1.2f, 1.5f, 1.5f});
const float mPadWidth[10] GPUCA_CPP11_INIT(= {.416f, .420f, .420f, .436f, .6f, .6f, .608f, .588f, .604f, .607f});

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
static CONSTEXPR float FACTOR_T2Z GPUCA_CPP11_INIT(= 250.f / 512.f); // Used in compression, must remain constant at 250cm, 512 time bins!
#endif

Expand Down Expand Up @@ -95,7 +95,7 @@ class GPUTPCGeometry // TODO: Make values constexpr
const float mPadHeight[3] GPUCA_CPP11_INIT(= {.75f, 1.f, 1.5f});
const float mPadWidth[3] GPUCA_CPP11_INIT(= {.4f, .6f, .6f});

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
static CONSTEXPR float FACTOR_T2Z GPUCA_CPP11_INIT(= 250.f / 1024.f); // Used in compression, must remain constant at 250cm, 1024 time bins!
#endif

Expand All @@ -109,7 +109,7 @@ class GPUTPCGeometry // TODO: Make values constexpr
GPUd() int32_t EndOROC2() const { return GPUCA_ROW_COUNT; }
#endif
private:
#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
static CONSTEXPR float FACTOR_Z2T GPUCA_CPP11_INIT(= 1.f / FACTOR_T2Z);
#endif
public:
Expand All @@ -120,7 +120,7 @@ class GPUTPCGeometry // TODO: Make values constexpr
GPUd() float PadWidth(int32_t row) const { return (mPadWidth[GetRegion(row)]); }
GPUd() uint8_t NPads(int32_t row) const { return mNPads[row]; }

#if !defined(__OPENCL__) || defined(__OPENCLCPP__)
#if !defined(__OPENCL1__)
GPUd() float LinearPad2Y(int32_t slice, int32_t row, float pad) const
{
const float u = (pad - 0.5f * mNPads[row]) * PadWidth(row);
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#if defined(GPUCA_NSLICES) || defined(GPUCA_ROW_COUNT)
#error GPUCA_NSLICES or GPUCA_ROW_COUNT already defined, do not include GPUTPCGeometry.h before!
#endif
#if defined(GPUCA_HAVE_O2HEADERS) && defined(GPUCA_TPC_GEOMETRY_O2) && (!defined(__OPENCL__) || defined(__OPENCLCPP__)) && !(defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE < 393216)
#if defined(GPUCA_HAVE_O2HEADERS) && defined(GPUCA_TPC_GEOMETRY_O2) && !defined(__OPENCL1__) && !(defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE < 393216)
//Use definitions from the O2 headers if available for nicer code and type safety
#include "DataFormatsTPC/Constants.h"
#define GPUCA_NSLICES o2::tpc::constants::MAXSECTOR
Expand Down
4 changes: 3 additions & 1 deletion GPU/GPUTracking/Definitions/GPUSettingsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ AddOptionRTC(cfNoiseSuppressionEpsilonRelative, uint8_t, 76, "", 0, "Cluster Fin
AddOptionRTC(nWays, uint8_t, 3, "", 0, "Do N fit passes in final fit of merger")
AddOptionRTC(nWaysOuter, int8_t, 0, "", 0, "Store outer param")
AddOptionRTC(trackFitRejectMode, int8_t, 5, "", 0, "0: no limit on rejection or missed hits, >0: break after n rejected hits, <0: reject at max -n hits")
AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 0, "", 0, "Reject clusters that get the IFC mask error during refit")
AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128")
AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128")
AddOptionRTC(globalTracking, int8_t, 1, "", 0, "Enable Global Tracking (prolong tracks to adjacent sectors to find short segments)")
Expand Down Expand Up @@ -345,7 +346,8 @@ AddOption(drawTracksAndFilter, bool, false, "", 0, "Use AND filter instead of OR
AddOption(propagateLoopers, bool, false, "", 0, "Enabale propagation of loopers")
AddOption(clustersOnly, bool, false, "", 0, "Visualize clusters only")
AddOption(clustersOnNominalRow, bool, false, "", 0, "Show clusters at nominal x of pad row for early-transformed data")
AddOption(separateGlobalTracks, bool, false, "", 0, "Separate global tracks")
AddOption(separateGlobalTracks, bool, false, "", 0, "Draw track segments propagated to adjacent sectors separately")
AddOption(splitCETracks, int8_t, -1, "", 0, "Split CE tracks when they cross the central electrode (-1 = for triggered data)")
AddOption(markClusters, int32_t, 0, "", 0, "Mark clusters")
AddOption(markFakeClusters, int32_t, 0, "", 0, "Mark fake clusters")
AddOption(markAdjacentClusters, int32_t, 0, "", 0, "Mark adjacent clusters")
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Interface/GPUO2InterfaceQA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
/// \file GPUO2InterfaceQA.cxx
/// \author David Rohr

#include "TGraphAsymmErrors.h"
#include "GPUParam.h"
#include "GPUQA.h"
#include "GPUO2InterfaceConfiguration.h"
#include "GPUO2InterfaceQA.h"
#include "TGraphAsymmErrors.h"

using namespace o2::gpu;
using namespace o2::tpc;
Expand Down
Loading