From 5269f06d062522a6a5c95a8b96a68b1e0835d0aa Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:44:55 +0100 Subject: [PATCH 01/50] DPL: hide more stuff from runDataProcessing.h This avoids having a large mainNoCatch duplicated in each executable. --- .../include/Framework/runDataProcessing.h | 41 ++++++++----------- Framework/Core/src/runDataProcessing.cxx | 34 +++++++++++++++ 2 files changed, 52 insertions(+), 23 deletions(-) diff --git a/Framework/Core/include/Framework/runDataProcessing.h b/Framework/Core/include/Framework/runDataProcessing.h index 6c1897bc8c1f3..f52ba08aa3f53 100644 --- a/Framework/Core/include/Framework/runDataProcessing.h +++ b/Framework/Core/include/Framework/runDataProcessing.h @@ -12,6 +12,7 @@ #define FRAMEWORK_RUN_DATA_PROCESSING_H #include +#include "Framework/ConfigParamSpec.h" #include "Framework/ChannelConfigurationPolicy.h" #include "Framework/CallbacksPolicy.h" #include "Framework/CompletionPolicy.h" @@ -22,17 +23,13 @@ #include "Framework/SendingPolicy.h" #include "Framework/WorkflowSpec.h" #include "Framework/ConfigContext.h" -#include "Framework/BoostOptionsRetriever.h" #include "Framework/CustomWorkflowTerminationHook.h" #include "Framework/CommonServices.h" #include "Framework/WorkflowCustomizationHelpers.h" -#include "Framework/ResourcePolicyHelpers.h" #include "Framework/Logger.h" #include "Framework/CheckTypes.h" #include "Framework/StructToTuple.h" -#include "Framework/ConfigParamDiscovery.h" #include "ResourcePolicy.h" -#include "ServiceRegistryRef.h" #include namespace o2::framework @@ -120,7 +117,9 @@ struct UserCustomizationsHelper { namespace o2::framework { class ConfigContext; -} +class ConfigParamRegistry; +class ConfigParamSpec; +} // namespace o2::framework /// Helper used to customize a workflow pipelining options void overridePipeline(o2::framework::ConfigContext& ctx, std::vector& workflow); @@ -155,10 +154,18 @@ std::vector injectCustomizations() return policies; } +void overrideAll(o2::framework::ConfigContext& ctx, std::vector& workflow); + +o2::framework::ConfigContext createConfigContext(std::unique_ptr& workflowOptionsRegistry, + o2::framework::ServiceRegistry& configRegistry, + std::vector& workflowOptions, + std::vector& extraOptions, int argc, char** argv); + +std::unique_ptr createRegistry(); + int mainNoCatch(int argc, char** argv) { using namespace o2::framework; - using namespace boost::program_options; std::vector workflowOptions; UserCustomizationsHelper::userDefinedCustomization(workflowOptions); @@ -171,24 +178,13 @@ int mainNoCatch(int argc, char** argv) std::vector callbacksPolicies = injectCustomizations(); std::vector sendingPolicies = injectCustomizations(); - std::vector> retrievers; - std::unique_ptr retriever{new BoostOptionsRetriever(true, argc, argv)}; - retrievers.emplace_back(std::move(retriever)); - auto workflowOptionsStore = std::make_unique(workflowOptions, std::move(retrievers)); - workflowOptionsStore->preload(); - workflowOptionsStore->activate(); - ConfigParamRegistry workflowOptionsRegistry(std::move(workflowOptionsStore)); - auto extraOptions = o2::framework::ConfigParamDiscovery::discover(workflowOptionsRegistry, argc, argv); - for (auto& extra : extraOptions) { - workflowOptions.push_back(extra); - } + std::unique_ptr configRegistry = createRegistry(); + std::vector extraOptions; + std::unique_ptr workflowOptionsRegistry{nullptr}; + auto configContext = createConfigContext(workflowOptionsRegistry, *configRegistry, workflowOptions, extraOptions, argc, argv); - ServiceRegistry configRegistry; - ConfigContext configContext(workflowOptionsRegistry, ServiceRegistryRef{configRegistry}, argc, argv); o2::framework::WorkflowSpec specs = defineDataProcessing(configContext); - overrideCloning(configContext, specs); - overridePipeline(configContext, specs); - overrideLabels(configContext, specs); + overrideAll(configContext, specs); for (auto& spec : specs) { UserCustomizationsHelper::userDefinedCustomization(spec.requiredServices); } @@ -207,7 +203,6 @@ char* getIdString(int argc, char** argv); int main(int argc, char** argv) { using namespace o2::framework; - using namespace boost::program_options; int result = callMain(argc, argv, mainNoCatch); diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index 03b013d266316..e5263247e641b 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -8,6 +8,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include #define BOOST_BIND_GLOBAL_PLACEHOLDERS #include #include "Framework/BoostOptionsRetriever.h" @@ -69,6 +70,7 @@ #include "HTTPParser.h" #include "DPLWebSocket.h" #include "ArrowSupport.h" +#include "Framework/ConfigParamDiscovery.h" #include "ComputingResourceHelpers.h" #include "DataProcessingStatus.h" @@ -2806,6 +2808,38 @@ void enableSignposts(std::string const& signpostsToEnable) } } +void overrideAll(o2::framework::ConfigContext& ctx, std::vector& workflow) +{ + overrideCloning(ctx, workflow); + overridePipeline(ctx, workflow); + overrideLabels(ctx, workflow); +} + +o2::framework::ConfigContext createConfigContext(std::unique_ptr& workflowOptionsRegistry, + o2::framework::ServiceRegistry& configRegistry, + std::vector& workflowOptions, + std::vector& extraOptions, int argc, char** argv) +{ + std::vector> retrievers; + std::unique_ptr retriever{new o2::framework::BoostOptionsRetriever(true, argc, argv)}; + retrievers.emplace_back(std::move(retriever)); + auto workflowOptionsStore = std::make_unique(workflowOptions, std::move(retrievers)); + workflowOptionsStore->preload(); + workflowOptionsStore->activate(); + workflowOptionsRegistry = std::make_unique(std::move(workflowOptionsStore)); + extraOptions = o2::framework::ConfigParamDiscovery::discover(*workflowOptionsRegistry, argc, argv); + for (auto& extra : extraOptions) { + workflowOptions.push_back(extra); + } + + return o2::framework::ConfigContext(*workflowOptionsRegistry, o2::framework::ServiceRegistryRef{configRegistry}, argc, argv); +} + +std::unique_ptr createRegistry() +{ + return std::make_unique(); +} + // This is a toy executor for the workflow spec // What it needs to do is: // From 87221842648514a957d2332f6d07e803ef0ab1a3 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Thu, 9 Jan 2025 01:39:41 +0100 Subject: [PATCH 02/50] GPU: Fix copying of cluster data to GPU when not all processing steps are running on GPU --- GPU/GPUTracking/Global/GPUChainTracking.h | 1 + .../Global/GPUChainTrackingClusterizer.cxx | 2 +- .../Global/GPUChainTrackingTransformation.cxx | 29 ++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/GPU/GPUTracking/Global/GPUChainTracking.h b/GPU/GPUTracking/Global/GPUChainTracking.h index 11443b52504e2..6eb20f3093b2f 100644 --- a/GPU/GPUTracking/Global/GPUChainTracking.h +++ b/GPU/GPUTracking/Global/GPUChainTracking.h @@ -313,6 +313,7 @@ class GPUChainTracking : public GPUChain, GPUReconstructionHelpers::helperDelega void RunTPCTrackingMerger_MergeBorderTracks(int8_t withinSlice, int8_t mergeMode, GPUReconstruction::krnlDeviceType deviceType); void RunTPCTrackingMerger_Resolve(int8_t useOrigTrackParam, int8_t mergeAll, GPUReconstruction::krnlDeviceType deviceType); void RunTPCClusterFilter(o2::tpc::ClusterNativeAccess* clusters, std::function allocator, bool applyClusterCuts); + bool NeedTPCClustersOnGPU(); std::atomic_flag mLockAtomicOutputBuffer = ATOMIC_FLAG_INIT; std::mutex mMutexUpdateCalib; diff --git a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx index 4bc0ee4e91ff1..ff4133d9b2ce3 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx @@ -629,7 +629,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) auto* digitsMC = propagateMCLabels ? processors()->ioPtrs.tpcPackedDigits->tpcDigitsMC : nullptr; - bool buildNativeGPU = (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCConversion) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSliceTracking) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCMerging) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression); + bool buildNativeGPU = doGPU && NeedTPCClustersOnGPU(); bool buildNativeHost = (mRec->GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCClusters) || GetProcessingSettings().deterministicGPUReconstruction; // TODO: Should do this also when clusters are needed for later steps on the host but not requested as output mInputsHost->mNClusterNative = mInputsShadow->mNClusterNative = mRec->MemoryScalers()->nTPCHits * tpcHitLowOccupancyScalingFactor; diff --git a/GPU/GPUTracking/Global/GPUChainTrackingTransformation.cxx b/GPU/GPUTracking/Global/GPUChainTrackingTransformation.cxx index 67f1ff63e9cb3..5b7cf945a15c9 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingTransformation.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingTransformation.cxx @@ -32,6 +32,11 @@ using namespace GPUCA_NAMESPACE::gpu; using namespace o2::tpc; +bool GPUChainTracking::NeedTPCClustersOnGPU() +{ + return (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCConversion) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCSliceTracking) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCMerging) || (mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCCompression); +} + int32_t GPUChainTracking::ConvertNativeToClusterData() { #ifdef GPUCA_HAVE_O2HEADERS @@ -42,19 +47,17 @@ int32_t GPUChainTracking::ConvertNativeToClusterData() GPUTPCConvert& convertShadow = doGPU ? processorsShadow()->tpcConverter : convert; bool transferClusters = false; - if (doGPU) { - if (!(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding)) { - mInputsHost->mNClusterNative = mInputsShadow->mNClusterNative = mIOPtrs.clustersNative->nClustersTotal; - AllocateRegisteredMemory(mInputsHost->mResourceClusterNativeBuffer); - processorsShadow()->ioPtrs.clustersNative = mInputsShadow->mPclusterNativeAccess; - WriteToConstantMemory(RecoStep::TPCConversion, (char*)&processors()->ioPtrs - (char*)processors(), &processorsShadow()->ioPtrs, sizeof(processorsShadow()->ioPtrs), 0); - *mInputsHost->mPclusterNativeAccess = *mIOPtrs.clustersNative; - mInputsHost->mPclusterNativeAccess->clustersLinear = mInputsShadow->mPclusterNativeBuffer; - mInputsHost->mPclusterNativeAccess->setOffsetPtrs(); - GPUMemCpy(RecoStep::TPCConversion, mInputsShadow->mPclusterNativeBuffer, mIOPtrs.clustersNative->clustersLinear, sizeof(mIOPtrs.clustersNative->clustersLinear[0]) * mIOPtrs.clustersNative->nClustersTotal, 0, true); - TransferMemoryResourceLinkToGPU(RecoStep::TPCConversion, mInputsHost->mResourceClusterNativeAccess, 0); - transferClusters = true; - } + if (mRec->IsGPU() && !(mRec->GetRecoStepsGPU() & GPUDataTypes::RecoStep::TPCClusterFinding) && NeedTPCClustersOnGPU()) { + mInputsHost->mNClusterNative = mInputsShadow->mNClusterNative = mIOPtrs.clustersNative->nClustersTotal; + AllocateRegisteredMemory(mInputsHost->mResourceClusterNativeBuffer); + processorsShadow()->ioPtrs.clustersNative = mInputsShadow->mPclusterNativeAccess; + WriteToConstantMemory(RecoStep::TPCConversion, (char*)&processors()->ioPtrs - (char*)processors(), &processorsShadow()->ioPtrs, sizeof(processorsShadow()->ioPtrs), 0); + *mInputsHost->mPclusterNativeAccess = *mIOPtrs.clustersNative; + mInputsHost->mPclusterNativeAccess->clustersLinear = mInputsShadow->mPclusterNativeBuffer; + mInputsHost->mPclusterNativeAccess->setOffsetPtrs(); + GPUMemCpy(RecoStep::TPCConversion, mInputsShadow->mPclusterNativeBuffer, mIOPtrs.clustersNative->clustersLinear, sizeof(mIOPtrs.clustersNative->clustersLinear[0]) * mIOPtrs.clustersNative->nClustersTotal, 0, true); + TransferMemoryResourceLinkToGPU(RecoStep::TPCConversion, mInputsHost->mResourceClusterNativeAccess, 0); + transferClusters = true; } if (!param().par.earlyTpcTransform) { if (GetProcessingSettings().debugLevel >= 3) { From 651d9e5ef80ab16140b92c07390bc266b74b19be Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:55:13 +0100 Subject: [PATCH 03/50] DPL: improve calling of the termination hook --- .../include/Framework/runDataProcessing.h | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Framework/Core/include/Framework/runDataProcessing.h b/Framework/Core/include/Framework/runDataProcessing.h index f52ba08aa3f53..07083314af12e 100644 --- a/Framework/Core/include/Framework/runDataProcessing.h +++ b/Framework/Core/include/Framework/runDataProcessing.h @@ -87,11 +87,6 @@ void defaultConfiguration(std::vector& services) /// Workflow options which are required by DPL in order to work. std::vector requiredWorkflowOptions(); -void defaultConfiguration(o2::framework::OnWorkflowTerminationHook& hook) -{ - hook = [](const char*) {}; -} - template concept WithUserOverride = requires(T& something) { customize(something); }; @@ -154,6 +149,22 @@ std::vector injectCustomizations() return policies; } +template + requires requires(T& hook) { customize(hook); } +void callWorkflowTermination(T& hook, char const* idstring) +{ + customize(hook); + hook(idstring); + doDefaultWorkflowTerminationHook(); +} + +// Do not call the user hook if it's not there. +template +void callWorkflowTermination(T&, char const* idstring) +{ + doDefaultWorkflowTerminationHook(); +} + void overrideAll(o2::framework::ConfigContext& ctx, std::vector& workflow); o2::framework::ConfigContext createConfigContext(std::unique_ptr& workflowOptionsRegistry, @@ -208,9 +219,7 @@ int main(int argc, char** argv) char* idstring = getIdString(argc, argv); o2::framework::OnWorkflowTerminationHook onWorkflowTerminationHook; - UserCustomizationsHelper::userDefinedCustomization(onWorkflowTerminationHook); - onWorkflowTerminationHook(idstring); - doDefaultWorkflowTerminationHook(); + callWorkflowTermination(onWorkflowTerminationHook, idstring); return result; } From 501ef180cd63ed1ba7068c58f024da383daa33af Mon Sep 17 00:00:00 2001 From: David Rohr Date: Fri, 10 Jan 2025 14:43:02 +0100 Subject: [PATCH 04/50] GPU: Fix sector tracking running on CPU if in GPU mode --- .../Global/GPUChainTrackingSliceTracker.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx b/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx index 62c93bcb1bfb5..00b71aed7cb8b 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingSliceTracker.cxx @@ -150,7 +150,9 @@ int32_t GPUChainTracking::RunTPCTrackingSlices_internal() AllocateRegisteredMemory(mInputsHost->mResourceOccupancyMap, mSubOutputControls[GPUTrackingOutputs::getIndex(&GPUTrackingOutputs::tpcOccupancyMap)]); } if (param().rec.tpc.occupancyMapTimeBins) { - ReleaseEvent(mEvents->init); + if (doGPU) { + ReleaseEvent(mEvents->init); + } uint32_t* ptr = doGPU ? mInputsShadow->mTPCClusterOccupancyMap : mInputsHost->mTPCClusterOccupancyMap; auto* ptrTmp = (GPUTPCClusterOccupancyMapBin*)mRec->AllocateVolatileMemory(GPUTPCClusterOccupancyMapBin::getTotalSize(param()), doGPU); runKernel(GetGridAutoStep(streamOccMap, RecoStep::TPCSliceTracking), ptrTmp, GPUTPCClusterOccupancyMapBin::getTotalSize(param())); @@ -297,7 +299,9 @@ int32_t GPUChainTracking::RunTPCTrackingSlices_internal() } if (doGPU || GetProcessingSettings().debugLevel >= 1) { - ReleaseEvent(mEvents->init); + if (doGPU) { + ReleaseEvent(mEvents->init); + } if (!doSliceDataOnGPU) { WaitForHelperThreads(); } @@ -439,11 +443,11 @@ int32_t GPUChainTracking::RunTPCTrackingSlices_internal() if (!((GetRecoStepsOutputs() & GPUDataTypes::InOutType::TPCSectorTracks) || (doGPU && !(GetRecoStepsGPU() & RecoStep::TPCMerging)))) { uint32_t sliceLeft, sliceRight; GPUTPCGlobalTracking::GlobalTrackingSliceLeftRight(tmpSlice, sliceLeft, sliceRight); - if (!blocking[tmpSlice * mRec->NStreams() + sliceLeft % mRec->NStreams()]) { + if (doGPU && !blocking[tmpSlice * mRec->NStreams() + sliceLeft % mRec->NStreams()]) { StreamWaitForEvents(tmpSlice % mRec->NStreams(), &mEvents->slice[sliceLeft]); blocking[tmpSlice * mRec->NStreams() + sliceLeft % mRec->NStreams()] = true; } - if (!blocking[tmpSlice * mRec->NStreams() + sliceRight % mRec->NStreams()]) { + if (doGPU && !blocking[tmpSlice * mRec->NStreams() + sliceRight % mRec->NStreams()]) { StreamWaitForEvents(tmpSlice % mRec->NStreams(), &mEvents->slice[sliceRight]); blocking[tmpSlice * mRec->NStreams() + sliceRight % mRec->NStreams()] = true; } @@ -452,7 +456,7 @@ int32_t GPUChainTracking::RunTPCTrackingSlices_internal() } } for (uint32_t iSlice = 0; iSlice < NSLICES; iSlice++) { - if (transferRunning[iSlice]) { + if (doGPU && transferRunning[iSlice]) { ReleaseEvent(mEvents->slice[iSlice]); } } From fff029646981920cf52ea48cad9495a30ba156b2 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Sat, 11 Jan 2025 00:59:40 +0100 Subject: [PATCH 05/50] Drop unneeded regex (#13851) The unused regex pollutes a bunch of compile units with unneeded code. --- .../DCS/include/DetectorsDCS/DeliveryType.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Detectors/DCS/include/DetectorsDCS/DeliveryType.h b/Detectors/DCS/include/DetectorsDCS/DeliveryType.h index 236d9eb084759..f0ee5573a9421 100644 --- a/Detectors/DCS/include/DetectorsDCS/DeliveryType.h +++ b/Detectors/DCS/include/DetectorsDCS/DeliveryType.h @@ -20,20 +20,12 @@ #define O2_DCS_DELIVERY_TYPE #include -#include +#include #include #include "DetectorsDCS/GenericFunctions.h" -namespace o2 -{ -namespace dcs +namespace o2::dcs { -/** - * This regular expression matches with strings representing payload types. - */ -static const std::regex REGEX_PT( - "^(Raw|DPVAL)/(Int|Uint|Float|Double|Bool|Char|String|Time|Binary)$"); - /** *

DeliveryType is a piece of meta-information used for deducing types of * DPVAL payloads and DIM service description strings used with services @@ -406,8 +398,8 @@ inline size_t dim_buffer_size(const DeliveryType type) throw std::domain_error("Illegal DeliveryType."); } } -} // namespace dcs +} // namespace o2::dcs + -} // namespace o2 #endif /* O2_DCS_DELIVERY_TYPE */ From a6d96bc5e8e41ccdda00faaef35ea9fac00ec745 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Sat, 11 Jan 2025 09:57:07 +0100 Subject: [PATCH 06/50] DPL: refactor ConfigParamRegistry to use C++20 (#13850) Use constraints to make sure we can out-of-line known types of parameter. Remove the need to include Array2D.h when not used. Reduce dependence on ptree, in particular moving the helper methods out of line. --- Framework/Core/CMakeLists.txt | 1 + Framework/Core/include/Framework/Array2D.h | 2 + .../include/Framework/ConfigParamRegistry.h | 142 ++++++---------- Framework/Core/src/ConfigParamRegistry.cxx | 157 ++++++++++++++++++ 4 files changed, 214 insertions(+), 88 deletions(-) create mode 100644 Framework/Core/src/ConfigParamRegistry.cxx diff --git a/Framework/Core/CMakeLists.txt b/Framework/Core/CMakeLists.txt index b5e1935fa5581..103b559f642e2 100644 --- a/Framework/Core/CMakeLists.txt +++ b/Framework/Core/CMakeLists.txt @@ -52,6 +52,7 @@ o2_add_library(Framework src/ConfigParamDiscovery.cxx src/ConfigParamStore.cxx src/ConfigParamsHelper.cxx + src/ConfigParamRegistry.cxx src/ChannelParamSpec.cxx src/DDSConfigHelpers.cxx src/DataAllocator.cxx diff --git a/Framework/Core/include/Framework/Array2D.h b/Framework/Core/include/Framework/Array2D.h index 5a1ed57408f30..593a50afd91f6 100644 --- a/Framework/Core/include/Framework/Array2D.h +++ b/Framework/Core/include/Framework/Array2D.h @@ -24,6 +24,7 @@ namespace o2::framework // has no range checks template struct Array2D { + void is_array_2d(); using element_t = T; Array2D() @@ -161,6 +162,7 @@ template class LabeledArray : public LabelMap { public: + void is_labeled_array(); using element_t = T; LabeledArray() diff --git a/Framework/Core/include/Framework/ConfigParamRegistry.h b/Framework/Core/include/Framework/ConfigParamRegistry.h index fdd1cad1de477..540581231dde3 100644 --- a/Framework/Core/include/Framework/ConfigParamRegistry.h +++ b/Framework/Core/include/Framework/ConfigParamRegistry.h @@ -11,35 +11,45 @@ #ifndef O2_FRAMEWORK_CONFIGPARAMREGISTRY_H_ #define O2_FRAMEWORK_CONFIGPARAMREGISTRY_H_ -#include "Framework/ParamRetriever.h" #include "Framework/ConfigParamStore.h" +#include #include "Framework/Traits.h" -#include "Framework/VariantPropertyTreeHelpers.h" -#include +#include +#include #include #include #include +#include -namespace -{ template -constexpr auto isSimpleType() -{ - return std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v; -} -} // namespace +concept SimpleConfigValueType = std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as || + std::same_as; + +template +concept StringConfigValueType = std::same_as; + +template +concept PtreeConfigValueType = std::same_as || std::constructible_from; + +template +concept Array2DLike = requires(T& t) { t.is_array_2d(); }; + +template +concept LabeledArrayLike = requires(T& t) { t.is_labeled_array(); }; + +template +concept ConfigValueType = SimpleConfigValueType || StringConfigValueType || o2::framework::base_of_template || Array2DLike || LabeledArrayLike; namespace o2::framework { @@ -54,87 +64,43 @@ class ConfigParamStore; class ConfigParamRegistry { public: - ConfigParamRegistry(std::unique_ptr store) - : mStore{std::move(store)} - { - } + ConfigParamRegistry(std::unique_ptr store); - bool isSet(const char* key) const - { - return mStore->store().count(key); - } + bool isSet(const char* key) const; - bool hasOption(const char* key) const - { - return mStore->store().get_child_optional(key).is_initialized(); - } + bool hasOption(const char* key) const; - bool isDefault(const char* key) const - { - return mStore->store().count(key) > 0 && mStore->provenance(key) != "default"; - } + bool isDefault(const char* key) const; - [[nodiscard]] std::vector const& specs() const - { - return mStore->specs(); - } + [[nodiscard]] std::vector const& specs() const; - template - T get(const char* key) const - { - assert(mStore.get()); - try { - if constexpr (isSimpleType()) { - return mStore->store().get(key); - } else if constexpr (std::is_same_v) { - return mStore->store().get(key); - } else if constexpr (std::is_same_v) { - return std::string_view{mStore->store().get(key)}; - } else if constexpr (base_of_template) { - return vectorFromBranch(mStore->store().get_child(key)); - } else if constexpr (base_of_template) { - return array2DFromBranch(mStore->store().get_child(key)); - } else if constexpr (base_of_template) { - return labeledArrayFromBranch(mStore->store().get_child(key)); - } else if constexpr (std::is_same_v) { - return mStore->store().get_child(key); - } else if constexpr (std::is_constructible_v) { - return T{mStore->store().get_child(key)}; - } else if constexpr (std::is_constructible_v == false) { - static_assert(std::is_constructible_v == false, - "Not a basic type and no constructor from ptree provided"); - } - } catch (std::exception& e) { - throw std::invalid_argument(std::string("missing option: ") + key + " (" + e.what() + ")"); - } catch (...) { - throw std::invalid_argument(std::string("error parsing option: ") + key); - } - throw std::invalid_argument(std::string("bad type for option: ") + key); - } + template + T get(const char* key) const; template - void override(const char* key, const T& val) const - { - assert(mStore.get()); - try { - mStore->store().put(key, val); - } catch (std::exception& e) { - throw std::invalid_argument(std::string("failed to store an option: ") + key + " (" + e.what() + ")"); - } catch (...) { - throw std::invalid_argument(std::string("failed to store an option: ") + key); - } - } + T get(const char* key) const; + + void override(const char* key, ConfigValueType auto const& val) const; // Load extra parameters discovered while we process data - void loadExtra(std::vector& extras) - { - mStore->load(extras); - } + void loadExtra(std::vector& extras); private: std::unique_ptr mStore; }; +template +T ConfigParamRegistry::get(const char* key) const +{ + try { + return T{mStore->store().get_child(key)}; + } catch (std::exception& e) { + throw std::invalid_argument(std::string("missing option: ") + key + " (" + e.what() + ")"); + } catch (...) { + throw std::invalid_argument(std::string("error parsing option: ") + key); + } +} + } // namespace o2::framework #endif // O2_FRAMEWORK_CONFIGPARAMREGISTRY_H_ diff --git a/Framework/Core/src/ConfigParamRegistry.cxx b/Framework/Core/src/ConfigParamRegistry.cxx new file mode 100644 index 0000000000000..e6af6eeaebcae --- /dev/null +++ b/Framework/Core/src/ConfigParamRegistry.cxx @@ -0,0 +1,157 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +#include "Framework/ConfigParamRegistry.h" +#include "Framework/VariantPropertyTreeHelpers.h" +#include "Framework/Array2D.h" + +namespace o2::framework +{ + +ConfigParamRegistry::ConfigParamRegistry(std::unique_ptr store) + : mStore{std::move(store)} +{ +} + +bool ConfigParamRegistry::isSet(const char* key) const +{ + return mStore->store().count(key); +} + +bool ConfigParamRegistry::hasOption(const char* key) const +{ + return mStore->store().get_child_optional(key).is_initialized(); +} + +bool ConfigParamRegistry::isDefault(const char* key) const +{ + return mStore->store().count(key) > 0 && mStore->provenance(key) != "default"; +} + +namespace +{ +template +T getImpl(boost::property_tree::ptree const& tree, const char* key) +{ + return tree.get(key); +} + +template +T getImpl(boost::property_tree::ptree const& tree, const char* key) +{ + return tree.get(key); +} + +template + requires base_of_template +auto getImpl(boost::property_tree::ptree const& tree, const char* key) +{ + return o2::framework::vectorFromBranch(tree.get_child(key)); +} + +template +auto getImpl(boost::property_tree::ptree& tree, const char* key) +{ + return array2DFromBranch(tree.get_child(key)); +} + +template +auto getImpl(boost::property_tree::ptree& tree, const char* key) +{ + return labeledArrayFromBranch(tree.get_child(key)); +} +} // namespace + +template +T ConfigParamRegistry::get(const char* key) const +{ + try { + return getImpl(this->mStore->store(), key); + } catch (std::exception& e) { + throw std::invalid_argument(std::string("missing option: ") + key + " (" + e.what() + ")"); + } catch (...) { + throw std::invalid_argument(std::string("error parsing option: ") + key); + } +} + +void ConfigParamRegistry::override(const char* key, ConfigValueType auto const& val) const +{ + try { + mStore->store().put(key, val); + } catch (std::exception& e) { + throw std::invalid_argument(std::string("failed to store an option: ") + key + " (" + e.what() + ")"); + } catch (...) { + throw std::invalid_argument(std::string("failed to store an option: ") + key); + } +} + +// Load extra parameters discovered while we process data +void ConfigParamRegistry::loadExtra(std::vector& extras) +{ + mStore->load(extras); +} + +[[nodiscard]] std::vector const& ConfigParamRegistry::specs() const +{ + return mStore->specs(); +} + +template int8_t ConfigParamRegistry::get(const char* key) const; +template short ConfigParamRegistry::get(const char* key) const; +template int ConfigParamRegistry::get(const char* key) const; +template long ConfigParamRegistry::get(const char* key) const; +template long long ConfigParamRegistry::get(const char* key) const; +template uint8_t ConfigParamRegistry::get(const char* key) const; +template uint16_t ConfigParamRegistry::get(const char* key) const; +template uint32_t ConfigParamRegistry::get(const char* key) const; +template uint64_t ConfigParamRegistry::get(const char* key) const; +template LabeledArray ConfigParamRegistry::get>(const char* key) const; +template LabeledArray ConfigParamRegistry::get>(const char* key) const; +template LabeledArray ConfigParamRegistry::get>(const char* key) const; +template LabeledArray ConfigParamRegistry::get>(const char* key) const; +template Array2D ConfigParamRegistry::get>(const char* key) const; +template Array2D ConfigParamRegistry::get>(const char* key) const; +template Array2D ConfigParamRegistry::get>(const char* key) const; +template Array2D ConfigParamRegistry::get>(const char* key) const; +template std::vector ConfigParamRegistry::get>(const char* key) const; +template std::vector ConfigParamRegistry::get>(const char* key) const; +template std::vector ConfigParamRegistry::get>(const char* key) const; +template std::vector ConfigParamRegistry::get>(const char* key) const; +template float ConfigParamRegistry::get(const char* key) const; +template double ConfigParamRegistry::get(const char* key) const; +template std::string ConfigParamRegistry::get(const char* key) const; +template bool ConfigParamRegistry::get(const char* key) const; + +template void ConfigParamRegistry::override(const char* key, int8_t const&) const; +template void ConfigParamRegistry::override(const char* key, int16_t const&) const; +template void ConfigParamRegistry::override(const char* key, int32_t const&) const; +template void ConfigParamRegistry::override(const char* key, int64_t const&) const; +template void ConfigParamRegistry::override(const char* key, uint8_t const&) const; +template void ConfigParamRegistry::override(const char* key, uint16_t const&) const; +template void ConfigParamRegistry::override(const char* key, uint32_t const&) const; +template void ConfigParamRegistry::override(const char* key, uint64_t const&) const; +template void ConfigParamRegistry::override(const char* key, float const&) const; +template void ConfigParamRegistry::override(const char* key, double const&) const; +template void ConfigParamRegistry::override(const char* key, std::string const&) const; +template void ConfigParamRegistry::override(const char* key, bool const&) const; + +//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +} // namespace o2::framework From 0c08b77fd6e40497c4e2b4ef21cb1eea09275d9c Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Sun, 12 Jan 2025 09:07:59 +0100 Subject: [PATCH 07/50] Get fmt 11.1.1 to compile (#13855) --- .../Headers/include/Headers/DataHeaderHelpers.h | 4 ++-- EventVisualisation/Workflow/src/O2DPLDisplay.cxx | 3 ++- Framework/Core/include/Framework/Formatters.h | 2 +- Framework/Core/src/ComputingQuotaEvaluator.cxx | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/DataFormats/Headers/include/Headers/DataHeaderHelpers.h b/DataFormats/Headers/include/Headers/DataHeaderHelpers.h index f264460890494..aa93414cfb99f 100644 --- a/DataFormats/Headers/include/Headers/DataHeaderHelpers.h +++ b/DataFormats/Headers/include/Headers/DataHeaderHelpers.h @@ -38,7 +38,7 @@ struct fmt::formatter::value, c } template - auto format(const T& p, FormatContext& ctx) + auto format(const T& p, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "{}", p.template as()); } @@ -67,7 +67,7 @@ struct fmt::formatter { } template - auto format(const o2::header::DataHeader& h, FormatContext& ctx) + auto format(const o2::header::DataHeader& h, FormatContext& ctx) const { if (presentation == 's') { auto res = fmt::format("Data header version {}, flags: {}\n", h.headerVersion, h.flags) + diff --git a/EventVisualisation/Workflow/src/O2DPLDisplay.cxx b/EventVisualisation/Workflow/src/O2DPLDisplay.cxx index 414d70c443541..e02e1ee20ce58 100644 --- a/EventVisualisation/Workflow/src/O2DPLDisplay.cxx +++ b/EventVisualisation/Workflow/src/O2DPLDisplay.cxx @@ -229,7 +229,8 @@ void O2DPLDisplaySpec::run(ProcessingContext& pc) } } - LOGP(info, "Tracks: {}", fmt::join(sourceStats, ", ")); + // FIXME: find out why this does not work with 11.1.1 +// LOGP(info, "Tracks: {}", fmt::join(sourceStats, ", ")); } void O2DPLDisplaySpec::endOfStream(EndOfStreamContext& ec) diff --git a/Framework/Core/include/Framework/Formatters.h b/Framework/Core/include/Framework/Formatters.h index 100dfd3c754dd..c38926ed1fdc1 100644 --- a/Framework/Core/include/Framework/Formatters.h +++ b/Framework/Core/include/Framework/Formatters.h @@ -20,7 +20,7 @@ struct fmt::formatter : fmt::formatter - auto format(o2::framework::Lifetime const& h, FormatContext& ctx) + auto format(o2::framework::Lifetime const& h, FormatContext& ctx) const { std::string_view s = "unknown"; switch (h) { diff --git a/Framework/Core/src/ComputingQuotaEvaluator.cxx b/Framework/Core/src/ComputingQuotaEvaluator.cxx index 6ad7d84c44d66..56b7f4a59be88 100644 --- a/Framework/Core/src/ComputingQuotaEvaluator.cxx +++ b/Framework/Core/src/ComputingQuotaEvaluator.cxx @@ -24,6 +24,7 @@ #define LOGLEVEL debug + namespace o2::framework { @@ -90,7 +91,7 @@ bool ComputingQuotaEvaluator::selectOffer(int task, ComputingQuotaRequest const& } if (enough) { LOGP(LOGLEVEL, "{} offers were selected for a total of: cpu {}, memory {}, shared memory {}", result.size(), totalOffer.cpu, totalOffer.memory, totalOffer.sharedMemory); - LOGP(LOGLEVEL, " The following offers were selected for computation: {} ", fmt::join(result, ",")); + //LOG(LOGLEVEL) << " The following offers were selected for computation: {} " << fmt::join(result, ", "); dpStats.updateStats({static_cast(ProcessingStatsId::RESOURCES_SATISFACTORY), DataProcessingStats::Op::Add, 1}); } else { dpStats.updateStats({static_cast(ProcessingStatsId::RESOURCES_MISSING), DataProcessingStats::Op::Add, 1}); @@ -99,16 +100,16 @@ bool ComputingQuotaEvaluator::selectOffer(int task, ComputingQuotaRequest const& } } if (stats.invalidOffers.size()) { - LOGP(LOGLEVEL, " The following offers were invalid: {}", fmt::join(stats.invalidOffers, ", ")); + // LOGP(LOGLEVEL, " The following offers were invalid: {}", fmt::join(stats.invalidOffers, ", ")); } if (stats.otherUser.size()) { - LOGP(LOGLEVEL, " The following offers were owned by other users: {}", fmt::join(stats.otherUser, ", ")); + // LOGP(LOGLEVEL, " The following offers were owned by other users: {}", fmt::join(stats.otherUser, ", ")); } if (stats.expired.size()) { - LOGP(LOGLEVEL, " The following offers are expired: {}", fmt::join(stats.expired, ", ")); + // LOGP(LOGLEVEL, " The following offers are expired: {}", fmt::join(stats.expired, ", ")); } if (stats.unexpiring.size() > 1) { - LOGP(LOGLEVEL, " The following offers will never expire: {}", fmt::join(stats.unexpiring, ", ")); + // LOGP(LOGLEVEL, " The following offers will never expire: {}", fmt::join(stats.unexpiring, ", ")); } return enough; From 7f23fa18e02520731a25e1bcacbcd352310c42b0 Mon Sep 17 00:00:00 2001 From: Marco Giacalone Date: Thu, 19 Dec 2024 20:36:28 +0100 Subject: [PATCH 08/50] Basic implementation of cocktail generation --- .../include/Generators/GeneratorHybrid.h | 5 + Generators/src/GeneratorHybrid.cxx | 180 +++++++++++------- run/SimExamples/Hybrid/README.md | 4 +- run/SimExamples/Hybrid/hybridconfig.json | 3 +- run/SimExamples/Hybrid_cocktail/README.md | 13 ++ .../Hybrid_cocktail/hybridcocktail.json | 55 ++++++ run/SimExamples/Hybrid_cocktail/runo2sim.sh | 68 +++++++ 7 files changed, 258 insertions(+), 70 deletions(-) create mode 100644 run/SimExamples/Hybrid_cocktail/README.md create mode 100644 run/SimExamples/Hybrid_cocktail/hybridcocktail.json create mode 100644 run/SimExamples/Hybrid_cocktail/runo2sim.sh diff --git a/Generators/include/Generators/GeneratorHybrid.h b/Generators/include/Generators/GeneratorHybrid.h index abce56f762f2a..b0993c4fd82e2 100644 --- a/Generators/include/Generators/GeneratorHybrid.h +++ b/Generators/include/Generators/GeneratorHybrid.h @@ -66,6 +66,7 @@ class GeneratorHybrid : public Generator void setNEvents(int n) { mNEvents = n; } Bool_t parseJSON(const std::string& path); + Bool_t confSetter(const auto& gen); template std::string jsonValueToString(const T& value); @@ -98,6 +99,10 @@ class GeneratorHybrid : public Generator int mEventCounter = 0; int mTasksStarted = 0; + // Cocktail mode + bool mCocktailMode = false; + std::vector> mGroups; + // Create a task arena with a specified number of threads std::thread mTBBTaskPoolRunner; tbb::concurrent_bounded_queue mInputTaskQueue; diff --git a/Generators/src/GeneratorHybrid.cxx b/Generators/src/GeneratorHybrid.cxx index 932be0586ce4d..af6f2bea03052 100644 --- a/Generators/src/GeneratorHybrid.cxx +++ b/Generators/src/GeneratorHybrid.cxx @@ -12,7 +12,6 @@ #include "Generators/GeneratorHybrid.h" #include #include - #include #include #include @@ -42,9 +41,16 @@ GeneratorHybrid::GeneratorHybrid(const std::string& inputgens) } int index = 0; if (!(mRandomize || mGenerationMode == GenMode::kParallel)) { - if (mFractions.size() != mInputGens.size()) { - LOG(fatal) << "Number of fractions does not match the number of generators"; - return; + if (mCocktailMode) { + if (mGroups.size() != mFractions.size()) { + LOG(fatal) << "Number of groups does not match the number of fractions"; + return; + } + } else { + if (mFractions.size() != mInputGens.size()) { + LOG(fatal) << "Number of fractions does not match the number of generators"; + return; + } } // Check if all elements of mFractions are 0 if (std::all_of(mFractions.begin(), mFractions.end(), [](int i) { return i == 0; })) { @@ -303,7 +309,7 @@ bool GeneratorHybrid::generateEvent() } } } else { - mIndex = gRandom->Integer(mGens.size()); + mIndex = gRandom->Integer(mFractions.size()); } } else { while (mFractions[mCurrentFraction] == 0 || mseqCounter == mFractions[mCurrentFraction]) { @@ -322,25 +328,47 @@ bool GeneratorHybrid::generateEvent() bool GeneratorHybrid::importParticles() { int genIndex = -1; + std::vector subGenIndex = {}; if (mIndex == -1) { // this means parallel mode ---> we have a common queue mResultQueue[0].pop(genIndex); } else { // need to pop from a particular queue - mResultQueue[mIndex].pop(genIndex); + if (!mCocktailMode) { + mResultQueue[mIndex].pop(genIndex); + } else { + // in cocktail mode we need to pop from the group queue + subGenIndex.resize(mGroups[mIndex].size()); + for (size_t pos = 0; pos < mGroups[mIndex].size(); ++pos) { + int subIndex = mGroups[mIndex][pos]; + LOG(info) << "Getting generator " << mGens[subIndex] << " from cocktail group " << mIndex; + mResultQueue[subIndex].pop(subGenIndex[pos]); + } + } } - LOG(info) << "Importing particles for task " << genIndex; - - // at this moment the mIndex-th generator is ready to be used + // Clear particles and event header mParticles.clear(); - mParticles = gens[genIndex]->getParticles(); - - // fetch the event Header information from the underlying generator mMCEventHeader.clearInfo(); - gens[genIndex]->updateHeader(&mMCEventHeader); - - mInputTaskQueue.push(genIndex); - mTasksStarted++; + if (mCocktailMode) { + // in cocktail mode we need to merge the particles from the different generators + for (auto subIndex : subGenIndex) { + LOG(info) << "Importing particles for task " << subIndex; + auto subParticles = gens[subIndex]->getParticles(); + mParticles.insert(mParticles.end(), subParticles.begin(), subParticles.end()); + // fetch the event Header information from the underlying generator + gens[subIndex]->updateHeader(&mMCEventHeader); + mInputTaskQueue.push(subIndex); + mTasksStarted++; + } + } else { + LOG(info) << "Importing particles for task " << genIndex; + // at this moment the mIndex-th generator is ready to be used + mParticles = gens[genIndex]->getParticles(); + // fetch the event Header information from the underlying generator + gens[genIndex]->updateHeader(&mMCEventHeader); + mInputTaskQueue.push(genIndex); + mTasksStarted++; + } mseqCounter++; mEventCounter++; @@ -348,6 +376,7 @@ bool GeneratorHybrid::importParticles() LOG(info) << "HybridGen: Stopping TBB task pool"; mStopFlag = true; } + return true; } @@ -371,6 +400,59 @@ std::string GeneratorHybrid::jsonValueToString(const T& value) return buffer.GetString(); } +Bool_t GeneratorHybrid::confSetter(const auto& gen) +{ + std::string name = gen["name"].GetString(); + mInputGens.push_back(name); + if (gen.HasMember("config")) { + if (name == "boxgen") { + const auto& boxconf = gen["config"]; + auto boxConfig = TBufferJSON::FromJSON(jsonValueToString(boxconf).c_str()); + mBoxGenConfigs.push_back(std::move(boxConfig)); + mConfigs.push_back("boxgen_" + std::to_string(mBoxGenConfigs.size() - 1)); + } else if (name == "pythia8") { + const auto& pythia8conf = gen["config"]; + auto pythia8Config = TBufferJSON::FromJSON(jsonValueToString(pythia8conf).c_str()); + mPythia8GenConfigs.push_back(std::move(pythia8Config)); + mConfigs.push_back("pythia8_" + std::to_string(mPythia8GenConfigs.size() - 1)); + } else if (name == "extkinO2") { + const auto& o2kineconf = gen["config"]; + auto o2kineConfig = TBufferJSON::FromJSON(jsonValueToString(o2kineconf).c_str()); + mO2KineGenConfigs.push_back(std::move(o2kineConfig)); + mConfigs.push_back("extkinO2_" + std::to_string(mO2KineGenConfigs.size() - 1)); + } else if (name == "evtpool") { + const auto& o2kineconf = gen["config"]; + auto poolConfig = TBufferJSON::FromJSON(jsonValueToString(o2kineconf).c_str()); + mEventPoolConfigs.push_back(*poolConfig); + mConfigs.push_back("evtpool_" + std::to_string(mEventPoolConfigs.size() - 1)); + } else if (name == "external") { + const auto& extconf = gen["config"]; + auto extConfig = TBufferJSON::FromJSON(jsonValueToString(extconf).c_str()); + mExternalGenConfigs.push_back(std::move(extConfig)); + mConfigs.push_back("external_" + std::to_string(mExternalGenConfigs.size() - 1)); + } else if (name == "hepmc") { + const auto& genconf = gen["config"]; + const auto& cmdconf = genconf["configcmd"]; + const auto& hepmcconf = genconf["confighepmc"]; + auto cmdConfig = TBufferJSON::FromJSON(jsonValueToString(cmdconf).c_str()); + auto hepmcConfig = TBufferJSON::FromJSON(jsonValueToString(hepmcconf).c_str()); + mFileOrCmdGenConfigs.push_back(std::move(cmdConfig)); + mHepMCGenConfigs.push_back(std::move(hepmcConfig)); + mConfigs.push_back("hepmc_" + std::to_string(mFileOrCmdGenConfigs.size() - 1)); + } else { + mConfigs.push_back(""); + } + } else { + if (name == "boxgen" || name == "pythia8" || name == "extkinO2" || name == "external" || name == "hepmc") { + LOG(fatal) << "No configuration provided for generator " << name; + return false; + } else { + mConfigs.push_back(""); + } + } + return true; +} + Bool_t GeneratorHybrid::parseJSON(const std::string& path) { // Parse JSON file to build map @@ -407,60 +489,26 @@ Bool_t GeneratorHybrid::parseJSON(const std::string& path) if (doc.HasMember("generators")) { const auto& gens = doc["generators"]; for (const auto& gen : gens.GetArray()) { - // push in mInputGens the "name" of the generator - std::string name = gen["name"].GetString(); - mInputGens.push_back(name); - if (gen.HasMember("config")) { - if (name == "boxgen") { - const auto& boxconf = gen["config"]; - auto boxConfig = TBufferJSON::FromJSON(jsonValueToString(boxconf).c_str()); - mBoxGenConfigs.push_back(std::move(boxConfig)); - mConfigs.push_back("boxgen_" + std::to_string(mBoxGenConfigs.size() - 1)); - continue; - } else if (name == "pythia8") { - const auto& pythia8conf = gen["config"]; - auto pythia8Config = TBufferJSON::FromJSON(jsonValueToString(pythia8conf).c_str()); - mPythia8GenConfigs.push_back(std::move(pythia8Config)); - mConfigs.push_back("pythia8_" + std::to_string(mPythia8GenConfigs.size() - 1)); - continue; - } else if (name == "extkinO2") { - const auto& o2kineconf = gen["config"]; - auto o2kineConfig = TBufferJSON::FromJSON(jsonValueToString(o2kineconf).c_str()); - mO2KineGenConfigs.push_back(std::move(o2kineConfig)); - mConfigs.push_back("extkinO2_" + std::to_string(mO2KineGenConfigs.size() - 1)); - continue; - } else if (name == "evtpool") { - const auto& o2kineconf = gen["config"]; - auto poolConfig = TBufferJSON::FromJSON(jsonValueToString(o2kineconf).c_str()); - mEventPoolConfigs.push_back(*poolConfig); - mConfigs.push_back("evtpool_" + std::to_string(mEventPoolConfigs.size() - 1)); - continue; - } else if (name == "external") { - const auto& extconf = gen["config"]; - auto extConfig = TBufferJSON::FromJSON(jsonValueToString(extconf).c_str()); - mExternalGenConfigs.push_back(std::move(extConfig)); - mConfigs.push_back("external_" + std::to_string(mExternalGenConfigs.size() - 1)); - continue; - } else if (name == "hepmc") { - const auto& genconf = gen["config"]; - const auto& cmdconf = genconf["configcmd"]; - const auto& hepmcconf = genconf["confighepmc"]; - auto cmdConfig = TBufferJSON::FromJSON(jsonValueToString(cmdconf).c_str()); - auto hepmcConfig = TBufferJSON::FromJSON(jsonValueToString(hepmcconf).c_str()); - mFileOrCmdGenConfigs.push_back(std::move(cmdConfig)); - mHepMCGenConfigs.push_back(std::move(hepmcConfig)); - mConfigs.push_back("hepmc_" + std::to_string(mFileOrCmdGenConfigs.size() - 1)); - continue; - } else { - mConfigs.push_back(""); + mGroups.push_back({}); + // Check if gen is an array (cocktail mode) + if (gen.HasMember("cocktail")) { + mCocktailMode = true; + for (const auto& subgen : gen["cocktail"].GetArray()) { + if (confSetter(subgen)) { + mGroups.back().push_back(mInputGens.size() - 1); + } else { + return false; + } } } else { - if (name == "boxgen" || name == "pythia8" || name == "extkinO2" || name == "external" || name == "hepmc") { - LOG(fatal) << "No configuration provided for generator " << name; + if (!confSetter(gen)) { return false; - } else { - mConfigs.push_back(""); } + // Groups are created in case cocktail mode is activated, this way + // cocktails can be declared anywhere in the JSON file, without the need + // of grouping single generators. If no cocktail is defined + // groups will be ignored nonetheless. + mGroups.back().push_back(mInputGens.size() - 1); } } } diff --git a/run/SimExamples/Hybrid/README.md b/run/SimExamples/Hybrid/README.md index 3c3cba37748bf..21ccde29dece5 100644 --- a/run/SimExamples/Hybrid/README.md +++ b/run/SimExamples/Hybrid/README.md @@ -13,6 +13,4 @@ available generators in O2. The JSON template can be generated using the ${O2DPG - **runo2sim.sh** → allows to use the hybrid generator example - **hybridconfig.json** → example JSON file for the hybrid generator configuration -- **example.optns** → options file to be used in EPOS4 implemented as subgenerator in this example (the .optns must be available in the current working directory) -- **evtpool.root** → cached events to be used with the extkinO2 generator -- **epos4.hepmc** → EPOS4 events stored as hepmc file \ No newline at end of file +- **example.optns** → options file to be used in EPOS4 implemented as subgenerator in this example (the .optns must be available in the current working directory) \ No newline at end of file diff --git a/run/SimExamples/Hybrid/hybridconfig.json b/run/SimExamples/Hybrid/hybridconfig.json index ec36930c569fe..bd027963417b8 100644 --- a/run/SimExamples/Hybrid/hybridconfig.json +++ b/run/SimExamples/Hybrid/hybridconfig.json @@ -53,7 +53,8 @@ "name": "external", "config": { "fileName": "${O2DPG_ROOT}/MC/config/PWGDQ/external/generator/GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV.C", - "funcName": "GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV()" + "funcName": "GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV()", + "iniFile": "" } }, { diff --git a/run/SimExamples/Hybrid_cocktail/README.md b/run/SimExamples/Hybrid_cocktail/README.md new file mode 100644 index 0000000000000..6e07a847e0e6e --- /dev/null +++ b/run/SimExamples/Hybrid_cocktail/README.md @@ -0,0 +1,13 @@ + + +The usage of the Hybrid generator using cocktails is presented in this example. +The syntax of the JSON file shows how the cocktails can be grouped. Each generator will be pulled exactly once in order for each cocktail event generation. +The basic Hybrid Generator mechanisms are shown in the Hybrid and Hybrid_parallel example folders. +The cocktail configuration can not be setup with the template script for now. + +# Files description + +- **runo2sim.sh** → allows to use the hybrid generator example +- **hybridcocktail.json** → example JSON file for the hybrid generator configuration using cocktails \ No newline at end of file diff --git a/run/SimExamples/Hybrid_cocktail/hybridcocktail.json b/run/SimExamples/Hybrid_cocktail/hybridcocktail.json new file mode 100644 index 0000000000000..7bffc334e174c --- /dev/null +++ b/run/SimExamples/Hybrid_cocktail/hybridcocktail.json @@ -0,0 +1,55 @@ +{ + "generators": [ + { + "cocktail": [ + { + "name": "pythia8", + "config": { + "config": "$O2_ROOT/share/Generators/egconfig/pythia8_inel.cfg", + "hooksFileName": "", + "hooksFuncName": "", + "includePartonEvent": false, + "particleFilter": "", + "verbose": 0 + } + }, + { + "name": "external", + "config": { + "fileName": "${O2DPG_ROOT}/MC/config/PWGDQ/external/generator/GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV.C", + "funcName": "GeneratorParamPromptJpsiToElectronEvtGen_pp13TeV()", + "iniFile": "" + } + } + ] + }, + { + "cocktail": [ + { + "name": "pythia8pp" + }, + { + "name": "extkinO2", + "config": { + "skipNonTrackable": true, + "continueMode": false, + "roundRobin": false, + "randomize": false, + "rngseed": 0, + "randomphi": false, + "fileName": "${PWD}/evtpool.root" + } + } + ] + }, + { + "name": "pythia8hf", + "config": "" + } + ], + "fractions": [ + 1, + 1, + 1 + ] +} \ No newline at end of file diff --git a/run/SimExamples/Hybrid_cocktail/runo2sim.sh b/run/SimExamples/Hybrid_cocktail/runo2sim.sh new file mode 100644 index 0000000000000..64e44fefdd21b --- /dev/null +++ b/run/SimExamples/Hybrid_cocktail/runo2sim.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# +# Hybrid generator simulation example using cocktails: +# the simulation is configured using a JSON file (hybridcocktail.json in this folder) +set -x +if [ ! "${O2DPG_ROOT}" ]; then + echo "This needs O2DPG loaded; alienv enter ..." + exit 1 +fi + +[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 2 + +NEV=-1 +more="" +JOBS=2 + +usage() +{ + cat </dev/stderr + exit 3 + ;; + esac + shift +done + +# Set number of events in optns file +if [ ! $NEV -eq -1 ]; then + echo "Setting number of events to $NEV" +else + echo "Number of events not set, defaulting to 10..." + NEV=10 +fi + +# Generation of event pool with pythia8 (10000 events) in a evtpool.root file +${O2DPG_ROOT}/MC/run/examples/event_pool.sh --make + +# Starting simulation with Hybrid generator +${O2_ROOT}/bin/o2-sim --noGeant -j $JOBS --field ccdb --vertexMode kCCDB --run 300000 --configKeyValues "MFTBase.buildAlignment=true;GeneratorHybrid.configFile=$PWD/hybridcocktail.json;GeneratorHybrid.randomize=false;${more}" -g hybrid -o genevents --timestamp 1546300800000 --seed 836302859 -n $NEV \ No newline at end of file From 9e612a68b27a5e94ef5a6c0e1ca5a793e62c7f5e Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Mon, 13 Jan 2025 13:55:29 +0100 Subject: [PATCH 09/50] Update deep trigger example Newer Pythia8 does no longer ship the `HIUserHooks.h` header. Replace by `HIInfo.h`. --- .../Trigger_ImpactB_Pythia8/trigger_impactb_pythia8.macro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/SimExamples/Trigger_ImpactB_Pythia8/trigger_impactb_pythia8.macro b/run/SimExamples/Trigger_ImpactB_Pythia8/trigger_impactb_pythia8.macro index 89df09713db56..9b2dbebda920b 100644 --- a/run/SimExamples/Trigger_ImpactB_Pythia8/trigger_impactb_pythia8.macro +++ b/run/SimExamples/Trigger_ImpactB_Pythia8/trigger_impactb_pythia8.macro @@ -2,7 +2,7 @@ #include "Generators/Trigger.h" #include "Pythia8/Pythia.h" -#include "Pythia8/HIUserHooks.h" +#include "Pythia8/HIInfo.h" #include o2::eventgen::DeepTrigger From c834c68d9190d8bececcae9e79b6b4961a371a46 Mon Sep 17 00:00:00 2001 From: mcoquet642 <74600025+mcoquet642@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:27:59 +0100 Subject: [PATCH 10/50] Adding MFT covariances in AOD associated with global muon tracks (#13780) * Adding MFT covariances in AOD associated with global muon tracks * Clang format --- .../AODProducerWorkflowSpec.h | 7 ++-- Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 40 ++++++++++++++++--- .../include/Framework/AnalysisDataModel.h | 26 ++++++++++++ 3 files changed, 64 insertions(+), 9 deletions(-) diff --git a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h index 5c2bfbd90bc5b..241846f1a9270 100644 --- a/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h +++ b/Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h @@ -520,8 +520,8 @@ class AODProducerWorkflowDPL : public Task GIndex trackID, const o2::globaltracking::RecoContainer& data, int collisionID, std::uint64_t collisionBC, const std::map& bcsMap); - template - void addToFwdTracksTable(fwdTracksCursorType& fwdTracksCursor, fwdTracksCovCursorType& fwdTracksCovCursor, AmbigFwdTracksCursorType& ambigFwdTracksCursor, + template + void addToFwdTracksTable(fwdTracksCursorType& fwdTracksCursor, fwdTracksCovCursorType& fwdTracksCovCursor, AmbigFwdTracksCursorType& ambigFwdTracksCursor, mftTracksCovCursorType& mftTracksCovCursor, GIndex trackID, const o2::globaltracking::RecoContainer& data, int collisionID, std::uint64_t collisionBC, const std::map& bcsMap); TrackExtraInfo processBarrelTrack(int collisionID, std::uint64_t collisionBC, GIndex trackIndex, const o2::globaltracking::RecoContainer& data, const std::map& bcsMap); @@ -535,7 +535,7 @@ class AODProducerWorkflowDPL : public Task // * fills tables collision by collision // * interaction time is for TOF information template void fillTrackTablesPerCollision(int collisionID, std::uint64_t collisionBC, @@ -548,6 +548,7 @@ class AODProducerWorkflowDPL : public Task TracksQACursorType& tracksQACursor, AmbigTracksCursorType& ambigTracksCursor, MFTTracksCursorType& mftTracksCursor, + MFTTracksCovCursorType& mftTracksCovCursor, AmbigMFTTracksCursorType& ambigMFTTracksCursor, FwdTracksCursorType& fwdTracksCursor, FwdTracksCovCursorType& fwdTracksCovCursor, diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index 1550ab2485d9e..6083052eb1168 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -428,7 +428,7 @@ void AODProducerWorkflowDPL::addToMFTTracksTable(mftTracksCursorType& mftTracksC } template void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID, std::uint64_t collisionBC, @@ -441,6 +441,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID, TracksQACursorType& tracksQACursor, AmbigTracksCursorType& ambigTracksCursor, MFTTracksCursorType& mftTracksCursor, + MFTTracksCovCursorType& mftTracksCovCursor, AmbigMFTTracksCursorType& ambigMFTTracksCursor, FwdTracksCursorType& fwdTracksCursor, FwdTracksCovCursorType& fwdTracksCovCursor, @@ -460,6 +461,9 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID, } else if (src == GIndex::Source::MCH || src == GIndex::Source::MFTMCH || src == GIndex::Source::MCHMID) { fwdTracksCursor.reserve(nToReserve + fwdTracksCursor.lastIndex()); fwdTracksCovCursor.reserve(nToReserve + fwdTracksCovCursor.lastIndex()); + if (src == GIndex::Source::MFTMCH) { + mftTracksCovCursor.reserve(nToReserve + mftTracksCovCursor.lastIndex()); + } } else { tracksCursor.reserve(nToReserve + tracksCursor.lastIndex()); tracksCovCursor.reserve(nToReserve + tracksCovCursor.lastIndex()); @@ -479,7 +483,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID, if (trackIndex.isAmbiguous() && mGIDToTableFwdID.find(trackIndex) != mGIDToTableFwdID.end()) { // was it already stored ? continue; } - addToFwdTracksTable(fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, trackIndex, data, collisionID, collisionBC, bcsMap); + addToFwdTracksTable(fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, mftTracksCovCursor, trackIndex, data, collisionID, collisionBC, bcsMap); mGIDToTableFwdID.emplace(trackIndex, mTableTrFwdID); addClustersToFwdTrkClsTable(data, fwdTrkClsCursor, trackIndex, mTableTrFwdID); mTableTrFwdID++; @@ -600,9 +604,9 @@ void AODProducerWorkflowDPL::fillIndexTablesPerCollision(const o2::dataformats:: } } -template +template void AODProducerWorkflowDPL::addToFwdTracksTable(FwdTracksCursorType& fwdTracksCursor, FwdTracksCovCursorType& fwdTracksCovCursor, - AmbigFwdTracksCursorType& ambigFwdTracksCursor, GIndex trackID, + AmbigFwdTracksCursorType& ambigFwdTracksCursor, mftTracksCovCursorType& mftTracksCovCursor, GIndex trackID, const o2::globaltracking::RecoContainer& data, int collisionID, std::uint64_t collisionBC, const std::map& bcsMap) { @@ -744,6 +748,8 @@ void AODProducerWorkflowDPL::addToFwdTracksTable(FwdTracksCursorType& fwdTracksC fwdInfo.trackTimeRes = time.getTimeStampError() * 1.e3; } else { // This is a GlobalMuonTrack or a GlobalForwardTrack const auto& track = data.getGlobalFwdTrack(trackID); + const auto& mftTracks = data.getMFTTracks(); + const auto& mfttrack = mftTracks[track.getMFTTrackID()]; if (!extrapMCHTrack(track.getMCHTrackID())) { LOGF(warn, "Unable to extrapolate MCH track with ID %d! Dummy parameters will be used", track.getMCHTrackID()); } @@ -783,6 +789,26 @@ void AODProducerWorkflowDPL::addToFwdTracksTable(FwdTracksCursorType& fwdTracksC fwdCovInfo.rho1PtTgl = (Char_t)(128. * track.getCovariances()(3, 4) / (fwdCovInfo.sig1Pt * fwdCovInfo.sigTgl)); fwdInfo.trackTypeId = (fwdInfo.chi2matchmchmid >= 0) ? o2::aod::fwdtrack::GlobalMuonTrack : o2::aod::fwdtrack::GlobalForwardTrack; + + float sX = TMath::Sqrt(mfttrack.getSigma2X()), sY = TMath::Sqrt(mfttrack.getSigma2Y()), sPhi = TMath::Sqrt(mfttrack.getSigma2Phi()), + sTgl = TMath::Sqrt(mfttrack.getSigma2Tanl()), sQ2Pt = TMath::Sqrt(mfttrack.getSigma2InvQPt()); + + mftTracksCovCursor(fwdInfo.matchmfttrackid, + truncateFloatFraction(sX, mTrackCovDiag), + truncateFloatFraction(sY, mTrackCovDiag), + truncateFloatFraction(sPhi, mTrackCovDiag), + truncateFloatFraction(sTgl, mTrackCovDiag), + truncateFloatFraction(sQ2Pt, mTrackCovDiag), + (Char_t)(128. * mfttrack.getCovariances()(0, 1) / (sX * sY)), + (Char_t)(128. * mfttrack.getCovariances()(0, 2) / (sPhi * sX)), + (Char_t)(128. * mfttrack.getCovariances()(1, 2) / (sPhi * sY)), + (Char_t)(128. * mfttrack.getCovariances()(0, 3) / (sTgl * sX)), + (Char_t)(128. * mfttrack.getCovariances()(1, 3) / (sTgl * sY)), + (Char_t)(128. * mfttrack.getCovariances()(2, 3) / (sTgl * sPhi)), + (Char_t)(128. * mfttrack.getCovariances()(0, 4) / (sQ2Pt * sX)), + (Char_t)(128. * mfttrack.getCovariances()(1, 4) / (sQ2Pt * sY)), + (Char_t)(128. * mfttrack.getCovariances()(2, 4) / (sQ2Pt * sPhi)), + (Char_t)(128. * mfttrack.getCovariances()(3, 4) / (sQ2Pt * sTgl))); } std::uint64_t bcOfTimeRef; @@ -1837,6 +1863,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto fwdTracksCovCursor = createTableCursor(pc); auto fwdTrkClsCursor = createTableCursor(pc); auto mftTracksCursor = createTableCursor(pc); + auto mftTracksCovCursor = createTableCursor(pc); auto tracksCursor = createTableCursor(pc); auto tracksCovCursor = createTableCursor(pc); auto tracksExtraCursor = createTableCursor(pc); @@ -2171,7 +2198,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto& trackRef = primVer2TRefs.back(); // references to unassigned tracks are at the end // fixme: interaction time is undefined for unassigned tracks (?) fillTrackTablesPerCollision(-1, std::uint64_t(-1), trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, tracksQACursor, - ambigTracksCursor, mftTracksCursor, ambigMFTTracksCursor, + ambigTracksCursor, mftTracksCursor, mftTracksCovCursor, ambigMFTTracksCursor, fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, fwdTrkClsCursor, bcsMap); // filling collisions and tracks into tables @@ -2213,7 +2240,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) auto& trackRef = primVer2TRefs[collisionID]; // passing interaction time in [ps] fillTrackTablesPerCollision(collisionID, globalBC, trackRef, primVerGIs, recoData, tracksCursor, tracksCovCursor, tracksExtraCursor, tracksQACursor, ambigTracksCursor, - mftTracksCursor, ambigMFTTracksCursor, + mftTracksCursor, mftTracksCovCursor, ambigMFTTracksCursor, fwdTracksCursor, fwdTracksCovCursor, ambigFwdTracksCursor, fwdTrkClsCursor, bcsMap); collisionID++; } @@ -3139,6 +3166,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), + OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), OutputForTable::spec(), diff --git a/Framework/Core/include/Framework/AnalysisDataModel.h b/Framework/Core/include/Framework/AnalysisDataModel.h index 934cc7df0c286..1096e151c019e 100644 --- a/Framework/Core/include/Framework/AnalysisDataModel.h +++ b/Framework/Core/include/Framework/AnalysisDataModel.h @@ -951,6 +951,32 @@ DECLARE_SOA_EXTENDED_TABLE(FwdTracksCov, StoredFwdTracksCov, "EXFWDTRACKCOV", 0, using FwdTrack = FwdTracks::iterator; using FwdTrackCovFwd = FwdTracksCov::iterator; +DECLARE_SOA_TABLE_FULL(StoredMFTTracksCov, "MFTTracksCov", "AOD", "MFTTRACKCOV", //! + o2::soa::Index<>, fwdtrack::MFTTrackId, + fwdtrack::SigmaX, fwdtrack::SigmaY, fwdtrack::SigmaPhi, fwdtrack::SigmaTgl, fwdtrack::Sigma1Pt, + fwdtrack::RhoXY, fwdtrack::RhoPhiX, fwdtrack::RhoPhiY, fwdtrack::RhoTglX, fwdtrack::RhoTglY, + fwdtrack::RhoTglPhi, fwdtrack::Rho1PtX, fwdtrack::Rho1PtY, fwdtrack::Rho1PtPhi, fwdtrack::Rho1PtTgl); + +DECLARE_SOA_EXTENDED_TABLE(MFTTracksCov, StoredMFTTracksCov, "EXMFTTRACKCOV", 0, //! + aod::fwdtrack::CXX, + aod::fwdtrack::CXY, + aod::fwdtrack::CYY, + aod::fwdtrack::CPhiX, + aod::fwdtrack::CPhiY, + aod::fwdtrack::CPhiPhi, + aod::fwdtrack::CTglX, + aod::fwdtrack::CTglY, + aod::fwdtrack::CTglPhi, + aod::fwdtrack::CTglTgl, + aod::fwdtrack::C1PtX, + aod::fwdtrack::C1PtY, + aod::fwdtrack::C1PtPhi, + aod::fwdtrack::C1PtTgl, + aod::fwdtrack::C1Pt21Pt2); + +using MFTTrack = MFTTracks::iterator; +using MFTTrackCovFwd = MFTTracksCov::iterator; + } // namespace aod namespace soa { From 92166c63c24fe54ac4ab0c2c01c940c38680a069 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Mon, 13 Jan 2025 15:43:33 +0100 Subject: [PATCH 11/50] Fix mac having a different representation for unsigned long (#13858) --- Framework/Core/include/Framework/ConfigParamRegistry.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Framework/Core/include/Framework/ConfigParamRegistry.h b/Framework/Core/include/Framework/ConfigParamRegistry.h index 540581231dde3..91c523b9d96e7 100644 --- a/Framework/Core/include/Framework/ConfigParamRegistry.h +++ b/Framework/Core/include/Framework/ConfigParamRegistry.h @@ -28,8 +28,9 @@ concept SimpleConfigValueType = std::same_as || std::same_as || std::same_as || std::same_as || - std::same_as || - std::same_as || + std::same_as || + std::same_as || + std::same_as || std::same_as || std::same_as || std::same_as || From 25abc6036e1555057fa0ddd2174e52b7777bd46a Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:06:04 +0100 Subject: [PATCH 12/50] Replace is_bounded_array implementation with std:: one (#13856) --- .../Core/include/Framework/TableBuilder.h | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/Framework/Core/include/Framework/TableBuilder.h b/Framework/Core/include/Framework/TableBuilder.h index b9c5a8ed732b6..65f361edc0c3b 100644 --- a/Framework/Core/include/Framework/TableBuilder.h +++ b/Framework/Core/include/Framework/TableBuilder.h @@ -569,21 +569,6 @@ constexpr auto tuple_to_pack(std::tuple&&) return framework::pack{}; } -/// Detect if this is a fixed size array -/// FIXME: Notice that C++20 provides a method with the same name -/// so we should move to it when we switch. -template -struct is_bounded_array : std::false_type { -}; - -template -struct is_bounded_array : std::true_type { -}; - -template -struct is_bounded_array> : std::true_type { -}; - template concept BulkInsertable = (std::integral> && !std::same_as>); @@ -681,14 +666,14 @@ class TableBuilder { using args_pack_t = framework::pack; if constexpr (sizeof...(ARGS) == 1 && - is_bounded_array>::value == false && + std::is_bounded_array>::value == false && std::is_arithmetic_v> == false && framework::is_base_of_template_v> == false) { using objType_t = pack_element_t<0, framework::pack>; using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); return framework::pack_size(argsPack_t{}); } else if constexpr (sizeof...(ARGS) == 1 && - (is_bounded_array>::value == true || + (std::is_bounded_array>::value == true || framework::is_base_of_template_v> == true)) { using objType_t = pack_element_t<0, framework::pack>; using argsPack_t = framework::pack; @@ -719,7 +704,7 @@ class TableBuilder { using args_pack_t = framework::pack; if constexpr (sizeof...(ARGS) == 1 && - is_bounded_array>::value == false && + std::is_bounded_array>::value == false && std::is_arithmetic_v> == false && framework::is_base_of_template_v> == false) { using objType_t = pack_element_t<0, framework::pack>; @@ -730,7 +715,7 @@ class TableBuilder persister(slot, t); }; } else if constexpr (sizeof...(ARGS) == 1 && - (is_bounded_array>::value == true || + (std::is_bounded_array>::value == true || framework::is_base_of_template_v> == true)) { using objType_t = pack_element_t<0, framework::pack>; auto persister = persistTuple(framework::pack{}, columnNames); From 51c14988c732a0576e67cc161394c6de9166e7ba Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 14 Jan 2025 10:02:05 +0100 Subject: [PATCH 13/50] DPL: add explicit implementation of unsigned long (#13862) --- Framework/Core/src/ConfigParamRegistry.cxx | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/Framework/Core/src/ConfigParamRegistry.cxx b/Framework/Core/src/ConfigParamRegistry.cxx index e6af6eeaebcae..44eb61b4a30c4 100644 --- a/Framework/Core/src/ConfigParamRegistry.cxx +++ b/Framework/Core/src/ConfigParamRegistry.cxx @@ -110,8 +110,9 @@ template long ConfigParamRegistry::get(const char* key) const; template long long ConfigParamRegistry::get(const char* key) const; template uint8_t ConfigParamRegistry::get(const char* key) const; template uint16_t ConfigParamRegistry::get(const char* key) const; -template uint32_t ConfigParamRegistry::get(const char* key) const; -template uint64_t ConfigParamRegistry::get(const char* key) const; +template unsigned long ConfigParamRegistry::get(const char* key) const; +template unsigned long long ConfigParamRegistry::get(const char* key) const; +template unsigned int ConfigParamRegistry::get(const char* key) const; template LabeledArray ConfigParamRegistry::get>(const char* key) const; template LabeledArray ConfigParamRegistry::get>(const char* key) const; template LabeledArray ConfigParamRegistry::get>(const char* key) const; @@ -142,16 +143,16 @@ template void ConfigParamRegistry::override(const char* key, double const&) cons template void ConfigParamRegistry::override(const char* key, std::string const&) const; template void ConfigParamRegistry::override(const char* key, bool const&) const; -//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; -//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; -//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; -//template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; -//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; -//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; -//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; -//template void ConfigParamRegistry::override(char const* key, Array2D const&) const; -//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; -//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; -//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; -//template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +// template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +// template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +// template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +// template void ConfigParamRegistry::override(char const* key, LabeledArray const&) const; +// template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +// template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +// template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +// template void ConfigParamRegistry::override(char const* key, Array2D const&) const; +// template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +// template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +// template void ConfigParamRegistry::override(char const* key, std::vector const&) const; +// template void ConfigParamRegistry::override(char const* key, std::vector const&) const; } // namespace o2::framework From ee436d8945bf083c045cdad43d4d239799231eab Mon Sep 17 00:00:00 2001 From: wiechula Date: Mon, 6 Jan 2025 17:49:35 +0100 Subject: [PATCH 14/50] Update SCD interpolation parameters --- .../include/SpacePoints/SpacePointsCalibConfParam.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h b/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h index 9a4d7c1474287..819ca7b0ae07f 100644 --- a/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h +++ b/Detectors/TPC/calibration/SpacePoints/include/SpacePoints/SpacePointsCalibConfParam.h @@ -37,8 +37,8 @@ struct SpacePointsCalibConfParam : public o2::conf::ConfigurableParamHelper Date: Tue, 14 Jan 2025 13:52:00 +0100 Subject: [PATCH 15/50] Protection against null CTPClass::descriptor in CTP digitizer --- Detectors/CTP/simulation/src/Digitizer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/CTP/simulation/src/Digitizer.cxx b/Detectors/CTP/simulation/src/Digitizer.cxx index 7f8c00a0ace69..2f033b8a01462 100644 --- a/Detectors/CTP/simulation/src/Digitizer.cxx +++ b/Detectors/CTP/simulation/src/Digitizer.cxx @@ -170,7 +170,7 @@ void Digitizer::calculateClassMask(const std::bitset ctpinpmask, st // } } } else { - if ((ctpinpmask.to_ullong() & tcl.descriptor->getInputsMask()) == tcl.descriptor->getInputsMask()) { + if (tcl.descriptor && ((ctpinpmask.to_ullong() & tcl.descriptor->getInputsMask()) == tcl.descriptor->getInputsMask())) { classmask |= tcl.classMask; } } From 82a019b5a13a47d53362db986a640c4f835bcca4 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 14 Jan 2025 19:08:18 +0100 Subject: [PATCH 16/50] C++20 related fixes (#13860) --- Framework/Core/src/ArrowSupport.cxx | 3 --- Framework/Core/src/CallbacksPolicy.cxx | 4 ---- Framework/Core/src/CommonMessageBackends.cxx | 4 ---- Framework/Core/src/CommonServices.cxx | 5 ----- Framework/Core/src/runDataProcessing.cxx | 3 --- Framework/Core/test/test_ComputingQuotaEvaluator.cxx | 4 ---- Framework/Core/test/test_DataProcessorSpec.cxx | 5 ----- Framework/Foundation/include/Framework/Signpost.h | 9 ++++----- 8 files changed, 4 insertions(+), 33 deletions(-) diff --git a/Framework/Core/src/ArrowSupport.cxx b/Framework/Core/src/ArrowSupport.cxx index 1dcc85c1d4f04..12a4c7131e828 100644 --- a/Framework/Core/src/ArrowSupport.cxx +++ b/Framework/Core/src/ArrowSupport.cxx @@ -46,8 +46,6 @@ #include #include -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" namespace o2::framework { @@ -596,4 +594,3 @@ o2::framework::ServiceSpec ArrowSupport::arrowTableSlicingCacheSpec() } } // namespace o2::framework -#pragma GGC diagnostic pop diff --git a/Framework/Core/src/CallbacksPolicy.cxx b/Framework/Core/src/CallbacksPolicy.cxx index 9be04cdef290d..aa22fa830c4c2 100644 --- a/Framework/Core/src/CallbacksPolicy.cxx +++ b/Framework/Core/src/CallbacksPolicy.cxx @@ -20,10 +20,6 @@ #include #include -// This is to allow C++20 aggregate initialisation -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" - namespace o2::framework { diff --git a/Framework/Core/src/CommonMessageBackends.cxx b/Framework/Core/src/CommonMessageBackends.cxx index f3bf36edca8ea..79bd84307df15 100644 --- a/Framework/Core/src/CommonMessageBackends.cxx +++ b/Framework/Core/src/CommonMessageBackends.cxx @@ -33,10 +33,6 @@ #include #include -// This is to allow C++20 aggregate initialisation -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" - namespace o2::framework { diff --git a/Framework/Core/src/CommonServices.cxx b/Framework/Core/src/CommonServices.cxx index 23375b76487b9..95836adc02171 100644 --- a/Framework/Core/src/CommonServices.cxx +++ b/Framework/Core/src/CommonServices.cxx @@ -77,10 +77,6 @@ using Metric = o2::monitoring::Metric; using Key = o2::monitoring::tags::Key; using Value = o2::monitoring::tags::Value; -// This is to allow C++20 aggregate initialisation -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" - O2_DECLARE_DYNAMIC_LOG(data_processor_context); O2_DECLARE_DYNAMIC_LOG(stream_context); O2_DECLARE_DYNAMIC_LOG(async_queue); @@ -1327,4 +1323,3 @@ std::vector CommonServices::arrowServices() } } // namespace o2::framework -#pragma GCC diagnostic pop diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index e5263247e641b..c8f77ab7082e6 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -134,9 +134,6 @@ #include #include #include -// This is to allow C++20 aggregate initialisation -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" #if defined(__linux__) && __has_include() #include #elif __has_include() diff --git a/Framework/Core/test/test_ComputingQuotaEvaluator.cxx b/Framework/Core/test/test_ComputingQuotaEvaluator.cxx index cd0d79538e12a..0df58ae7fed08 100644 --- a/Framework/Core/test/test_ComputingQuotaEvaluator.cxx +++ b/Framework/Core/test/test_ComputingQuotaEvaluator.cxx @@ -19,8 +19,6 @@ #include "Framework/ServiceRegistryHelpers.h" #include "uv.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" using namespace o2::framework; TEST_CASE("TestComputingQuotaEvaluator") @@ -219,5 +217,3 @@ TEST_CASE("TestComputingQuotaEvaluator") REQUIRE(evaluator.mOffers[1].valid == false); REQUIRE(evaluator.mOffers[2].valid == false); } - -#pragma GGC diagnostic pop diff --git a/Framework/Core/test/test_DataProcessorSpec.cxx b/Framework/Core/test/test_DataProcessorSpec.cxx index 9bebd06f15b43..48e59c95475ba 100644 --- a/Framework/Core/test/test_DataProcessorSpec.cxx +++ b/Framework/Core/test/test_DataProcessorSpec.cxx @@ -14,9 +14,6 @@ #include "Framework/DataProcessorSpecHelpers.h" #include "Framework/ConfigParamSpec.h" -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wpedantic" - TEST_CASE("TestDataProcessorSpecHelpers") { using namespace o2::framework; @@ -35,5 +32,3 @@ TEST_CASE("TestDataProcessorSpecHelpers") REQUIRE(DataProcessorSpecHelpers::hasLabel(spec, "label2") == false); REQUIRE(DataProcessorSpecHelpers::hasLabel(spec, "label3") == true); } - -#pragma diagnostic pop diff --git a/Framework/Foundation/include/Framework/Signpost.h b/Framework/Foundation/include/Framework/Signpost.h index 74368f73c382e..ba807865a1195 100644 --- a/Framework/Foundation/include/Framework/Signpost.h +++ b/Framework/Foundation/include/Framework/Signpost.h @@ -90,11 +90,10 @@ o2_log_handle_t* o2_walk_logs(bool (*callback)(char const* name, void* log, void #include #include #include -#define O2_LOG_DEBUG_MAC(log, ...) os_log_debug(private_o2_log_##log, __VA_ARGS__) -// FIXME: use __VA_OPT__ when available in C++20 -#define O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ...) os_signpost_event_emit(private_o2_log_##log->os_log, (uint64_t)id.value, name, format, ##__VA_ARGS__) -#define O2_SIGNPOST_START_MAC(log, id, name, format, ...) os_signpost_interval_begin(private_o2_log_##log->os_log, (uint64_t)id.value, name, format, ##__VA_ARGS__) -#define O2_SIGNPOST_END_MAC(log, id, name, format, ...) os_signpost_interval_end(private_o2_log_##log->os_log, (uint64_t)id.value, name, format, ##__VA_ARGS__) +#define O2_LOG_DEBUG_MAC(log, format, ...) os_log_debug(private_o2_log_##log, format __VA_OPT__(, ) __VA_ARGS__) +#define O2_SIGNPOST_EVENT_EMIT_MAC(log, id, name, format, ...) os_signpost_event_emit(private_o2_log_##log->os_log, (uint64_t)id.value, name, format __VA_OPT__(, ) __VA_ARGS__) +#define O2_SIGNPOST_START_MAC(log, id, name, format, ...) os_signpost_interval_begin(private_o2_log_##log->os_log, (uint64_t)id.value, name, format __VA_OPT__(, ) __VA_ARGS__) +#define O2_SIGNPOST_END_MAC(log, id, name, format, ...) os_signpost_interval_end(private_o2_log_##log->os_log, (uint64_t)id.value, name, format __VA_OPT__(, ) __VA_ARGS__) #define O2_SIGNPOST_ENABLED_MAC(log) os_signpost_enabled(private_o2_log_##log->os_log) #else // These are no-ops on linux. From 240fad5f3873de9acf05f1881be1cb7eb39fa529 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Sat, 11 Jan 2025 02:17:37 +0100 Subject: [PATCH 17/50] GPU OpenCL: Use device timers only when supported + better debug output --- .../opencl-common/GPUReconstructionOCL.cxx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx b/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx index cad56e77c79d5..d5b10afeb68f2 100644 --- a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx +++ b/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx @@ -108,6 +108,14 @@ int32_t GPUReconstructionOCL::InitDevice_Runtime() } mInternals->platform = mInternals->platforms[mProcessingSettings.platformNum]; found = true; + if (mProcessingSettings.debugLevel >= 2) { + char platform_profile[256] = {}, platform_version[256] = {}, platform_name[256] = {}, platform_vendor[256] = {}; + clGetPlatformInfo(mInternals->platform, CL_PLATFORM_PROFILE, sizeof(platform_profile), platform_profile, nullptr); + clGetPlatformInfo(mInternals->platform, CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr); + clGetPlatformInfo(mInternals->platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, nullptr); + clGetPlatformInfo(mInternals->platform, CL_PLATFORM_VENDOR, sizeof(platform_vendor), platform_vendor, nullptr); + GPUInfo("Selected Platform %d: (%s %s) %s %s", mProcessingSettings.platformNum, platform_profile, platform_version, platform_vendor, platform_name); + } } else { for (uint32_t i_platform = 0; i_platform < num_platforms; i_platform++) { char platform_profile[256] = {}, platform_version[256] = {}, platform_name[256] = {}, platform_vendor[256] = {}; @@ -227,6 +235,8 @@ int32_t GPUReconstructionOCL::InitDevice_Runtime() clGetDeviceInfo(mInternals->device, CL_DEVICE_VERSION, sizeof(deviceVersion) - 1, deviceVersion, nullptr); clGetDeviceInfo(mInternals->device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(maxWorkGroup), &maxWorkGroup, nullptr); clGetDeviceInfo(mInternals->device, CL_DEVICE_MAX_WORK_ITEM_SIZES, sizeof(maxWorkItems), maxWorkItems, nullptr); + int versionMajor, versionMinor; + sscanf(deviceVersion, "OpenCL %d.%d", &versionMajor, &versionMinor); if (mProcessingSettings.debugLevel >= 2) { GPUInfo("Using OpenCL device %d: %s %s with properties:", bestDevice, device_vendor, device_name); GPUInfo("\tVersion = %s", deviceVersion); @@ -277,9 +287,18 @@ int32_t GPUReconstructionOCL::InitDevice_Runtime() quit("OPENCL Constant Memory Allocation Error"); } + if (device_type & CL_DEVICE_TYPE_CPU) { + if (mProcessingSettings.deviceTimers && mProcessingSettings.debugLevel >= 2) { + GPUInfo("Disabling device timers for CPU device"); + } + mProcessingSettings.deviceTimers = 0; + } for (int32_t i = 0; i < mNStreams; i++) { #ifdef CL_VERSION_2_0 - cl_queue_properties prop = mProcessingSettings.deviceTimers ? CL_QUEUE_PROFILING_ENABLE : 0; + cl_queue_properties prop = 0; + if (versionMajor >= 2 && IsGPU() && mProcessingSettings.deviceTimers) { + prop |= CL_QUEUE_PROFILING_ENABLE; + } mInternals->command_queue[i] = clCreateCommandQueueWithProperties(mInternals->context, mInternals->device, &prop, &ocl_error); if (mProcessingSettings.deviceTimers && ocl_error == CL_INVALID_QUEUE_PROPERTIES) { GPUError("GPU device timers not supported by OpenCL platform, disabling"); From 828216abd1c0265d7706012d003a925a81bfbbf4 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 15 Jan 2025 11:32:29 +0100 Subject: [PATCH 18/50] DPL: improve HistogramRegistry.h (#13863) - Use concepts to determine which fill operation applies to a given kind of histograms. - Make sure we out of line invalid filling operations. --- .../include/Framework/HistogramRegistry.h | 122 +++++++++++++----- Framework/Core/src/HistogramRegistry.cxx | 5 + 2 files changed, 93 insertions(+), 34 deletions(-) diff --git a/Framework/Core/include/Framework/HistogramRegistry.h b/Framework/Core/include/Framework/HistogramRegistry.h index f11fd3f263e9d..0801064b6f4cc 100644 --- a/Framework/Core/include/Framework/HistogramRegistry.h +++ b/Framework/Core/include/Framework/HistogramRegistry.h @@ -26,7 +26,10 @@ #include #include #include +#include +#include +#include #include class TList; @@ -43,11 +46,58 @@ namespace o2::framework template concept FillValue = std::is_integral_v || std::is_floating_point_v || std::is_enum_v; +template +concept ValidTH3 = std::same_as && (dimensions == 3 || dimensions == 4); + +template +concept ValidTH2 = std::same_as && (dimensions == 2 || dimensions == 3); + +template +concept ValidTH1 = std::same_as && (dimensions == 1 || dimensions == 2); + +template +concept ValidTProfile3D = std::same_as && (dimensions == 4 || dimensions == 5); + +template +concept ValidTProfile2D = std::same_as && (dimensions == 3 || dimensions == 4); + +template +concept ValidTProfile = std::same_as && (dimensions == 2 || dimensions == 3); + +template +concept ValidSimpleFill = ValidTH1 || ValidTH2 || ValidTH3 || ValidTProfile || ValidTProfile2D || ValidTProfile3D; + +template +concept ValidComplexFill = std::is_base_of_v; + +template +concept ValidComplexFillStep = std::is_base_of_v; + +template +concept ValidFill = ValidSimpleFill || ValidComplexFill || ValidComplexFillStep; + struct HistFiller { // fill any type of histogram (if weight was requested it must be the last argument) template static void fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) - requires(FillValue && ...); + requires ValidSimpleFill && (FillValue && ...); + + template + static void fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) + requires ValidComplexFill && (FillValue && ...); + + template + static void fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) + requires ValidComplexFillStep && (FillValue && ...); + + // This applies only for the non-viable cases + template + static void fillHistAny(std::shared_ptr hist, Ts... positionAndWeight); + + // fill any type of histogram with columns (Cs) of a filtered table (if weight is requested it must reside the last specified column) + template + static void fillHistAny(std::shared_ptr hist, const T& table, const o2::framework::expressions::Filter& filter) + requires(!ValidComplexFillStep) && requires(T t) { t.asArrowTable(); }; // fill any type of histogram with columns (Cs) of a filtered table (if weight is requested it must reside the last specified column) template @@ -67,6 +117,8 @@ struct HistFiller { template static int getBaseElementSize(T* ptr); + + static void badHistogramFill(char const* name); }; //************************************************************************************************** @@ -203,51 +255,47 @@ class HistogramRegistry // Implementation of HistFiller template functions. //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- +template +void HistFiller::fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) + requires ValidSimpleFill && (FillValue && ...) +{ + hist->Fill(static_cast(positionAndWeight)...); +} template void HistFiller::fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) - requires(FillValue && ...) + requires ValidComplexFill && (FillValue && ...) { constexpr int nArgs = sizeof...(Ts); - constexpr bool validTH3 = (std::is_same_v && (nArgs == 3 || nArgs == 4)); - constexpr bool validTH2 = (std::is_same_v && (nArgs == 2 || nArgs == 3)); - constexpr bool validTH1 = (std::is_same_v && (nArgs == 1 || nArgs == 2)); - constexpr bool validTProfile3D = (std::is_same_v && (nArgs == 4 || nArgs == 5)); - constexpr bool validTProfile2D = (std::is_same_v && (nArgs == 3 || nArgs == 4)); - constexpr bool validTProfile = (std::is_same_v && (nArgs == 2 || nArgs == 3)); - - constexpr bool validSimpleFill = validTH1 || validTH2 || validTH3 || validTProfile || validTProfile2D || validTProfile3D; - // unfortunately we dont know at compile the dimension of THn(Sparse) - constexpr bool validComplexFill = std::is_base_of_v; - constexpr bool validComplexFillStep = std::is_base_of_v; - - if constexpr (validSimpleFill) { - hist->Fill(static_cast(positionAndWeight)...); - } else if constexpr (validComplexFillStep) { - hist->Fill(positionAndWeight...); // first argument in pack is iStep, dimension check is done in StepTHn itself - } else if constexpr (validComplexFill) { - double tempArray[] = {static_cast(positionAndWeight)...}; - double weight{1.}; - constexpr int nArgsMinusOne = nArgs - 1; - if (hist->GetNdimensions() == nArgsMinusOne) { - weight = tempArray[nArgsMinusOne]; - } else if (hist->GetNdimensions() != nArgs) { - LOGF(fatal, "The number of arguments in fill function called for histogram %s is incompatible with histogram dimensions.", hist->GetName()); - } - hist->Fill(tempArray, weight); - } else { - LOGF(fatal, "The number of arguments in fill function called for histogram %s is incompatible with histogram dimensions.", hist->GetName()); + double tempArray[] = {static_cast(positionAndWeight)...}; + double weight{1.}; + constexpr int nArgsMinusOne = nArgs - 1; + if (hist->GetNdimensions() == nArgsMinusOne) { + weight = tempArray[nArgsMinusOne]; + } else if (hist->GetNdimensions() != nArgs) { + badHistogramFill(hist->GetName()); } + hist->Fill(tempArray, weight); +} + +template +void HistFiller::fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) + requires ValidComplexFillStep && (FillValue && ...) +{ + hist->Fill(positionAndWeight...); // first argument in pack is iStep, dimension check is done in StepTHn itself +} + +template +void HistFiller::fillHistAny(std::shared_ptr hist, Ts... positionAndWeight) +{ + HistFiller::badHistogramFill(hist->GetName()); } template void HistFiller::fillHistAny(std::shared_ptr hist, const T& table, const o2::framework::expressions::Filter& filter) + requires(!ValidComplexFillStep) && requires(T t) { t.asArrowTable(); } { - if constexpr (std::is_base_of_v) { - LOGF(fatal, "Table filling is not (yet?) supported for StepTHn."); - return; - } auto s = o2::framework::expressions::createSelection(table.asArrowTable(), filter); auto filtered = o2::soa::Filtered{{table.asArrowTable()}, s}; for (auto& t : filtered) { @@ -255,6 +303,12 @@ void HistFiller::fillHistAny(std::shared_ptr hist, const T& table, const o2:: } } +template +void HistFiller::fillHistAny(std::shared_ptr hist, const T& table, const o2::framework::expressions::Filter& filter) +{ + HistFiller::badHistogramFill(hist->GetName()); +} + template double HistFiller::getSize(std::shared_ptr hist, double fillFraction) { diff --git a/Framework/Core/src/HistogramRegistry.cxx b/Framework/Core/src/HistogramRegistry.cxx index c246fd752e5a1..0836e72ffa935 100644 --- a/Framework/Core/src/HistogramRegistry.cxx +++ b/Framework/Core/src/HistogramRegistry.cxx @@ -409,4 +409,9 @@ void HistogramRegistry::registerName(const std::string& name) mRegisteredNames.push_back(name); } +void HistFiller::badHistogramFill(char const* name) +{ + LOGF(fatal, "The number of arguments in fill function called for histogram %s is incompatible with histogram dimensions.", name); +} + } // namespace o2::framework From a31deb15314fe7797020f5d1ba2c54245b14c9cb Mon Sep 17 00:00:00 2001 From: David Rohr Date: Tue, 26 Nov 2024 19:55:34 +0100 Subject: [PATCH 19/50] GPU CMake: Add check that RTC source files do not contain system headers --- GPU/GPUTracking/Base/cuda/CMakeLists.txt | 8 +++++++- GPU/GPUTracking/Base/hip/CMakeLists.txt | 17 +++++++++++++---- GPU/GPUTracking/Base/opencl2/CMakeLists.txt | 1 + 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/GPU/GPUTracking/Base/cuda/CMakeLists.txt b/GPU/GPUTracking/Base/cuda/CMakeLists.txt index a24092f50ebaf..995b9224a4ad0 100644 --- a/GPU/GPUTracking/Base/cuda/CMakeLists.txt +++ b/GPU/GPUTracking/Base/cuda/CMakeLists.txt @@ -69,7 +69,7 @@ if(NOT ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") add_custom_command( OUTPUT ${GPU_RTC_BIN}.src COMMAND cat ${GPUDIR}/Base/cuda/GPUReconstructionCUDAIncludes.h > ${GPU_RTC_BIN}.src - COMMAND ${CMAKE_CXX_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_CUDA_STANDARD} -D__CUDA_ARCH__=${RTC_CUDA_ARCH} -D__CUDACC__ -x c++ -E ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src + COMMAND ${CMAKE_CXX_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_CUDA_STANDARD} -D__CUDA_ARCH__=${RTC_CUDA_ARCH} -D__CUDACC__ -x c++ -nostdinc -E ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src MAIN_DEPENDENCY ${GPU_RTC_SRC} IMPLICIT_DEPENDS CXX ${GPU_RTC_SRC} COMMAND_EXPAND_LISTS @@ -77,6 +77,12 @@ if(NOT ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") ) create_binary_resource(${GPU_RTC_BIN}.src ${GPU_RTC_BIN}.src.o) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_CUDA_SRC_CHK.done + COMMAND ! grep "# [0-9]* \"\\(/usr/\\|.*GCC-Toolchain\\)" ${GPU_RTC_BIN}.src > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_CUDA_SRC_CHK.done || bash -c "echo ERROR: CUDA RTC sources contain standard headers 1>&2 && exit 1" + COMMENT Checking CUDA RTC File ${GPU_RTC_BIN}.src + DEPENDS ${GPU_RTC_BIN}.src VERBATIM) + add_custom_target(${MODULE}_CUDA_SRC_CHK ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_CUDA_SRC_CHK.done) + add_custom_command( OUTPUT ${GPU_RTC_BIN}.command COMMAND echo -n "${CMAKE_CUDA_COMPILER} ${GPU_RTC_FLAGS_SEPARATED} ${GPU_RTC_DEFINES} -fatbin" > ${GPU_RTC_BIN}.command diff --git a/GPU/GPUTracking/Base/hip/CMakeLists.txt b/GPU/GPUTracking/Base/hip/CMakeLists.txt index f488ce8c7dd14..40b095143d639 100644 --- a/GPU/GPUTracking/Base/hip/CMakeLists.txt +++ b/GPU/GPUTracking/Base/hip/CMakeLists.txt @@ -52,8 +52,11 @@ if(NOT DEFINED GPUCA_HIP_HIPIFY_FROM_CUDA OR "${GPUCA_HIP_HIPIFY_FROM_CUDA}") list(APPEND HIP_SOURCES "${GPUCA_HIP_SOURCE_DIR}/${HIP_SOURCE}") endforeach() - add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIPIFIED_CHK.done COMMAND diff -u ${GPUCA_HIP_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip ${CMAKE_CURRENT_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip && touch ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIPIFIED_CHK.done DEPENDS ${GPUCA_HIP_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip ${CMAKE_CURRENT_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip) - add_custom_target(${MODULE}_HIPIFIED_CHK DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIPIFIED_CHK.done) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIPIFIED_CHK.done + COMMAND diff -u ${GPUCA_HIP_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip ${CMAKE_CURRENT_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIPIFIED_CHK.done + DEPENDS ${GPUCA_HIP_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip ${CMAKE_CURRENT_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip + COMMENT Checking HIPified file ${CMAKE_CURRENT_SOURCE_DIR}/GPUReconstructionHIPkernel.template.hip) + add_custom_target(${MODULE}_HIPIFIED_CHK ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIPIFIED_CHK.done) else() get_filename_component(GPUCA_HIP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} ABSOLUTE) endif() @@ -103,7 +106,7 @@ if(NOT ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") add_custom_command( OUTPUT ${GPU_RTC_BIN}.src COMMAND cat ${GPUDIR}/Base/hip/GPUReconstructionHIPIncludes.h > ${GPU_RTC_BIN}.src - COMMAND ${CMAKE_CXX_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_HIP_STANDARD} -D__HIPCC__ -D__HIP_DEVICE_COMPILE__ -x c++ -E ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src + COMMAND ${CMAKE_CXX_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_HIP_STANDARD} -D__HIPCC__ -D__HIP_DEVICE_COMPILE__ -x c++ -nostdinc -E ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src MAIN_DEPENDENCY ${GPU_RTC_SRC} IMPLICIT_DEPENDS CXX ${GPU_RTC_SRC} COMMAND_EXPAND_LISTS @@ -111,6 +114,12 @@ if(NOT ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") ) create_binary_resource(${GPU_RTC_BIN}.src ${GPU_RTC_BIN}.src.o) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIP_SRC_CHK.done + COMMAND ! grep "# [0-9]* \"\\(/usr/\\|.*GCC-Toolchain\\)" ${GPU_RTC_BIN}.src > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIP_SRC_CHK.done || bash -c "echo ERROR: HIP RTC sources contain standard headers 1>&2 && exit 1" + COMMENT Checking HIP RTC File ${GPU_RTC_BIN}.src + DEPENDS ${GPU_RTC_BIN}.src VERBATIM) + add_custom_target(${MODULE}_HIP_SRC_CHK ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_HIP_SRC_CHK.done) + add_custom_command( OUTPUT ${GPU_RTC_BIN}.command COMMAND echo -n "${hip_HIPCC_EXECUTABLE} ${GPU_RTC_FLAGS_SEPARATED} ${GPU_RTC_DEFINES} --genco" > ${GPU_RTC_BIN}.command @@ -202,7 +211,7 @@ target_include_directories(${MODULE}_CXX PRIVATE $ ${CL_BIN}.src MAIN_DEPENDENCY ${CL_SRC} IMPLICIT_DEPENDS CXX ${CL_SRC} From 6390170c14c04aaed46bb776147376198fdb8194 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Tue, 26 Nov 2024 19:55:41 +0100 Subject: [PATCH 20/50] Remove obsolete tools --- .../Standalone/tools/rtc/rtcsource.sh | 15 ---- GPU/GPUTracking/Standalone/tools/rtc/test.cu | 86 ------------------- 2 files changed, 101 deletions(-) delete mode 100755 GPU/GPUTracking/Standalone/tools/rtc/rtcsource.sh delete mode 100644 GPU/GPUTracking/Standalone/tools/rtc/test.cu diff --git a/GPU/GPUTracking/Standalone/tools/rtc/rtcsource.sh b/GPU/GPUTracking/Standalone/tools/rtc/rtcsource.sh deleted file mode 100755 index 9f59855eaf278..0000000000000 --- a/GPU/GPUTracking/Standalone/tools/rtc/rtcsource.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -cat < source.cu -# 1 "/home/qon/alice/O2/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu" -# 1 "/home/qon/alice/O2/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtcPre.h" 1 -EOT -cat src/Base/cuda/GPUReconstructionCUDAIncludes.h >> source.cu -nvcc -std=c++17 -gencode arch=compute_75,code=sm_75 -E \ - -I src/ -I src/Common/ -I src/Base/ -I src/SliceTracker/ -I src/Merger/ -I src/TRDTracking/ -I src/TPCClusterFinder/ -I src/TPCConvert/ -I src/Global/ -I src/dEdx/ -I src/TPCFastTransformation/ -I src/GPUUtils/ -I src/DataCompression -I src/ITS \ - -I$HOME/alice/O2/DataFormats/Detectors/TPC/include -I$HOME/alice/O2/Detectors/Base/include -I$HOME/alice/O2/Detectors/Base/src -I$HOME/alice/O2/Common/MathUtils/include -I$HOME/alice/O2/DataFormats/Headers/include \ - -I$HOME/alice/O2/Detectors/TRD/base/include -I$HOME/alice/O2/Detectors/TRD/base/src -I$HOME/alice/O2/Detectors/ITSMFT/ITS/tracking/include -I$HOME/alice/O2/Detectors/ITSMFT/ITS/tracking/cuda/include -I$HOME/alice/O2/Common/Constants/include \ - -I$HOME/alice/O2/DataFormats/common/include -I$HOME/alice/O2/DataFormats/Detectors/TRD/include -I$HOME/alice/O2/Detectors/Raw/include \ - -DGPUCA_HAVE_O2HEADERS -DGPUCA_TPC_GEOMETRY_O2 -DGPUCA_STANDALONE \ - ~/alice/O2/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDArtc.cu \ -| sed '1,/^# 1 ".*GPUReconstructionCUDArtcPre.h" 1$/d' | grep -v O2_GPU_KERNEL_TEMPLATE_REPLACE \ ->> source.cu diff --git a/GPU/GPUTracking/Standalone/tools/rtc/test.cu b/GPU/GPUTracking/Standalone/tools/rtc/test.cu deleted file mode 100644 index f567218046ac7..0000000000000 --- a/GPU/GPUTracking/Standalone/tools/rtc/test.cu +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include -#include - -#define NVRTC_SAFE_CALL(x) \ - do { \ - nvrtcResult result = x; \ - if (result != NVRTC_SUCCESS) { \ - std::cerr << "\nerror: " #x " failed with error " \ - << nvrtcGetErrorString(result) << '\n'; \ - exit(1); \ - } \ - } while (0) - -#define CUDA_SAFE_CALL(x) \ - do { \ - CUresult result = x; \ - if (result != CUDA_SUCCESS) { \ - const char* msg; \ - cuGetErrorName(result, &msg); \ - std::cerr << "\nerror: " #x " failed with error " \ - << msg << '\n'; \ - exit(1); \ - } \ - } while (0) - -int32_t main(int argc, char** argv) -{ - //Read Sourcecode from file - uint32_t filesize; - FILE* pFile; - //Open file - if ((pFile = fopen("source.cu", "rb")) == NULL) - exit(1); - //Optain File Size - fseek(pFile, 0, SEEK_END); - filesize = ftell(pFile); - rewind(pFile); - //Read file - char* sourceCode = new char[filesize + 1]; - if (fread(sourceCode, 1, filesize, pFile) != filesize) - exit(1); - //Make sourceCode 0-terminated - sourceCode[filesize] = 0; - fclose(pFile); - - nvrtcProgram prog; - NVRTC_SAFE_CALL(nvrtcCreateProgram(&prog, // prog - sourceCode, // buffer - "saxpy.cu", // name - 0, // numHeaders - NULL, // headers - NULL)); // includeNames - delete[] sourceCode; - //const char *opts[] = {"-default-device -std=c++17 --extended-lambda -Xptxas -O4 -Xcompiler -O4 -use_fast_math --ftz=true"}; - const char* opts[] = {"-default-device", "--std=c++17", "-use_fast_math", "-ftz=true"}; - nvrtcResult compileResult = nvrtcCompileProgram(prog, // prog - sizeof(opts) / sizeof(opts[0]), // numOptions - opts); // options - size_t logSize; - NVRTC_SAFE_CALL(nvrtcGetProgramLogSize(prog, &logSize)); - char* log = new char[logSize]; - NVRTC_SAFE_CALL(nvrtcGetProgramLog(prog, log)); - std::cout << log << '\n'; - delete[] log; - if (compileResult != NVRTC_SUCCESS) { - exit(1); - } - size_t ptxSize; - NVRTC_SAFE_CALL(nvrtcGetPTXSize(prog, &ptxSize)); - char* ptx = new char[ptxSize]; - NVRTC_SAFE_CALL(nvrtcGetPTX(prog, ptx)); - NVRTC_SAFE_CALL(nvrtcDestroyProgram(&prog)); - CUmodule module; - CUfunction kernel; - CUDA_SAFE_CALL(cuModuleLoadDataEx(&module, ptx, 0, 0, 0)); - CUDA_SAFE_CALL(cuModuleGetFunction(&kernel, module, "foo")); - void* args[] = {}; - CUDA_SAFE_CALL( - cuLaunchKernel(kernel, - 1, 1, 1, // grid dim - 32, 1, 1, // block dim - 0, NULL, // shared mem and stream - args, 0)); // arguments - return 0; -} From 4a3f26198836d891be2996699f5aff608800d87d Mon Sep 17 00:00:00 2001 From: David Rohr Date: Tue, 14 Jan 2025 23:34:47 +0100 Subject: [PATCH 21/50] HIP RTC CMake: Fix dependency --- GPU/GPUTracking/Base/hip/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/GPU/GPUTracking/Base/hip/CMakeLists.txt b/GPU/GPUTracking/Base/hip/CMakeLists.txt index 40b095143d639..acd87c528e8e4 100644 --- a/GPU/GPUTracking/Base/hip/CMakeLists.txt +++ b/GPU/GPUTracking/Base/hip/CMakeLists.txt @@ -109,6 +109,7 @@ if(NOT ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") COMMAND ${CMAKE_CXX_COMPILER} ${GPU_RTC_DEFINES} ${GPU_RTC_INCLUDES} -std=c++${CMAKE_HIP_STANDARD} -D__HIPCC__ -D__HIP_DEVICE_COMPILE__ -x c++ -nostdinc -E ${GPU_RTC_SRC} >> ${GPU_RTC_BIN}.src MAIN_DEPENDENCY ${GPU_RTC_SRC} IMPLICIT_DEPENDS CXX ${GPU_RTC_SRC} + DEPENDS ${MODULE}_HIPIFIED COMMAND_EXPAND_LISTS COMMENT "Preparing HIP RTC source file ${GPU_RTC_BIN}.src" ) From fcb75a1cb86d19ed3ad5bc67249f8135b7fa9c99 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Thu, 16 Jan 2025 10:30:19 +0100 Subject: [PATCH 22/50] DPL: add missing header on macOS (#13867) For some reasons this is not included anymore. --- Framework/Core/src/DataSpecUtils.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Framework/Core/src/DataSpecUtils.cxx b/Framework/Core/src/DataSpecUtils.cxx index b0a20df065878..3babbaba2a6ca 100644 --- a/Framework/Core/src/DataSpecUtils.cxx +++ b/Framework/Core/src/DataSpecUtils.cxx @@ -16,6 +16,7 @@ #include "Headers/DataHeaderHelpers.h" #include +#include #include #include #include From f83ef77c4036b7b1d9721c00dbb42314d50f5be5 Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Thu, 16 Jan 2025 13:59:26 +0100 Subject: [PATCH 23/50] DPL Analysis: fix use-after-delete in expressions (#13869) --- Framework/Core/src/Expressions.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Framework/Core/src/Expressions.cxx b/Framework/Core/src/Expressions.cxx index b3301e2cf4040..45bb120b6eb74 100644 --- a/Framework/Core/src/Expressions.cxx +++ b/Framework/Core/src/Expressions.cxx @@ -67,7 +67,7 @@ size_t Filter::designateSubtrees(Node* node, size_t index) path.emplace(node, 0); while (!path.empty()) { - auto& top = path.top(); + auto top = path.top(); top.node_ptr->index = local_index; path.pop(); if (top.node_ptr->condition != nullptr) { @@ -277,7 +277,7 @@ Operations createOperations(Filter const& expression) // while the stack is not empty while (!path.empty()) { - auto& top = path.top(); + auto top = path.top(); // create operation spec, pop the node and add its children auto operationSpec = @@ -458,7 +458,7 @@ std::shared_ptr { std::shared_ptr filter; auto s = gandiva::Filter::Make(Schema, - std::move(condition), + condition, &filter); if (!s.ok()) { throw runtime_error_f("Failed to create filter: %s", s.ToString().c_str()); From c595debae2b57fd5cb478951dedba3250e1bf7dc Mon Sep 17 00:00:00 2001 From: shahoian Date: Thu, 16 Jan 2025 17:15:47 +0100 Subject: [PATCH 24/50] Fix shared clusters calculation in TrackingStudy --- .../GlobalTrackingWorkflow/study/src/TrackingStudy.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx b/Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx index 89ce3fa57c21a..c6345b128f562 100644 --- a/Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx +++ b/Detectors/GlobalTrackingWorkflow/study/src/TrackingStudy.cxx @@ -254,7 +254,8 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) auto fillTPCClInfo = [&recoData, this](const o2::tpc::TrackTPC& trc, o2::dataformats::TrackInfoExt& trExt, float timestampTB = -1e9) { const auto clRefs = recoData.getTPCTracksClusterRefs(); - const auto shMap = recoData.clusterShMapTPC.data(); + const auto tpcClusAcc = recoData.getTPCClusters(); + const auto shMap = recoData.clusterShMapTPC; if (recoData.inputsTPCclusters) { uint8_t clSect = 0, clRow = 0, clRowP = -1; uint32_t clIdx = 0; @@ -264,13 +265,14 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) trExt.rowCountTPC++; clRowP = clRow; } - if (shMap[clRefs[ic + trc.getClusterRef().getFirstEntry()]]) { + unsigned int absoluteIndex = tpcClusAcc.clusterOffset[clSect][clRow] + clIdx; + if (shMap[absoluteIndex] & GPUCA_NAMESPACE::gpu::GPUTPCGMMergedTrackHit::flagShared) { trExt.nClTPCShared++; } } trc.getClusterReference(clRefs, trc.getNClusterReferences() - 1, clSect, clRow, clIdx); trExt.rowMinTPC = clRow; - const auto& clus = recoData.inputsTPCclusters->clusterIndex.clusters[clSect][clRow][clIdx]; + const auto& clus = tpcClusAcc.clusters[clSect][clRow][clIdx]; this->mTPCCorrMapsLoader.Transform(clSect, clRow, clus.getPad(), clus.getTime(), trExt.innerTPCPos0[0], trExt.innerTPCPos0[1], trExt.innerTPCPos0[2], trc.getTime0()); // nominal time of the track if (timestampTB > -1e8) { this->mTPCCorrMapsLoader.Transform(clSect, clRow, clus.getPad(), clus.getTime(), trExt.innerTPCPos[0], trExt.innerTPCPos[1], trExt.innerTPCPos[2], timestampTB); // time assigned from the global track track @@ -284,7 +286,6 @@ void TrackingStudySpec::process(o2::globaltracking::RecoContainer& recoData) auto getTPCPairSharing = [&recoData, this](const o2::tpc::TrackTPC& trc0, const o2::tpc::TrackTPC& trc1) { const auto clRefs = recoData.getTPCTracksClusterRefs(); - const auto shMap = recoData.clusterShMapTPC.data(); uint8_t nsh = 0, nshRows = 0, lastSharedRow = -1; if (recoData.inputsTPCclusters) { uint8_t clSect0 = 0, clRow0 = 0, clSect1 = 0, clRow1 = 0; From 98dc52125d7e9badca2b8f1fd8c0603c020966e8 Mon Sep 17 00:00:00 2001 From: Yuvraj Singh <113302796+Yuvrajsinghspd09@users.noreply.github.com> Date: Fri, 17 Jan 2025 14:37:11 +0530 Subject: [PATCH 25/50] Replaced kRainbow with kRainBow for consistency in PostTrackExtension macro (#13866) --- .../ITS/postprocessing/studies/macros/PostTrackExtension.notest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/ITSMFT/ITS/postprocessing/studies/macros/PostTrackExtension.notest b/Detectors/ITSMFT/ITS/postprocessing/studies/macros/PostTrackExtension.notest index 4a7c9c4159a4b..29f94086aae4c 100644 --- a/Detectors/ITSMFT/ITS/postprocessing/studies/macros/PostTrackExtension.notest +++ b/Detectors/ITSMFT/ITS/postprocessing/studies/macros/PostTrackExtension.notest @@ -587,7 +587,7 @@ void setStyle() gStyle->Reset("Plain"); gStyle->SetOptTitle(0); gStyle->SetOptStat(0); - gStyle->SetPalette(kRainbow); + gStyle->SetPalette(kRainBow); gStyle->SetCanvasColor(10); gStyle->SetCanvasBorderMode(0); gStyle->SetFrameLineWidth(1); From 90ca34cffac983c8d23c626eaf8e2b52ebd905b7 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 12:57:09 +0100 Subject: [PATCH 26/50] GPU:Remove OpenCL 1.2, now that OpenCL 2 supports all its functionality --- GPU/Common/GPUCommonConstants.h | 4 +- GPU/Common/GPUCommonDef.h | 4 +- GPU/Common/GPUCommonDefSettings.h | 1 - GPU/Common/GPUCommonMath.h | 12 +- GPU/Common/GPUCommonTypeTraits.h | 2 +- GPU/GPUTracking/Base/GPUConstantMem.h | 2 +- GPU/GPUTracking/Base/GPUParam.inc | 6 - GPU/GPUTracking/Base/GPUReconstruction.h | 2 +- ...ReconstructionAvailableBackends.template.h | 1 - .../GPUReconstructionKernelList.template.h | 8 +- .../Base/GPUReconstructionLibrary.cxx | 5 - .../opencl-common/GPUReconstructionOCL.cl | 28 ----- GPU/GPUTracking/Base/opencl/CMakeLists.txt | 112 ------------------ .../Base/opencl/GPUReconstructionOCL1.cxx | 103 ---------------- .../Base/opencl/GPUReconstructionOCL1.h | 52 -------- .../opencl/GPUReconstructionOCL1Internals.h | 28 ----- GPU/GPUTracking/CMakeLists.txt | 12 +- GPU/GPUTracking/DataTypes/GPUDataTypes.h | 3 - GPU/GPUTracking/DataTypes/GPUO2DataTypes.h | 4 +- GPU/GPUTracking/DataTypes/GPUSettings.h | 2 - .../DataTypes/GPUTPCGMPolynomialField.h | 9 -- GPU/GPUTracking/DataTypes/GPUTPCGeometry.h | 12 +- .../Definitions/GPUDefConstantsAndSettings.h | 2 +- GPU/GPUTracking/Definitions/GPULogging.h | 2 +- GPU/GPUTracking/Definitions/GPUSettingsList.h | 2 +- .../Global/GPUChainTrackingClusterizer.cxx | 1 - .../SliceTracker/GPUTPCGlobalTracking.cxx | 3 - .../SliceTracker/GPUTPCGlobalTracking.h | 2 - .../SliceTracker/GPUTPCSliceOutput.h | 2 - .../SliceTracker/GPUTPCTracker.cxx | 2 - GPU/GPUTracking/SliceTracker/GPUTPCTracker.h | 2 - .../GPUTPCTrackletConstructor.cxx | 16 +-- .../SliceTracker/GPUTPCTrackletConstructor.h | 2 - GPU/GPUTracking/Standalone/cmake/config.cmake | 1 - GPU/GPUTracking/cmake/kernel_helpers.cmake | 4 +- GPU/GPUTracking/dEdx/GPUdEdx.h | 6 +- GPU/GPUTracking/kernels.cmake | 20 ++-- dependencies/FindO2GPU.cmake | 26 +--- 38 files changed, 40 insertions(+), 465 deletions(-) delete mode 100644 GPU/GPUTracking/Base/opencl/CMakeLists.txt delete mode 100644 GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.cxx delete mode 100644 GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.h delete mode 100644 GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1Internals.h diff --git a/GPU/Common/GPUCommonConstants.h b/GPU/Common/GPUCommonConstants.h index f45aa05ed00ca..c6dfedc14ab7e 100644 --- a/GPU/Common/GPUCommonConstants.h +++ b/GPU/Common/GPUCommonConstants.h @@ -17,11 +17,9 @@ #include "GPUCommonDef.h" -#if !defined(__OPENCL1__) namespace GPUCA_NAMESPACE::gpu::gpu_common_constants { -static CONSTEXPR const float kCLight = 0.000299792458f; // TODO: Duplicate of MathConstants, fix this when OpenCL1 is removed +static CONSTEXPR const float kCLight = 0.000299792458f; // TODO: Duplicate of MathConstants, fix this now that we use only OpenCL CPP } -#endif #endif diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index ac3d7279fbaf4..14949d569c1e6 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -30,7 +30,7 @@ //Some GPU configuration settings, must be included first #include "GPUCommonDefSettings.h" -#if !defined(__OPENCL1__) && (!(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__)) && defined(__cplusplus) && __cplusplus >= 201103L +#if (!(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 @@ -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(__OPENCL1__) && 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(__OPENCLCPP__) && defined(GPUCA_OPENCLCPP_NO_CONSTANT_MEMORY)) #define GPUCA_NO_CONSTANT_MEMORY #elif defined(__CUDACC__) || defined(__HIPCC__) #define GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM diff --git a/GPU/Common/GPUCommonDefSettings.h b/GPU/Common/GPUCommonDefSettings.h index 6a4ef86125a3f..91f44657c4f06 100644 --- a/GPU/Common/GPUCommonDefSettings.h +++ b/GPU/Common/GPUCommonDefSettings.h @@ -26,7 +26,6 @@ //#define GPUCA_CUDA_NO_CONSTANT_MEMORY // Do not use constant memory for CUDA //#define GPUCA_HIP_NO_CONSTANT_MEMORY // Do not use constant memory for HIP -//#define GPUCA_OPENCL_NO_CONSTANT_MEMORY // Do not use constant memory for OpenCL 1.2 #define GPUCA_OPENCLCPP_NO_CONSTANT_MEMORY // Do not use constant memory for OpenCL C++ - MANDATORY as OpenCL cannot cast between __constant and __generic yet! // clang-format on diff --git a/GPU/Common/GPUCommonMath.h b/GPU/Common/GPUCommonMath.h index 0e5db743d0c57..d211b051bed39 100644 --- a/GPU/Common/GPUCommonMath.h +++ b/GPU/Common/GPUCommonMath.h @@ -31,12 +31,10 @@ #include #endif -#if !defined(__OPENCL1__) namespace GPUCA_NAMESPACE { namespace gpu { -#endif class GPUCommonMath { @@ -289,7 +287,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(__OPENCL1__) +#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) 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--) { @@ -303,7 +301,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(__OPENCL1__)*/) // TODO: exclude only OPENCLC (not CPP) when reported SPIR-V bug is fixed +#if (defined(__GNUC__) || defined(__clang__) || defined(__CUDACC__) || defined(__HIPCC__)) && !defined(__OPENCL__) // TODO: remove OPENCL when reported SPIR-V bug is fixed // use builtin if available return CHOICE(__builtin_popcount(x), __popc(x), __builtin_popcount(x)); #else @@ -563,9 +561,7 @@ GPUdii() void GPUCommonMath::AtomicMinInternal(GPUglobalref() GPUgeneric() GPUAt #undef CHOICE -#if !defined(__OPENCL1__) -} -} -#endif +} // namespace gpu +} // namespace GPUCA_NAMESPACE #endif // GPUCOMMONMATH_H diff --git a/GPU/Common/GPUCommonTypeTraits.h b/GPU/Common/GPUCommonTypeTraits.h index 88fcc9b838a65..6d72565d1f1fb 100644 --- a/GPU/Common/GPUCommonTypeTraits.h +++ b/GPU/Common/GPUCommonTypeTraits.h @@ -21,7 +21,7 @@ #ifndef GPUCA_GPUCODE_COMPILEKERNELS #include #endif -#elif !defined(__OPENCL1__) +#else // We just reimplement some type traits in std for the GPU namespace std { diff --git a/GPU/GPUTracking/Base/GPUConstantMem.h b/GPU/GPUTracking/Base/GPUConstantMem.h index df797f4c79419..96b212eeea078 100644 --- a/GPU/GPUTracking/Base/GPUConstantMem.h +++ b/GPU/GPUTracking/Base/GPUConstantMem.h @@ -20,7 +20,7 @@ #include "GPUDataTypes.h" #include "GPUErrors.h" -// Dummies for stuff not supported in legacy code (ROOT 5 / OPENCL1.2) +// Dummies for stuff not supported in legacy code (ROOT 5) #if defined(GPUCA_NOCOMPAT_ALLCINT) #include "GPUTPCGMMerger.h" #else diff --git a/GPU/GPUTracking/Base/GPUParam.inc b/GPU/GPUTracking/Base/GPUParam.inc index 41ed3c8f203cb..1e972189d1b92 100644 --- a/GPU/GPUTracking/Base/GPUParam.inc +++ b/GPU/GPUTracking/Base/GPUParam.inc @@ -17,9 +17,7 @@ #include "GPUParam.h" #include "GPUTPCGMMergedTrackHit.h" -#if !defined(__OPENCL1__) #include "GPUTPCClusterOccupancyMap.h" -#endif namespace GPUCA_NAMESPACE { @@ -228,15 +226,11 @@ GPUdi() void MEM_LG(GPUParam)::UpdateClusterError2ByState(int16_t clusterState, MEM_CLASS_PRE() GPUdi() float MEM_LG(GPUParam)::GetUnscaledMult(float time) const { -#if !defined(__OPENCL1__) if (!occupancyMap) { return 0.f; } const uint32_t bin = CAMath::Max(0.f, time / rec.tpc.occupancyMapTimeBins); return occupancyMap[bin]; -#else - return 0.f; -#endif } MEM_CLASS_PRE() diff --git a/GPU/GPUTracking/Base/GPUReconstruction.h b/GPU/GPUTracking/Base/GPUReconstruction.h index efad0b41fd571..bbac264b2828c 100644 --- a/GPU/GPUTracking/Base/GPUReconstruction.h +++ b/GPU/GPUTracking/Base/GPUReconstruction.h @@ -390,7 +390,7 @@ class GPUReconstruction void* mGPULib; void* mGPUEntry; }; - static std::shared_ptr sLibCUDA, sLibHIP, sLibOCL, sLibOCL2; + static std::shared_ptr sLibCUDA, sLibHIP, sLibOCL2; static GPUReconstruction* GPUReconstruction_Create_CPU(const GPUSettingsDeviceBackend& cfg); }; diff --git a/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h b/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h index 77c57533ba541..3aea2706723f1 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h +++ b/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h @@ -14,5 +14,4 @@ #cmakedefine CUDA_ENABLED #cmakedefine HIP_ENABLED -#cmakedefine OPENCL1_ENABLED #cmakedefine OPENCL2_ENABLED diff --git a/GPU/GPUTracking/Base/GPUReconstructionKernelList.template.h b/GPU/GPUTracking/Base/GPUReconstructionKernelList.template.h index 8194214a180e4..1def09c61e606 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionKernelList.template.h +++ b/GPU/GPUTracking/Base/GPUReconstructionKernelList.template.h @@ -15,14 +15,14 @@ // No header protection, this may be used multiple times #include "GPUReconstructionKernelMacros.h" -#if !defined(GPUCA_OPENCL1) && (!defined(GPUCA_ALIROOT_LIB) || !defined(GPUCA_GPUCODE)) -#define GPUCA_KRNL_NOOCL1 +#if !defined(GPUCA_ALIROOT_LIB) || !defined(GPUCA_GPUCODE) +#define GPUCA_KRNL_NOALIROOT #endif // clang-format off $,> // clang-format on -#ifdef GPUCA_KRNL_NOOCL1 -#undef GPUCA_KRNL_NOOCL1 +#ifdef GPUCA_KRNL_NOALIROOT +#undef GPUCA_KRNL_NOALIROOT #endif diff --git a/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx b/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx index d4d7b12dc8cc6..ac852e93f5171 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx +++ b/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx @@ -101,10 +101,6 @@ std::shared_ptr* GPUReconstruction::GetLibrary } else if (type == DeviceType::HIP) { #ifdef HIP_ENABLED return &sLibHIP; -#endif - } else if (type == DeviceType::OCL) { -#ifdef OPENCL1_ENABLED - return &sLibOCL; #endif } else if (type == DeviceType::OCL2) { #ifdef OPENCL2_ENABLED @@ -132,7 +128,6 @@ GPUReconstruction* GPUReconstruction::CreateInstance(const char* type, bool forc std::shared_ptr GPUReconstruction::sLibCUDA(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingCUDA" LIBRARY_EXTENSION, "GPUReconstruction_Create_CUDA")); std::shared_ptr GPUReconstruction::sLibHIP(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingHIP" LIBRARY_EXTENSION, "GPUReconstruction_Create_HIP")); -std::shared_ptr GPUReconstruction::sLibOCL(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingOCL" LIBRARY_EXTENSION, "GPUReconstruction_Create_OCL")); std::shared_ptr GPUReconstruction::sLibOCL2(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingOCL2" LIBRARY_EXTENSION, "GPUReconstruction_Create_OCL2")); GPUReconstruction::LibraryLoader::LibraryLoader(const char* lib, const char* func) : mLibName(lib), mFuncName(func), mGPULib(nullptr), mGPUEntry(nullptr) {} diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl b/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl index 672c4b63eb476..57b32850900b3 100644 --- a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl +++ b/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl @@ -16,8 +16,6 @@ #define __OPENCL__ #if defined(__cplusplus) && __cplusplus >= 201703L #define __OPENCLCPP__ -#else - #define __OPENCL1__ #endif #define GPUCA_GPUTYPE_OPENCL @@ -57,9 +55,6 @@ #define M_PI 3.1415926535f #endif #else - #ifdef GPUCA_OPENCL_NO_CONSTANT_MEMORY - #define GPUCA_NO_CONSTANT_MEMORY - #endif #define nullptr NULL #define NULL (0x0) #endif @@ -77,32 +72,9 @@ typedef signed char int8_t; #undef assert #endif #define assert(param) -#ifndef __OPENCLCPP__ -#define static_assert(...) -#define GPUCA_OPENCL1 -#endif #include "GPUConstantMem.h" -#ifdef __OPENCLCPP__ #include "GPUReconstructionIncludesDeviceAll.h" -#else // Workaround, since OpenCL1 cannot digest all files -#include "GPUTPCTrackParam.cxx" -#include "GPUTPCTrack.cxx" -#include "GPUTPCGrid.cxx" -#include "GPUTPCRow.cxx" -#include "GPUTPCTracker.cxx" - -#include "GPUGeneralKernels.cxx" -#include "GPUErrors.cxx" - -#include "GPUTPCTrackletSelector.cxx" -#include "GPUTPCNeighboursFinder.cxx" -#include "GPUTPCNeighboursCleaner.cxx" -#include "GPUTPCStartHitsFinder.cxx" -#include "GPUTPCStartHitsSorter.cxx" -#include "GPUTPCTrackletConstructor.cxx" -#include "GPUTPCGlobalTracking.cxx" -#endif // if (gpu_mem != pTracker.GPUParametersConst()->gpumem) return; //TODO! diff --git a/GPU/GPUTracking/Base/opencl/CMakeLists.txt b/GPU/GPUTracking/Base/opencl/CMakeLists.txt deleted file mode 100644 index 1ad9041f70997..0000000000000 --- a/GPU/GPUTracking/Base/opencl/CMakeLists.txt +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright 2019-2020 CERN and copyright holders of ALICE O2. -# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -# All rights not expressly granted are reserved. -# -# This software is distributed under the terms of the GNU General Public -# License v3 (GPL Version 3), copied verbatim in the file "COPYING". -# -# In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE GPUTrackingOCL) -enable_language(ASM) - -# AMD APP SDK required for OpenCL tracker as it's using specific extensions -# (currently) not provided by other vendors - -if(NOT AMDAPPSDKROOT) - message( - FATAL_ERROR - "AMDAPPSDKROOT not set. Please install AMD APP SDK and set $AMDAPPSDKROOT or disable ENABLE_OPENCL1." - ) -endif() - -message(STATUS "Building GPUTracking with OpenCL 1.2 support") - -# convenience variables -if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") - set(GPUDIR ${CMAKE_SOURCE_DIR}/../) -else() - set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) -endif() -set(CL_SRC ${GPUDIR}/Base/opencl-common/GPUReconstructionOCL.cl) -set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCL1Code.bin) - -# build the OpenCL compile wrapper : -# -# * checks the correct vendor implementation (AMD) -# * builds binary code (blob) for the found platform(s) -add_executable(opencl_compiler - ${GPUDIR}/utils/makefile_opencl_compiler.cxx) -target_link_libraries(opencl_compiler PUBLIC OpenCL::OpenCL) -set_property(TARGET opencl_compiler - PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) - -if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") - set(OPENCL_HEADER_FILTER "${CMAKE_SOURCE_DIR}") -else() - set(OPENCL_HEADER_FILTER "${CMAKE_SOURCE_DIR}/GPU") -endif() -set(OPENCL_HEADER_FILTER "^${OPENCL_HEADER_FILTER}|^${CMAKE_BINARY_DIR}.*include_gpu_onthefly") - -# executes OpenCL compiler wrapper to build binary object -add_custom_command( - OUTPUT ${CL_BIN} - COMMAND LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ - $ - -output-file - ${CL_BIN} - ${CL_SRC} - -- - "-D$,$-D>" - "-I$,EXCLUDE,^/usr>,INCLUDE,${OPENCL_HEADER_FILTER}>,$-I>" - -x clc++ - MAIN_DEPENDENCY ${CL_SRC} - IMPLICIT_DEPENDS CXX ${CL_SRC} - COMMAND_EXPAND_LISTS - COMMENT "Compiling OpenCL1 CL source file ${CL_SRC}") - -create_binary_resource(${CL_BIN} ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.o) - -set(SRCS GPUReconstructionOCL1.cxx - ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.o) -set(HDRS GPUReconstructionOCL1.h GPUReconstructionOCL1Internals.h) - -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - o2_add_library(${MODULE} - SOURCES ${SRCS} - PUBLIC_LINK_LIBRARIES O2::GPUTrackingOpenCLCommon - TARGETVARNAME targetName) - - target_compile_definitions(${targetName} PRIVATE $) - # the compile_defitions are not propagated automatically on purpose (they are - # declared PRIVATE) so we are not leaking them outside of the GPU** - # directories - - install(FILES ${HDRS} DESTINATION include/GPU) -endif() - -if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Generate the dictionary - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("Ali${MODULE}" "" "GPUReconstructionOCL1.h" "${incdirs} .") - - # Generate the ROOT map - generate_rootmap("Ali${MODULE}" "" "") - - # Add a library to the project using the specified source files - add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) - target_link_libraries(Ali${MODULE} PUBLIC AliGPUTrackingOpenCLCommon) - - # Installation - install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) - - install(FILES ${HDRS} DESTINATION include) -endif() - -if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") - add_library(${MODULE} SHARED ${SRCS}) - target_link_libraries(${MODULE} GPUTrackingOpenCLCommon) - install(TARGETS ${MODULE}) -endif() diff --git a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.cxx b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.cxx deleted file mode 100644 index 3f84ab0f6ac15..0000000000000 --- a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUReconstructionOCL1.cxx -/// \author David Rohr - -#define GPUCA_GPUTYPE_OPENCL -#define __OPENCL_HOST__ - -#include "GPUReconstructionOCL1.h" -#include "GPUReconstructionOCL1Internals.h" -#include "GPUReconstructionIncludes.h" - -using namespace GPUCA_NAMESPACE::gpu; - -#include -#include -#include -#include - -#include "utils/opencl_obtain_program.h" -#include "utils/qGetLdBinarySymbols.h" -QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCL1Code_bin); - -GPUReconstruction* GPUReconstruction_Create_OCL(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL1(cfg); } - -GPUReconstructionOCL1Backend::GPUReconstructionOCL1Backend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionOCL(cfg) -{ -} - -template -int32_t GPUReconstructionOCL1Backend::runKernelBackend(const krnlSetupArgs& args) -{ - cl_kernel k = args.s.y.num > 1 ? getKernelObject() : getKernelObject(); - return std::apply([this, &args, &k](auto&... vals) { return runKernelBackendInternal(args.s, k, vals...); }, args.v); -} - -template -S& GPUReconstructionOCL1Backend::getKernelObject() -{ - static uint32_t krnl = FindKernel(MULTI ? 2 : 1); - return mInternals->kernels[krnl].first; -} - -int32_t GPUReconstructionOCL1Backend::GetOCLPrograms() -{ - cl_uint count; - if (GPUFailedMsgI(clGetDeviceIDs(mInternals->platform, CL_DEVICE_TYPE_ALL, 0, nullptr, &count))) { - GPUError("Error getting OPENCL Device Count"); - return (1); - } - - if (_makefiles_opencl_obtain_program_helper(mInternals->context, count, mInternals->devices.get(), &mInternals->program, _binary_GPUReconstructionOCL1Code_bin_start)) { - clReleaseContext(mInternals->context); - GPUError("Could not obtain OpenCL progarm"); - return 1; - } - -#define GPUCA_OPENCL1 -#define GPUCA_KRNL(...) \ - GPUCA_KRNL_WRAP(GPUCA_KRNL_LOAD_, __VA_ARGS__) -#define GPUCA_KRNL_LOAD_single(x_class, ...) \ - if (AddKernel(false)) { \ - return 1; \ - } -#define GPUCA_KRNL_LOAD_multi(x_class, ...) \ - if (AddKernel(true)) { \ - return 1; \ - } -#include "GPUReconstructionKernelList.h" -#undef GPUCA_KRNL -#undef GPUCA_OPENCL1 -#undef GPUCA_KRNL_LOAD_single -#undef GPUCA_KRNL_LOAD_multi - - return 0; -} - -bool GPUReconstructionOCL1Backend::CheckPlatform(uint32_t i) -{ - char platform_version[64] = {}, platform_vendor[64] = {}; - clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr); - clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VENDOR, sizeof(platform_vendor), platform_vendor, nullptr); - if (strcmp(platform_vendor, "Advanced Micro Devices, Inc.") == 0 && strstr(platform_version, "OpenCL 2.0 AMD-APP (") != nullptr) { - float ver = 0; - sscanf(platform_version, "OpenCL 2.0 AMD-APP (%f)", &ver); - if (ver < 2000.f) { - if (mProcessingSettings.debugLevel >= 2) { - GPUInfo("AMD APP OpenCL Platform found"); - } - return true; - } - } - return false; -} diff --git a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.h b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.h deleted file mode 100644 index c9a3b89a79cd1..0000000000000 --- a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUReconstructionOCL1.h -/// \author David Rohr - -#ifndef GPURECONSTRUCTIONOCL1_H -#define GPURECONSTRUCTIONOCL1_H - -#include "GPUReconstructionOCL.h" - -#ifdef _WIN32 -extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); -#else -extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); -#endif - -namespace GPUCA_NAMESPACE::gpu -{ -struct GPUReconstructionOCL1Internals; - -class GPUReconstructionOCL1Backend : public GPUReconstructionOCL -{ - public: - ~GPUReconstructionOCL1Backend() override = default; - - protected: - GPUReconstructionOCL1Backend(const GPUSettingsDeviceBackend& cfg); - - template - int32_t runKernelBackend(const krnlSetupArgs& args); - template - S& getKernelObject(); - - RecoStepField AvailableGPURecoSteps() override { return (RecoStep::TPCSliceTracking); } - bool ContextForAllPlatforms() override { return true; } - bool CheckPlatform(uint32_t i) override; - int32_t GetOCLPrograms() override; -}; - -using GPUReconstructionOCL1 = GPUReconstructionKernels; -} // namespace GPUCA_NAMESPACE::gpu - -#endif diff --git a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1Internals.h b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1Internals.h deleted file mode 100644 index 997a108ac26d0..0000000000000 --- a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL1Internals.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUReconstructionOCL1Internals.h -/// \author David Rohr, Sergey Gorbunov - -#ifndef GPUTPCGPUTRACKEROPENCLINTERNALS1_H -#define GPUTPCGPUTRACKEROPENCLINTERNALS1_H - -#include "GPUReconstructionOCLInternals.h" - -namespace GPUCA_NAMESPACE::gpu -{ - -struct GPUReconstructionOCL1Internals : public GPUReconstructionOCLInternals { -}; - -} // namespace GPUCA_NAMESPACE::gpu - -#endif diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index dd3480cae86bd..2cf03860a6d86 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -22,7 +22,7 @@ endif() include(cmake/helpers.cmake) if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - if(ENABLE_CUDA OR ENABLE_OPENCL1 OR ENABLE_OPENCL2 OR ENABLE_HIP) + if(ENABLE_CUDA OR ENABLE_OPENCL2 OR ENABLE_HIP) include(FeatureSummary) find_package(O2GPU) else() @@ -415,7 +415,6 @@ if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/cuda ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/hip ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl-common - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl2 ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation) alice_usevc() @@ -523,20 +522,15 @@ endif() target_compile_options(${targetName} PRIVATE -Wno-instantiation-after-specialization) # Add CMake recipes for GPU Tracking librararies -if(CUDA_ENABLED OR OPENCL1_ENABLED OR OPENCL2_ENABLED OR HIP_ENABLED) +if(CUDA_ENABLED OR OPENCL2_ENABLED OR HIP_ENABLED) if(CMAKE_SYSTEM_NAME MATCHES Darwin) message(WARNING "GPU Tracking disabled on MacOS") else() if(CUDA_ENABLED) add_subdirectory(Base/cuda) endif() - if(OPENCL1_ENABLED OR OPENCL2_ENABLED) - add_subdirectory(Base/opencl-common) - endif() - if(OPENCL1_ENABLED) - add_subdirectory(Base/opencl) - endif() if(OPENCL2_ENABLED) + add_subdirectory(Base/opencl-common) add_subdirectory(Base/opencl2) endif() if(HIP_ENABLED) diff --git a/GPU/GPUTracking/DataTypes/GPUDataTypes.h b/GPU/GPUTracking/DataTypes/GPUDataTypes.h index d3b88f0239c7b..8bcd06576d776 100644 --- a/GPU/GPUTracking/DataTypes/GPUDataTypes.h +++ b/GPU/GPUTracking/DataTypes/GPUDataTypes.h @@ -125,9 +125,6 @@ namespace gpu #define GPUCA_RECO_STEP GPUDataTypes #endif -#if defined(__OPENCL1__) -MEM_CLASS_PRE() // Macro with some template magic for OpenCL 1.2 -#endif class GPUTPCTrack; class GPUTPCHitId; class GPUTPCGMMergedTrack; diff --git a/GPU/GPUTracking/DataTypes/GPUO2DataTypes.h b/GPU/GPUTracking/DataTypes/GPUO2DataTypes.h index 1015b31fe6556..810e4dd58ca0e 100644 --- a/GPU/GPUTracking/DataTypes/GPUO2DataTypes.h +++ b/GPU/GPUTracking/DataTypes/GPUO2DataTypes.h @@ -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(__OPENCL1__) +#if defined(GPUCA_HAVE_O2HEADERS) #include "DataFormatsTPC/ClusterNative.h" #include "DataFormatsTPC/Digit.h" #include "DetectorsBase/MatLayerCylSet.h" @@ -27,8 +27,6 @@ #include "GPUO2FakeClasses.h" #endif -#if !defined(__OPENCL1__) #include "GPUdEdxInfo.h" -#endif #endif diff --git a/GPU/GPUTracking/DataTypes/GPUSettings.h b/GPU/GPUTracking/DataTypes/GPUSettings.h index b967a7ce42620..b853d80754080 100644 --- a/GPU/GPUTracking/DataTypes/GPUSettings.h +++ b/GPU/GPUTracking/DataTypes/GPUSettings.h @@ -45,9 +45,7 @@ class GPUSettings RejectionStrategyA = 1, RejectionStrategyB = 2 }; -#if !defined(__OPENCL1__) static CONSTEXPR const uint32_t TPC_MAX_TF_TIME_BIN = ((256 * 3564 + 2 * 8 - 2) / 8); -#endif }; #ifdef GPUCA_NOCOMPAT diff --git a/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h b/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h index 09193e76b9382..88294b2b06c25 100644 --- a/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h +++ b/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h @@ -29,7 +29,6 @@ namespace gpu class GPUTPCGMPolynomialField { public: -#if !defined(__OPENCL1__) GPUTPCGMPolynomialField() : mNominalBz(0.f) { Reset(); @@ -75,11 +74,6 @@ class GPUTPCGMPolynomialField const float* GetCoefmItsBx() const { return mItsBx; } const float* GetCoefmItsBy() const { return mItsBy; } const float* GetCoefmItsBz() const { return mItsBz; } -#else -#define NTPCM 10 -#define NTRDM 20 -#define NITSM 10 -#endif private: float mNominalBz; // nominal constant field value in [kG * 2.99792458E-4 GeV/c/cm] @@ -94,8 +88,6 @@ class GPUTPCGMPolynomialField float mItsBz[NITSM]; }; -#if !defined(__OPENCL1__) - inline void GPUTPCGMPolynomialField::Reset() { mNominalBz = 0.f; @@ -297,7 +289,6 @@ GPUdi() float GPUTPCGMPolynomialField::GetFieldItsBz(float x, float y, float z) return bz; } -#endif // __OPENCL__ } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h b/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h index 515905abe48b5..75b08047834bb 100644 --- a/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h +++ b/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h @@ -34,9 +34,6 @@ 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(__OPENCL1__) - GPUTPCGeometry(); // Fake constructor declaration for OpenCL due to static members, does not exist! -#endif #ifdef GPUCA_TPC_GEOMETRY_O2 const float mX[GPUCA_ROW_COUNT] GPUCA_CPP11_INIT(= {85.225f, 85.975f, 86.725f, 87.475f, 88.225f, 88.975f, 89.725f, 90.475f, 91.225f, 91.975f, 92.725f, 93.475f, 94.225f, 94.975f, 95.725f, 96.475f, 97.225f, 97.975f, 98.725f, 99.475f, 100.225f, 100.975f, 101.725f, 102.475f, 103.225f, 103.975f, 104.725f, 105.475f, 106.225f, 106.975f, 107.725f, 108.475f, 109.225f, 109.975f, 110.725f, 111.475f, 112.225f, 112.975f, 113.725f, 114.475f, 115.225f, 115.975f, 116.725f, 117.475f, @@ -63,9 +60,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(__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 public: GPUd() int32_t GetRegion(int32_t row) const { return mRegion[row]; } @@ -95,9 +90,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(__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 public: GPUd() int32_t GetRegion(int32_t row) const { return (row < 63 ? 0 : row < 63 + 64 ? 1 : 2); } @@ -109,9 +102,8 @@ class GPUTPCGeometry // TODO: Make values constexpr GPUd() int32_t EndOROC2() const { return GPUCA_ROW_COUNT; } #endif private: -#if !defined(__OPENCL1__) static CONSTEXPR float FACTOR_Z2T GPUCA_CPP11_INIT(= 1.f / FACTOR_T2Z); -#endif + public: GPUd() static CONSTEXPR float TPCLength() { return 250.f - 0.275f; } GPUd() float Row2X(int32_t row) const { return (mX[row]); } @@ -120,7 +112,6 @@ 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(__OPENCL1__) GPUd() float LinearPad2Y(int32_t slice, int32_t row, float pad) const { const float u = (pad - 0.5f * mNPads[row]) * PadWidth(row); @@ -144,7 +135,6 @@ class GPUTPCGeometry // TODO: Make values constexpr const float v = (slice >= GPUCA_NSLICES / 2) ? -z : z; return (250.f - v) * FACTOR_Z2T; // Used in compression, must remain constant at 250cm } -#endif }; } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h b/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h index 7693ee8553b77..1c8134f11efda 100644 --- a/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h +++ b/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h @@ -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(__OPENCL1__) && !(defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE < 393216) +#if defined(GPUCA_HAVE_O2HEADERS) && defined(GPUCA_TPC_GEOMETRY_O2) && !(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 diff --git a/GPU/GPUTracking/Definitions/GPULogging.h b/GPU/GPUTracking/Definitions/GPULogging.h index f3c6c019f593b..32557edb01d1b 100644 --- a/GPU/GPUTracking/Definitions/GPULogging.h +++ b/GPU/GPUTracking/Definitions/GPULogging.h @@ -18,7 +18,7 @@ #include "GPUCommonDef.h" // clang-format off #if !defined(GPUCA_NOCOMPAT) - // Cannot do anything for ROOT5CINT / OpenCL1, so just disable + // Cannot do anything for ROOT5CINT, so just disable #define GPUInfo(...) #define GPUImportant(...) #define GPUWarning(...) diff --git a/GPU/GPUTracking/Definitions/GPUSettingsList.h b/GPU/GPUTracking/Definitions/GPUSettingsList.h index 07cd320140909..d09f9c89a8077 100644 --- a/GPU/GPUTracking/Definitions/GPUSettingsList.h +++ b/GPU/GPUTracking/Definitions/GPUSettingsList.h @@ -537,7 +537,7 @@ AddOption(constBz, bool, false, "", 0, "force constant Bz for tests") AddOption(setMaxTimeBin, int32_t, -2, "", 0, "maximum time bin of continuous data, 0 for triggered events, -1 for automatic continuous mode, -2 for automatic continuous / triggered") AddOption(overrideNHbfPerTF, int32_t, 0, "", 0, "Overrides the number of HBF per TF if != 0") AddOption(overrideTPCTimeBinCur, int32_t, 0, "", 0, "Overrides TPC time bin cut if > 0") -AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL1 | OCL2") +AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL2") AddOption(forceDeviceType, bool, true, "", 0, "force device type, otherwise allows fall-back to CPU") AddOption(synchronousProcessing, bool, false, "", 0, "Apply performance shortcuts for synchronous processing, disable unneeded steps") AddOption(dump, int32_t, 0, "", 0, "Dump events for standalone benchmark: 1 = dump events, 2 = dump events and skip processing in workflow") diff --git a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx index ff4133d9b2ce3..8eddab63df35c 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx @@ -567,7 +567,6 @@ int32_t GPUChainTracking::RunTPCClusterizer_prepare(bool restorePointers) } #endif -// TODO: Clusterizer not working with OCL1 (Clusterizer on CPU, Tracking on GPU) int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput) { if (param().rec.fwdTPCDigitsAsClusters) { diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx index c1a3c685947d6..5cf14ca6ab5a4 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx @@ -22,8 +22,6 @@ using namespace GPUCA_NAMESPACE::gpu; -#if !defined(__OPENCL1__) - GPUd() int32_t GPUTPCGlobalTracking::PerformGlobalTrackingRun(GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, const GPUTPCTracker& GPUrestrict() sliceSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction) { /*for (int32_t j = 0;j < Tracks()[j].NHits();j++) @@ -200,7 +198,6 @@ GPUd() void GPUTPCGlobalTracking::GlobalTrackingSliceLeftRight(uint32_t iSlice, right += GPUDataTypes::NSLICES / 2; } } -#endif // !__OPENCL1__ template <> GPUdii() void GPUTPCGlobalTrackingCopyNumbers::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& GPUrestrict() tracker, int32_t n) diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h index 9d732a582b1c4..c45391cd46a4c 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h @@ -25,7 +25,6 @@ namespace gpu MEM_CLASS_PRE() class GPUTPCTracker; -#if !defined(__OPENCL1__) class GPUTPCGlobalTracking : public GPUKernelTemplate { public: @@ -49,7 +48,6 @@ class GPUTPCGlobalTracking : public GPUKernelTemplate GPUd() static int32_t PerformGlobalTrackingRun(GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, const GPUTPCTracker& sliceSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction); GPUd() static void PerformGlobalTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, GPUTPCTracker& sliceTarget, bool right); }; -#endif class GPUTPCGlobalTrackingCopyNumbers : public GPUKernelTemplate { diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h b/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h index 3ab5b0a331f31..5108c3f2ec8bb 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h @@ -44,7 +44,6 @@ class GPUTPCSliceOutput } GPUhd() uint32_t NLocalTracks() const { return mNLocalTracks; } GPUhd() uint32_t NTrackClusters() const { return mNTrackClusters; } -#if !defined(__OPENCL1__) GPUhd() const GPUTPCTrack* GetFirstTrack() const { return (const GPUTPCTrack*)((const char*)this + sizeof(*this)); @@ -53,7 +52,6 @@ class GPUTPCSliceOutput { return (GPUTPCTrack*)((char*)this + sizeof(*this)); } -#endif GPUhd() size_t Size() const { return (mMemorySize); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.cxx index 84bdc52ab6f46..4970ff90a934c 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.cxx @@ -22,9 +22,7 @@ #include "GPUO2DataTypes.h" #include "GPUTPCTrackParam.h" #include "GPUParam.inc" -#if !defined(__OPENCL1__) #include "GPUTPCConvertImpl.h" -#endif #if !defined(GPUCA_GPUCODE) #include diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h index da8d3d1fb28d4..488807e981b5b 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h @@ -94,14 +94,12 @@ class GPUTPCTracker : public GPUProcessor StructGPUParameters gpuParameters; // GPU parameters }; -#if !defined(__OPENCL1__) GPUhdi() GPUglobalref() const GPUTPCClusterData* ClusterData() const { return mData.ClusterData(); } GPUhdi() MakeType(const MEM_LG(GPUTPCRow) &) Row(const GPUTPCHitId& HitId) const { return mData.Row(HitId.RowIndex()); } GPUhdi() GPUglobalref() GPUTPCSliceOutput* Output() const { return mOutput; } -#endif GPUhdni() GPUglobalref() commonMemoryStruct* CommonMemory() const { return (mCommonMem); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx index 05e75232297a3..c073ad3d26b8b 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx @@ -21,13 +21,11 @@ #include "GPUTPCTracker.h" #include "GPUTPCTracklet.h" #include "GPUTPCTrackletConstructor.h" -#if !defined(__OPENCL1__) #include "GPUTPCGlobalTracking.h" #include "CorrectionMapsHelper.h" #ifdef GPUCA_HAVE_O2HEADERS #include "CalibdEdxContainer.h" #endif // GPUCA_HAVE_O2HEADERS -#endif // OPENCL1 #include "GPUParam.inc" #include "GPUCommonMath.h" @@ -140,18 +138,14 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, float z = z0 + hh.y * stepZ; if (iRow != r.mStartRow || !tracker.Param().par.continuousTracking) { tParam.ConstrainZ(z, tracker.ISlice(), z0, r.mLastZ); -#if !defined(__OPENCL1__) tracker.GetConstantMem()->calibObjects.fastTransformHelper->TransformXYZ(tracker.ISlice(), iRow, x, y, z); -#endif } if (iRow == r.mStartRow) { if (tracker.Param().par.continuousTracking) { float refZ = ((z > 0) ? tracker.Param().rec.tpc.defaultZOffsetOverR : -tracker.Param().rec.tpc.defaultZOffsetOverR) * x; -#if !defined(__OPENCL1__) float zTmp = refZ; tracker.GetConstantMem()->calibObjects.fastTransformHelper->TransformXYZ(tracker.ISlice(), iRow, x, y, zTmp); z += zTmp - refZ; // Add zCorrection (=zTmp - refZ) to z, such that zOffset is set such, that transformed (z - zOffset) becomes refZ -#endif tParam.SetZOffset(z - refZ); tParam.SetZ(refZ); r.mLastZ = refZ; @@ -266,7 +260,6 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, r.mNMissed++; float x = row.X(); -#if !defined(__OPENCL1__) { float tmpY, tmpZ; if (!tParam.GetPropagatedYZ(tracker.Param().bzCLight, x, tmpY, tmpZ)) { @@ -277,7 +270,6 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, tParam.ConstrainZ(tmpZ, tracker.ISlice(), z0, r.mLastZ); tracker.GetConstantMem()->calibObjects.fastTransformHelper->InverseTransformYZtoX(tracker.ISlice(), iRow, tmpY, tmpZ, x); } -#endif CADEBUG(printf("%14s: SEA TRACK ROW %3d X %8.3f -", "", iRow, tParam.X()); for (int32_t i = 0; i < 5; i++) { printf(" %8.3f", tParam.Par()[i]); } printf(" -"); for (int32_t i = 0; i < 15; i++) { printf(" %8.3f", tParam.Cov()[i]); } printf("\n")); if (!tParam.TransportToX(x, tParam.SinPhi(), tParam.GetCosPhi(), tracker.Param().bzCLight, GPUCA_MAX_SIN_PHI_LOW)) { @@ -299,9 +291,7 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, GPUglobalref() const cahit2* hits = tracker.HitData(row); GPUglobalref() const calink* firsthit = tracker.FirstHitInBin(row); #endif //! GPUCA_TEXTURE_FETCH_CONSTRUCTOR -#if !defined(__OPENCL1__) tracker.GetConstantMem()->calibObjects.fastTransformHelper->InverseTransformYZtoNominalYZ(tracker.ISlice(), iRow, yUncorrected, zUncorrected, yUncorrected, zUncorrected); -#endif if (tracker.Param().rec.tpc.rejectEdgeClustersInSeeding && tracker.Param().rejectEdgeClusterByY(yUncorrected, iRow, CAMath::Sqrt(tParam.Err2Y()))) { rowHit = CALINK_INVAL; @@ -391,7 +381,7 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, } } while (false); (void)found; -#if defined(GPUCA_HAVE_O2HEADERS) && !defined(__OPENCL1__) +#if defined(GPUCA_HAVE_O2HEADERS) if (!found && tracker.GetConstantMem()->calibObjects.dEdxCalibContainer) { uint32_t pad = CAMath::Float2UIntRn(tracker.Param().tpcGeometry.LinearY2Pad(tracker.ISlice(), iRow, yUncorrected)); if (pad < tracker.Param().tpcGeometry.NPads(iRow) && tracker.GetConstantMem()->calibObjects.dEdxCalibContainer->isDead(tracker.ISlice(), iRow, pad)) { @@ -461,7 +451,6 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::DoTracklet(GPUconstantref() MEM_GLO iRow = r.mEndRow; iRowEnd = -1; float x = tracker.Row(r.mEndRow).X(); -#if !defined(__OPENCL1__) { float tmpY, tmpZ; if (tParam.GetPropagatedYZ(tracker.Param().bzCLight, x, tmpY, tmpZ)) { @@ -476,7 +465,6 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::DoTracklet(GPUconstantref() MEM_GLO continue; } } -#endif if ((r.mGo = (tParam.TransportToX(x, tracker.Param().bzCLight, GPUCA_MAX_SIN_PHI) && tParam.Filter(r.mLastY, r.mLastZ, tParam.Err2Y() * 0.5f, tParam.Err2Z() * 0.5f, GPUCA_MAX_SIN_PHI_LOW, true)))) { CADEBUG(printf("%14s: SEA BACK ROW %3d X %8.3f -", "", iRow, tParam.X()); for (int32_t i = 0; i < 5; i++) { printf(" %8.3f", tParam.Par()[i]); } printf(" -"); for (int32_t i = 0; i < 15; i++) { printf(" %8.3f", tParam.Cov()[i]); } printf("\n")); float err2Y, err2Z; @@ -584,7 +572,6 @@ GPUd() int32_t GPUTPCTrackletConstructor::FetchTracklet(GPUconstantref() MEM_GLO #endif // GPUCA_GPUCODE -#if !defined(__OPENCL1__) template <> // FIXME: GPUgeneric() needed to make the clang spirv output link correctly GPUd() int32_t GPUTPCTrackletConstructor::GPUTPCTrackletConstructorGlobalTracking(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & GPUrestrict() tracker, GPUsharedref() GPUTPCGlobalTracking::GPUSharedMemory& sMem, MEM_LG(GPUTPCTrackParam) & GPUrestrict() tParam, int32_t row, int32_t increment, int32_t iTracklet, calink* rowHits) { @@ -602,4 +589,3 @@ GPUd() int32_t GPUTPCTrackletConstructor::GPUTPCTrackletConstructorGlobalTrackin } return (rMem.mNHits); } -#endif diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h index effee4fa757b8..f82aba47788f9 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h @@ -100,10 +100,8 @@ class GPUTPCTrackletConstructor GPUd() static int32_t FetchTracklet(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & sMem); #endif // GPUCA_GPUCODE -#if !defined(__OPENCL1__) template GPUd() static int32_t GPUTPCTrackletConstructorGlobalTracking(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & tracker, GPUsharedref() T& sMem, GPUTPCTrackParam& tParam, int32_t startrow, int32_t increment, int32_t iTracklet, calink* rowHits); -#endif typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } diff --git a/GPU/GPUTracking/Standalone/cmake/config.cmake b/GPU/GPUTracking/Standalone/cmake/config.cmake index 29f908c538af7..c2167d9591ba2 100644 --- a/GPU/GPUTracking/Standalone/cmake/config.cmake +++ b/GPU/GPUTracking/Standalone/cmake/config.cmake @@ -14,7 +14,6 @@ set(ENABLE_CUDA AUTO) set(ENABLE_HIP AUTO) -set(ENABLE_OPENCL1 AUTO) set(ENABLE_OPENCL2 AUTO) set(CONFIG_OPENMP 1) set(GPUCA_CONFIG_VC 1) diff --git a/GPU/GPUTracking/cmake/kernel_helpers.cmake b/GPU/GPUTracking/cmake/kernel_helpers.cmake index 42fd6b3d2402a..1667ad867a9e7 100644 --- a/GPU/GPUTracking/cmake/kernel_helpers.cmake +++ b/GPU/GPUTracking/cmake/kernel_helpers.cmake @@ -52,8 +52,8 @@ function(o2_gpu_add_kernel kernel_name kernel_files kernel_bounds kernel_type) endif() set(TMP_PRE "") set(TMP_POST "") - if(NOT kernel_bounds MATCHES "_OCL1") - set(TMP_PRE "#ifdef GPUCA_KRNL_NOOCL1\n") + if(NOT kernel_bounds MATCHES "_ALIR") + set(TMP_PRE "#ifdef GPUCA_KRNL_NOALIROOT\n") set(TMP_POST "#endif\n") endif() set(TMP_KERNEL "GPUCA_KRNL${TMP_BOUNDS}((${kernel_name}), (${kernel_type}), (${OPT1}), (${OPT2}), (${OPT3}))\n") diff --git a/GPU/GPUTracking/dEdx/GPUdEdx.h b/GPU/GPUTracking/dEdx/GPUdEdx.h index 516d1fced0a20..8c042d51514c4 100644 --- a/GPU/GPUTracking/dEdx/GPUdEdx.h +++ b/GPU/GPUTracking/dEdx/GPUdEdx.h @@ -20,7 +20,7 @@ #include "GPUCommonMath.h" #include "GPUParam.h" #include "GPUdEdxInfo.h" -#if defined(GPUCA_HAVE_O2HEADERS) && !defined(GPUCA_OPENCL1) +#if defined(GPUCA_HAVE_O2HEADERS) #include "DataFormatsTPC/Defs.h" #include "CalibdEdxContainer.h" #include "GPUDebugStreamer.h" @@ -30,7 +30,7 @@ namespace GPUCA_NAMESPACE { namespace gpu { -#if !defined(GPUCA_HAVE_O2HEADERS) || defined(GPUCA_OPENCL1) +#if !defined(GPUCA_HAVE_O2HEADERS) class GPUdEdx { @@ -212,7 +212,7 @@ GPUdi() void GPUdEdx::fillSubThreshold(int32_t padRow, const GPUParam& GPUrestri mNSubThresh++; } -#endif // !GPUCA_HAVE_O2HEADERS || GPUCA_OPENCL1 +#endif // !GPUCA_HAVE_O2HEADERS } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/kernels.cmake b/GPU/GPUTracking/kernels.cmake index f028c6990f267..bfa738201b637 100644 --- a/GPU/GPUTracking/kernels.cmake +++ b/GPU/GPUTracking/kernels.cmake @@ -33,16 +33,16 @@ o2_gpu_kernel_file_list(MATLUT) o2_gpu_kernel_file_list(TPCMERGER) endif() -o2_gpu_add_kernel("GPUTPCNeighboursFinder" "= TPCTRACKER" LB_OCL1 single) -o2_gpu_add_kernel("GPUTPCNeighboursCleaner" "= TPCTRACKER" LB_OCL1 single) -o2_gpu_add_kernel("GPUTPCStartHitsFinder" "= TPCTRACKER" LB_OCL1 single) -o2_gpu_add_kernel("GPUTPCStartHitsSorter" "= TPCTRACKER" LB_OCL1 single) -o2_gpu_add_kernel("GPUTPCTrackletConstructor, singleSlice" "= TPCTRACKER" LB_OCL1 single) -o2_gpu_add_kernel("GPUTPCTrackletConstructor, allSlices" "= TPCTRACKER" LB_OCL1 single) -o2_gpu_add_kernel("GPUTPCTrackletSelector" "= TPCTRACKER" LB_OCL1 both) -o2_gpu_add_kernel("GPUMemClean16" "GPUGeneralKernels" NO_OCL1 "simple, REG, (GPUCA_THREAD_COUNT, 1)" void* ptr "uint64_t" size) -o2_gpu_add_kernel("GPUitoa" "GPUGeneralKernels" NO_OCL1 "simple, REG, (GPUCA_THREAD_COUNT, 1)" int32_t* ptr "uint64_t" size) -o2_gpu_add_kernel("GPUTPCGlobalTrackingCopyNumbers" "GPUTPCGlobalTracking TPCTRACKER" NO_OCL1 single int32_t n) +o2_gpu_add_kernel("GPUTPCNeighboursFinder" "= TPCTRACKER" LB_ALIR single) +o2_gpu_add_kernel("GPUTPCNeighboursCleaner" "= TPCTRACKER" LB_ALIR single) +o2_gpu_add_kernel("GPUTPCStartHitsFinder" "= TPCTRACKER" LB_ALIR single) +o2_gpu_add_kernel("GPUTPCStartHitsSorter" "= TPCTRACKER" LB_ALIR single) +o2_gpu_add_kernel("GPUTPCTrackletConstructor, singleSlice" "= TPCTRACKER" LB_ALIR single) +o2_gpu_add_kernel("GPUTPCTrackletConstructor, allSlices" "= TPCTRACKER" LB_ALIR single) +o2_gpu_add_kernel("GPUTPCTrackletSelector" "= TPCTRACKER" LB_ALIR both) +o2_gpu_add_kernel("GPUMemClean16" "GPUGeneralKernels" NO_ALIR "simple, REG, (GPUCA_THREAD_COUNT, 1)" void* ptr "uint64_t" size) +o2_gpu_add_kernel("GPUitoa" "GPUGeneralKernels" NO_ALIR "simple, REG, (GPUCA_THREAD_COUNT, 1)" int32_t* ptr "uint64_t" size) +o2_gpu_add_kernel("GPUTPCGlobalTrackingCopyNumbers" "GPUTPCGlobalTracking TPCTRACKER" NO_ALIR single int32_t n) o2_gpu_add_kernel("GPUTPCGlobalTracking" "= TPCTRACKER TPCTRACKLETCONS" LB single) o2_gpu_add_kernel("GPUTPCCreateSliceData" "= TPCTRACKER TPCSLICEDATA" LB single) o2_gpu_add_kernel("GPUTPCSectorDebugSortKernels, hitData" "= TPCTRACKER" NO single) diff --git a/dependencies/FindO2GPU.cmake b/dependencies/FindO2GPU.cmake index c9420de2b704b..aacaf7fcedd8d 100644 --- a/dependencies/FindO2GPU.cmake +++ b/dependencies/FindO2GPU.cmake @@ -12,9 +12,6 @@ if(NOT DEFINED ENABLE_CUDA) set(ENABLE_CUDA "AUTO") endif() -if(NOT DEFINED ENABLE_OPENCL1) - set(ENABLE_OPENCL1 "AUTO") -endif() if(NOT DEFINED ENABLE_OPENCL2) set(ENABLE_OPENCL2 "AUTO") endif() @@ -22,7 +19,6 @@ if(NOT DEFINED ENABLE_HIP) set(ENABLE_HIP "AUTO") endif() string(TOUPPER "${ENABLE_CUDA}" ENABLE_CUDA) -string(TOUPPER "${ENABLE_OPENCL1}" ENABLE_OPENCL1) string(TOUPPER "${ENABLE_OPENCL2}" ENABLE_OPENCL2) string(TOUPPER "${ENABLE_HIP}" ENABLE_HIP) if(NOT DEFINED CMAKE_BUILD_TYPE_UPPER) @@ -151,32 +147,14 @@ if(ENABLE_CUDA) endif() # Detect and enable OpenCL 1.2 from AMD -if(ENABLE_OPENCL1 OR ENABLE_OPENCL2) +if(ENABLE_OPENCL2) find_package(OpenCL) - if((ENABLE_OPENCL1 AND NOT ENABLE_OPENCL1 STREQUAL "AUTO") - OR (ENABLE_OPENCL2 AND NOT ENABLE_OPENCL2 STREQUAL "AUTO")) + if(ENABLE_OPENCL2 AND NOT ENABLE_OPENCL2 STREQUAL "AUTO") set_package_properties(OpenCL PROPERTIES TYPE REQUIRED) else() set_package_properties(OpenCL PROPERTIES TYPE OPTIONAL) endif() endif() -if(ENABLE_OPENCL1) - if(NOT AMDAPPSDKROOT) - set(AMDAPPSDKROOT "$ENV{AMDAPPSDKROOT}") - endif() - - if(OpenCL_FOUND - AND OpenCL_VERSION_STRING VERSION_GREATER_EQUAL 1.2 - AND AMDAPPSDKROOT - AND EXISTS "${AMDAPPSDKROOT}") - set(OPENCL1_ENABLED ON) - message(STATUS "Found AMD OpenCL 1.2") - elseif(NOT ENABLE_OPENCL1 STREQUAL "AUTO") - message(FATAL_ERROR "AMD OpenCL 1.2 not available") - else() - set(OPENCL1_ENABLED OFF) - endif() -endif() # Detect and enable OpenCL 2.x if(ENABLE_OPENCL2) From b1f5bd5080258361487f4a2d732a338a44a5f78e Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 13:25:39 +0100 Subject: [PATCH 27/50] GPU: Remove some template magic that was only needed for OpenCL 1.2 --- GPU/GPUTracking/Base/GPUConstantMem.h | 12 +- GPU/GPUTracking/Base/GPUGeneralKernels.cxx | 4 +- GPU/GPUTracking/Base/GPUGeneralKernels.h | 15 +-- GPU/GPUTracking/Base/GPUParam.h | 1 - GPU/GPUTracking/Base/GPUParam.inc | 56 +++----- GPU/GPUTracking/Base/GPUProcessor.h | 8 +- .../Base/GPUReconstructionDeviceBase.cxx | 1 - .../Base/GPUReconstructionKernelMacros.h | 4 +- .../opencl-common/GPUReconstructionOCL.cl | 2 +- GPU/GPUTracking/CMakeLists.txt | 1 - GPU/GPUTracking/Definitions/GPUDef.h | 5 +- .../Definitions/GPUDefOpenCL12Templates.h | 86 ------------ GPU/GPUTracking/Refit/GPUTrackingRefit.cxx | 2 +- GPU/GPUTracking/Refit/GPUTrackingRefit.h | 8 +- .../SliceTracker/GPUTPCBaseTrackParam.h | 6 +- .../SliceTracker/GPUTPCCreateSliceData.cxx | 2 +- .../SliceTracker/GPUTPCCreateSliceData.h | 7 +- .../SliceTracker/GPUTPCGlobalTracking.cxx | 12 +- .../SliceTracker/GPUTPCGlobalTracking.h | 20 ++- GPU/GPUTracking/SliceTracker/GPUTPCGrid.cxx | 18 +-- GPU/GPUTracking/SliceTracker/GPUTPCGrid.h | 1 - .../SliceTracker/GPUTPCNeighboursCleaner.cxx | 8 +- .../SliceTracker/GPUTPCNeighboursCleaner.h | 9 +- .../SliceTracker/GPUTPCNeighboursFinder.cxx | 16 +-- .../SliceTracker/GPUTPCNeighboursFinder.h | 12 +- GPU/GPUTracking/SliceTracker/GPUTPCRow.h | 7 +- .../GPUTPCSectorDebugSortKernels.cxx | 4 +- .../SliceTracker/GPUTPCSliceData.cxx | 8 +- .../SliceTracker/GPUTPCSliceData.h | 123 ++++++------------ .../SliceTracker/GPUTPCStartHitsFinder.cxx | 6 +- .../SliceTracker/GPUTPCStartHitsFinder.h | 9 +- .../SliceTracker/GPUTPCStartHitsSorter.cxx | 2 +- .../SliceTracker/GPUTPCStartHitsSorter.h | 9 +- GPU/GPUTracking/SliceTracker/GPUTPCTrack.h | 9 +- .../SliceTracker/GPUTPCTrackLinearisation.h | 5 +- .../SliceTracker/GPUTPCTrackParam.cxx | 72 ++++------ .../SliceTracker/GPUTPCTrackParam.h | 13 +- GPU/GPUTracking/SliceTracker/GPUTPCTracker.h | 106 ++++++--------- GPU/GPUTracking/SliceTracker/GPUTPCTracklet.h | 9 +- .../GPUTPCTrackletConstructor.cxx | 44 +++---- .../SliceTracker/GPUTPCTrackletConstructor.h | 30 ++--- .../SliceTracker/GPUTPCTrackletSelector.cxx | 6 +- .../SliceTracker/GPUTPCTrackletSelector.h | 9 +- 43 files changed, 261 insertions(+), 526 deletions(-) delete mode 100644 GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h diff --git a/GPU/GPUTracking/Base/GPUConstantMem.h b/GPU/GPUTracking/Base/GPUConstantMem.h index 96b212eeea078..c36cec7100b59 100644 --- a/GPU/GPUTracking/Base/GPUConstantMem.h +++ b/GPU/GPUTracking/Base/GPUConstantMem.h @@ -71,12 +71,10 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() struct GPUConstantMem { - MEM_CONSTANT(GPUParam) - param; - MEM_GLOBAL(GPUTPCTracker) - tpcTrackers[GPUCA_NSLICES]; + GPUParam param; + GPUTPCTracker + tpcTrackers[GPUCA_NSLICES]; GPUTPCConvert tpcConverter; GPUTPCCompression tpcCompressor; GPUTPCDecompression tpcDecompressor; @@ -150,7 +148,7 @@ namespace gpu { // Must be placed here, to avoid circular header dependency -GPUdi() GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * GPUProcessor::GetConstantMem() const +GPUdi() GPUconstantref() const GPUConstantMem* GPUProcessor::GetConstantMem() const { #if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM) && !defined(GPUCA_GPUCODE_HOSTONLY) return &GPUCA_CONSMEM; @@ -159,7 +157,7 @@ GPUdi() GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * GPUProcessor::GetC #endif } -GPUdi() GPUconstantref() const MEM_CONSTANT(GPUParam) & GPUProcessor::Param() const +GPUdi() GPUconstantref() const GPUParam& GPUProcessor::Param() const { return GetConstantMem()->param; } diff --git a/GPU/GPUTracking/Base/GPUGeneralKernels.cxx b/GPU/GPUTracking/Base/GPUGeneralKernels.cxx index 8fc60bae6dbe9..44faf09112e5e 100644 --- a/GPU/GPUTracking/Base/GPUGeneralKernels.cxx +++ b/GPU/GPUTracking/Base/GPUGeneralKernels.cxx @@ -17,7 +17,7 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUMemClean16::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& GPUrestrict() processors, GPUglobalref() void* ptr, uint64_t size) +GPUdii() void GPUMemClean16::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() processors, GPUglobalref() void* ptr, uint64_t size) { const uint64_t stride = get_global_size(0); int4 i0; @@ -30,7 +30,7 @@ GPUdii() void GPUMemClean16::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_ } template <> -GPUdii() void GPUitoa::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& GPUrestrict() processors, GPUglobalref() int32_t* ptr, uint64_t size) +GPUdii() void GPUitoa::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() processors, GPUglobalref() int32_t* ptr, uint64_t size) { const uint64_t stride = get_global_size(0); for (uint64_t i = get_global_id(0); i < size; i += stride) { diff --git a/GPU/GPUTracking/Base/GPUGeneralKernels.h b/GPU/GPUTracking/Base/GPUGeneralKernels.h index 44314e3393589..47f26e2443229 100644 --- a/GPU/GPUTracking/Base/GPUGeneralKernels.h +++ b/GPU/GPUTracking/Base/GPUGeneralKernels.h @@ -36,7 +36,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() struct GPUConstantMem; class GPUKernelTemplate @@ -50,7 +49,6 @@ class GPUKernelTemplate step4 = 4, step5 = 5 }; - MEM_CLASS_PRE() struct GPUSharedMemory { }; @@ -82,21 +80,20 @@ class GPUKernelTemplate #endif }; - typedef GPUconstantref() MEM_CONSTANT(GPUConstantMem) processorType; + typedef GPUconstantref() GPUConstantMem processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::NoRecoStep; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return &processors; } #ifdef GPUCA_NOCOMPAT template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& processors, Args... args) + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, Args... args) { } #else template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& processors) + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors) { } #endif @@ -108,7 +105,7 @@ class GPUMemClean16 : public GPUKernelTemplate public: GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::NoRecoStep; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& processors, GPUglobalref() void* ptr, uint64_t size); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, GPUglobalref() void* ptr, uint64_t size); }; // Fill with incrementing sequnce of integers @@ -117,7 +114,7 @@ class GPUitoa : public GPUKernelTemplate public: GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::NoRecoStep; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& processors, GPUglobalref() int32_t* ptr, uint64_t size); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, GPUglobalref() int32_t* ptr, uint64_t size); }; } // namespace gpu diff --git a/GPU/GPUTracking/Base/GPUParam.h b/GPU/GPUTracking/Base/GPUParam.h index ce9ac30b7c35b..48771578c63a4 100644 --- a/GPU/GPUTracking/Base/GPUParam.h +++ b/GPU/GPUTracking/Base/GPUParam.h @@ -79,7 +79,6 @@ struct GPUParam_t { } // namespace internal #if !(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__) // Hide from ROOT 5 CINT -MEM_CLASS_PRE() struct GPUParam : public internal::GPUParam_t { #ifndef GPUCA_GPUCODE diff --git a/GPU/GPUTracking/Base/GPUParam.inc b/GPU/GPUTracking/Base/GPUParam.inc index 1e972189d1b92..0b32067f8980c 100644 --- a/GPU/GPUTracking/Base/GPUParam.inc +++ b/GPU/GPUTracking/Base/GPUParam.inc @@ -24,8 +24,7 @@ namespace GPUCA_NAMESPACE namespace gpu { -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUParam)::Slice2Global(int32_t iSlice, float x, float y, float z, float* X, float* Y, float* Z) const +GPUdi() void GPUParam::Slice2Global(int32_t iSlice, float x, float y, float z, float* X, float* Y, float* Z) const { // conversion of coordinates sector->global *X = x * SliceParam[iSlice].CosAlpha - y * SliceParam[iSlice].SinAlpha; @@ -33,8 +32,7 @@ GPUdi() void MEM_LG(GPUParam)::Slice2Global(int32_t iSlice, float x, float y, fl *Z = z; } -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUParam)::Global2Slice(int32_t iSlice, float X, float Y, float Z, float* x, float* y, float* z) const +GPUdi() void GPUParam::Global2Slice(int32_t iSlice, float X, float Y, float Z, float* x, float* y, float* z) const { // conversion of coordinates global->sector *x = X * SliceParam[iSlice].CosAlpha + Y * SliceParam[iSlice].SinAlpha; @@ -44,8 +42,7 @@ GPUdi() void MEM_LG(GPUParam)::Global2Slice(int32_t iSlice, float X, float Y, fl #ifdef GPUCA_TPC_GEOMETRY_O2 -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUParam)::GetClusterErrorsSeeding2(uint8_t sector, int32_t iRow, float z, float sinPhi, float DzDs, float time, float& ErrY2, float& ErrZ2) const +GPUdi() void GPUParam::GetClusterErrorsSeeding2(uint8_t sector, int32_t iRow, float z, float sinPhi, float DzDs, float time, float& ErrY2, float& ErrZ2) const { const int32_t rowType = tpcGeometry.GetROC(iRow); z = CAMath::Abs(tpcGeometry.TPCLength() - CAMath::Abs(z)); @@ -60,10 +57,9 @@ GPUdi() void MEM_LG(GPUParam)::GetClusterErrorsSeeding2(uint8_t sector, int32_t ErrZ2 = GetClusterErrorSeeding(1, rowType, z, angleZ2, unscaledMult); // Returns Err2 } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetClusterErrorSeeding(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult) const // Note, returns Err2 despite the name not containing 2 +GPUdi() float GPUParam::GetClusterErrorSeeding(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult) const // Note, returns Err2 despite the name not containing 2 { - MakeType(const float*) c = ParamErrors[yz][type]; // Note: c[0] = p[0]^2, c[1] = p[1]^2 * padHeight, c[2] = p[2]^2 / tpcLength / padHeight, c[3] = p[3]^2 * clusterErrorOccupancyScaler^2 + const float* c = ParamErrors[yz][type]; // Note: c[0] = p[0]^2, c[1] = p[1]^2 * padHeight, c[2] = p[2]^2 / tpcLength / padHeight, c[3] = p[3]^2 * clusterErrorOccupancyScaler^2 float v = c[0] + c[1] * angle2 + c[2] * zDiff + c[3] * (unscaledMult * unscaledMult); v = CAMath::Abs(v); v *= yz ? rec.tpc.clusterError2CorrectionZ : rec.tpc.clusterError2CorrectionY; @@ -71,10 +67,9 @@ GPUdi() float MEM_LG(GPUParam)::GetClusterErrorSeeding(int32_t yz, int32_t type, return v; } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetClusterError2(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult, float scaledInvAvgCharge, float scaledInvCharge) const +GPUdi() float GPUParam::GetClusterError2(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult, float scaledInvAvgCharge, float scaledInvCharge) const { - MakeType(const float*) c = ParamErrors[yz][type]; // Note: c[0] = p[0]^2, c[1] = p[1]^2 * padHeight, c[2] = p[2]^2 / tpcLength / padHeight, c[3] = p[3]^2 * clusterErrorOccupancyScaler^2 + const float* c = ParamErrors[yz][type]; // Note: c[0] = p[0]^2, c[1] = p[1]^2 * padHeight, c[2] = p[2]^2 / tpcLength / padHeight, c[3] = p[3]^2 * clusterErrorOccupancyScaler^2 float v = c[0] + c[1] * angle2 * scaledInvAvgCharge + c[2] * zDiff * scaledInvCharge + c[3] * (unscaledMult * unscaledMult) * (scaledInvAvgCharge * scaledInvAvgCharge); v = CAMath::Abs(v); v *= yz ? rec.tpc.clusterError2CorrectionZ : rec.tpc.clusterError2CorrectionY; @@ -82,8 +77,7 @@ GPUdi() float MEM_LG(GPUParam)::GetClusterError2(int32_t yz, int32_t type, float return v; } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetSystematicClusterErrorIFC2(float x, float y, float z, bool sideC) const +GPUdi() float GPUParam::GetSystematicClusterErrorIFC2(float x, float y, float z, bool sideC) const { float sysErr = 0.f; const float kMaxExpArg = 9.f; // limit r-dumped error to this exp. argument @@ -116,8 +110,7 @@ GPUdi() float MEM_LG(GPUParam)::GetSystematicClusterErrorIFC2(float x, float y, return sysErr; } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetSystematicClusterErrorC122(float x, float y, uint8_t sector) const +GPUdi() float GPUParam::GetSystematicClusterErrorC122(float x, float y, uint8_t sector) const { const float dx = x - 83.f; if (dx > occupancyTotal * rec.tpc.sysClusErrorC12Box) { @@ -131,17 +124,15 @@ GPUdi() float MEM_LG(GPUParam)::GetSystematicClusterErrorC122(float x, float y, #else // GPUCA_TPC_GEOMETRY_O2 -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetClusterErrorSeeding(int32_t yz, int32_t type, float zDiff, float angle2, float scaledMult) const +GPUdi() float GPUParam::GetClusterErrorSeeding(int32_t yz, int32_t type, float zDiff, float angle2, float scaledMult) const { - MakeType(const float*) c = ParamErrorsSeeding0[yz][type]; + const float* c = ParamErrorsSeeding0[yz][type]; float v = c[0] + c[1] * zDiff + c[2] * angle2; v = CAMath::Abs(v); return v; } -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUParam)::GetClusterErrorsSeeding2(uint8_t sector, int32_t iRow, float z, float sinPhi, float DzDs, float time, float& ErrY2, float& ErrZ2) const +GPUdi() void GPUParam::GetClusterErrorsSeeding2(uint8_t sector, int32_t iRow, float z, float sinPhi, float DzDs, float time, float& ErrY2, float& ErrZ2) const { int32_t rowType = tpcGeometry.GetROC(iRow); z = CAMath::Abs(tpcGeometry.TPCLength() - CAMath::Abs(z)); @@ -156,10 +147,9 @@ GPUdi() void MEM_LG(GPUParam)::GetClusterErrorsSeeding2(uint8_t sector, int32_t ErrZ2 = ErrZ2 * ErrZ2 * rec.tpc.clusterError2CorrectionZ + rec.tpc.clusterError2AdditionalZ; } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetClusterError2(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult, float avgInvCharge, float invCharge) const +GPUdi() float GPUParam::GetClusterError2(int32_t yz, int32_t type, float zDiff, float angle2, float unscaledMult, float avgInvCharge, float invCharge) const { - MakeType(const float*) c = ParamS0Par[yz][type]; + const float* c = ParamS0Par[yz][type]; float v = c[0] + c[1] * zDiff + c[2] * angle2 + c[3] * zDiff * zDiff + c[4] * angle2 * angle2 + c[5] * zDiff * angle2; v = CAMath::Abs(v); if (v < 0.0001f) { @@ -170,22 +160,19 @@ GPUdi() float MEM_LG(GPUParam)::GetClusterError2(int32_t yz, int32_t type, float return v; } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetSystematicClusterErrorIFC2(float trackX, float trackY, float z, bool sideC) const +GPUdi() float GPUParam::GetSystematicClusterErrorIFC2(float trackX, float trackY, float z, bool sideC) const { return 0; } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetSystematicClusterErrorC122(float trackX, float trackY, uint8_t sector) const +GPUdi() float GPUParam::GetSystematicClusterErrorC122(float trackX, float trackY, uint8_t sector) const { return 0; } #endif // !GPUCA_TPC_GEOMETRY_O2 -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUParam)::GetClusterErrors2(uint8_t sector, int32_t iRow, float z, float sinPhi, float DzDs, float time, float avgInvCharge, float invCharge, float& ErrY2, float& ErrZ2) const +GPUdi() void GPUParam::GetClusterErrors2(uint8_t sector, int32_t iRow, float z, float sinPhi, float DzDs, float time, float avgInvCharge, float invCharge, float& ErrY2, float& ErrZ2) const { const int32_t rowType = tpcGeometry.GetROC(iRow); z = CAMath::Abs(tpcGeometry.TPCLength() - CAMath::Abs(z)); @@ -202,8 +189,7 @@ GPUdi() void MEM_LG(GPUParam)::GetClusterErrors2(uint8_t sector, int32_t iRow, f ErrZ2 = GetClusterError2(1, rowType, z, angleZ2, unscaledMult, scaledInvAvgCharge, scaledInvCharge); } -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUParam)::UpdateClusterError2ByState(int16_t clusterState, float& ErrY2, float& ErrZ2) const +GPUdi() void GPUParam::UpdateClusterError2ByState(int16_t clusterState, float& ErrY2, float& ErrZ2) const { if (clusterState & GPUTPCGMMergedTrackHit::flagEdge) { ErrY2 += rec.tpc.extraClusterErrorEdgeY2; @@ -223,8 +209,7 @@ GPUdi() void MEM_LG(GPUParam)::UpdateClusterError2ByState(int16_t clusterState, } } -MEM_CLASS_PRE() -GPUdi() float MEM_LG(GPUParam)::GetUnscaledMult(float time) const +GPUdi() float GPUParam::GetUnscaledMult(float time) const { if (!occupancyMap) { return 0.f; @@ -233,8 +218,7 @@ GPUdi() float MEM_LG(GPUParam)::GetUnscaledMult(float time) const return occupancyMap[bin]; } -MEM_CLASS_PRE() -GPUdi() bool MEM_LG(GPUParam)::rejectEdgeClusterByY(float uncorrectedY, int32_t iRow, float trackSigmaY) const +GPUdi() bool GPUParam::rejectEdgeClusterByY(float uncorrectedY, int32_t iRow, float trackSigmaY) const { return CAMath::Abs(uncorrectedY) > (tpcGeometry.NPads(iRow) - 1) * 0.5f * tpcGeometry.PadWidth(iRow) + rec.tpc.rejectEdgeClustersMargin + trackSigmaY * rec.tpc.rejectEdgeClustersSigmaMargin; } diff --git a/GPU/GPUTracking/Base/GPUProcessor.h b/GPU/GPUTracking/Base/GPUProcessor.h index 95b56a5c4cd28..af8dd895f4ecf 100644 --- a/GPU/GPUTracking/Base/GPUProcessor.h +++ b/GPU/GPUTracking/Base/GPUProcessor.h @@ -29,9 +29,7 @@ namespace gpu { struct GPUTrackingInOutPointers; class GPUReconstruction; -MEM_CLASS_PRE() struct GPUParam; -MEM_CLASS_PRE() struct GPUConstantMem; class GPUProcessor @@ -52,8 +50,8 @@ class GPUProcessor GPUProcessor& operator=(const GPUProcessor&) CON_DELETE; #endif - GPUd() GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * GetConstantMem() const; // Body in GPUConstantMem.h to avoid circular headers - GPUd() GPUconstantref() const MEM_CONSTANT(GPUParam) & Param() const; // ... + GPUd() GPUconstantref() const GPUConstantMem* GetConstantMem() const; // Body in GPUConstantMem.h to avoid circular headers + GPUd() GPUconstantref() const GPUParam& Param() const; // ... GPUd() void raiseError(uint32_t code, uint32_t param1 = 0, uint32_t param2 = 0, uint32_t param3 = 0) const; const GPUReconstruction& GetRec() const { return *mRec; } @@ -152,7 +150,7 @@ class GPUProcessor GPUReconstruction* mRec; ProcessorType mGPUProcessorType; GPUProcessor* mLinkedProcessor; - GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * mConstantMem; + GPUconstantref() const GPUConstantMem* mConstantMem; private: bool mAllocateAndInitializeLate; diff --git a/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.cxx b/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.cxx index 70eedd0ca86d1..c9155c1cb8f60 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.cxx +++ b/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.cxx @@ -28,7 +28,6 @@ using namespace GPUCA_NAMESPACE::gpu; #endif #include -MEM_CLASS_PRE() class GPUTPCRow; #define SemLockName "AliceHLTTPCGPUTrackerInitLockSem" diff --git a/GPU/GPUTracking/Base/GPUReconstructionKernelMacros.h b/GPU/GPUTracking/Base/GPUReconstructionKernelMacros.h index de6d5d079cd00..295e6e1a5d9b7 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionKernelMacros.h +++ b/GPU/GPUTracking/Base/GPUReconstructionKernelMacros.h @@ -59,7 +59,7 @@ #else #define GPUCA_KRNLGPU_SINGLE(x_class, x_attributes, x_arguments, x_forward, ...) GPUCA_KRNLGPU_SINGLE_DEF(x_class, x_attributes, x_arguments, x_forward, __VA_ARGS__) \ { \ - GPUshared() typename GPUCA_M_STRIP_FIRST(x_class)::MEM_LOCAL(GPUSharedMemory) smem; \ + GPUshared() typename GPUCA_M_STRIP_FIRST(x_class)::GPUSharedMemory smem; \ GPUCA_M_STRIP_FIRST(x_class)::template Thread(get_num_groups(0), get_local_size(0), get_group_id(0), get_local_id(0), smem, GPUCA_M_STRIP_FIRST(x_class)::Processor(GPUCA_CONSMEM)[iSlice_internal] GPUCA_M_STRIP(x_forward)); \ } #endif @@ -76,7 +76,7 @@ const int32_t nSliceBlockOffset = get_num_groups(0) * iSlice_internal / nSliceCount; \ const int32_t sliceBlockId = get_group_id(0) - nSliceBlockOffset; \ const int32_t sliceGridDim = get_num_groups(0) * (iSlice_internal + 1) / nSliceCount - get_num_groups(0) * (iSlice_internal) / nSliceCount; \ - GPUshared() typename GPUCA_M_STRIP_FIRST(x_class)::MEM_LOCAL(GPUSharedMemory) smem; \ + GPUshared() typename GPUCA_M_STRIP_FIRST(x_class)::GPUSharedMemory smem; \ GPUCA_M_STRIP_FIRST(x_class)::template Thread(sliceGridDim, get_local_size(0), sliceBlockId, get_local_id(0), smem, GPUCA_M_STRIP_FIRST(x_class)::Processor(GPUCA_CONSMEM)[firstSlice + iSlice_internal] GPUCA_M_STRIP(x_forward)); \ } #endif diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl b/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl index 57b32850900b3..e94efce6503fe 100644 --- a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl +++ b/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl @@ -81,7 +81,7 @@ typedef signed char int8_t; #define GPUCA_KRNL(...) GPUCA_KRNL_WRAP(GPUCA_KRNL_LOAD_, __VA_ARGS__) #define GPUCA_KRNL_LOAD_single(...) GPUCA_KRNLGPU_SINGLE(__VA_ARGS__) #define GPUCA_KRNL_LOAD_multi(...) GPUCA_KRNLGPU_MULTI(__VA_ARGS__) -#define GPUCA_CONSMEM_PTR GPUglobal() char *gpu_mem, GPUconstant() MEM_CONSTANT(GPUConstantMem) * pConstant, +#define GPUCA_CONSMEM_PTR GPUglobal() char *gpu_mem, GPUconstant() GPUConstantMem* pConstant, #define GPUCA_CONSMEM (*pConstant) #include "GPUReconstructionKernelList.h" #undef GPUCA_KRNL diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index 2cf03860a6d86..7e4ddf0dbd20e 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -137,7 +137,6 @@ set(HDRS_INSTALL Definitions/GPUDefGPUParameters.h Definitions/GPUDef.h Definitions/GPUDefMacros.h - Definitions/GPUDefOpenCL12Templates.h Definitions/GPULogging.h Definitions/GPUSettingsList.h Global/GPUChainTrackingDefs.h diff --git a/GPU/GPUTracking/Definitions/GPUDef.h b/GPU/GPUTracking/Definitions/GPUDef.h index 38784b1ded80e..7152bf2e1813b 100644 --- a/GPU/GPUTracking/Definitions/GPUDef.h +++ b/GPU/GPUTracking/Definitions/GPUDef.h @@ -19,7 +19,6 @@ #include "GPUCommonDef.h" #include "GPUDefConstantsAndSettings.h" #include "GPUDefGPUParameters.h" -#include "GPUDefOpenCL12Templates.h" #include "GPUCommonRtypes.h" // Macros for masking ptrs in OpenCL kernel calls as uint64_t (The API only allows us to pass buffer objects) @@ -42,7 +41,7 @@ #endif #ifdef GPUCA_GPUCODE - #define CA_MAKE_SHARED_REF(vartype, varname, varglobal, varshared) const GPUsharedref() MEM_LOCAL(vartype) & __restrict__ varname = varshared; + #define CA_MAKE_SHARED_REF(vartype, varname, varglobal, varshared) const GPUsharedref() vartype& __restrict__ varname = varshared; #define CA_SHARED_STORAGE(storage) storage #define CA_SHARED_CACHE(target, src, size) \ static_assert((size) % sizeof(int32_t) == 0, "Invalid shared cache size"); \ @@ -53,7 +52,7 @@ CA_SHARED_CACHE(target, src, size) \ GPUsharedref() const reftype* __restrict__ ref = (target) #else - #define CA_MAKE_SHARED_REF(vartype, varname, varglobal, varshared) const GPUglobalref() MEM_GLOBAL(vartype) & __restrict__ varname = varglobal; + #define CA_MAKE_SHARED_REF(vartype, varname, varglobal, varshared) const GPUglobalref() vartype & __restrict__ varname = varglobal; #define CA_SHARED_STORAGE(storage) #define CA_SHARED_CACHE(target, src, size) #define CA_SHARED_CACHE_REF(target, src, size, reftype, ref) GPUglobalref() const reftype* __restrict__ ref = src diff --git a/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h b/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h deleted file mode 100644 index f65e670399f34..0000000000000 --- a/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUDefOpenCL12Templates.h -/// \author David Rohr, Sergey Gorbunov - -// clang-format off -#ifndef GPUDEFOPENCL12TEMPLATES_H -#define GPUDEFOPENCL12TEMPLATES_H - -// Special macros for OpenCL rev. 1.2 (encode address space in template parameter) -enum LocalOrGlobal { Mem_Local, Mem_Global, Mem_Constant, Mem_Plain }; -#if defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_USE_TEMPLATE_ADDRESS_SPACES) - template struct MakeTypeHelper; - template struct MakeTypeHelper { typedef L type; }; - template struct MakeTypeHelper { typedef G type; }; - template struct MakeTypeHelper { typedef C type; }; - template struct MakeTypeHelper { typedef P type; }; - #define MakeType(base_type) typename MakeTypeHelper::type - #define MEM_CLASS_PRE() template - #define MEM_CLASS_PRE_TEMPLATE(t) template - #define MEM_LG(type) type - #define MEM_CLASS_PRE2() template - #define MEM_CLASS_PRE2_TEMPLATE(t) template - #define MEM_LG2(type) type - #define MEM_CLASS_PRE12() template template - #define MEM_CLASS_PRE23() template - #define MEM_LG3(type) type - #define MEM_CLASS_PRE234() template - #define MEM_LG4(type) type - #define MEM_GLOBAL(type) type - #define MEM_LOCAL(type) type - #define MEM_LOCAL_TEMPLATE(type, t) type - #define MEM_CONSTANT(type) type - #define MEM_PLAIN(type) type - #define MEM_TEMPLATE() template - #define MEM_TYPE(type) T - #define MEM_TEMPLATE2() template - #define MEM_TYPE2(type) T2 - #define MEM_TEMPLATE3() template - #define MEM_TYPE3(type) T3 - #define MEM_TEMPLATE4() template - #define MEM_TYPE4(type) T4 -#else - #define MakeType(base_type) base_type - #define MEM_CLASS_PRE() - #define MEM_CLASS_PRE_TEMPLATE(t) template - #define MEM_LG(type) type - #define MEM_CLASS_PRE2() - #define MEM_CLASS_PRE2_TEMPLATE(t) template - #define MEM_LG2(type) type - #define MEM_CLASS_PRE12() - #define MEM_CLASS_PRE23() - #define MEM_LG3(type) type - #define MEM_CLASS_PRE234() - #define MEM_LG4(type) type - #define MEM_GLOBAL(type) type - #define MEM_LOCAL(type) type - #define MEM_LOCAL_TEMPLATE(type, t) type - #define MEM_CONSTANT(type) type - #define MEM_PLAIN(type) type - #define MEM_TEMPLATE() - #define MEM_TYPE(type) type - #define MEM_TEMPLATE2() - #define MEM_TYPE2(type) type - #define MEM_TEMPLATE3() - #define MEM_TYPE3(type) type - #define MEM_TEMPLATE4() - #define MEM_TYPE4(type) type -#endif - -#if defined(GPUCA_NO_CONSTANT_MEMORY) - #undef MEM_CONSTANT - #define MEM_CONSTANT(type) MEM_GLOBAL(type) -#endif - -#endif // GPUDEFOPENCL12TEMPLATES_H -// clang-format on diff --git a/GPU/GPUTracking/Refit/GPUTrackingRefit.cxx b/GPU/GPUTracking/Refit/GPUTrackingRefit.cxx index 8220b743dde0e..8cca91c0a0033 100644 --- a/GPU/GPUTracking/Refit/GPUTrackingRefit.cxx +++ b/GPU/GPUTracking/Refit/GPUTrackingRefit.cxx @@ -431,7 +431,7 @@ template GPUdni() int32_t GPUTrackingRefit::RefitTrackioPtrs.mergedTrackHitStates; mPclusterNative = v->ioPtrs.clustersNative; diff --git a/GPU/GPUTracking/Refit/GPUTrackingRefit.h b/GPU/GPUTracking/Refit/GPUTrackingRefit.h index 2cc414bbc2d81..bb45709d08165 100644 --- a/GPU/GPUTracking/Refit/GPUTrackingRefit.h +++ b/GPU/GPUTracking/Refit/GPUTrackingRefit.h @@ -48,9 +48,7 @@ namespace o2::gpu class CorrectionMapsHelper; class GPUTPCGMTrackParam; class GPUTPCGMMergedTrack; -MEM_CLASS_PRE() struct GPUConstantMem; -MEM_CLASS_PRE() struct GPUParam; struct GPUTPCGMMergedTrackHit; @@ -58,13 +56,13 @@ class GPUTrackingRefit { public: void SetClusterStateArray(const uint8_t* v) { mPclusterState = v; } - void SetPtrsFromGPUConstantMem(const GPUConstantMem* v, MEM_CONSTANT(GPUParam) * p = nullptr); + void SetPtrsFromGPUConstantMem(const GPUConstantMem* v, GPUParam* p = nullptr); void SetPropagator(const o2::base::Propagator* v) { mPpropagator = v; } void SetClusterNative(const o2::tpc::ClusterNativeAccess* v) { mPclusterNative = v; } void SetTrackHits(const GPUTPCGMMergedTrackHit* v) { mPtrackHits = v; } void SetTrackHitReferences(const uint32_t* v) { mPtrackHitReferences = v; } void SetFastTransformHelper(const CorrectionMapsHelper* v) { mPfastTransformHelper = v; } - void SetGPUParam(const MEM_CONSTANT(GPUParam) * v) { mPparam = v; } + void SetGPUParam(const GPUParam* v) { mPparam = v; } GPUd() int32_t RefitTrackAsGPU(GPUTPCGMMergedTrack& trk, bool outward = false, bool resetCov = false) { return RefitTrack(trk, outward, resetCov); } GPUd() int32_t RefitTrackAsTrackParCov(GPUTPCGMMergedTrack& trk, bool outward = false, bool resetCov = false) { return RefitTrack(trk, outward, resetCov); } GPUd() int32_t RefitTrackAsGPU(o2::tpc::TrackTPC& trk, bool outward = false, bool resetCov = false) { return RefitTrack(trk, outward, resetCov); } @@ -97,7 +95,7 @@ class GPUTrackingRefit const GPUTPCGMMergedTrackHit* mPtrackHits = nullptr; // Ptr to hits for GPUTPCGMMergedTrack tracks const uint32_t* mPtrackHitReferences = nullptr; // Ptr to hits for TrackTPC tracks const CorrectionMapsHelper* mPfastTransformHelper = nullptr; // Ptr to TPC fast transform object helper - const MEM_CONSTANT(GPUParam) * mPparam = nullptr; // Ptr to GPUParam + const GPUParam* mPparam = nullptr; // Ptr to GPUParam template GPUd() int32_t RefitTrack(T& trk, bool outward, bool resetCov); template diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCBaseTrackParam.h b/GPU/GPUTracking/SliceTracker/GPUTPCBaseTrackParam.h index 28fa54544e292..c2fc7e58061da 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCBaseTrackParam.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCBaseTrackParam.h @@ -21,7 +21,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTrackParam; /** @@ -31,7 +30,6 @@ class GPUTPCTrackParam; * used in output of the GPUTPCTracker slice tracker. * This class is used for transfer between tracker and merger and does not contain the covariance matrice */ -MEM_CLASS_PRE() struct GPUTPCBaseTrackParam { GPUd() float X() const { return mX; } GPUd() float Y() const { return mP[0]; } @@ -60,8 +58,8 @@ struct GPUTPCBaseTrackParam { GPUd() float GetKappa(float Bz) const { return -mP[4] * Bz; } - GPUhd() MakeType(const float*) Par() const { return mP; } - GPUd() const MakeType(float*) GetPar() const { return mP; } + GPUhd() const float* Par() const { return mP; } + GPUd() const float* GetPar() const { return mP; } GPUd() float GetPar(int32_t i) const { return (mP[i]); } GPUhd() void SetPar(int32_t i, float v) { mP[i] = v; } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.cxx index 3ddedd702f784..5c3e473aab0c9 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.cxx @@ -19,7 +19,7 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUTPCCreateSliceData::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCCreateSliceData::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { tracker.Data().InitFromClusterData(nBlocks, nThreads, iBlock, iThread, tracker.GetConstantMem(), tracker.ISlice(), s.tmp); } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.h b/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.h index 9a64d04e7ca6d..916891c2035ef 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCCreateSliceData.h @@ -33,15 +33,14 @@ class GPUTPCCreateSliceData : public GPUKernelTemplate float tmp[4]; }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx index 5cf14ca6ab5a4..c86249fbb6f77 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.cxx @@ -22,7 +22,7 @@ using namespace GPUCA_NAMESPACE::gpu; -GPUd() int32_t GPUTPCGlobalTracking::PerformGlobalTrackingRun(GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, const GPUTPCTracker& GPUrestrict() sliceSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction) +GPUd() int32_t GPUTPCGlobalTracking::PerformGlobalTrackingRun(GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, const GPUTPCTracker& GPUrestrict() sliceSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction) { /*for (int32_t j = 0;j < Tracks()[j].NHits();j++) { @@ -118,7 +118,7 @@ GPUd() int32_t GPUTPCGlobalTracking::PerformGlobalTrackingRun(GPUTPCTracker& tra return (nHits >= tracker.Param().rec.tpc.globalTrackingMinHits); } -GPUd() void GPUTPCGlobalTracking::PerformGlobalTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, GPUTPCTracker& GPUrestrict() sliceTarget, bool right) +GPUd() void GPUTPCGlobalTracking::PerformGlobalTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, GPUTPCTracker& GPUrestrict() sliceTarget, bool right) { for (int32_t i = iBlock * nThreads + iThread; i < tracker.CommonMemory()->nLocalTracks; i += nThreads * nBlocks) { { @@ -158,9 +158,9 @@ GPUd() void GPUTPCGlobalTracking::PerformGlobalTracking(int32_t nBlocks, int32_t } template <> -GPUdii() void GPUTPCGlobalTracking::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCGlobalTracking::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() tracker) { - CA_SHARED_CACHE(&smem.mRows[0], tracker.SliceDataRows(), GPUCA_ROW_COUNT * sizeof(MEM_PLAIN(GPUTPCRow))); + CA_SHARED_CACHE(&smem.mRows[0], tracker.SliceDataRows(), GPUCA_ROW_COUNT * sizeof(GPUTPCRow)); GPUbarrier(); if (tracker.NHitsTotal() == 0) { @@ -200,10 +200,10 @@ GPUd() void GPUTPCGlobalTracking::GlobalTrackingSliceLeftRight(uint32_t iSlice, } template <> -GPUdii() void GPUTPCGlobalTrackingCopyNumbers::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& GPUrestrict() tracker, int32_t n) +GPUdii() void GPUTPCGlobalTrackingCopyNumbers::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() tracker, int32_t n) { for (int32_t i = get_global_id(0); i < n; i += get_global_size(0)) { - GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & GPUrestrict() trk = (&tracker)[i]; + GPUconstantref() GPUTPCTracker& GPUrestrict() trk = (&tracker)[i]; trk.CommonMemory()->nLocalTracks = trk.CommonMemory()->nTracks; trk.CommonMemory()->nLocalTrackHits = trk.CommonMemory()->nTrackHits; } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h index c45391cd46a4c..367b4314814fe 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCGlobalTracking.h @@ -22,45 +22,43 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTracker; class GPUTPCGlobalTracking : public GPUKernelTemplate { public: struct GPUSharedMemory { - CA_SHARED_STORAGE(MEM_LG(GPUTPCRow) mRows[GPUCA_ROW_COUNT]); + CA_SHARED_STORAGE(GPUTPCRow mRows[GPUCA_ROW_COUNT]); }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); GPUd() static int32_t GlobalTrackingSliceOrder(int32_t iSlice); GPUd() static void GlobalTrackingSliceLeftRight(uint32_t iSlice, uint32_t& left, uint32_t& right); private: - GPUd() static int32_t PerformGlobalTrackingRun(GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, const GPUTPCTracker& sliceSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction); - GPUd() static void PerformGlobalTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, GPUTPCTracker& sliceTarget, bool right); + GPUd() static int32_t PerformGlobalTrackingRun(GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, const GPUTPCTracker& sliceSource, int32_t iTrack, int32_t rowIndex, float angle, int32_t direction); + GPUd() static void PerformGlobalTracking(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, const GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& smem, GPUTPCTracker& sliceTarget, bool right); }; class GPUTPCGlobalTrackingCopyNumbers : public GPUKernelTemplate { public: - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker, int32_t n); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker, int32_t n); }; } // namespace gpu diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGrid.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCGrid.cxx index 00fceaf8a5874..56d2e88db1c28 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGrid.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCGrid.cxx @@ -20,8 +20,7 @@ using namespace GPUCA_NAMESPACE::gpu; #include #endif -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCGrid)::CreateEmpty() +GPUd() void GPUTPCGrid::CreateEmpty() { // Create an empty grid mYMin = 0.f; @@ -37,8 +36,7 @@ GPUd() void MEM_LG(GPUTPCGrid)::CreateEmpty() mStepZInv = 1.f; } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCGrid)::Create(float yMin, float yMax, float zMin, float zMax, int32_t ny, int32_t nz) +GPUd() void GPUTPCGrid::Create(float yMin, float yMax, float zMin, float zMax, int32_t ny, int32_t nz) { //* Create the grid mYMin = yMin; @@ -59,8 +57,7 @@ GPUd() void MEM_LG(GPUTPCGrid)::Create(float yMin, float yMax, float zMin, float mZMax = mZMin + mNz * sz; } -MEM_CLASS_PRE() -GPUd() int32_t MEM_LG(GPUTPCGrid)::GetBin(float Y, float Z) const +GPUd() int32_t GPUTPCGrid::GetBin(float Y, float Z) const { //* get the bin pointer const int32_t yBin = static_cast((Y - mYMin) * mStepYInv); @@ -73,8 +70,7 @@ GPUd() int32_t MEM_LG(GPUTPCGrid)::GetBin(float Y, float Z) const return bin; } -MEM_CLASS_PRE() -GPUd() int32_t MEM_LG(GPUTPCGrid)::GetBinBounded(float Y, float Z) const +GPUd() int32_t GPUTPCGrid::GetBinBounded(float Y, float Z) const { //* get the bin pointer const int32_t yBin = static_cast((Y - mYMin) * mStepYInv); @@ -89,8 +85,7 @@ GPUd() int32_t MEM_LG(GPUTPCGrid)::GetBinBounded(float Y, float Z) const return bin; } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCGrid)::GetBin(float Y, float Z, int32_t* const bY, int32_t* const bZ) const +GPUd() void GPUTPCGrid::GetBin(float Y, float Z, int32_t* const bY, int32_t* const bZ) const { //* get the bin pointer @@ -114,8 +109,7 @@ GPUd() void MEM_LG(GPUTPCGrid)::GetBin(float Y, float Z, int32_t* const bY, int3 *bZ = (uint32_t)bbZ; } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCGrid)::GetBinArea(float Y, float Z, float dy, float dz, int32_t& bin, int32_t& ny, int32_t& nz) const +GPUd() void GPUTPCGrid::GetBinArea(float Y, float Z, float dy, float dz, int32_t& bin, int32_t& ny, int32_t& nz) const { Y -= mYMin; int32_t by = (int32_t)((Y - dy) * mStepYInv); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGrid.h b/GPU/GPUTracking/SliceTracker/GPUTPCGrid.h index a069282e2a0a9..a3cd7916f0e6d 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGrid.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCGrid.h @@ -29,7 +29,6 @@ namespace gpu * used by GPUTPCTracker to speed-up the hit operations * grid axis are named Z,Y to be similar to TPC row coordinates. */ -MEM_CLASS_PRE() class GPUTPCGrid { public: diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.cxx index 7842a57f47794..9293801f5f5f9 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.cxx @@ -18,7 +18,7 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUTPCNeighboursCleaner::Thread<0>(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCNeighboursCleaner::Thread<0>(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { // * // * kill link to the neighbour if the neighbour is not pointed to the cluster @@ -38,9 +38,9 @@ GPUdii() void GPUTPCNeighboursCleaner::Thread<0>(int32_t /*nBlocks*/, int32_t nT #ifdef GPUCA_GPUCODE int32_t Up = s.mIRowUp; int32_t Dn = s.mIRowDn; - GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row = tracker.Row(s.mIRow); - GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & GPUrestrict() rowUp = tracker.Row(Up); - GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & GPUrestrict() rowDn = tracker.Row(Dn); + GPUglobalref() const GPUTPCRow& GPUrestrict() row = tracker.Row(s.mIRow); + GPUglobalref() const GPUTPCRow& GPUrestrict() rowUp = tracker.Row(Up); + GPUglobalref() const GPUTPCRow& GPUrestrict() rowDn = tracker.Row(Dn); #else const GPUTPCRow& GPUrestrict() row = tracker.Row(s.mIRow); const GPUTPCRow& GPUrestrict() rowUp = tracker.Row(s.mIRowUp); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.h b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.h index 26e85907bc6ab..23c1e21e87ab0 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursCleaner.h @@ -23,7 +23,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTracker; /** @@ -33,7 +32,6 @@ class GPUTPCTracker; class GPUTPCNeighboursCleaner : public GPUKernelTemplate { public: - MEM_CLASS_PRE() struct GPUSharedMemory { int32_t mIRow; // current row index int32_t mIRowUp; // current row index @@ -41,15 +39,14 @@ class GPUTPCNeighboursCleaner : public GPUKernelTemplate int32_t mNHits; // number of hits }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.cxx index b7cfccfa15408..69d05fc3176b4 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.cxx @@ -20,12 +20,12 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUTPCNeighboursFinder::Thread<0>(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCNeighboursFinder::Thread<0>(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { //* find neighbours #ifdef GPUCA_GPUCODE - for (uint32_t i = iThread; i < sizeof(MEM_PLAIN(GPUTPCRow)) / sizeof(int32_t); i += nThreads) { + for (uint32_t i = iThread; i < sizeof(GPUTPCRow) / sizeof(int32_t); i += nThreads) { reinterpret_cast(&s.mRow)[i] = reinterpret_cast(&tracker.SliceDataRows()[iBlock])[i]; if (iBlock >= 2 && iBlock < GPUCA_ROW_COUNT - 2) { reinterpret_cast(&s.mRowUp)[i] = reinterpret_cast(&tracker.SliceDataRows()[iBlock + 2])[i]; @@ -33,13 +33,13 @@ GPUdii() void GPUTPCNeighboursFinder::Thread<0>(int32_t /*nBlocks*/, int32_t nTh } } GPUbarrier(); - const GPUsharedref() MEM_LOCAL(GPUTPCRow) & GPUrestrict() row = s.mRow; - const GPUsharedref() MEM_LOCAL(GPUTPCRow) & GPUrestrict() rowUp = s.mRowUp; - const GPUsharedref() MEM_LOCAL(GPUTPCRow) & GPUrestrict() rowDn = s.mRowDown; + const GPUsharedref() GPUTPCRow& GPUrestrict() row = s.mRow; + const GPUsharedref() GPUTPCRow& GPUrestrict() rowUp = s.mRowUp; + const GPUsharedref() GPUTPCRow& GPUrestrict() rowDn = s.mRowDown; #else - const GPUglobalref() MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row = tracker.mData.mRows[iBlock]; - const GPUglobalref() MEM_GLOBAL(GPUTPCRow) & GPUrestrict() rowUp = tracker.mData.mRows[iBlock + 2]; - const GPUglobalref() MEM_GLOBAL(GPUTPCRow) & GPUrestrict() rowDn = tracker.mData.mRows[iBlock - 2]; + const GPUglobalref() GPUTPCRow& GPUrestrict() row = tracker.mData.mRows[iBlock]; + const GPUglobalref() GPUTPCRow& GPUrestrict() rowUp = tracker.mData.mRows[iBlock + 2]; + const GPUglobalref() GPUTPCRow& GPUrestrict() rowDn = tracker.mData.mRows[iBlock - 2]; #endif if (iThread == 0) { diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.h b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.h index 7174286fde948..a121a0f14eb67 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCNeighboursFinder.h @@ -24,7 +24,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTracker; /** @@ -34,7 +33,6 @@ class GPUTPCTracker; class GPUTPCNeighboursFinder : public GPUKernelTemplate { public: - MEM_CLASS_PRE() struct GPUSharedMemory { int32_t mNHits; // n hits float mUpDx; // x distance to the next row @@ -49,19 +47,17 @@ class GPUTPCNeighboursFinder : public GPUKernelTemplate float mA2[GPUCA_NEIGHBOURS_FINDER_MAX_NNEIGHUP][GPUCA_GET_THREAD_COUNT(GPUCA_LB_GPUTPCNeighboursFinder)]; calink mB[GPUCA_NEIGHBOURS_FINDER_MAX_NNEIGHUP][GPUCA_GET_THREAD_COUNT(GPUCA_LB_GPUTPCNeighboursFinder)]; #endif - MEM_LG(GPUTPCRow) - mRow, mRowUp, mRowDown; + GPUTPCRow mRow, mRowUp, mRowDown; }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCRow.h b/GPU/GPUTracking/SliceTracker/GPUTPCRow.h index ed25e18e90c46..7c8e96c8352a8 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCRow.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCRow.h @@ -29,10 +29,8 @@ namespace gpu * It is the internal class of the GPUTPCTracker algorithm. * */ -MEM_CLASS_PRE() class GPUTPCRow { - MEM_CLASS_PRE2() friend class GPUTPCSliceData; public: @@ -46,7 +44,7 @@ class GPUTPCRow } GPUhd() float X() const { return mX; } GPUhd() float MaxY() const { return mMaxY; } - GPUhd() MakeType(const MEM_LG(GPUTPCGrid) &) Grid() const { return mGrid; } + GPUhd() const GPUTPCGrid& Grid() const { return mGrid; } GPUhd() float Hy0() const { return mHy0; } GPUhd() float Hz0() const { return mHz0; } @@ -66,8 +64,7 @@ class GPUTPCRow int32_t mNHits; // number of hits float mX; // X coordinate of the row float mMaxY; // maximal Y coordinate of the row - MEM_LG(GPUTPCGrid) - mGrid; // grid of hits + GPUTPCGrid mGrid; // grid of hits // hit packing: float mHy0; // offset diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx index 99088a1e99c53..ba5da49ff6ff9 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSectorDebugSortKernels.cxx @@ -28,8 +28,8 @@ template <> GPUdii() void GPUTPCSectorDebugSortKernels::Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& GPUrestrict() tracker) { const uint32_t iRow = iBlock; - const MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row = tracker.Data().Row(iRow); - const MEM_GLOBAL(GPUTPCGrid) & GPUrestrict() grid = row.Grid(); + const GPUTPCRow& GPUrestrict() row = tracker.Data().Row(iRow); + const GPUTPCGrid& GPUrestrict() grid = row.Grid(); for (uint32_t i = iThread; i < grid.N(); i += nThreads) { uint32_t jMin = tracker.Data().FirstHitInBin(row, i); uint32_t jMax = tracker.Data().FirstHitInBin(row, i + 1); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.cxx index 6c456a28918ab..5177c48b6a834 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.cxx @@ -32,7 +32,7 @@ using namespace GPUCA_NAMESPACE::gpu; #ifndef GPUCA_GPUCODE -void GPUTPCSliceData::InitializeRows(const MEM_CONSTANT(GPUParam) & p) +void GPUTPCSliceData::InitializeRows(const GPUParam& p) { // initialisation of rows for (int32_t i = 0; i < GPUCA_ROW_COUNT + 1; ++i) { @@ -109,7 +109,7 @@ void* GPUTPCSliceData::SetPointersRows(void* mem) #endif -GPUd() void GPUTPCSliceData::GetMaxNBins(GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * mem, GPUTPCRow* GPUrestrict() row, int32_t& maxY, int32_t& maxZ) +GPUd() void GPUTPCSliceData::GetMaxNBins(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, int32_t& maxY, int32_t& maxZ) { maxY = row->mMaxY * 2.f / GPUCA_MIN_BIN_SIZE + 1; maxZ = (mem->param.continuousMaxTimeBin > 0 ? (mem->calibObjects.fastTransformHelper->getCorrMap()->convTimeToZinTimeFrame(0, 0, mem->param.continuousMaxTimeBin)) : mem->param.tpcGeometry.TPCLength()) + 50; @@ -121,7 +121,7 @@ GPUd() uint32_t GPUTPCSliceData::GetGridSize(uint32_t nHits, uint32_t nRows) return 128 * nRows + 4 * nHits; } -GPUdi() void GPUTPCSliceData::CreateGrid(GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * mem, GPUTPCRow* GPUrestrict() row, float yMin, float yMax, float zMin, float zMax) +GPUdi() void GPUTPCSliceData::CreateGrid(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, float yMin, float yMax, float zMin, float zMax) { float dz = zMax - zMin; float tfFactor = 1.f; @@ -172,7 +172,7 @@ GPUdii() void GPUTPCSliceData::SetRowGridEmpty(GPUTPCRow& GPUrestrict() row) } } -GPUdii() int32_t GPUTPCSliceData::InitFromClusterData(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * GPUrestrict() mem, int32_t iSlice, float* tmpMinMax) +GPUdii() int32_t GPUTPCSliceData::InitFromClusterData(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUconstantref() const GPUConstantMem* GPUrestrict() mem, int32_t iSlice, float* tmpMinMax) { #ifdef GPUCA_GPUCODE constexpr bool EarlyTransformWithoutClusterNative = false; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h b/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h index a75cba8dd861b..9ab74d969d965 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h @@ -28,7 +28,6 @@ namespace gpu struct GPUTPCClusterData; class GPUTPCHit; -MEM_CLASS_PRE() class GPUTPCSliceData { public: @@ -36,7 +35,7 @@ class GPUTPCSliceData #ifndef GPUCA_GPUCODE_DEVICE ~GPUTPCSliceData() CON_DEFAULT; - void InitializeRows(const MEM_CONSTANT(GPUParam) & p); + void InitializeRows(const GPUParam& p); void SetMaxData(); void SetClusterData(const GPUTPCClusterData* data, int32_t nClusters, int32_t clusterIdOffset); void* SetPointersInput(void* mem, bool idsOnGPU, bool sliceDataOnGPU); @@ -47,7 +46,7 @@ class GPUTPCSliceData void* SetPointersRows(void* mem); #endif - GPUd() int32_t InitFromClusterData(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * mem, int32_t iSlice, float* tmpMinMax); + GPUd() int32_t InitFromClusterData(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUconstantref() const GPUConstantMem* mem, int32_t iSlice, float* tmpMinMax); /** * Return the number of hits in this slice. @@ -61,39 +60,26 @@ class GPUTPCSliceData * * The links values give the hit index in the row above/below. Or -1 if there is no link. */ - MEM_TEMPLATE() - GPUd() calink HitLinkUpData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex) const; - MEM_TEMPLATE() - GPUd() calink HitLinkDownData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex) const; - - MEM_TEMPLATE() - GPUhdi() GPUglobalref() const cahit2* HitData(const MEM_TYPE(GPUTPCRow) & row) const { return &mHitData[row.mHitNumberOffset]; } - MEM_TEMPLATE() - GPUhdi() GPUglobalref() cahit2* HitData(const MEM_TYPE(GPUTPCRow) & row) { return &mHitData[row.mHitNumberOffset]; } + GPUd() calink HitLinkUpData(const GPUTPCRow& row, const calink& hitIndex) const; + GPUd() calink HitLinkDownData(const GPUTPCRow& row, const calink& hitIndex) const; + + GPUhdi() GPUglobalref() const cahit2* HitData(const GPUTPCRow& row) const { return &mHitData[row.mHitNumberOffset]; } + GPUhdi() GPUglobalref() cahit2* HitData(const GPUTPCRow& row) { return &mHitData[row.mHitNumberOffset]; } GPUhd() GPUglobalref() const cahit2* HitData() const { return (mHitData); } - MEM_TEMPLATE() - GPUdi() GPUglobalref() const calink* HitLinkUpData(const MEM_TYPE(GPUTPCRow) & row) const { return &mLinkUpData[row.mHitNumberOffset]; } - MEM_TEMPLATE() - GPUdi() GPUglobalref() calink* HitLinkUpData(const MEM_TYPE(GPUTPCRow) & row) { return &mLinkUpData[row.mHitNumberOffset]; } - MEM_TEMPLATE() - GPUdi() GPUglobalref() const calink* HitLinkDownData(const MEM_TYPE(GPUTPCRow) & row) const { return &mLinkDownData[row.mHitNumberOffset]; } - MEM_TEMPLATE() - GPUdi() GPUglobalref() const calink* FirstHitInBin(const MEM_TYPE(GPUTPCRow) & row) const { return &mFirstHitInBin[row.mFirstHitInBinOffset]; } - - MEM_TEMPLATE() - GPUd() void SetHitLinkUpData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex, const calink& value); - MEM_TEMPLATE() - GPUd() void SetHitLinkDownData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex, const calink& value); + GPUdi() GPUglobalref() const calink* HitLinkUpData(const GPUTPCRow& row) const { return &mLinkUpData[row.mHitNumberOffset]; } + GPUdi() GPUglobalref() calink* HitLinkUpData(const GPUTPCRow& row) { return &mLinkUpData[row.mHitNumberOffset]; } + GPUdi() GPUglobalref() const calink* HitLinkDownData(const GPUTPCRow& row) const { return &mLinkDownData[row.mHitNumberOffset]; } + GPUdi() GPUglobalref() const calink* FirstHitInBin(const GPUTPCRow& row) const { return &mFirstHitInBin[row.mFirstHitInBinOffset]; } + + GPUd() void SetHitLinkUpData(const GPUTPCRow& row, const calink& hitIndex, const calink& value); + GPUd() void SetHitLinkDownData(const GPUTPCRow& row, const calink& hitIndex, const calink& value); /** * Return the y and z coordinate(s) of the given hit(s). */ - MEM_TEMPLATE() - GPUd() cahit HitDataY(const MEM_TYPE(GPUTPCRow) & row, const uint32_t& hitIndex) const; - MEM_TEMPLATE() - GPUd() cahit HitDataZ(const MEM_TYPE(GPUTPCRow) & row, const uint32_t& hitIndex) const; - MEM_TEMPLATE() - GPUd() cahit2 HitData(const MEM_TYPE(GPUTPCRow) & row, const uint32_t& hitIndex) const; + GPUd() cahit HitDataY(const GPUTPCRow& row, const uint32_t& hitIndex) const; + GPUd() cahit HitDataZ(const GPUTPCRow& row, const uint32_t& hitIndex) const; + GPUd() cahit2 HitData(const GPUTPCRow& row, const uint32_t& hitIndex) const; /** * For a given bin index, content tells how many hits there are in the preceding bins. This maps @@ -101,36 +87,31 @@ class GPUTPCSliceData * * \param binIndexes in the range 0 to row.Grid.N + row.Grid.Ny + 3. */ - MEM_TEMPLATE() - GPUd() calink FirstHitInBin(const MEM_TYPE(GPUTPCRow) & row, calink binIndex) const; + GPUd() calink FirstHitInBin(const GPUTPCRow& row, calink binIndex) const; /** * If the given weight is higher than what is currently stored replace with the new weight. */ - MEM_TEMPLATE() - GPUd() void MaximizeHitWeight(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex, uint32_t weight); - MEM_TEMPLATE() - GPUd() void SetHitWeight(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex, uint32_t weight); + GPUd() void MaximizeHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight); + GPUd() void SetHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight); /** * Return the maximal weight the given hit got from one tracklet */ - MEM_TEMPLATE() - GPUd() int32_t HitWeight(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex) const; + GPUd() int32_t HitWeight(const GPUTPCRow& row, uint32_t hitIndex) const; /** * Returns the index in the original GPUTPCClusterData object of the given hit */ - MEM_TEMPLATE() - GPUhd() int32_t ClusterDataIndex(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex) const; + GPUhd() int32_t ClusterDataIndex(const GPUTPCRow& row, uint32_t hitIndex) const; GPUd() GPUglobalref() const int32_t* ClusterDataIndex() const { return mClusterDataIndex; } GPUd() GPUglobalref() int32_t* ClusterDataIndex() { return mClusterDataIndex; } /** * Return the row object for the given row index. */ - GPUhdi() GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & Row(int32_t rowIndex) const { return mRows[rowIndex]; } - GPUhdi() GPUglobalref() MEM_GLOBAL(GPUTPCRow) * Rows() const { return mRows; } + GPUhdi() GPUglobalref() const GPUTPCRow& Row(int32_t rowIndex) const { return mRows[rowIndex]; } + GPUhdi() GPUglobalref() GPUTPCRow* Rows() const { return mRows; } GPUhdi() GPUglobalref() GPUAtomic(uint32_t) * HitWeights() { return (mHitWeights); } @@ -145,9 +126,9 @@ class GPUTPCSliceData GPUTPCSliceData& operator=(const GPUTPCSliceData&) CON_DELETE; // ROOT 5 tries to use this if it is not private GPUTPCSliceData(const GPUTPCSliceData&) CON_DELETE; // #endif - GPUd() void CreateGrid(GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * mem, MEM_GLOBAL(GPUTPCRow) * GPUrestrict() row, float yMin, float yMax, float zMin, float zMax); - GPUd() void SetRowGridEmpty(MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row); - GPUd() static void GetMaxNBins(GPUconstantref() const MEM_CONSTANT(GPUConstantMem) * mem, MEM_GLOBAL(GPUTPCRow) * GPUrestrict() row, int32_t& maxY, int32_t& maxZ); + GPUd() void CreateGrid(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, float yMin, float yMax, float zMin, float zMax); + GPUd() void SetRowGridEmpty(GPUTPCRow& GPUrestrict() row); + GPUd() static void GetMaxNBins(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, int32_t& maxY, int32_t& maxZ); GPUd() uint32_t GetGridSize(uint32_t nHits, uint32_t nRows); friend class GPUTPCNeighboursFinder; @@ -159,7 +140,7 @@ class GPUTPCSliceData GPUglobalref() const void* mGPUTextureBase; // pointer to start of GPU texture - GPUglobalref() MEM_GLOBAL(GPUTPCRow) * mRows; // The row objects needed for most accessor functions + GPUglobalref() GPUTPCRow* mRows; // The row objects needed for most accessor functions GPUglobalref() calink* mLinkUpData; // hit index in the row above which is linked to the given (global) hit index GPUglobalref() calink* mLinkDownData; // hit index in the row below which is linked to the given (global) hit index @@ -175,65 +156,41 @@ class GPUTPCSliceData GPUglobalref() const GPUTPCClusterData* mClusterData; }; -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() calink MEM_LG(GPUTPCSliceData)::HitLinkUpData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex) const { return mLinkUpData[row.mHitNumberOffset + hitIndex]; } +GPUdi() calink GPUTPCSliceData::HitLinkUpData(const GPUTPCRow& row, const calink& hitIndex) const { return mLinkUpData[row.mHitNumberOffset + hitIndex]; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() calink MEM_LG(GPUTPCSliceData)::HitLinkDownData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex) const { return mLinkDownData[row.mHitNumberOffset + hitIndex]; } +GPUdi() calink GPUTPCSliceData::HitLinkDownData(const GPUTPCRow& row, const calink& hitIndex) const { return mLinkDownData[row.mHitNumberOffset + hitIndex]; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() void MEM_LG(GPUTPCSliceData)::SetHitLinkUpData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex, const calink& value) +GPUdi() void GPUTPCSliceData::SetHitLinkUpData(const GPUTPCRow& row, const calink& hitIndex, const calink& value) { mLinkUpData[row.mHitNumberOffset + hitIndex] = value; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() void MEM_LG(GPUTPCSliceData)::SetHitLinkDownData(const MEM_TYPE(GPUTPCRow) & row, const calink& hitIndex, const calink& value) +GPUdi() void GPUTPCSliceData::SetHitLinkDownData(const GPUTPCRow& row, const calink& hitIndex, const calink& value) { mLinkDownData[row.mHitNumberOffset + hitIndex] = value; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() cahit MEM_LG(GPUTPCSliceData)::HitDataY(const MEM_TYPE(GPUTPCRow) & row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].x; } +GPUdi() cahit GPUTPCSliceData::HitDataY(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].x; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() cahit MEM_LG(GPUTPCSliceData)::HitDataZ(const MEM_TYPE(GPUTPCRow) & row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].y; } +GPUdi() cahit GPUTPCSliceData::HitDataZ(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex].y; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() cahit2 MEM_LG(GPUTPCSliceData)::HitData(const MEM_TYPE(GPUTPCRow) & row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex]; } +GPUdi() cahit2 GPUTPCSliceData::HitData(const GPUTPCRow& row, const uint32_t& hitIndex) const { return mHitData[row.mHitNumberOffset + hitIndex]; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() calink MEM_LG(GPUTPCSliceData)::FirstHitInBin(const MEM_TYPE(GPUTPCRow) & row, calink binIndex) const { return mFirstHitInBin[row.mFirstHitInBinOffset + binIndex]; } +GPUdi() calink GPUTPCSliceData::FirstHitInBin(const GPUTPCRow& row, calink binIndex) const { return mFirstHitInBin[row.mFirstHitInBinOffset + binIndex]; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUhdi() int32_t MEM_LG(GPUTPCSliceData)::ClusterDataIndex(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex) const { return mClusterDataIndex[row.mHitNumberOffset + hitIndex]; } +GPUhdi() int32_t GPUTPCSliceData::ClusterDataIndex(const GPUTPCRow& row, uint32_t hitIndex) const { return mClusterDataIndex[row.mHitNumberOffset + hitIndex]; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() void MEM_LG(GPUTPCSliceData)::MaximizeHitWeight(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex, uint32_t weight) +GPUdi() void GPUTPCSliceData::MaximizeHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight) { CAMath::AtomicMax(&mHitWeights[row.mHitNumberOffset + hitIndex], weight); } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() void MEM_LG(GPUTPCSliceData)::SetHitWeight(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex, uint32_t weight) +GPUdi() void GPUTPCSliceData::SetHitWeight(const GPUTPCRow& row, uint32_t hitIndex, uint32_t weight) { mHitWeights[row.mHitNumberOffset + hitIndex] = weight; } -MEM_CLASS_PRE() -MEM_TEMPLATE() -GPUdi() int32_t MEM_LG(GPUTPCSliceData)::HitWeight(const MEM_TYPE(GPUTPCRow) & row, uint32_t hitIndex) const { return mHitWeights[row.mHitNumberOffset + hitIndex]; } +GPUdi() int32_t GPUTPCSliceData::HitWeight(const GPUTPCRow& row, uint32_t hitIndex) const { return mHitWeights[row.mHitNumberOffset + hitIndex]; } } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.cxx index e9bbcdf91ca6c..2b097ab8f1835 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.cxx @@ -19,7 +19,7 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUTPCStartHitsFinder::Thread<0>(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCStartHitsFinder::Thread<0>(int32_t /*nBlocks*/, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { // find start hits for tracklets if (iThread == 0) { @@ -32,8 +32,8 @@ GPUdii() void GPUTPCStartHitsFinder::Thread<0>(int32_t /*nBlocks*/, int32_t nThr } } GPUbarrier(); - GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row = tracker.mData.mRows[s.mIRow]; - GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & GPUrestrict() rowUp = tracker.mData.mRows[s.mIRow + 2]; + GPUglobalref() const GPUTPCRow& GPUrestrict() row = tracker.mData.mRows[s.mIRow]; + GPUglobalref() const GPUTPCRow& GPUrestrict() rowUp = tracker.mData.mRows[s.mIRow + 2]; for (int32_t ih = iThread; ih < s.mNHits; ih += nThreads) { int64_t lHitNumberOffset = row.mHitNumberOffset; uint32_t linkUpData = tracker.mData.mLinkUpData[lHitNumberOffset + ih]; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.h b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.h index f0adf3985a613..b2b9bfb355fa1 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsFinder.h @@ -24,7 +24,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTracker; /** @@ -34,22 +33,20 @@ class GPUTPCTracker; class GPUTPCStartHitsFinder : public GPUKernelTemplate { public: - MEM_CLASS_PRE() struct GPUSharedMemory { int32_t mIRow; // row index int32_t mNHits; // n hits in the row GPUAtomic(uint32_t) mNRowStartHits; // start hits found in the row }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.cxx index 4275306999531..84ad70b58b964 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.cxx @@ -21,7 +21,7 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUTPCStartHitsSorter::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCStartHitsSorter::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { // Sorts the Start Hits by Row Index if (iThread == 0) { diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.h b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.h index d5f9cc41e2a1a..838fcf7e7d7e1 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCStartHitsSorter.h @@ -24,7 +24,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTracker; /** @@ -34,22 +33,20 @@ class GPUTPCTracker; class GPUTPCStartHitsSorter : public GPUKernelTemplate { public: - MEM_CLASS_PRE() struct GPUSharedMemory { int32_t mStartRow; // start row index int32_t mNRows; // number of rows to process int32_t mStartOffset; // start offset for hits sorted by this block }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h index 759f4e0f954bd..50c99cd3ad6ec 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h @@ -30,7 +30,6 @@ namespace gpu * The class is dedicated for internal use by the GPUTPCTracker algorithm. * The track parameters at both ends are stored separately in the GPUTPCEndPoint class */ -MEM_CLASS_PRE() class GPUTPCTrack { public: @@ -44,14 +43,13 @@ class GPUTPCTrack GPUhd() int32_t NHits() const { return mNHits; } GPUhd() int32_t LocalTrackId() const { return mLocalTrackId; } GPUhd() int32_t FirstHitID() const { return mFirstHitID; } - GPUhd() MakeType(const MEM_LG(GPUTPCBaseTrackParam) &) Param() const { return mParam; } + GPUhd() const GPUTPCBaseTrackParam& Param() const { return mParam; } GPUhd() void SetNHits(int32_t v) { mNHits = v; } GPUhd() void SetLocalTrackId(int32_t v) { mLocalTrackId = v; } GPUhd() void SetFirstHitID(int32_t v) { mFirstHitID = v; } - MEM_TEMPLATE() - GPUhd() void SetParam(const MEM_TYPE(GPUTPCBaseTrackParam) & v) { mParam = v; } + GPUhd() void SetParam(const GPUTPCBaseTrackParam& v) { mParam = v; } // Only if used as replacement for SliceOutTrack GPUhd() static int32_t GetSize(int32_t nClust) { return sizeof(GPUTPCTrack) + nClust * sizeof(GPUTPCSliceOutCluster); } @@ -65,8 +63,7 @@ class GPUTPCTrack int32_t mFirstHitID; // index of the first track cell in the track->cell pointer array int32_t mNHits; // number of track cells int32_t mLocalTrackId; // Id of local track this global track belongs to, index of this track itself if it is a local track - MEM_LG(GPUTPCBaseTrackParam) - mParam; // track parameters + GPUTPCBaseTrackParam mParam; // track parameters private: }; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackLinearisation.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrackLinearisation.h index d9f332beabd7d..972c62ffe7e20 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackLinearisation.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackLinearisation.h @@ -41,7 +41,7 @@ class GPUTPCTrackLinearisation GPUTPCTrackLinearisation() : mSinPhi(0), mCosPhi(1), mDzDs(0), mQPt(0) {} GPUTPCTrackLinearisation(float SinPhi1, float CosPhi1, float DzDs1, float QPt1) : mSinPhi(SinPhi1), mCosPhi(CosPhi1), mDzDs(DzDs1), mQPt(QPt1) {} - GPUd() MEM_CLASS_PRE2() GPUTPCTrackLinearisation(const MEM_LG2(GPUTPCTrackParam) & t); + GPUd() GPUTPCTrackLinearisation(const GPUTPCTrackParam& t); GPUd() void Set(float SinPhi1, float CosPhi1, float DzDs1, float QPt1); @@ -67,8 +67,7 @@ class GPUTPCTrackLinearisation float mQPt; // QPt }; -MEM_CLASS_PRE2() -GPUdi() GPUTPCTrackLinearisation::GPUTPCTrackLinearisation(const MEM_LG2(GPUTPCTrackParam) & GPUrestrict() t) : mSinPhi(t.SinPhi()), mCosPhi(0), mDzDs(t.DzDs()), mQPt(t.QPt()) +GPUdi() GPUTPCTrackLinearisation::GPUTPCTrackLinearisation(const GPUTPCTrackParam& GPUrestrict() t) : mSinPhi(t.SinPhi()), mCosPhi(0), mDzDs(t.DzDs()), mQPt(t.QPt()) { if (mSinPhi > GPUCA_MAX_SIN_PHI) { mSinPhi = GPUCA_MAX_SIN_PHI; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx index 18245c48ab578..5c1c99c4d75b2 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.cxx @@ -28,8 +28,7 @@ using namespace GPUCA_NAMESPACE::gpu; // Yc = Y + CAMath::Cos(Phi)/Kappa; // -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::GetDist2(const MEM_LG(GPUTPCTrackParam) & GPUrestrict() t) const +GPUd() float GPUTPCTrackParam::GetDist2(const GPUTPCTrackParam& GPUrestrict() t) const { // get squared distance between tracks @@ -39,8 +38,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::GetDist2(const MEM_LG(GPUTPCTrackParam) & return dx * dx + dy * dy + dz * dz; } -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::GetDistXZ2(const MEM_LG(GPUTPCTrackParam) & GPUrestrict() t) const +GPUd() float GPUTPCTrackParam::GetDistXZ2(const GPUTPCTrackParam& GPUrestrict() t) const { // get squared distance between tracks in X&Z @@ -49,8 +47,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::GetDistXZ2(const MEM_LG(GPUTPCTrackParam) return dx * dx + dz * dz; } -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::GetS(float x, float y, float Bz) const +GPUd() float GPUTPCTrackParam::GetS(float x, float y, float Bz) const { //* Get XY path length to the given point @@ -66,8 +63,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::GetS(float x, float y, float Bz) const return dS; } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCTrackParam)::GetDCAPoint(float x, float y, float z, float& GPUrestrict() xp, float& GPUrestrict() yp, float& GPUrestrict() zp, float Bz) const +GPUd() void GPUTPCTrackParam::GetDCAPoint(float x, float y, float z, float& GPUrestrict() xp, float& GPUrestrict() yp, float& GPUrestrict() zp, float Bz) const { //* Get the track point closest to the (x,y,z) @@ -97,8 +93,7 @@ GPUd() void MEM_LG(GPUTPCTrackParam)::GetDCAPoint(float x, float y, float z, flo //* Transport routines //* -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToX(float x, GPUTPCTrackLinearisation& GPUrestrict() t0, float Bz, float maxSinPhi, float* GPUrestrict() DL) +GPUd() bool GPUTPCTrackParam::TransportToX(float x, GPUTPCTrackLinearisation& GPUrestrict() t0, float Bz, float maxSinPhi, float* GPUrestrict() DL) { //* Transport the track parameters to X=x, using linearization at t0, and the field value Bz //* maxSinPhi is the max. allowed value for |t0.SinPhi()| @@ -218,8 +213,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToX(float x, GPUTPCTrackLinearisa return 1; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToX(float x, float sinPhi0, float cosPhi0, float Bz, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::TransportToX(float x, float sinPhi0, float cosPhi0, float Bz, float maxSinPhi) { //* Transport the track parameters to X=x, using linearization at phi0 with 0 curvature, //* and the field value Bz @@ -299,16 +293,14 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToX(float x, float sinPhi0, float return 1; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToX(float x, float Bz, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::TransportToX(float x, float Bz, float maxSinPhi) { //* Transport the track parameters to X=x GPUTPCTrackLinearisation t0(*this); return TransportToX(x, t0, Bz, maxSinPhi); } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToXWithMaterial(float x, GPUTPCTrackLinearisation& GPUrestrict() t0, GPUTPCTrackFitParam& GPUrestrict() par, float Bz, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::TransportToXWithMaterial(float x, GPUTPCTrackLinearisation& GPUrestrict() t0, GPUTPCTrackFitParam& GPUrestrict() par, float Bz, float maxSinPhi) { //* Transport the track parameters to X=x taking into account material budget @@ -326,8 +318,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToXWithMaterial(float x, GPUTPCTr return 1; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToXWithMaterial(float x, GPUTPCTrackFitParam& GPUrestrict() par, float Bz, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::TransportToXWithMaterial(float x, GPUTPCTrackFitParam& GPUrestrict() par, float Bz, float maxSinPhi) { //* Transport the track parameters to X=x taking into account material budget @@ -335,8 +326,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToXWithMaterial(float x, GPUTPCTr return TransportToXWithMaterial(x, t0, par, Bz, maxSinPhi); } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToXWithMaterial(float x, float Bz, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::TransportToXWithMaterial(float x, float Bz, float maxSinPhi) { //* Transport the track parameters to X=x taking into account material budget @@ -348,8 +338,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::TransportToXWithMaterial(float x, float Bz //* //* Multiple scattering and energy losses //* -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::BetheBlochGeant(float bg2, float kp0, float kp1, float kp2, float kp3, float kp4) +GPUd() float GPUTPCTrackParam::BetheBlochGeant(float bg2, float kp0, float kp1, float kp2, float kp3, float kp4) { // // This is the parameterization of the Bethe-Bloch formula inspired by Geant. @@ -388,8 +377,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::BetheBlochGeant(float bg2, float kp0, flo return mK * mZA * (1 + bg2) / bg2 * (0.5f * CAMath::Log(2 * me * bg2 * maxT / (mI * mI)) - bg2 / (1 + bg2) - d2); } -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::BetheBlochSolid(float bg) +GPUd() float GPUTPCTrackParam::BetheBlochSolid(float bg) { //------------------------------------------------------------------ // This is an approximation of the Bethe-Bloch formula, @@ -401,8 +389,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::BetheBlochSolid(float bg) return BetheBlochGeant(bg); } -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::BetheBlochGas(float bg) +GPUd() float GPUTPCTrackParam::BetheBlochGas(float bg) { //------------------------------------------------------------------ // This is an approximation of the Bethe-Bloch formula, @@ -420,8 +407,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::BetheBlochGas(float bg) return BetheBlochGeant(bg, rho, x0, x1, mI, mZA); } -MEM_CLASS_PRE() -GPUd() float MEM_LG(GPUTPCTrackParam)::ApproximateBetheBloch(float beta2) +GPUd() float GPUTPCTrackParam::ApproximateBetheBloch(float beta2) { //------------------------------------------------------------------ // This is an approximation of the Bethe-Bloch formula with @@ -438,8 +424,7 @@ GPUd() float MEM_LG(GPUTPCTrackParam)::ApproximateBetheBloch(float beta2) return 0.153e-3f / beta2 * (CAMath::Log(5940 * beta2 / (1 - beta2)) - beta2); } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCTrackParam)::CalculateFitParameters(GPUTPCTrackFitParam& par, float mass) +GPUd() void GPUTPCTrackParam::CalculateFitParameters(GPUTPCTrackFitParam& par, float mass) { //*! @@ -473,8 +458,7 @@ GPUd() void MEM_LG(GPUTPCTrackParam)::CalculateFitParameters(GPUTPCTrackFitParam par.k44 = GetPar(3) * GetPar(3) * k2; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::CorrectForMeanMaterial(float xOverX0, float xTimesRho, const GPUTPCTrackFitParam& par) +GPUd() bool GPUTPCTrackParam::CorrectForMeanMaterial(float xOverX0, float xTimesRho, const GPUTPCTrackFitParam& par) { //------------------------------------------------------------------ // This function corrects the track parameters for the crossed material. @@ -523,8 +507,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::CorrectForMeanMaterial(float xOverX0, floa //* //* Rotation //* -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::Rotate(float alpha, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::Rotate(float alpha, float maxSinPhi) { //* Rotate the coordinate system in XY on the angle alpha @@ -581,8 +564,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::Rotate(float alpha, float maxSinPhi) return 1; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::Rotate(float alpha, GPUTPCTrackLinearisation& t0, float maxSinPhi) +GPUd() bool GPUTPCTrackParam::Rotate(float alpha, GPUTPCTrackLinearisation& t0, float maxSinPhi) { //* Rotate the coordinate system in XY on the angle alpha @@ -628,8 +610,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::Rotate(float alpha, GPUTPCTrackLinearisati return 1; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::Filter(float y, float z, float err2Y, float err2Z, float maxSinPhi, bool paramOnly) +GPUd() bool GPUTPCTrackParam::Filter(float y, float z, float err2Y, float err2Z, float maxSinPhi, bool paramOnly) { //* Add the y,z measurement with the Kalman filter @@ -690,8 +671,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::Filter(float y, float z, float err2Y, floa return 1; } -MEM_CLASS_PRE() -GPUd() bool MEM_LG(GPUTPCTrackParam)::CheckNumericalQuality() const +GPUd() bool GPUTPCTrackParam::CheckNumericalQuality() const { //* Check that the track parameters and covariance matrix are reasonable @@ -727,8 +707,7 @@ GPUd() bool MEM_LG(GPUTPCTrackParam)::CheckNumericalQuality() const return ok; } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCTrackParam)::ConstrainZ(float& z, int32_t sector, float& z0, float& lastZ) +GPUd() void GPUTPCTrackParam::ConstrainZ(float& z, int32_t sector, float& z0, float& lastZ) { if (sector < GPUCA_NSLICES / 2) { if (z < 0) { @@ -763,8 +742,7 @@ GPUd() void MEM_LG(GPUTPCTrackParam)::ConstrainZ(float& z, int32_t sector, float } } -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCTrackParam)::ShiftZ(float z1, float z2, float x1, float x2, float bz, float defaultZOffsetOverR) +GPUd() void GPUTPCTrackParam::ShiftZ(float z1, float z2, float x1, float x2, float bz, float defaultZOffsetOverR) { const float r1 = CAMath::Max(0.0001f, CAMath::Abs(mParam.mP[4] * bz)); @@ -826,8 +804,7 @@ GPUd() void MEM_LG(GPUTPCTrackParam)::ShiftZ(float z1, float z2, float x1, float #include #endif -MEM_CLASS_PRE() -GPUd() void MEM_LG(GPUTPCTrackParam)::Print() const +GPUd() void GPUTPCTrackParam::Print() const { //* print parameters @@ -837,8 +814,7 @@ GPUd() void MEM_LG(GPUTPCTrackParam)::Print() const #endif } -MEM_CLASS_PRE() -GPUd() int32_t MEM_LG(GPUTPCTrackParam)::GetPropagatedYZ(float bz, float x, float& projY, float& projZ) const +GPUd() int32_t GPUTPCTrackParam::GetPropagatedYZ(float bz, float x, float& projY, float& projZ) const { float k = mParam.mP[4] * bz; float dx = x - mParam.mX; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.h index ffc28af6f4e32..792cba4f519e1 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackParam.h @@ -32,7 +32,6 @@ class GPUTPCTrackLinearisation; * which is used by the GPUTPCTracker slice tracker. * */ -MEM_CLASS_PRE() class GPUTPCTrackParam { public: @@ -40,8 +39,8 @@ class GPUTPCTrackParam float bethe, e, theta2, EP2, sigmadE2, k22, k33, k43, k44; // parameters }; - GPUd() MakeType(const MEM_LG(GPUTPCBaseTrackParam) &) GetParam() const { return mParam; } - GPUd() void SetParam(const MEM_LG(GPUTPCBaseTrackParam) & v) { mParam = v; } + GPUd() const GPUTPCBaseTrackParam& GetParam() const { return mParam; } + GPUd() void SetParam(const GPUTPCBaseTrackParam& v) { mParam = v; } GPUd() void InitParam(); GPUd() float X() const { return mParam.X(); } @@ -74,7 +73,7 @@ class GPUTPCTrackParam GPUd() float GetKappa(float Bz) const { return mParam.GetKappa(Bz); } GPUd() float GetCosPhi() const { return mSignCosPhi * CAMath::Sqrt(1 - SinPhi() * SinPhi()); } - GPUhd() MakeType(const float*) Par() const { return mParam.Par(); } + GPUhd() const float* Par() const { return mParam.Par(); } GPUhd() const float* Cov() const { return mParam.Cov(); } GPUd() const float* GetPar() const { return mParam.GetPar(); } @@ -145,8 +144,7 @@ class GPUTPCTrackParam #ifndef GPUCA_GPUCODE private: #endif //! GPUCA_GPUCODE - MEM_LG(GPUTPCBaseTrackParam) - mParam; // Track Parameters + GPUTPCBaseTrackParam mParam; // Track Parameters private: // WARNING, Track Param Data is copied in the GPU Tracklet Constructor element by element instead of using copy constructor!!! @@ -157,8 +155,7 @@ class GPUTPCTrackParam int32_t mNDF; // the Number of Degrees of Freedom }; -MEM_CLASS_PRE() -GPUdi() void MEM_LG(GPUTPCTrackParam)::InitParam() +GPUdi() void GPUTPCTrackParam::InitParam() { // Initialize Tracklet Parameters using default values SetSinPhi(0); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h index 488807e981b5b..5a320a8863992 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h @@ -33,16 +33,11 @@ namespace gpu { class GPUTPCSliceOutput; struct GPUTPCClusterData; -MEM_CLASS_PRE() struct GPUParam; -MEM_CLASS_PRE() class GPUTPCTrack; -MEM_CLASS_PRE() class GPUTPCTrackParam; -MEM_CLASS_PRE() class GPUTPCRow; -MEM_CLASS_PRE() class GPUTPCTracker : public GPUProcessor { public: @@ -52,12 +47,9 @@ class GPUTPCTracker : public GPUProcessor GPUTPCTracker(const GPUTPCTracker&) CON_DELETE; GPUTPCTracker& operator=(const GPUTPCTracker&) CON_DELETE; - MEM_CLASS_PRE2() void SetSlice(int32_t iSlice); - MEM_CLASS_PRE2() void InitializeProcessor(); - MEM_CLASS_PRE2() - void InitializeRows(const MEM_CONSTANT(GPUParam) * param) { mData.InitializeRows(*param); } + void InitializeRows(const GPUParam* param) { mData.InitializeRows(*param); } int32_t CheckEmptySlice(); void WriteOutputPrepare(); @@ -77,7 +69,6 @@ class GPUTPCTracker : public GPUProcessor GPUAtomic(uint32_t) nextStartHit; // Next Tracklet to process }; - MEM_CLASS_PRE2() struct StructGPUParametersConst { GPUglobalref() char* gpumem; // Base pointer to GPU memory (Needed for OpenCL for verification) }; @@ -98,22 +89,20 @@ class GPUTPCTracker : public GPUProcessor { return mData.ClusterData(); } - GPUhdi() MakeType(const MEM_LG(GPUTPCRow) &) Row(const GPUTPCHitId& HitId) const { return mData.Row(HitId.RowIndex()); } + GPUhdi() const GPUTPCRow& Row(const GPUTPCHitId& HitId) const { return mData.Row(HitId.RowIndex()); } GPUhdi() GPUglobalref() GPUTPCSliceOutput* Output() const { return mOutput; } GPUhdni() GPUglobalref() commonMemoryStruct* CommonMemory() const { return (mCommonMem); } - MEM_CLASS_PRE2() - GPUdi() static void GetErrors2Seeding(const MEM_CONSTANT(GPUParam) & param, char sector, int32_t iRow, const MEM_LG2(GPUTPCTrackParam) & t, float time, float& ErrY2, float& ErrZ2) + GPUdi() static void GetErrors2Seeding(const GPUParam& param, char sector, int32_t iRow, const GPUTPCTrackParam& t, float time, float& ErrY2, float& ErrZ2) { // param.GetClusterErrors2(sector, iRow, param.GetContinuousTracking() != 0. ? 125.f : t.Z(), t.SinPhi(), t.DzDs(), time, 0.f, 0.f, ErrY2, ErrZ2); param.GetClusterErrorsSeeding2(sector, iRow, param.par.continuousTracking != 0.f ? 125.f : t.Z(), t.SinPhi(), t.DzDs(), time, ErrY2, ErrZ2); } - MEM_CLASS_PRE2() - GPUdi() void GetErrors2Seeding(int32_t iRow, const MEM_LG2(GPUTPCTrackParam) & t, float time, float& ErrY2, float& ErrZ2) const + GPUdi() void GetErrors2Seeding(int32_t iRow, const GPUTPCTrackParam& t, float time, float& ErrY2, float& ErrZ2) const { // Param().GetClusterErrors2(mISlice, iRow, Param().GetContinuousTracking() != 0. ? 125.f : t.Z(), t.SinPhi(), t.DzDs(), time, 0.f, 0.f, ErrY2, ErrZ2); Param().GetClusterErrorsSeeding2(mISlice, iRow, Param().par.continuousTracking != 0.f ? 125.f : t.Z(), t.SinPhi(), t.DzDs(), time, ErrY2, ErrZ2); @@ -151,13 +140,13 @@ class GPUTPCTracker : public GPUProcessor GPUhd() int32_t ISlice() const { return mISlice; } - GPUhd() GPUconstantref() const MEM_LG(GPUTPCSliceData) & Data() const { return mData; } - GPUhdi() GPUconstantref() MEM_LG(GPUTPCSliceData) & Data() + GPUhd() GPUconstantref() const GPUTPCSliceData& Data() const { return mData; } + GPUhdi() GPUconstantref() GPUTPCSliceData& Data() { return mData; } - GPUhd() GPUglobalref() const MEM_GLOBAL(GPUTPCRow) & Row(int32_t rowIndex) const { return mData.Row(rowIndex); } + GPUhd() GPUglobalref() const GPUTPCRow& Row(int32_t rowIndex) const { return mData.Row(rowIndex); } GPUhd() uint32_t NHitsTotal() const { return mData.NumberOfHits(); } GPUhd() uint32_t NMaxTracklets() const { return mNMaxTracklets; } @@ -167,36 +156,23 @@ class GPUTPCTracker : public GPUProcessor GPUhd() uint32_t NMaxStartHits() const { return mNMaxStartHits; } GPUhd() uint32_t NMaxRowStartHits() const { return mNMaxRowStartHits; } - MEM_TEMPLATE() - GPUd() void SetHitLinkUpData(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex, calink v) { mData.SetHitLinkUpData(row, hitIndex, v); } - MEM_TEMPLATE() - GPUd() void SetHitLinkDownData(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex, calink v) { mData.SetHitLinkDownData(row, hitIndex, v); } - MEM_TEMPLATE() - GPUd() calink HitLinkUpData(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.HitLinkUpData(row, hitIndex); } - MEM_TEMPLATE() - GPUd() calink HitLinkDownData(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.HitLinkDownData(row, hitIndex); } - - MEM_TEMPLATE() - GPUd() GPUglobalref() const cahit2* HitData(const MEM_TYPE(GPUTPCRow) & row) const { return mData.HitData(row); } - MEM_TEMPLATE() - GPUd() GPUglobalref() const calink* HitLinkUpData(const MEM_TYPE(GPUTPCRow) & row) const { return mData.HitLinkUpData(row); } - MEM_TEMPLATE() - GPUd() GPUglobalref() const calink* HitLinkDownData(const MEM_TYPE(GPUTPCRow) & row) const { return mData.HitLinkDownData(row); } - MEM_TEMPLATE() - GPUd() GPUglobalref() const calink* FirstHitInBin(const MEM_TYPE(GPUTPCRow) & row) const { return mData.FirstHitInBin(row); } - - MEM_TEMPLATE() - GPUd() int32_t FirstHitInBin(const MEM_TYPE(GPUTPCRow) & row, int32_t binIndex) const { return mData.FirstHitInBin(row, binIndex); } - - MEM_TEMPLATE() - GPUd() cahit HitDataY(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.HitDataY(row, hitIndex); } - MEM_TEMPLATE() - GPUd() cahit HitDataZ(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.HitDataZ(row, hitIndex); } - MEM_TEMPLATE() - GPUd() cahit2 HitData(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.HitData(row, hitIndex); } - - MEM_TEMPLATE() - GPUhd() int32_t HitInputID(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.ClusterDataIndex(row, hitIndex); } + GPUd() void SetHitLinkUpData(const GPUTPCRow& row, int32_t hitIndex, calink v) { mData.SetHitLinkUpData(row, hitIndex, v); } + GPUd() void SetHitLinkDownData(const GPUTPCRow& row, int32_t hitIndex, calink v) { mData.SetHitLinkDownData(row, hitIndex, v); } + GPUd() calink HitLinkUpData(const GPUTPCRow& row, int32_t hitIndex) const { return mData.HitLinkUpData(row, hitIndex); } + GPUd() calink HitLinkDownData(const GPUTPCRow& row, int32_t hitIndex) const { return mData.HitLinkDownData(row, hitIndex); } + + GPUd() GPUglobalref() const cahit2* HitData(const GPUTPCRow& row) const { return mData.HitData(row); } + GPUd() GPUglobalref() const calink* HitLinkUpData(const GPUTPCRow& row) const { return mData.HitLinkUpData(row); } + GPUd() GPUglobalref() const calink* HitLinkDownData(const GPUTPCRow& row) const { return mData.HitLinkDownData(row); } + GPUd() GPUglobalref() const calink* FirstHitInBin(const GPUTPCRow& row) const { return mData.FirstHitInBin(row); } + + GPUd() int32_t FirstHitInBin(const GPUTPCRow& row, int32_t binIndex) const { return mData.FirstHitInBin(row, binIndex); } + + GPUd() cahit HitDataY(const GPUTPCRow& row, int32_t hitIndex) const { return mData.HitDataY(row, hitIndex); } + GPUd() cahit HitDataZ(const GPUTPCRow& row, int32_t hitIndex) const { return mData.HitDataZ(row, hitIndex); } + GPUd() cahit2 HitData(const GPUTPCRow& row, int32_t hitIndex) const { return mData.HitData(row, hitIndex); } + + GPUhd() int32_t HitInputID(const GPUTPCRow& row, int32_t hitIndex) const { return mData.ClusterDataIndex(row, hitIndex); } /** * The hit weight is used to determine whether a hit belongs to a certain tracklet or another one @@ -216,12 +192,9 @@ class GPUTPCTracker : public GPUProcessor return ((int32_t)weight); // return( (NHits << 16) + num); } - MEM_TEMPLATE() - GPUd() void MaximizeHitWeight(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex, int32_t weight) { mData.MaximizeHitWeight(row, hitIndex, weight); } - MEM_TEMPLATE() - GPUd() void SetHitWeight(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex, int32_t weight) { mData.SetHitWeight(row, hitIndex, weight); } - MEM_TEMPLATE() - GPUd() int32_t HitWeight(const MEM_TYPE(GPUTPCRow) & row, int32_t hitIndex) const { return mData.HitWeight(row, hitIndex); } + GPUd() void MaximizeHitWeight(const GPUTPCRow& row, int32_t hitIndex, int32_t weight) { mData.MaximizeHitWeight(row, hitIndex, weight); } + GPUd() void SetHitWeight(const GPUTPCRow& row, int32_t hitIndex, int32_t weight) { mData.SetHitWeight(row, hitIndex, weight); } + GPUd() int32_t HitWeight(const GPUTPCRow& row, int32_t hitIndex) const { return mData.HitWeight(row, hitIndex); } GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NTracklets() const { return &mCommonMem->nTracklets; } GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NRowHits() const { return &mCommonMem->nRowHits; } @@ -231,24 +204,23 @@ class GPUTPCTracker : public GPUProcessor GPUhd() GPUglobalref() const GPUTPCHitId* TrackletStartHits() const { return mTrackletStartHits; } GPUhd() GPUglobalref() GPUTPCHitId* TrackletStartHits() { return mTrackletStartHits; } GPUhd() GPUglobalref() GPUTPCHitId* TrackletTmpStartHits() const { return mTrackletTmpStartHits; } - MEM_CLASS_PRE2() - GPUhd() GPUglobalref() const MEM_LG2(GPUTPCTracklet) & Tracklet(int32_t i) const { return mTracklets[i]; } - GPUhd() GPUglobalref() MEM_GLOBAL(GPUTPCTracklet) * Tracklets() const { return mTracklets; } + GPUhd() GPUglobalref() const GPUTPCTracklet& Tracklet(int32_t i) const { return mTracklets[i]; } + GPUhd() GPUglobalref() GPUTPCTracklet* Tracklets() const { return mTracklets; } GPUhd() GPUglobalref() calink* TrackletRowHits() const { return mTrackletRowHits; } GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NTracks() const { return &mCommonMem->nTracks; } - GPUhd() GPUglobalref() MEM_GLOBAL(GPUTPCTrack) * Tracks() const { return mTracks; } + GPUhd() GPUglobalref() GPUTPCTrack* Tracks() const { return mTracks; } GPUhd() GPUglobalref() GPUAtomic(uint32_t) * NTrackHits() const { return &mCommonMem->nTrackHits; } GPUhd() GPUglobalref() GPUTPCHitId* TrackHits() const { return mTrackHits; } - GPUhd() GPUglobalref() MEM_GLOBAL(GPUTPCRow) * SliceDataRows() const { return (mData.Rows()); } + GPUhd() GPUglobalref() GPUTPCRow* SliceDataRows() const { return (mData.Rows()); } GPUhd() GPUglobalref() int32_t* RowStartHitCountOffset() const { return (mRowStartHitCountOffset); } GPUhd() GPUglobalref() StructGPUParameters* GPUParameters() const { return (&mCommonMem->gpuParameters); } - GPUhd() MakeType(MEM_LG(StructGPUParametersConst) *) GPUParametersConst() + GPUhd() StructGPUParametersConst* GPUParametersConst() { return (&mGPUParametersConst); } - GPUhd() MakeType(MEM_LG(const StructGPUParametersConst) *) GetGPUParametersConst() const { return (&mGPUParametersConst); } + GPUhd() const StructGPUParametersConst* GetGPUParametersConst() const { return (&mGPUParametersConst); } GPUhd() void SetGPUTextureBase(GPUglobalref() const void* val) { mData.SetGPUTextureBase(val); } struct trackSortData { @@ -270,10 +242,7 @@ class GPUTPCTracker : public GPUProcessor int32_t mISlice; // Number of slice - /** A pointer to the ClusterData object that the SliceData was created from. This can be used to - * merge clusters from inside the SliceTracker code and recreate the SliceData. */ - MEM_LG(GPUTPCSliceData) - mData; // The SliceData object. It is used to encapsulate the storage in memory from the access + GPUTPCSliceData mData; // The SliceData object. It is used to encapsulate the storage in memory from the access uint32_t mNMaxStartHits; uint32_t mNMaxRowStartHits; @@ -295,15 +264,14 @@ class GPUTPCTracker : public GPUProcessor GPUglobalref() GPUTPCHitId* mTrackletTmpStartHits; // Unsorted start hits GPUglobalref() char* mGPUTrackletTemp; // Temp Memory for GPU Tracklet Constructor - MEM_LG(StructGPUParametersConst) - mGPUParametersConst; // Parameters for GPU if this is a GPU tracker + StructGPUParametersConst mGPUParametersConst; // Parameters for GPU if this is a GPU tracker // event GPUglobalref() commonMemoryStruct* mCommonMem; // common event memory GPUglobalref() GPUTPCHitId* mTrackletStartHits; // start hits for the tracklets - GPUglobalref() MEM_GLOBAL(GPUTPCTracklet) * mTracklets; // tracklets + GPUglobalref() GPUTPCTracklet* mTracklets; // tracklets GPUglobalref() calink* mTrackletRowHits; // Hits for each Tracklet in each row - GPUglobalref() MEM_GLOBAL(GPUTPCTrack) * mTracks; // reconstructed tracks + GPUglobalref() GPUTPCTrack* mTracks; // reconstructed tracks GPUglobalref() GPUTPCHitId* mTrackHits; // array of track hit numbers // output diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTracklet.h b/GPU/GPUTracking/SliceTracker/GPUTPCTracklet.h index 08ec8d8bf54e7..9190cdb94aa5f 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTracklet.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTracklet.h @@ -28,7 +28,6 @@ namespace gpu * The class describes the reconstructed TPC track candidate. * The class is dedicated for internal use by the GPUTPCTracker algorithm. */ -MEM_CLASS_PRE() class GPUTPCTracklet { public: @@ -40,20 +39,18 @@ class GPUTPCTracklet GPUhd() int32_t LastRow() const { return mLastRow; } GPUhd() int32_t HitWeight() const { return mHitWeight; } GPUhd() uint32_t FirstHit() const { return mFirstHit; } - GPUhd() MakeType(const MEM_LG(GPUTPCBaseTrackParam) &) Param() const { return mParam; } + GPUhd() const GPUTPCBaseTrackParam& Param() const { return mParam; } GPUhd() void SetFirstRow(int32_t v) { mFirstRow = v; } GPUhd() void SetLastRow(int32_t v) { mLastRow = v; } GPUhd() void SetFirstHit(uint32_t v) { mFirstHit = v; } - MEM_CLASS_PRE2() - GPUhd() void SetParam(const MEM_LG2(GPUTPCBaseTrackParam) & v) { mParam = reinterpret_cast(v); } + GPUhd() void SetParam(const GPUTPCBaseTrackParam& v) { mParam = reinterpret_cast(v); } GPUhd() void SetHitWeight(const int32_t w) { mHitWeight = w; } private: int32_t mFirstRow; // first TPC row // TODO: We can use smaller data format here! int32_t mLastRow; // last TPC row - MEM_LG(GPUTPCBaseTrackParam) - mParam; // tracklet parameters + GPUTPCBaseTrackParam mParam; // tracklet parameters int32_t mHitWeight; // Hit Weight of Tracklet uint32_t mFirstHit; // first hit in row hit array }; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx index c073ad3d26b8b..e7735b4b2580c 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.cxx @@ -31,15 +31,13 @@ using namespace GPUCA_NAMESPACE::gpu; -MEM_CLASS_PRE2() -GPUdii() void GPUTPCTrackletConstructor::InitTracklet(MEM_LG2(GPUTPCTrackParam) & GPUrestrict() tParam) +GPUdii() void GPUTPCTrackletConstructor::InitTracklet(GPUTPCTrackParam& GPUrestrict() tParam) { // Initialize Tracklet Parameters using default values tParam.InitParam(); } -MEM_CLASS_PRE2() -GPUd() bool GPUTPCTrackletConstructor::CheckCov(MEM_LG2(GPUTPCTrackParam) & GPUrestrict() tParam) +GPUd() bool GPUTPCTrackletConstructor::CheckCov(GPUTPCTrackParam& GPUrestrict() tParam) { bool ok = 1; const float* c = tParam.Cov(); @@ -56,8 +54,7 @@ GPUd() bool GPUTPCTrackletConstructor::CheckCov(MEM_LG2(GPUTPCTrackParam) & GPUr return (ok); } -MEM_CLASS_PRE23() -GPUd() void GPUTPCTrackletConstructor::StoreTracklet(int32_t /*nBlocks*/, int32_t /*nThreads*/, int32_t /*iBlock*/, int32_t /*iThread*/, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, GPUTPCThreadMemory& GPUrestrict() r, GPUconstantref() MEM_LG2(GPUTPCTracker) & GPUrestrict() tracker, MEM_LG3(GPUTPCTrackParam) & GPUrestrict() tParam, calink* rowHits) +GPUd() void GPUTPCTrackletConstructor::StoreTracklet(int32_t /*nBlocks*/, int32_t /*nThreads*/, int32_t /*iBlock*/, int32_t /*iThread*/, GPUsharedref() GPUSharedMemory& s, GPUTPCThreadMemory& GPUrestrict() r, GPUconstantref() GPUTPCTracker& GPUrestrict() tracker, GPUTPCTrackParam& GPUrestrict() tParam, calink* rowHits) { // reconstruction of tracklets, tracklet store step const uint32_t nHits = r.mLastRow + 1 - r.mFirstRow; @@ -83,7 +80,7 @@ GPUd() void GPUTPCTrackletConstructor::StoreTracklet(int32_t /*nBlocks*/, int32_ return; } - GPUglobalref() MEM_GLOBAL(GPUTPCTracklet) & GPUrestrict() tracklet = tracker.Tracklets()[itrout]; + GPUglobalref() GPUTPCTracklet& GPUrestrict() tracklet = tracker.Tracklets()[itrout]; CADEBUG(printf(" Storing tracklet: %d rows\n", nHits)); @@ -107,8 +104,8 @@ GPUd() void GPUTPCTrackletConstructor::StoreTracklet(int32_t /*nBlocks*/, int32_ } } -MEM_CLASS_PRE2_TEMPLATE(class T) -GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, int32_t /*nThreads*/, int32_t /*iBlock*/, int32_t /*iThread*/, GPUsharedref() T& s, GPUTPCThreadMemory& GPUrestrict() r, GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & GPUrestrict() tracker, MEM_LG2(GPUTPCTrackParam) & GPUrestrict() tParam, int32_t iRow, calink& rowHit, calink* rowHits) +template +GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, int32_t /*nThreads*/, int32_t /*iBlock*/, int32_t /*iThread*/, GPUsharedref() T& s, GPUTPCThreadMemory& GPUrestrict() r, GPUconstantref() GPUTPCTracker& GPUrestrict() tracker, GPUTPCTrackParam& GPUrestrict() tParam, int32_t iRow, calink& rowHit, calink* rowHits) { // reconstruction of tracklets, tracklets update step CA_MAKE_SHARED_REF(GPUTPCRow, row, tracker.Row(iRow), s.mRows[iRow]); @@ -300,13 +297,13 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, calink best = CALINK_INVAL; float err2Y, err2Z; - tracker.GetErrors2Seeding(iRow, *((MEM_LG2(GPUTPCTrackParam)*)&tParam), -1.f, err2Y, err2Z); // TODO: Use correct time + tracker.GetErrors2Seeding(iRow, *((GPUTPCTrackParam*)&tParam), -1.f, err2Y, err2Z); // TODO: Use correct time if (r.mNHits >= 10) { const float sErr2 = tracker.Param().GetSystematicClusterErrorIFC2(x, tParam.GetY(), tParam.GetZ(), tracker.ISlice() >= 18); err2Y += sErr2; err2Z += sErr2; } - if (CAMath::Abs(yUncorrected) < x * MEM_GLOBAL(GPUTPCRow)::getTPCMaxY1X()) { // search for the closest hit + if (CAMath::Abs(yUncorrected) < x * GPUTPCRow::getTPCMaxY1X()) { // search for the closest hit const float kFactor = tracker.Param().rec.tpc.hitPickUpFactor * tracker.Param().rec.tpc.hitPickUpFactor * 7.0f * 7.0f; const float maxWindow2 = tracker.Param().rec.tpc.hitSearchArea2; const float sy2 = CAMath::Min(maxWindow2, kFactor * (tParam.Err2Y() + err2Y)); @@ -393,8 +390,8 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, } while (0); } if (r.mNHits == 8 && r.mNMissed == 0 && rowHit != CALINK_INVAL && rowHit != CALINK_DEAD_CHANNEL && rowHits && tracker.Param().par.continuousTracking && rowHits[r.mFirstRow] != CALINK_INVAL && rowHits[r.mFirstRow] != CALINK_DEAD_CHANNEL && rowHits[r.mLastRow] != CALINK_INVAL && rowHits[r.mLastRow] != CALINK_DEAD_CHANNEL) { - const GPUglobalref() MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row1 = tracker.Row(r.mFirstRow); - const GPUglobalref() MEM_GLOBAL(GPUTPCRow) & GPUrestrict() row2 = tracker.Row(r.mLastRow); + const GPUglobalref() GPUTPCRow& GPUrestrict() row1 = tracker.Row(r.mFirstRow); + const GPUglobalref() GPUTPCRow& GPUrestrict() row2 = tracker.Row(r.mLastRow); GPUglobalref() const cahit2* hits1 = tracker.HitData(row1); GPUglobalref() const cahit2* hits2 = tracker.HitData(row2); const cahit2 hh1 = CA_TEXTURE_FETCH(cahit2, gAliTexRefu2, hits1, rowHits[r.mFirstRow]); @@ -408,11 +405,10 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::UpdateTracklet(int32_t /*nBlocks*/, } } -GPUdic(2, 1) void GPUTPCTrackletConstructor::DoTracklet(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & GPUrestrict() tracker, GPUsharedref() GPUTPCTrackletConstructor::MEM_LOCAL(GPUSharedMemory) & s, GPUTPCThreadMemory& GPUrestrict() r) +GPUdic(2, 1) void GPUTPCTrackletConstructor::DoTracklet(GPUconstantref() GPUTPCTracker& GPUrestrict() tracker, GPUsharedref() GPUTPCTrackletConstructor::GPUSharedMemory& s, GPUTPCThreadMemory& GPUrestrict() r) { int32_t iRow = 0, iRowEnd = GPUCA_ROW_COUNT; - MEM_PLAIN(GPUTPCTrackParam) - tParam; + GPUTPCTrackParam tParam; calink rowHits[GPUCA_ROW_COUNT]; if (r.mGo) { GPUTPCHitId id = tracker.TrackletStartHits()[r.mISH]; @@ -484,12 +480,12 @@ GPUdic(2, 1) void GPUTPCTrackletConstructor::DoTracklet(GPUconstantref() MEM_GLO } template <> -GPUdii() void GPUTPCTrackletConstructor::Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & sMem, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCTrackletConstructor::Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& sMem, processorType& GPUrestrict() tracker) { if (get_local_id(0) == 0) { sMem.mNStartHits = *tracker.NStartHits(); } - CA_SHARED_CACHE(&sMem.mRows[0], tracker.SliceDataRows(), GPUCA_ROW_COUNT * sizeof(MEM_PLAIN(GPUTPCRow))); + CA_SHARED_CACHE(&sMem.mRows[0], tracker.SliceDataRows(), GPUCA_ROW_COUNT * sizeof(GPUTPCRow)); GPUbarrier(); GPUTPCThreadMemory rMem; @@ -500,9 +496,9 @@ GPUdii() void GPUTPCTrackletConstructor::Thread -GPUdii() void GPUTPCTrackletConstructor::Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & sMem, processorType& GPUrestrict() tracker0) +GPUdii() void GPUTPCTrackletConstructor::Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& sMem, processorType& GPUrestrict() tracker0) { - GPUconstantref() MEM_GLOBAL(GPUTPCTracker) * GPUrestrict() pTracker = &tracker0; + GPUconstantref() GPUTPCTracker* GPUrestrict() pTracker = &tracker0; #ifdef GPUCA_GPUCODE int32_t mySlice = get_group_id(0) % GPUCA_NSLICES; int32_t currentSlice = -1; @@ -512,7 +508,7 @@ GPUdii() void GPUTPCTrackletConstructor::Thread // FIXME: GPUgeneric() needed to make the clang spirv output link correctly -GPUd() int32_t GPUTPCTrackletConstructor::GPUTPCTrackletConstructorGlobalTracking(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & GPUrestrict() tracker, GPUsharedref() GPUTPCGlobalTracking::GPUSharedMemory& sMem, MEM_LG(GPUTPCTrackParam) & GPUrestrict() tParam, int32_t row, int32_t increment, int32_t iTracklet, calink* rowHits) +GPUd() int32_t GPUTPCTrackletConstructor::GPUTPCTrackletConstructorGlobalTracking(GPUconstantref() GPUTPCTracker& GPUrestrict() tracker, GPUsharedref() GPUTPCGlobalTracking::GPUSharedMemory& sMem, GPUTPCTrackParam& GPUrestrict() tParam, int32_t row, int32_t increment, int32_t iTracklet, calink* rowHits) { GPUTPCThreadMemory rMem; rMem.mISH = iTracklet; diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h index f82aba47788f9..b1ef74b9896c1 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletConstructor.h @@ -28,7 +28,6 @@ namespace gpu * @class GPUTPCTrackletConstructor * */ -MEM_CLASS_PRE() class GPUTPCTracker; class GPUTPCTrackletConstructor @@ -69,9 +68,8 @@ class GPUTPCTrackletConstructor float mLastZ; // Z of the last fitted cluster }; - MEM_CLASS_PRE() struct GPUSharedMemory { - CA_SHARED_STORAGE(MEM_LG(GPUTPCRow) mRows[GPUCA_ROW_COUNT]); // rows + CA_SHARED_STORAGE(GPUTPCRow mRows[GPUCA_ROW_COUNT]); // rows int32_t mNextStartHitFirst; // First start hit to be processed by CUDA block during next iteration int32_t mNextStartHitCount; // Number of start hits to be processed by CUDA block during next iteration int32_t mNextStartHitFirstRun; // First run for dynamic scheduler? @@ -82,36 +80,32 @@ class GPUTPCTrackletConstructor #endif // GPUCA_TRACKLET_CONSTRUCTOR_DO_PROFILE }; - MEM_CLASS_PRE2() - GPUd() static void InitTracklet(MEM_LG2(GPUTPCTrackParam) & tParam); + GPUd() static void InitTracklet(GPUTPCTrackParam& tParam); - MEM_CLASS_PRE2_TEMPLATE(class T) - GPUd() static void UpdateTracklet(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() T& s, GPUTPCThreadMemory& r, GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & tracker, MEM_LG2(GPUTPCTrackParam) & tParam, int32_t iRow, calink& rowHit, calink* rowHits); + template + GPUd() static void UpdateTracklet(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() T& s, GPUTPCThreadMemory& r, GPUconstantref() GPUTPCTracker& tracker, GPUTPCTrackParam& tParam, int32_t iRow, calink& rowHit, calink* rowHits); - MEM_CLASS_PRE23() - GPUd() static void StoreTracklet(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, GPUTPCThreadMemory& r, GPUconstantref() MEM_LG2(GPUTPCTracker) & tracker, MEM_LG3(GPUTPCTrackParam) & tParam, calink* rowHits); + GPUd() static void StoreTracklet(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, GPUTPCThreadMemory& r, GPUconstantref() GPUTPCTracker& tracker, GPUTPCTrackParam& tParam, calink* rowHits); - MEM_CLASS_PRE2() - GPUd() static bool CheckCov(MEM_LG2(GPUTPCTrackParam) & tParam); + GPUd() static bool CheckCov(GPUTPCTrackParam& tParam); - GPUd() static void DoTracklet(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & tracker, GPUsharedref() GPUTPCTrackletConstructor::MEM_LOCAL(GPUSharedMemory) & sMem, GPUTPCThreadMemory& rMem); + GPUd() static void DoTracklet(GPUconstantref() GPUTPCTracker& tracker, GPUsharedref() GPUTPCTrackletConstructor::GPUSharedMemory& sMem, GPUTPCThreadMemory& rMem); #ifdef GPUCA_GPUCODE - GPUd() static int32_t FetchTracklet(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & tracker, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & sMem); + GPUd() static int32_t FetchTracklet(GPUconstantref() GPUTPCTracker& tracker, GPUsharedref() GPUSharedMemory& sMem); #endif // GPUCA_GPUCODE template - GPUd() static int32_t GPUTPCTrackletConstructorGlobalTracking(GPUconstantref() MEM_GLOBAL(GPUTPCTracker) & tracker, GPUsharedref() T& sMem, GPUTPCTrackParam& tParam, int32_t startrow, int32_t increment, int32_t iTracklet, calink* rowHits); + GPUd() static int32_t GPUTPCTrackletConstructorGlobalTracking(GPUconstantref() GPUTPCTracker& tracker, GPUsharedref() T& sMem, GPUTPCTrackParam& tParam, int32_t startrow, int32_t increment, int32_t iTracklet, calink* rowHits); - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.cxx index d3da504ab4ec0..b8cbbae06e8b0 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.cxx @@ -22,7 +22,7 @@ using namespace GPUCA_NAMESPACE::gpu; template <> -GPUdii() void GPUTPCTrackletSelector::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & s, processorType& GPUrestrict() tracker) +GPUdii() void GPUTPCTrackletSelector::Thread<0>(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& s, processorType& GPUrestrict() tracker) { // select best tracklets and kill clones @@ -39,7 +39,7 @@ GPUdii() void GPUTPCTrackletSelector::Thread<0>(int32_t nBlocks, int32_t nThread for (int32_t itr = s.mItr0 + iThread; itr < s.mNTracklets; itr += s.mNThreadsTotal) { GPUbarrierWarp(); - GPUglobalref() MEM_GLOBAL(GPUTPCTracklet) & GPUrestrict() tracklet = tracker.Tracklets()[itr]; + GPUglobalref() GPUTPCTracklet& GPUrestrict() tracklet = tracker.Tracklets()[itr]; int32_t firstRow = tracklet.FirstRow(); int32_t lastRow = tracklet.LastRow(); @@ -62,7 +62,7 @@ GPUdii() void GPUTPCTrackletSelector::Thread<0>(int32_t nBlocks, int32_t nThread gap++; } if (ih != CALINK_INVAL && ih != CALINK_DEAD_CHANNEL) { - GPUglobalref() const MEM_GLOBAL(GPUTPCRow)& row = tracker.Row(irow); + GPUglobalref() const GPUTPCRow& row = tracker.Row(irow); bool own = (tracker.HitWeight(row, ih) <= w); bool sharedOK = nShared <= (nHits < sharingMinNorm ? maxShared : nHits * maxSharedFrac); if (own || sharedOK) { // SG!!! diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.h index bae1cbe2bb876..af13b30022e6f 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackletSelector.h @@ -24,7 +24,6 @@ namespace GPUCA_NAMESPACE { namespace gpu { -MEM_CLASS_PRE() class GPUTPCTracker; /** @@ -34,7 +33,6 @@ class GPUTPCTracker; class GPUTPCTrackletSelector : public GPUKernelTemplate { public: - MEM_CLASS_PRE() struct GPUSharedMemory { int32_t mItr0; // index of the first track in the block int32_t mNThreadsTotal; // total n threads @@ -45,15 +43,14 @@ class GPUTPCTrackletSelector : public GPUKernelTemplate #endif // GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE != 0 }; - typedef GPUconstantref() MEM_GLOBAL(GPUTPCTracker) processorType; + typedef GPUconstantref() GPUTPCTracker processorType; GPUhdi() CONSTEXPR static GPUDataTypes::RecoStep GetRecoStep() { return GPUCA_RECO_STEP::TPCSliceTracking; } - MEM_TEMPLATE() - GPUhdi() static processorType* Processor(MEM_TYPE(GPUConstantMem) & processors) + GPUhdi() static processorType* Processor(GPUConstantMem& processors) { return processors.tpcTrackers; } template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() MEM_LOCAL(GPUSharedMemory) & smem, processorType& tracker); + GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& tracker); }; } // namespace gpu } // namespace GPUCA_NAMESPACE From e5c667235ad8981cdaa8507166c434147326040d Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 21:50:33 +0100 Subject: [PATCH 28/50] Code-Checker, silence some false warnings from failures in clang-tidy --- Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu | 4 ++-- GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu b/Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu index 67a515df1c730..19edef6c40346 100644 --- a/Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu +++ b/Detectors/ITSMFT/ITS/tracking/GPU/cuda/TrackingKernels.cu @@ -1215,14 +1215,14 @@ void processNeighboursHandler(const int startLayer, thrust::raw_pointer_cast(&foundSeedsTable[0]), // d_in thrust::raw_pointer_cast(&foundSeedsTable[0]), // d_out nCurrentCells + 1, // num_items - 0)); + 0)); // NOLINT: failure in clang-tidy discardResult(cudaMalloc(&d_temp_storage, temp_storage_bytes)); gpuCheckError(cub::DeviceScan::ExclusiveSum(d_temp_storage, // d_temp_storage temp_storage_bytes, // temp_storage_bytes thrust::raw_pointer_cast(&foundSeedsTable[0]), // d_in thrust::raw_pointer_cast(&foundSeedsTable[0]), // d_out nCurrentCells + 1, // num_items - 0)); + 0)); // NOLINT: failure in clang-tidy thrust::device_vector updatedCellIds(foundSeedsTable.back()) /*, lastCellIds(foundSeedsTable.back())*/; thrust::device_vector updatedCellSeeds(foundSeedsTable.back()) /*, lastCellSeeds(foundSeedsTable.back())*/; diff --git a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu index 9f043915efb19..dd35a23d67c21 100644 --- a/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu +++ b/GPU/GPUTracking/Base/cuda/GPUReconstructionCUDA.cu @@ -625,7 +625,7 @@ void GPUReconstructionCUDABackend::PrintKernelOccupancies() int32_t maxBlocks = 0, threads = 0, suggestedBlocks = 0, nRegs = 0, sMem = 0; GPUFailedMsg(cudaSetDevice(mDeviceId)); for (uint32_t i = 0; i < mInternals->kernelFunctions.size(); i++) { - GPUFailedMsg(cuOccupancyMaxPotentialBlockSize(&suggestedBlocks, &threads, *mInternals->kernelFunctions[i], 0, 0, 0)); + GPUFailedMsg(cuOccupancyMaxPotentialBlockSize(&suggestedBlocks, &threads, *mInternals->kernelFunctions[i], 0, 0, 0)); // NOLINT: failure in clang-tidy GPUFailedMsg(cuOccupancyMaxActiveBlocksPerMultiprocessor(&maxBlocks, *mInternals->kernelFunctions[i], threads, 0)); GPUFailedMsg(cuFuncGetAttribute(&nRegs, CU_FUNC_ATTRIBUTE_NUM_REGS, *mInternals->kernelFunctions[i])); GPUFailedMsg(cuFuncGetAttribute(&sMem, CU_FUNC_ATTRIBUTE_SHARED_SIZE_BYTES, *mInternals->kernelFunctions[i])); From 843479b980dc59d844fc8b6d91c60ab631235931 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 22:36:11 +0100 Subject: [PATCH 29/50] GPU: Rename OpenCL2 to OpenCL, now that we have only 1 OpenCL implementation --- GPU/GPUTracking/Base/GPUReconstruction.h | 2 +- ...ReconstructionAvailableBackends.template.h | 2 +- .../Base/GPUReconstructionLibrary.cxx | 8 ++--- GPU/GPUTracking/Base/opencl2/CMakeLists.txt | 16 +++++----- .../Base/opencl2/GPUReconstructionOCL2.cxx | 30 +++++++++---------- .../Base/opencl2/GPUReconstructionOCL2.h | 16 +++++----- .../opencl2/GPUReconstructionOCL2Internals.h | 28 ----------------- GPU/GPUTracking/CMakeLists.txt | 6 ++-- GPU/GPUTracking/DataTypes/GPUDataTypes.h | 5 ++-- GPU/GPUTracking/Definitions/GPUSettingsList.h | 4 +-- .../Standalone/Benchmark/standalone.cxx | 4 +-- GPU/GPUTracking/Standalone/cmake/config.cmake | 2 +- dependencies/FindO2GPU.cmake | 30 +++++++++---------- 13 files changed, 62 insertions(+), 91 deletions(-) delete mode 100644 GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2Internals.h diff --git a/GPU/GPUTracking/Base/GPUReconstruction.h b/GPU/GPUTracking/Base/GPUReconstruction.h index bbac264b2828c..6951646dff840 100644 --- a/GPU/GPUTracking/Base/GPUReconstruction.h +++ b/GPU/GPUTracking/Base/GPUReconstruction.h @@ -390,7 +390,7 @@ class GPUReconstruction void* mGPULib; void* mGPUEntry; }; - static std::shared_ptr sLibCUDA, sLibHIP, sLibOCL2; + static std::shared_ptr sLibCUDA, sLibHIP, sLibOCL; static GPUReconstruction* GPUReconstruction_Create_CPU(const GPUSettingsDeviceBackend& cfg); }; diff --git a/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h b/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h index 3aea2706723f1..35892db121f50 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h +++ b/GPU/GPUTracking/Base/GPUReconstructionAvailableBackends.template.h @@ -14,4 +14,4 @@ #cmakedefine CUDA_ENABLED #cmakedefine HIP_ENABLED -#cmakedefine OPENCL2_ENABLED +#cmakedefine OPENCL_ENABLED diff --git a/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx b/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx index ac852e93f5171..f3749c160c3ff 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx +++ b/GPU/GPUTracking/Base/GPUReconstructionLibrary.cxx @@ -102,9 +102,9 @@ std::shared_ptr* GPUReconstruction::GetLibrary #ifdef HIP_ENABLED return &sLibHIP; #endif - } else if (type == DeviceType::OCL2) { -#ifdef OPENCL2_ENABLED - return &sLibOCL2; + } else if (type == DeviceType::OCL) { +#ifdef OPENCL_ENABLED + return &sLibOCL; #endif } else { GPUError("Error: Invalid device type %u", (uint32_t)type); @@ -128,7 +128,7 @@ GPUReconstruction* GPUReconstruction::CreateInstance(const char* type, bool forc std::shared_ptr GPUReconstruction::sLibCUDA(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingCUDA" LIBRARY_EXTENSION, "GPUReconstruction_Create_CUDA")); std::shared_ptr GPUReconstruction::sLibHIP(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingHIP" LIBRARY_EXTENSION, "GPUReconstruction_Create_HIP")); -std::shared_ptr GPUReconstruction::sLibOCL2(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingOCL2" LIBRARY_EXTENSION, "GPUReconstruction_Create_OCL2")); +std::shared_ptr GPUReconstruction::sLibOCL(new GPUReconstruction::LibraryLoader("lib" LIBRARY_PREFIX "GPUTrackingOCL" LIBRARY_EXTENSION, "GPUReconstruction_Create_OCL")); GPUReconstruction::LibraryLoader::LibraryLoader(const char* lib, const char* func) : mLibName(lib), mFuncName(func), mGPULib(nullptr), mGPUEntry(nullptr) {} diff --git a/GPU/GPUTracking/Base/opencl2/CMakeLists.txt b/GPU/GPUTracking/Base/opencl2/CMakeLists.txt index 5030b7ab3b94f..672c1d2fb15ea 100644 --- a/GPU/GPUTracking/Base/opencl2/CMakeLists.txt +++ b/GPU/GPUTracking/Base/opencl2/CMakeLists.txt @@ -9,7 +9,7 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -set(MODULE GPUTrackingOCL2) +set(MODULE GPUTrackingOCL) enable_language(ASM) message(STATUS "Building GPUTracking with OpenCL 2 support") @@ -21,7 +21,7 @@ else() set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) endif() set(CL_SRC ${GPUDIR}/Base/opencl-common/GPUReconstructionOCL.cl) -set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCL2Code) +set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode) set(OCL_FLAGS -Dcl_clang_storage_class_specifiers -cl-std=CLC++2021) if(NOT DEFINED GPUCA_NO_FAST_MATH OR NOT ${GPUCA_NO_FAST_MATH}) @@ -39,7 +39,7 @@ set(OCL_DEFINECL "-D$= 17 cmake_path(GET LLVM_SPIRV PARENT_PATH TMP_LLVM_SPIRV_PATH) @@ -56,13 +56,13 @@ if(OPENCL2_ENABLED_SPIRV) # BUILD OpenCL2 intermediate code for SPIR-V target MAIN_DEPENDENCY ${CL_SRC} IMPLICIT_DEPENDS CXX ${CL_SRC} COMMAND_EXPAND_LISTS - COMMENT "Compiling OpenCL2 CL source file ${CL_SRC} to SPIRV ${CL_BIN}.spirv") + COMMENT "Compiling OpenCL CL source file ${CL_SRC} to SPIRV ${CL_BIN}.spirv") create_binary_resource(${CL_BIN}.spirv ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.spirv.o) set(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.spirv.o) endif() -if(OPENCL2_ENABLED) # BUILD OpenCL2 source code for runtime compilation target +if(OPENCL_ENABLED) # BUILD OpenCL source code for runtime compilation target # executes clang to preprocess add_custom_command( OUTPUT ${CL_BIN}.src @@ -76,7 +76,7 @@ if(OPENCL2_ENABLED) # BUILD OpenCL2 source code for runtime compilation target MAIN_DEPENDENCY ${CL_SRC} IMPLICIT_DEPENDS CXX ${CL_SRC} COMMAND_EXPAND_LISTS - COMMENT "Preparing OpenCL2 CL source file for run time compilation ${CL_BIN}.src") + COMMENT "Preparing OpenCL CL source file for run time compilation ${CL_BIN}.src") create_binary_resource(${CL_BIN}.src ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.src.o) set(SRCS ${SRCS} ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode.src.o) @@ -122,7 +122,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") set(targetName ${MODULE}) endif() -if(OPENCL2_ENABLED_SPIRV) - target_compile_definitions(${targetName} PRIVATE OPENCL2_ENABLED_SPIRV) +if(OPENCL_ENABLED_SPIRV) + target_compile_definitions(${targetName} PRIVATE OPENCL_ENABLED_SPIRV) endif() target_compile_definitions(${targetName} PRIVATE OCL_FLAGS=$) diff --git a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx index 435e69e91f5fe..b912dbab20229 100644 --- a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx +++ b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx @@ -9,14 +9,14 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file GPUReconstructionOCL2.cxx +/// \file GPUReconstructionOCL.cxx /// \author David Rohr #define GPUCA_GPUTYPE_OPENCL #define __OPENCL_HOST__ #include "GPUReconstructionOCL2.h" -#include "GPUReconstructionOCL2Internals.h" +#include "GPUReconstructionOCLInternals.h" #include "GPUReconstructionIncludes.h" using namespace GPUCA_NAMESPACE::gpu; @@ -27,32 +27,32 @@ using namespace GPUCA_NAMESPACE::gpu; #include #include "utils/qGetLdBinarySymbols.h" -QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCL2Code_src); -#ifdef OPENCL2_ENABLED_SPIRV -QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCL2Code_spirv); +QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_src); +#ifdef OPENCL_ENABLED_SPIRV +QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_spirv); #endif -GPUReconstruction* GPUReconstruction_Create_OCL2(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL2(cfg); } +GPUReconstruction* GPUReconstruction_Create_OCL(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL2(cfg); } -GPUReconstructionOCL2Backend::GPUReconstructionOCL2Backend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionOCL(cfg) +GPUReconstructionOCLBackend::GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionOCL(cfg) { } template -int32_t GPUReconstructionOCL2Backend::runKernelBackend(const krnlSetupArgs& args) +int32_t GPUReconstructionOCLBackend::runKernelBackend(const krnlSetupArgs& args) { cl_kernel k = args.s.y.num > 1 ? getKernelObject() : getKernelObject(); return std::apply([this, &args, &k](auto&... vals) { return runKernelBackendInternal(args.s, k, vals...); }, args.v); } template -S& GPUReconstructionOCL2Backend::getKernelObject() +S& GPUReconstructionOCLBackend::getKernelObject() { static uint32_t krnl = FindKernel(MULTI ? 2 : 1); return mInternals->kernels[krnl].first; } -int32_t GPUReconstructionOCL2Backend::GetOCLPrograms() +int32_t GPUReconstructionOCLBackend::GetOCLPrograms() { char platform_version[256] = {}; GPUFailedMsg(clGetPlatformInfo(mInternals->platform, CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr)); @@ -63,17 +63,17 @@ int32_t GPUReconstructionOCL2Backend::GetOCLPrograms() const char* ocl_flags = GPUCA_M_STR(OCL_FLAGS); -#ifdef OPENCL2_ENABLED_SPIRV // clang-format off +#ifdef OPENCL_ENABLED_SPIRV // clang-format off if (ver >= 2.2f && !GetProcessingSettings().oclCompileFromSources) { GPUInfo("Reading OpenCL program from SPIR-V IL (Platform version %4.2f)", ver); - mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCL2Code_spirv_start, _binary_GPUReconstructionOCL2Code_spirv_len, &ocl_error); + mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCLCode_spirv_start, _binary_GPUReconstructionOCLCode_spirv_len, &ocl_error); ocl_flags = ""; } else #endif // clang-format on { GPUInfo("Compiling OpenCL program from sources (Platform version %4.2f)", ver); - size_t program_sizes[1] = {_binary_GPUReconstructionOCL2Code_src_len}; - char* programs_sources[1] = {_binary_GPUReconstructionOCL2Code_src_start}; + size_t program_sizes[1] = {_binary_GPUReconstructionOCLCode_src_len}; + char* programs_sources[1] = {_binary_GPUReconstructionOCLCode_src_start}; mInternals->program = clCreateProgramWithSource(mInternals->context, (cl_uint)1, (const char**)&programs_sources, program_sizes, &ocl_error); } @@ -113,7 +113,7 @@ int32_t GPUReconstructionOCL2Backend::GetOCLPrograms() return 0; } -bool GPUReconstructionOCL2Backend::CheckPlatform(uint32_t i) +bool GPUReconstructionOCLBackend::CheckPlatform(uint32_t i) { char platform_version[64] = {}, platform_vendor[64] = {}; clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr); diff --git a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h index 8ce73df32b701..45642f69fae96 100644 --- a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h +++ b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h @@ -9,7 +9,7 @@ // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. -/// \file GPUReconstructionOCL2.h +/// \file GPUReconstructionOCL.h /// \author David Rohr #ifndef GPURECONSTRUCTIONOCL2_H @@ -18,22 +18,22 @@ #include "GPUReconstructionOCL.h" #ifdef _WIN32 -extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL2(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); +extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); #else -extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL2(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); +extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); #endif namespace GPUCA_NAMESPACE::gpu { -struct GPUReconstructionOCL2Internals; +struct GPUReconstructionOCLInternals; -class GPUReconstructionOCL2Backend : public GPUReconstructionOCL +class GPUReconstructionOCLBackend : public GPUReconstructionOCL { public: - ~GPUReconstructionOCL2Backend() override = default; + ~GPUReconstructionOCLBackend() override = default; protected: - GPUReconstructionOCL2Backend(const GPUSettingsDeviceBackend& cfg); + GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg); template int32_t runKernelBackend(const krnlSetupArgs& args); @@ -44,7 +44,7 @@ class GPUReconstructionOCL2Backend : public GPUReconstructionOCL bool CheckPlatform(uint32_t i) override; }; -using GPUReconstructionOCL2 = GPUReconstructionKernels; +using GPUReconstructionOCL2 = GPUReconstructionKernels; } // namespace GPUCA_NAMESPACE::gpu #endif diff --git a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2Internals.h b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2Internals.h deleted file mode 100644 index 8debdc47be8e8..0000000000000 --- a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2Internals.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUReconstructionOCL2Internals.h -/// \author David Rohr, Sergey Gorbunov - -#ifndef GPUTPCGPUTRACKEROPENCLINTERNALS2_H -#define GPUTPCGPUTRACKEROPENCLINTERNALS2_H - -#include "GPUReconstructionOCLInternals.h" - -namespace GPUCA_NAMESPACE::gpu -{ - -struct GPUReconstructionOCL2Internals : public GPUReconstructionOCLInternals { -}; - -} // namespace GPUCA_NAMESPACE::gpu - -#endif diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index 7e4ddf0dbd20e..807c010ce038b 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -22,7 +22,7 @@ endif() include(cmake/helpers.cmake) if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - if(ENABLE_CUDA OR ENABLE_OPENCL2 OR ENABLE_HIP) + if(ENABLE_CUDA OR ENABLE_OPENCL OR ENABLE_HIP) include(FeatureSummary) find_package(O2GPU) else() @@ -521,14 +521,14 @@ endif() target_compile_options(${targetName} PRIVATE -Wno-instantiation-after-specialization) # Add CMake recipes for GPU Tracking librararies -if(CUDA_ENABLED OR OPENCL2_ENABLED OR HIP_ENABLED) +if(CUDA_ENABLED OR OPENCL_ENABLED OR HIP_ENABLED) if(CMAKE_SYSTEM_NAME MATCHES Darwin) message(WARNING "GPU Tracking disabled on MacOS") else() if(CUDA_ENABLED) add_subdirectory(Base/cuda) endif() - if(OPENCL2_ENABLED) + if(OPENCL_ENABLED) add_subdirectory(Base/opencl-common) add_subdirectory(Base/opencl2) endif() diff --git a/GPU/GPUTracking/DataTypes/GPUDataTypes.h b/GPU/GPUTracking/DataTypes/GPUDataTypes.h index 8bcd06576d776..1109fd7e74705 100644 --- a/GPU/GPUTracking/DataTypes/GPUDataTypes.h +++ b/GPU/GPUTracking/DataTypes/GPUDataTypes.h @@ -147,8 +147,7 @@ class GPUDataTypes CPU = 1, CUDA = 2, HIP = 3, - OCL = 4, - OCL2 = 5 }; + OCL = 4 }; enum ENUM_CLASS GeneralStep { Prepare = 1, QA = 2 }; @@ -175,7 +174,7 @@ class GPUDataTypes ITSTracks = 256 }; #ifdef GPUCA_NOCOMPAT_ALLOPENCL - static constexpr const char* const DEVICE_TYPE_NAMES[] = {"INVALID", "CPU", "CUDA", "HIP", "OCL", "OCL2"}; + static constexpr const char* const DEVICE_TYPE_NAMES[] = {"INVALID", "CPU", "CUDA", "HIP", "OCL"}; static constexpr const char* const RECO_STEP_NAMES[] = {"TPC Transformation", "TPC Sector Tracking", "TPC Track Merging and Fit", "TPC Compression", "TRD Tracking", "ITS Tracking", "TPC dEdx Computation", "TPC Cluster Finding", "TPC Decompression", "Global Refit"}; static constexpr const char* const GENERAL_STEP_NAMES[] = {"Prepare", "QA"}; typedef bitfield RecoStepField; diff --git a/GPU/GPUTracking/Definitions/GPUSettingsList.h b/GPU/GPUTracking/Definitions/GPUSettingsList.h index d09f9c89a8077..b7881bd61978c 100644 --- a/GPU/GPUTracking/Definitions/GPUSettingsList.h +++ b/GPU/GPUTracking/Definitions/GPUSettingsList.h @@ -473,7 +473,7 @@ EndConfig() BeginConfig(GPUSettingsStandalone, configStandalone) AddOption(runGPU, uint8_t, 1, "", 'g', "Use GPU for processing", message("GPU processing enabled"), set(2)) AddOptionSet(runGPU, uint8_t, 0, "", 'c', "Use CPU for processing", message("CPU enabled")) -AddOption(gpuType, std::string, "AUTO", "", 0, "GPU type (CUDA / HIP / OCL / OCL2) or CPU or AUTO") +AddOption(gpuType, std::string, "AUTO", "", 0, "GPU type (CUDA / HIP / OCL / OCL) or CPU or AUTO") AddOption(runGPUforce, bool, true, "", 0, "Force usage of the specified GPU device type, no CPU fallback") AddOption(noprompt, bool, true, "", 0, "Do prompt for keypress before exiting") AddOption(continueOnError, bool, false, "", 0, "Continue processing after an error") @@ -537,7 +537,7 @@ AddOption(constBz, bool, false, "", 0, "force constant Bz for tests") AddOption(setMaxTimeBin, int32_t, -2, "", 0, "maximum time bin of continuous data, 0 for triggered events, -1 for automatic continuous mode, -2 for automatic continuous / triggered") AddOption(overrideNHbfPerTF, int32_t, 0, "", 0, "Overrides the number of HBF per TF if != 0") AddOption(overrideTPCTimeBinCur, int32_t, 0, "", 0, "Overrides TPC time bin cut if > 0") -AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL2") +AddOption(deviceType, std::string, "CPU", "", 0, "Device type, CPU | CUDA | HIP | OCL") AddOption(forceDeviceType, bool, true, "", 0, "force device type, otherwise allows fall-back to CPU") AddOption(synchronousProcessing, bool, false, "", 0, "Apply performance shortcuts for synchronous processing, disable unneeded steps") AddOption(dump, int32_t, 0, "", 0, "Dump events for standalone benchmark: 1 = dump events, 2 = dump events and skip processing in workflow") diff --git a/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx b/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx index 09069ba1d104d..8bef787b85e8e 100644 --- a/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx +++ b/GPU/GPUTracking/Standalone/Benchmark/standalone.cxx @@ -265,8 +265,8 @@ int32_t ReadConfiguration(int argc, char** argv) configStandalone.gpuType = "CUDA"; } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::HIP, configStandalone.proc.debugLevel >= 2)) { configStandalone.gpuType = "HIP"; - } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::OCL2, configStandalone.proc.debugLevel >= 2)) { - configStandalone.gpuType = "OCL2"; + } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::OCL, configStandalone.proc.debugLevel >= 2)) { + configStandalone.gpuType = "OCL"; } else if (GPUReconstruction::CheckInstanceAvailable(GPUReconstruction::DeviceType::OCL, configStandalone.proc.debugLevel >= 2)) { configStandalone.gpuType = "OCL"; } else { diff --git a/GPU/GPUTracking/Standalone/cmake/config.cmake b/GPU/GPUTracking/Standalone/cmake/config.cmake index c2167d9591ba2..d8ba50bfee804 100644 --- a/GPU/GPUTracking/Standalone/cmake/config.cmake +++ b/GPU/GPUTracking/Standalone/cmake/config.cmake @@ -14,7 +14,7 @@ set(ENABLE_CUDA AUTO) set(ENABLE_HIP AUTO) -set(ENABLE_OPENCL2 AUTO) +set(ENABLE_OPENCL AUTO) set(CONFIG_OPENMP 1) set(GPUCA_CONFIG_VC 1) set(GPUCA_CONFIG_FMT 1) diff --git a/dependencies/FindO2GPU.cmake b/dependencies/FindO2GPU.cmake index aacaf7fcedd8d..c5d53d6359ada 100644 --- a/dependencies/FindO2GPU.cmake +++ b/dependencies/FindO2GPU.cmake @@ -12,14 +12,14 @@ if(NOT DEFINED ENABLE_CUDA) set(ENABLE_CUDA "AUTO") endif() -if(NOT DEFINED ENABLE_OPENCL2) - set(ENABLE_OPENCL2 "AUTO") +if(NOT DEFINED ENABLE_OPENCL) + set(ENABLE_OPENCL "AUTO") endif() if(NOT DEFINED ENABLE_HIP) set(ENABLE_HIP "AUTO") endif() string(TOUPPER "${ENABLE_CUDA}" ENABLE_CUDA) -string(TOUPPER "${ENABLE_OPENCL2}" ENABLE_OPENCL2) +string(TOUPPER "${ENABLE_OPENCL}" ENABLE_OPENCL) string(TOUPPER "${ENABLE_HIP}" ENABLE_HIP) if(NOT DEFINED CMAKE_BUILD_TYPE_UPPER) string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER) @@ -147,9 +147,9 @@ if(ENABLE_CUDA) endif() # Detect and enable OpenCL 1.2 from AMD -if(ENABLE_OPENCL2) +if(ENABLE_OPENCL) find_package(OpenCL) - if(ENABLE_OPENCL2 AND NOT ENABLE_OPENCL2 STREQUAL "AUTO") + if(ENABLE_OPENCL AND NOT ENABLE_OPENCL STREQUAL "AUTO") set_package_properties(OpenCL PROPERTIES TYPE REQUIRED) else() set_package_properties(OpenCL PROPERTIES TYPE OPTIONAL) @@ -157,7 +157,7 @@ if(ENABLE_OPENCL2) endif() # Detect and enable OpenCL 2.x -if(ENABLE_OPENCL2) +if(ENABLE_OPENCL) find_package(OpenCL) find_package(LLVM) if(LLVM_FOUND) @@ -176,23 +176,23 @@ if(ENABLE_OPENCL2) AND LLVM_FOUND AND NOT LLVM_CLANG STREQUAL "LLVM_CLANG-NOTFOUND" AND LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 13.0) - set(OPENCL2_COMPATIBLE_CLANG_FOUND ON) + set(OPENCL_COMPATIBLE_CLANG_FOUND ON) endif() if(OpenCL_VERSION_STRING VERSION_GREATER_EQUAL 2.2 AND NOT LLVM_SPIRV STREQUAL "LLVM_SPIRV-NOTFOUND" - AND OPENCL2_COMPATIBLE_CLANG_FOUND) - set(OPENCL2_ENABLED_SPIRV ON) + AND OPENCL_COMPATIBLE_CLANG_FOUND) + set(OPENCL_ENABLED_SPIRV ON) message(STATUS "Using CLANG ${LLVM_CLANG} and ${LLVM_SPIRV} for SPIR-V compilation") endif () - if(OPENCL2_COMPATIBLE_CLANG_FOUND AND + if(OPENCL_COMPATIBLE_CLANG_FOUND AND (OpenCL_VERSION_STRING VERSION_GREATER_EQUAL 2.2 - OR OPENCL2_ENABLED_SPIRV)) - set(OPENCL2_ENABLED ON) - message(STATUS "Found OpenCL 2 (${OpenCL_VERSION_STRING} SPIR-V ${OPENCL2_ENABLED_SPIRV} with CLANG ${LLVM_PACKAGE_VERSION})") - elseif(NOT ENABLE_OPENCL2 STREQUAL "AUTO") + OR OPENCL_ENABLED_SPIRV)) + set(OPENCL_ENABLED ON) + message(STATUS "Found OpenCL 2 (${OpenCL_VERSION_STRING} SPIR-V ${OPENCL_ENABLED_SPIRV} with CLANG ${LLVM_PACKAGE_VERSION})") + elseif(NOT ENABLE_OPENCL STREQUAL "AUTO") message(FATAL_ERROR "OpenCL 2.x not available") else() - set(OPENCL2_ENABLED OFF) + set(OPENCL_ENABLED OFF) endif() endif() From 91d6a2c4129f7f4e0c0696b0396e35c0a06b2975 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 22:45:11 +0100 Subject: [PATCH 30/50] GPU: Remove obsolete tool --- GPU/GPUTracking/Standalone/tools/testCL.sh | 54 ---------------------- 1 file changed, 54 deletions(-) delete mode 100755 GPU/GPUTracking/Standalone/tools/testCL.sh diff --git a/GPU/GPUTracking/Standalone/tools/testCL.sh b/GPU/GPUTracking/Standalone/tools/testCL.sh deleted file mode 100755 index 0257830d8942d..0000000000000 --- a/GPU/GPUTracking/Standalone/tools/testCL.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -COMPILER=clang++ -LLVM_SPIRV=llvm-spirv - -echo "Testing using clang `which clang++`, spirv `which llvm-spirv`" - -#COMPILER=/usr/lib/llvm/roc-2.1.0/bin/clang++ -#COMPILER=/usr/lib/llvm/9/bin/clang++ - -#COMPILER=/home/qon/alice/llvm-project/build/bin/clang++ -#LLVM_SPIRV=/home/qon/alice/llvm-project/build/bin/llvm-spirv - -O2_DIR=${HOME}/alice/O2 -GPU_DIR=${HOME}/alice/O2/GPU/GPUTracking - -INCLUDES="-I${GPU_DIR}/. -I${GPU_DIR}/DataTypes -I${GPU_DIR}/Definitions -I${GPU_DIR}/Base -I${GPU_DIR}/SliceTracker -I${O2_DIR}/GPU/Common -I${GPU_DIR}/Merger -I${GPU_DIR}/Refit -I${GPU_DIR}/TRDTracking -I${GPU_DIR}/ITS -I${GPU_DIR}/dEdx \ - -I${GPU_DIR}/TPCConvert -I${O2_DIR}/GPU/TPCFastTransformation -I${GPU_DIR}/DataCompression -I${GPU_DIR}/TPCClusterFinder -I${GPU_DIR}/Global -I ${O2_DIR}/GPU/Utils \ - -I${O2_DIR}/DataFormats/Detectors/TPC/include -I${O2_DIR}/Detectors/Base/include -I${O2_DIR}/Detectors/Base/src -I${O2_DIR}/Common/MathUtils/include -I${O2_DIR}/DataFormats/Headers/include \ - -I${O2_DIR}/Detectors/TRD/base/include -I${O2_DIR}/Detectors/TRD/base/src -I${O2_DIR}/Detectors/ITSMFT/ITS/tracking/include -I${O2_DIR}/Detectors/ITSMFT/ITS/tracking/cuda/include -I${O2_DIR}/Common/Constants/include \ - -I${O2_DIR}/DataFormats/common/include -I${O2_DIR}/DataFormats/Detectors/Common/include -I${O2_DIR}/DataFormats/Detectors/TRD/include -I${O2_DIR}/DataFormats/Reconstruction/include -I${O2_DIR}/DataFormats/Reconstruction/src \ - -I${O2_DIR}/Detectors/Raw/include" -DEFINES="-DGPUCA_STANDALONE -DNDEBUG -D__OPENCLCPP__ -DGPUCA_HAVE_O2HEADERS -DGPUCA_TPC_GEOMETRY_O2" -FLAGS="-Xclang -fdenormal-fp-math-f32=ieee -cl-mad-enable -cl-no-signed-zeros -ferror-limit=1000 -Dcl_clang_storage_class_specifiers" - -echo Test1 - Preprocess -echo $COMPILER -cl-std=clc++ -x cl $INCLUDES $DEFINES -Dcl_clang_storage_class_specifiers -cl-no-stdinc -E ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl > test.cl - $COMPILER -cl-std=clc++ -x cl $INCLUDES $DEFINES -Dcl_clang_storage_class_specifiers -cl-no-stdinc -E ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl > test.cl -if [ $? != 0 ]; then exit 1; fi -echo Test 1A - Compile Preprocessed -echo $COMPILER -cl-std=clc++ -x cl -emit-llvm --target=spir64-unknown-unknown $FLAGS -c test.cl -o test.bc - $COMPILER -cl-std=clc++ -x cl -emit-llvm --target=spir64-unknown-unknown $FLAGS -c test.cl -o test.bc - -echo -echo Test2 - SPIR-V -echo $COMPILER -O0 -cl-std=clc++ -x cl -emit-llvm --target=spir64-unknown-unknown $FLAGS $INCLUDES $DEFINES -c ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl -o test.bc - $COMPILER -O0 -cl-std=clc++ -x cl -emit-llvm --target=spir64-unknown-unknown $FLAGS $INCLUDES $DEFINES -c ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl -o test.bc -if [ $? != 0 ]; then exit 1; fi -echo $LLVM_SPIRV test.bc -o test.spirv - $LLVM_SPIRV test.bc -o test.spirv -if [ $? != 0 ]; then exit 1; fi - -echo -echo Test3 - amdgcn -echo $COMPILER -O3 -cl-std=clc++ -x cl --target=amdgcn-amd-amdhsa -mcpu=gfx906 $FLAGS $INCLUDES $DEFINES -c ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl -o test.o - $COMPILER -O3 -cl-std=clc++ -x cl --target=amdgcn-amd-amdhsa -mcpu=gfx906 $FLAGS $INCLUDES $DEFINES -c ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl -o test.o -if [ $? != 0 ]; then exit 1; fi - -echo -echo Test4 - Clang OCL -echo clang-ocl -O3 -cl-std=clc++ -mcpu=gfx906 $FLAGS $INCLUDES $DEFINES -o test-clang-ocl.o ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl - clang-ocl -O3 -cl-std=clc++ -mcpu=gfx906 $FLAGS $INCLUDES $DEFINES -o test-clang-ocl.o ${GPU_DIR}/Base/opencl-common/GPUReconstructionOCL.cl -rm -f test-clang-ocl.o.* -if [ $? != 0 ]; then exit 1; fi From 147ed12e8f3f2f3f045d1a8ed9a233012a7a13ff Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 22:51:27 +0100 Subject: [PATCH 31/50] GPU: Merge opencl-common and opencl2 source files --- .../Base/opencl-common/CMakeLists.txt | 56 ------- .../Base/{opencl2 => opencl}/CMakeLists.txt | 16 +- .../GPUReconstructionOCL.cl | 0 .../GPUReconstructionOCL.cxx | 151 +++++++++++++++--- .../GPUReconstructionOCL.h | 20 ++- .../GPUReconstructionOCLInternals.h | 6 +- .../Base/opencl2/GPUReconstructionOCL2.cxx | 144 ----------------- .../Base/opencl2/GPUReconstructionOCL2.h | 50 ------ GPU/GPUTracking/CMakeLists.txt | 6 +- GPU/GPUTracking/Standalone/CMakeLists.txt | 1 - 10 files changed, 159 insertions(+), 291 deletions(-) delete mode 100644 GPU/GPUTracking/Base/opencl-common/CMakeLists.txt rename GPU/GPUTracking/Base/{opencl2 => opencl}/CMakeLists.txt (90%) rename GPU/GPUTracking/Base/{opencl-common => opencl}/GPUReconstructionOCL.cl (100%) rename GPU/GPUTracking/Base/{opencl-common => opencl}/GPUReconstructionOCL.cxx (76%) rename GPU/GPUTracking/Base/{opencl-common => opencl}/GPUReconstructionOCL.h (81%) rename GPU/GPUTracking/Base/{opencl-common => opencl}/GPUReconstructionOCLInternals.h (96%) delete mode 100644 GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx delete mode 100644 GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h diff --git a/GPU/GPUTracking/Base/opencl-common/CMakeLists.txt b/GPU/GPUTracking/Base/opencl-common/CMakeLists.txt deleted file mode 100644 index 5e49b7a81a85b..0000000000000 --- a/GPU/GPUTracking/Base/opencl-common/CMakeLists.txt +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2019-2020 CERN and copyright holders of ALICE O2. -# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -# All rights not expressly granted are reserved. -# -# This software is distributed under the terms of the GNU General Public -# License v3 (GPL Version 3), copied verbatim in the file "COPYING". -# -# In applying this license CERN does not waive the privileges and immunities -# granted to it by virtue of its status as an Intergovernmental Organization -# or submit itself to any jurisdiction. - -set(MODULE GPUTrackingOpenCLCommon) - -set(SRCS GPUReconstructionOCL.cxx) -set(HDRS GPUReconstructionOCL.h GPUReconstructionOCLInternals.h) - -if(ALIGPU_BUILD_TYPE STREQUAL "O2") - o2_add_library(${MODULE} - SOURCES ${SRCS} - PUBLIC_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR} - PUBLIC_LINK_LIBRARIES OpenCL::OpenCL O2::GPUTracking - TARGETVARNAME targetName) - - target_compile_definitions(${targetName} PRIVATE $) - # the compile_defitions are not propagated automatically on purpose (they are - # declared PRIVATE) so we are not leaking them outside of the GPU** - # directories - - install(FILES ${HDRS} DESTINATION include/GPU) -endif() - -if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") - # Generate the dictionary - get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("Ali${MODULE}" "" "GPUReconstructionOCL.h" "${incdirs} .") - - # Generate the ROOT map - generate_rootmap("Ali${MODULE}" "" "") - - # Add a library to the project using the specified source files - add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) - # AMD OpenCL run-time and driver - target_link_libraries(Ali${MODULE} PUBLIC OpenCL AliGPUTracking) - - # Installation - install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) - - install(FILES ${HDRS} DESTINATION include) -endif() - -if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") - add_library(${MODULE} SHARED ${SRCS}) - target_link_libraries(${MODULE} GPUTracking OpenCL) - target_include_directories(${MODULE} PUBLIC ${CMAKE_CURRENT_LIST_DIR}) - install(TARGETS ${MODULE}) -endif() diff --git a/GPU/GPUTracking/Base/opencl2/CMakeLists.txt b/GPU/GPUTracking/Base/opencl/CMakeLists.txt similarity index 90% rename from GPU/GPUTracking/Base/opencl2/CMakeLists.txt rename to GPU/GPUTracking/Base/opencl/CMakeLists.txt index 672c1d2fb15ea..58d0e5f40b593 100644 --- a/GPU/GPUTracking/Base/opencl2/CMakeLists.txt +++ b/GPU/GPUTracking/Base/opencl/CMakeLists.txt @@ -12,7 +12,7 @@ set(MODULE GPUTrackingOCL) enable_language(ASM) -message(STATUS "Building GPUTracking with OpenCL 2 support") +message(STATUS "Building GPUTracking with OpenCL support") # convenience variables if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") @@ -20,7 +20,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") else() set(GPUDIR ${CMAKE_SOURCE_DIR}/GPU/GPUTracking) endif() -set(CL_SRC ${GPUDIR}/Base/opencl-common/GPUReconstructionOCL.cl) +set(CL_SRC ${GPUDIR}/Base/opencl/GPUReconstructionOCL.cl) set(CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/GPUReconstructionOCLCode) set(OCL_FLAGS -Dcl_clang_storage_class_specifiers -cl-std=CLC++2021) @@ -36,8 +36,8 @@ set(OCL_DEFINECL "-D$) @@ -99,14 +99,14 @@ endif() if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") # Generate the dictionary get_directory_property(incdirs INCLUDE_DIRECTORIES) - generate_dictionary("Ali${MODULE}" "" "GPUReconstructionOCL2.h" "${incdirs} .") + generate_dictionary("Ali${MODULE}" "" "GPUReconstructionOCL.h" "${incdirs} .") # Generate the ROOT map generate_rootmap("Ali${MODULE}" "" "") # Add a library to the project using the specified source files add_library_tested(Ali${MODULE} SHARED ${SRCS} G__Ali${MODULE}.cxx) - target_link_libraries(Ali${MODULE} PUBLIC AliGPUTrackingOpenCLCommon) + target_link_libraries(Ali${MODULE} PUBLIC OpenCL AliGPUTracking) # Installation install(TARGETS Ali${MODULE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) @@ -117,7 +117,7 @@ endif() if(ALIGPU_BUILD_TYPE STREQUAL "Standalone") add_library(${MODULE} SHARED ${SRCS}) - target_link_libraries(${MODULE} GPUTrackingOpenCLCommon) + target_link_libraries(${MODULE} GPUTracking OpenCL) install(TARGETS ${MODULE}) set(targetName ${MODULE}) endif() diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl similarity index 100% rename from GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cl rename to GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx similarity index 76% rename from GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx rename to GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx index d5b10afeb68f2..f05780e86fe62 100644 --- a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.cxx +++ b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cxx @@ -33,11 +33,19 @@ using namespace GPUCA_NAMESPACE::gpu; } #define GPUCA_KRNL(x_class, x_attributes, ...) GPUCA_KRNL_PROP(x_class, x_attributes) -#define GPUCA_KRNL_BACKEND_CLASS GPUReconstructionOCL +#define GPUCA_KRNL_BACKEND_CLASS GPUReconstructionOCLBackend #include "GPUReconstructionKernelList.h" #undef GPUCA_KRNL -GPUReconstructionOCL::GPUReconstructionOCL(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionDeviceBase(cfg, sizeof(GPUReconstructionDeviceBase)) +#include "utils/qGetLdBinarySymbols.h" +QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_src); +#ifdef OPENCL_ENABLED_SPIRV +QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_spirv); +#endif + +GPUReconstruction* GPUReconstruction_Create_OCL(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL(cfg); } + +GPUReconstructionOCLBackend::GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionDeviceBase(cfg, sizeof(GPUReconstructionDeviceBase)) { if (mMaster == nullptr) { mInternals = new GPUReconstructionOCLInternals; @@ -45,7 +53,7 @@ GPUReconstructionOCL::GPUReconstructionOCL(const GPUSettingsDeviceBackend& cfg) mDeviceBackendSettings.deviceType = DeviceType::OCL; } -GPUReconstructionOCL::~GPUReconstructionOCL() +GPUReconstructionOCLBackend::~GPUReconstructionOCLBackend() { Exit(); // Make sure we destroy everything (in particular the ITS tracker) before we exit if (mMaster == nullptr) { @@ -53,7 +61,7 @@ GPUReconstructionOCL::~GPUReconstructionOCL() } } -int32_t GPUReconstructionOCL::GPUFailedMsgAI(const int64_t error, const char* file, int32_t line) +int32_t GPUReconstructionOCLBackend::GPUFailedMsgAI(const int64_t error, const char* file, int32_t line) { // Check for OPENCL Error and in the case of an error display the corresponding error string if (error == CL_SUCCESS) { @@ -63,7 +71,7 @@ int32_t GPUReconstructionOCL::GPUFailedMsgAI(const int64_t error, const char* fi return 1; } -void GPUReconstructionOCL::GPUFailedMsgA(const int64_t error, const char* file, int32_t line) +void GPUReconstructionOCLBackend::GPUFailedMsgA(const int64_t error, const char* file, int32_t line) { if (GPUFailedMsgAI(error, file, line)) { static bool runningCallbacks = false; @@ -75,12 +83,12 @@ void GPUReconstructionOCL::GPUFailedMsgA(const int64_t error, const char* file, } } -void GPUReconstructionOCL::UpdateAutomaticProcessingSettings() +void GPUReconstructionOCLBackend::UpdateAutomaticProcessingSettings() { GPUCA_GPUReconstructionUpdateDefaults(); } -int32_t GPUReconstructionOCL::InitDevice_Runtime() +int32_t GPUReconstructionOCLBackend::InitDevice_Runtime() { if (mMaster == nullptr) { cl_int ocl_error; @@ -386,7 +394,7 @@ int32_t GPUReconstructionOCL::InitDevice_Runtime() return (0); } -int32_t GPUReconstructionOCL::ExitDevice_Runtime() +int32_t GPUReconstructionOCLBackend::ExitDevice_Runtime() { // Uninitialize OPENCL SynchronizeGPU(); @@ -418,7 +426,7 @@ int32_t GPUReconstructionOCL::ExitDevice_Runtime() return (0); } -size_t GPUReconstructionOCL::GPUMemCpy(void* dst, const void* src, size_t size, int32_t stream, int32_t toGPU, deviceEvent* ev, deviceEvent* evList, int32_t nEvents) +size_t GPUReconstructionOCLBackend::GPUMemCpy(void* dst, const void* src, size_t size, int32_t stream, int32_t toGPU, deviceEvent* ev, deviceEvent* evList, int32_t nEvents) { if (evList == nullptr) { nEvents = 0; @@ -442,7 +450,7 @@ size_t GPUReconstructionOCL::GPUMemCpy(void* dst, const void* src, size_t size, return size; } -size_t GPUReconstructionOCL::WriteToConstantMemory(size_t offset, const void* src, size_t size, int32_t stream, deviceEvent* ev) +size_t GPUReconstructionOCLBackend::WriteToConstantMemory(size_t offset, const void* src, size_t size, int32_t stream, deviceEvent* ev) { if (stream == -1) { SynchronizeGPU(); @@ -454,11 +462,11 @@ size_t GPUReconstructionOCL::WriteToConstantMemory(size_t offset, const void* sr return size; } -void GPUReconstructionOCL::ReleaseEvent(deviceEvent ev) { GPUFailedMsg(clReleaseEvent(ev.get())); } +void GPUReconstructionOCLBackend::ReleaseEvent(deviceEvent ev) { GPUFailedMsg(clReleaseEvent(ev.get())); } -void GPUReconstructionOCL::RecordMarker(deviceEvent* ev, int32_t stream) { GPUFailedMsg(clEnqueueMarkerWithWaitList(mInternals->command_queue[stream], 0, nullptr, ev->getEventList())); } +void GPUReconstructionOCLBackend::RecordMarker(deviceEvent* ev, int32_t stream) { GPUFailedMsg(clEnqueueMarkerWithWaitList(mInternals->command_queue[stream], 0, nullptr, ev->getEventList())); } -int32_t GPUReconstructionOCL::DoStuckProtection(int32_t stream, deviceEvent event) +int32_t GPUReconstructionOCLBackend::DoStuckProtection(int32_t stream, deviceEvent event) { if (mProcessingSettings.stuckProtection) { cl_int tmp = 0; @@ -479,25 +487,25 @@ int32_t GPUReconstructionOCL::DoStuckProtection(int32_t stream, deviceEvent even return 0; } -void GPUReconstructionOCL::SynchronizeGPU() +void GPUReconstructionOCLBackend::SynchronizeGPU() { for (int32_t i = 0; i < mNStreams; i++) { GPUFailedMsg(clFinish(mInternals->command_queue[i])); } } -void GPUReconstructionOCL::SynchronizeStream(int32_t stream) { GPUFailedMsg(clFinish(mInternals->command_queue[stream])); } +void GPUReconstructionOCLBackend::SynchronizeStream(int32_t stream) { GPUFailedMsg(clFinish(mInternals->command_queue[stream])); } -void GPUReconstructionOCL::SynchronizeEvents(deviceEvent* evList, int32_t nEvents) { GPUFailedMsg(clWaitForEvents(nEvents, evList->getEventList())); } +void GPUReconstructionOCLBackend::SynchronizeEvents(deviceEvent* evList, int32_t nEvents) { GPUFailedMsg(clWaitForEvents(nEvents, evList->getEventList())); } -void GPUReconstructionOCL::StreamWaitForEvents(int32_t stream, deviceEvent* evList, int32_t nEvents) +void GPUReconstructionOCLBackend::StreamWaitForEvents(int32_t stream, deviceEvent* evList, int32_t nEvents) { if (nEvents) { GPUFailedMsg(clEnqueueMarkerWithWaitList(mInternals->command_queue[stream], nEvents, evList->getEventList(), nullptr)); } } -bool GPUReconstructionOCL::IsEventDone(deviceEvent* evList, int32_t nEvents) +bool GPUReconstructionOCLBackend::IsEventDone(deviceEvent* evList, int32_t nEvents) { cl_int eventdone; for (int32_t i = 0; i < nEvents; i++) { @@ -509,7 +517,7 @@ bool GPUReconstructionOCL::IsEventDone(deviceEvent* evList, int32_t nEvents) return true; } -int32_t GPUReconstructionOCL::GPUDebug(const char* state, int32_t stream, bool force) +int32_t GPUReconstructionOCLBackend::GPUDebug(const char* state, int32_t stream, bool force) { // Wait for OPENCL-Kernel to finish and check for OPENCL errors afterwards, in case of debugmode if (!force && mProcessingSettings.debugLevel <= 0) { @@ -525,3 +533,108 @@ int32_t GPUReconstructionOCL::GPUDebug(const char* state, int32_t stream, bool f } return (0); } + +template +int32_t GPUReconstructionOCLBackend::runKernelBackend(const krnlSetupArgs& args) +{ + cl_kernel k = args.s.y.num > 1 ? getKernelObject() : getKernelObject(); + return std::apply([this, &args, &k](auto&... vals) { return runKernelBackendInternal(args.s, k, vals...); }, args.v); +} + +template +S& GPUReconstructionOCLBackend::getKernelObject() +{ + static uint32_t krnl = FindKernel(MULTI ? 2 : 1); + return mInternals->kernels[krnl].first; +} + +int32_t GPUReconstructionOCLBackend::GetOCLPrograms() +{ + char platform_version[256] = {}; + GPUFailedMsg(clGetPlatformInfo(mInternals->platform, CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr)); + float ver = 0; + sscanf(platform_version, "OpenCL %f", &ver); + + cl_int ocl_error; + + const char* ocl_flags = GPUCA_M_STR(OCL_FLAGS); + +#ifdef OPENCL_ENABLED_SPIRV // clang-format off + if (ver >= 2.2f && !GetProcessingSettings().oclCompileFromSources) { + GPUInfo("Reading OpenCL program from SPIR-V IL (Platform version %4.2f)", ver); + mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCLCode_spirv_start, _binary_GPUReconstructionOCLCode_spirv_len, &ocl_error); + ocl_flags = ""; + } else +#endif // clang-format on + { + GPUInfo("Compiling OpenCL program from sources (Platform version %4.2f)", ver); + size_t program_sizes[1] = {_binary_GPUReconstructionOCLCode_src_len}; + char* programs_sources[1] = {_binary_GPUReconstructionOCLCode_src_start}; + mInternals->program = clCreateProgramWithSource(mInternals->context, (cl_uint)1, (const char**)&programs_sources, program_sizes, &ocl_error); + } + + if (GPUFailedMsgI(ocl_error)) { + GPUError("Error creating OpenCL program from binary"); + return 1; + } + + if (GPUFailedMsgI(clBuildProgram(mInternals->program, 1, &mInternals->device, ocl_flags, nullptr, nullptr))) { + cl_build_status status; + if (GPUFailedMsgI(clGetProgramBuildInfo(mInternals->program, mInternals->device, CL_PROGRAM_BUILD_STATUS, sizeof(status), &status, nullptr)) == 0 && status == CL_BUILD_ERROR) { + size_t log_size; + clGetProgramBuildInfo(mInternals->program, mInternals->device, CL_PROGRAM_BUILD_LOG, 0, nullptr, &log_size); + std::unique_ptr build_log(new char[log_size + 1]); + clGetProgramBuildInfo(mInternals->program, mInternals->device, CL_PROGRAM_BUILD_LOG, log_size, build_log.get(), nullptr); + build_log[log_size] = 0; + GPUError("Build Log:\n\n%s\n", build_log.get()); + } + return 1; + } + +#define GPUCA_KRNL(...) \ + GPUCA_KRNL_WRAP(GPUCA_KRNL_LOAD_, __VA_ARGS__) +#define GPUCA_KRNL_LOAD_single(x_class, ...) \ + if (AddKernel(false)) { \ + return 1; \ + } +#define GPUCA_KRNL_LOAD_multi(x_class, ...) \ + if (AddKernel(true)) { \ + return 1; \ + } +#include "GPUReconstructionKernelList.h" +#undef GPUCA_KRNL +#undef GPUCA_KRNL_LOAD_single +#undef GPUCA_KRNL_LOAD_multi + + return 0; +} + +bool GPUReconstructionOCLBackend::CheckPlatform(uint32_t i) +{ + char platform_version[64] = {}, platform_vendor[64] = {}; + clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr); + clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VENDOR, sizeof(platform_vendor), platform_vendor, nullptr); + float ver1 = 0; + sscanf(platform_version, "OpenCL %f", &ver1); + if (ver1 >= 2.2f) { + if (mProcessingSettings.debugLevel >= 2) { + GPUInfo("OpenCL 2.2 capable platform found"); + } + return true; + } + + if (strcmp(platform_vendor, "Advanced Micro Devices, Inc.") == 0 && ver1 >= 2.0f) { + float ver2 = 0; + const char* pos = strchr(platform_version, '('); + if (pos) { + sscanf(pos, "(%f)", &ver2); + } + if ((ver1 >= 2.f && ver2 >= 2000.f) || ver1 >= 2.1f) { + if (mProcessingSettings.debugLevel >= 2) { + GPUInfo("AMD ROCm OpenCL Platform found"); + } + return true; + } + } + return false; +} diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.h b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.h similarity index 81% rename from GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.h rename to GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.h index 6abe1045b550a..4d0c51e65a517 100644 --- a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCL.h +++ b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.h @@ -18,7 +18,7 @@ #include "GPUReconstructionDeviceBase.h" #ifdef _WIN32 -extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCLconst GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); +extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); #else extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); #endif @@ -27,13 +27,14 @@ namespace GPUCA_NAMESPACE::gpu { struct GPUReconstructionOCLInternals; -class GPUReconstructionOCL : public GPUReconstructionDeviceBase +class GPUReconstructionOCLBackend : public GPUReconstructionDeviceBase { public: - ~GPUReconstructionOCL() override; - GPUReconstructionOCL(const GPUSettingsDeviceBackend& cfg); + ~GPUReconstructionOCLBackend() override; protected: + GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg); + int32_t InitDevice_Runtime() override; int32_t ExitDevice_Runtime() override; void UpdateAutomaticProcessingSettings() override; @@ -54,8 +55,6 @@ class GPUReconstructionOCL : public GPUReconstructionDeviceBase void ReleaseEvent(deviceEvent ev) override; void RecordMarker(deviceEvent* ev, int32_t stream) override; - virtual int32_t GetOCLPrograms() = 0; - virtual bool CheckPlatform(uint32_t i) = 0; virtual bool ContextForAllPlatforms() { return false; } template @@ -68,8 +67,17 @@ class GPUReconstructionOCL : public GPUReconstructionDeviceBase gpu_reconstruction_kernels::krnlProperties getKernelPropertiesBackend(); GPUReconstructionOCLInternals* mInternals; + + template + int32_t runKernelBackend(const krnlSetupArgs& args); + template + S& getKernelObject(); + + int32_t GetOCLPrograms(); + bool CheckPlatform(uint32_t i); }; +using GPUReconstructionOCL = GPUReconstructionKernels; } // namespace GPUCA_NAMESPACE::gpu #endif diff --git a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCLInternals.h b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCLInternals.h similarity index 96% rename from GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCLInternals.h rename to GPU/GPUTracking/Base/opencl/GPUReconstructionOCLInternals.h index 182bef9f9d739..fdcd7ff7f12c9 100644 --- a/GPU/GPUTracking/Base/opencl-common/GPUReconstructionOCLInternals.h +++ b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCLInternals.h @@ -173,7 +173,7 @@ struct GPUReconstructionOCLInternals { }; template -inline int32_t GPUReconstructionOCL::runKernelBackendInternal(const krnlSetupTime& _xyz, K& k, const Args&... args) +inline int32_t GPUReconstructionOCLBackend::runKernelBackendInternal(const krnlSetupTime& _xyz, K& k, const Args&... args) { auto& x = _xyz.x; auto& y = _xyz.y; @@ -208,7 +208,7 @@ inline int32_t GPUReconstructionOCL::runKernelBackendInternal(const krnlSetupTim } template -int32_t GPUReconstructionOCL::AddKernel(bool multi) +int32_t GPUReconstructionOCLBackend::AddKernel(bool multi) { std::string name(GetKernelName()); if (multi) { @@ -227,7 +227,7 @@ int32_t GPUReconstructionOCL::AddKernel(bool multi) } template -inline uint32_t GPUReconstructionOCL::FindKernel(int32_t num) +inline uint32_t GPUReconstructionOCLBackend::FindKernel(int32_t num) { std::string name(GetKernelName()); if (num > 1) { diff --git a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx deleted file mode 100644 index b912dbab20229..0000000000000 --- a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.cxx +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUReconstructionOCL.cxx -/// \author David Rohr - -#define GPUCA_GPUTYPE_OPENCL -#define __OPENCL_HOST__ - -#include "GPUReconstructionOCL2.h" -#include "GPUReconstructionOCLInternals.h" -#include "GPUReconstructionIncludes.h" - -using namespace GPUCA_NAMESPACE::gpu; - -#include -#include -#include -#include - -#include "utils/qGetLdBinarySymbols.h" -QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_src); -#ifdef OPENCL_ENABLED_SPIRV -QGET_LD_BINARY_SYMBOLS(GPUReconstructionOCLCode_spirv); -#endif - -GPUReconstruction* GPUReconstruction_Create_OCL(const GPUSettingsDeviceBackend& cfg) { return new GPUReconstructionOCL2(cfg); } - -GPUReconstructionOCLBackend::GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg) : GPUReconstructionOCL(cfg) -{ -} - -template -int32_t GPUReconstructionOCLBackend::runKernelBackend(const krnlSetupArgs& args) -{ - cl_kernel k = args.s.y.num > 1 ? getKernelObject() : getKernelObject(); - return std::apply([this, &args, &k](auto&... vals) { return runKernelBackendInternal(args.s, k, vals...); }, args.v); -} - -template -S& GPUReconstructionOCLBackend::getKernelObject() -{ - static uint32_t krnl = FindKernel(MULTI ? 2 : 1); - return mInternals->kernels[krnl].first; -} - -int32_t GPUReconstructionOCLBackend::GetOCLPrograms() -{ - char platform_version[256] = {}; - GPUFailedMsg(clGetPlatformInfo(mInternals->platform, CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr)); - float ver = 0; - sscanf(platform_version, "OpenCL %f", &ver); - - cl_int ocl_error; - - const char* ocl_flags = GPUCA_M_STR(OCL_FLAGS); - -#ifdef OPENCL_ENABLED_SPIRV // clang-format off - if (ver >= 2.2f && !GetProcessingSettings().oclCompileFromSources) { - GPUInfo("Reading OpenCL program from SPIR-V IL (Platform version %4.2f)", ver); - mInternals->program = clCreateProgramWithIL(mInternals->context, _binary_GPUReconstructionOCLCode_spirv_start, _binary_GPUReconstructionOCLCode_spirv_len, &ocl_error); - ocl_flags = ""; - } else -#endif // clang-format on - { - GPUInfo("Compiling OpenCL program from sources (Platform version %4.2f)", ver); - size_t program_sizes[1] = {_binary_GPUReconstructionOCLCode_src_len}; - char* programs_sources[1] = {_binary_GPUReconstructionOCLCode_src_start}; - mInternals->program = clCreateProgramWithSource(mInternals->context, (cl_uint)1, (const char**)&programs_sources, program_sizes, &ocl_error); - } - - if (GPUFailedMsgI(ocl_error)) { - GPUError("Error creating OpenCL program from binary"); - return 1; - } - - if (GPUFailedMsgI(clBuildProgram(mInternals->program, 1, &mInternals->device, ocl_flags, nullptr, nullptr))) { - cl_build_status status; - if (GPUFailedMsgI(clGetProgramBuildInfo(mInternals->program, mInternals->device, CL_PROGRAM_BUILD_STATUS, sizeof(status), &status, nullptr)) == 0 && status == CL_BUILD_ERROR) { - size_t log_size; - clGetProgramBuildInfo(mInternals->program, mInternals->device, CL_PROGRAM_BUILD_LOG, 0, nullptr, &log_size); - std::unique_ptr build_log(new char[log_size + 1]); - clGetProgramBuildInfo(mInternals->program, mInternals->device, CL_PROGRAM_BUILD_LOG, log_size, build_log.get(), nullptr); - build_log[log_size] = 0; - GPUError("Build Log:\n\n%s\n", build_log.get()); - } - return 1; - } - -#define GPUCA_KRNL(...) \ - GPUCA_KRNL_WRAP(GPUCA_KRNL_LOAD_, __VA_ARGS__) -#define GPUCA_KRNL_LOAD_single(x_class, ...) \ - if (AddKernel(false)) { \ - return 1; \ - } -#define GPUCA_KRNL_LOAD_multi(x_class, ...) \ - if (AddKernel(true)) { \ - return 1; \ - } -#include "GPUReconstructionKernelList.h" -#undef GPUCA_KRNL -#undef GPUCA_KRNL_LOAD_single -#undef GPUCA_KRNL_LOAD_multi - - return 0; -} - -bool GPUReconstructionOCLBackend::CheckPlatform(uint32_t i) -{ - char platform_version[64] = {}, platform_vendor[64] = {}; - clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VERSION, sizeof(platform_version), platform_version, nullptr); - clGetPlatformInfo(mInternals->platforms[i], CL_PLATFORM_VENDOR, sizeof(platform_vendor), platform_vendor, nullptr); - float ver1 = 0; - sscanf(platform_version, "OpenCL %f", &ver1); - if (ver1 >= 2.2f) { - if (mProcessingSettings.debugLevel >= 2) { - GPUInfo("OpenCL 2.2 capable platform found"); - } - return true; - } - - if (strcmp(platform_vendor, "Advanced Micro Devices, Inc.") == 0 && ver1 >= 2.0f) { - float ver2 = 0; - const char* pos = strchr(platform_version, '('); - if (pos) { - sscanf(pos, "(%f)", &ver2); - } - if ((ver1 >= 2.f && ver2 >= 2000.f) || ver1 >= 2.1f) { - if (mProcessingSettings.debugLevel >= 2) { - GPUInfo("AMD ROCm OpenCL Platform found"); - } - return true; - } - } - return false; -} diff --git a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h b/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h deleted file mode 100644 index 45642f69fae96..0000000000000 --- a/GPU/GPUTracking/Base/opencl2/GPUReconstructionOCL2.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -/// \file GPUReconstructionOCL.h -/// \author David Rohr - -#ifndef GPURECONSTRUCTIONOCL2_H -#define GPURECONSTRUCTIONOCL2_H - -#include "GPUReconstructionOCL.h" - -#ifdef _WIN32 -extern "C" __declspec(dllexport) GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); -#else -extern "C" GPUCA_NAMESPACE::gpu::GPUReconstruction* GPUReconstruction_Create_OCL(const GPUCA_NAMESPACE::gpu::GPUSettingsDeviceBackend& cfg); -#endif - -namespace GPUCA_NAMESPACE::gpu -{ -struct GPUReconstructionOCLInternals; - -class GPUReconstructionOCLBackend : public GPUReconstructionOCL -{ - public: - ~GPUReconstructionOCLBackend() override = default; - - protected: - GPUReconstructionOCLBackend(const GPUSettingsDeviceBackend& cfg); - - template - int32_t runKernelBackend(const krnlSetupArgs& args); - template - S& getKernelObject(); - - int32_t GetOCLPrograms() override; - bool CheckPlatform(uint32_t i) override; -}; - -using GPUReconstructionOCL2 = GPUReconstructionKernels; -} // namespace GPUCA_NAMESPACE::gpu - -#endif diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index 807c010ce038b..b04a8c12dd598 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -413,8 +413,7 @@ if(ALIGPU_BUILD_TYPE STREQUAL "ALIROOT") ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/utils ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/cuda ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/hip - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl-common - ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl2 + ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Base/opencl ${CMAKE_SOURCE_DIR}/GPU/TPCFastTransformation) alice_usevc() @@ -529,8 +528,7 @@ if(CUDA_ENABLED OR OPENCL_ENABLED OR HIP_ENABLED) add_subdirectory(Base/cuda) endif() if(OPENCL_ENABLED) - add_subdirectory(Base/opencl-common) - add_subdirectory(Base/opencl2) + add_subdirectory(Base/opencl) endif() if(HIP_ENABLED) add_subdirectory(Base/hip) diff --git a/GPU/GPUTracking/Standalone/CMakeLists.txt b/GPU/GPUTracking/Standalone/CMakeLists.txt index fd5f812facf06..1857d77c11b1a 100644 --- a/GPU/GPUTracking/Standalone/CMakeLists.txt +++ b/GPU/GPUTracking/Standalone/CMakeLists.txt @@ -145,7 +145,6 @@ include_directories(${GPU_DIR}/Common ${GPUTRACKING_DIR}/Definitions ${GPUTRACKING_DIR}/DataTypes ${GPUTRACKING_DIR}/Base - ${GPUTRACKING_DIR}/Base/opencl-common ${GPUTRACKING_DIR}/dEdx ${GPUTRACKING_DIR}/TPCConvert ${GPUTRACKING_DIR}/Global From f9e0b93cf4e3ebbc869e1a3b7202fa97c920c35c Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 22:56:09 +0100 Subject: [PATCH 32/50] GPU Standalone: fix makefile clean command to clean ROOT dictionaries --- GPU/GPUTracking/Standalone/cmake/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPU/GPUTracking/Standalone/cmake/makefile b/GPU/GPUTracking/Standalone/cmake/makefile index 87de4d66bb8c8..f2c38b0deee8e 100644 --- a/GPU/GPUTracking/Standalone/cmake/makefile +++ b/GPU/GPUTracking/Standalone/cmake/makefile @@ -4,4 +4,4 @@ all: clean: +$(MAKE) -C build clean - rm -f ca *.so + rm -f ca *.so *.pcm *.rootmap From c758e98e74ed304c0ceaf1e23b28f77f1b027cde Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 23:01:14 +0100 Subject: [PATCH 33/50] GPU OpenCL: Rename OPENCLCPP macros to OPENCL, since OPENCLC was removed --- GPU/Common/GPUCommonDef.h | 2 +- GPU/Common/GPUCommonDefAPI.h | 8 ++++---- GPU/Common/GPUCommonDefSettings.h | 4 ++-- GPU/Common/GPUCommonMath.h | 12 ++++++------ GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl | 6 +++--- GPU/GPUTracking/Definitions/GPUDef.h | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index 14949d569c1e6..febb8baf94f5d 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -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(__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(__OPENCL__) && defined(GPUCA_OPENCL_NO_CONSTANT_MEMORY)) #define GPUCA_NO_CONSTANT_MEMORY #elif defined(__CUDACC__) || defined(__HIPCC__) #define GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM diff --git a/GPU/Common/GPUCommonDefAPI.h b/GPU/Common/GPUCommonDefAPI.h index 124a29ecc7a37..23e16c75f098f 100644 --- a/GPU/Common/GPUCommonDefAPI.h +++ b/GPU/Common/GPUCommonDefAPI.h @@ -95,7 +95,7 @@ #define GPUprivate() __private #define GPUgeneric() __generic #define GPUconstexprref() GPUconstexpr() - #if defined(__OPENCLCPP__) && !defined(__clang__) + #if defined(__OPENCL__) && !defined(__clang__) #define GPUbarrier() work_group_barrier(mem_fence::global | mem_fence::local); #define GPUbarrierWarp() #define GPUAtomic(type) atomic @@ -103,7 +103,7 @@ #else #define GPUbarrier() barrier(CLK_LOCAL_MEM_FENCE | CLK_GLOBAL_MEM_FENCE) #define GPUbarrierWarp() - #if defined(__OPENCLCPP__) && defined(GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS) + #if defined(__OPENCL__) && defined(GPUCA_OPENCL_CLANG_C11_ATOMICS) namespace GPUCA_NAMESPACE { namespace gpu { template struct oclAtomic; template <> struct oclAtomic {typedef atomic_uint t;}; @@ -114,14 +114,14 @@ #define GPUAtomic(type) volatile type #endif #endif - #if !defined(__OPENCLCPP__) // Other special defines for OpenCL 1 + #if !defined(__OPENCL__) // Other special defines for OpenCL 1 #define GPUCA_USE_TEMPLATE_ADDRESS_SPACES // TODO: check if we can make this (partially, where it is already implemented) compatible with OpenCL CPP #define GPUsharedref() GPUshared() #define GPUglobalref() GPUglobal() #undef GPUgeneric #define GPUgeneric() #endif - #if (!defined(__OPENCLCPP__) || !defined(GPUCA_NO_CONSTANT_MEMORY)) + #if (!defined(__OPENCL__) || !defined(GPUCA_NO_CONSTANT_MEMORY)) #define GPUconstantref() GPUconstant() #endif #elif defined(__HIPCC__) //Defines for HIP diff --git a/GPU/Common/GPUCommonDefSettings.h b/GPU/Common/GPUCommonDefSettings.h index 91f44657c4f06..860ca8792eb88 100644 --- a/GPU/Common/GPUCommonDefSettings.h +++ b/GPU/Common/GPUCommonDefSettings.h @@ -22,11 +22,11 @@ #error Please include GPUCommonDef.h! #endif -//#define GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS // Use C11 atomic instead of old style atomics for OpenCL C++ in clang (OpenCL 2.2 C++ will use C++11 atomics irrespectively) +//#define GPUCA_OPENCL_CLANG_C11_ATOMICS // Use C11 atomic instead of old style atomics for OpenCL C++ in clang (OpenCL 2.2 C++ will use C++11 atomics irrespectively) //#define GPUCA_CUDA_NO_CONSTANT_MEMORY // Do not use constant memory for CUDA //#define GPUCA_HIP_NO_CONSTANT_MEMORY // Do not use constant memory for HIP -#define GPUCA_OPENCLCPP_NO_CONSTANT_MEMORY // Do not use constant memory for OpenCL C++ - MANDATORY as OpenCL cannot cast between __constant and __generic yet! +#define GPUCA_OPENCL_NO_CONSTANT_MEMORY // Do not use constant memory for OpenCL C++ - MANDATORY as OpenCL cannot cast between __constant and __generic yet! // clang-format on diff --git a/GPU/Common/GPUCommonMath.h b/GPU/Common/GPUCommonMath.h index d211b051bed39..2b0c27632dec1 100644 --- a/GPU/Common/GPUCommonMath.h +++ b/GPU/Common/GPUCommonMath.h @@ -437,7 +437,7 @@ GPUhdi() int32_t GPUCommonMath::Abs(int32_t x) GPUhdi() float GPUCommonMath::Copysign(float x, float y) { -#if defined(__OPENCLCPP__) +#if defined(__OPENCL__) return copysign(x, y); #elif defined(GPUCA_GPUCODE) && !defined(__OPENCL__) return copysignf(x, y); @@ -452,7 +452,7 @@ GPUhdi() float GPUCommonMath::Copysign(float x, float y) template GPUdi() uint32_t GPUCommonMath::AtomicExchInternal(S* addr, T val) { -#if defined(GPUCA_GPUCODE) && defined(__OPENCLCPP__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS)) +#if defined(GPUCA_GPUCODE) && defined(__OPENCL__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CLANG_C11_ATOMICS)) return ::atomic_exchange(addr, val); #elif defined(GPUCA_GPUCODE) && defined(__OPENCL__) return ::atomic_xchg(addr, val); @@ -470,7 +470,7 @@ GPUdi() uint32_t GPUCommonMath::AtomicExchInternal(S* addr, T val) template GPUdi() bool GPUCommonMath::AtomicCASInternal(S* addr, T cmp, T val) { -#if defined(GPUCA_GPUCODE) && defined(__OPENCLCPP__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS)) +#if defined(GPUCA_GPUCODE) && defined(__OPENCL__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CLANG_C11_ATOMICS)) return ::atomic_compare_exchange(addr, cmp, val) == cmp; #elif defined(GPUCA_GPUCODE) && defined(__OPENCL__) return ::atomic_cmpxchg(addr, cmp, val) == cmp; @@ -486,7 +486,7 @@ GPUdi() bool GPUCommonMath::AtomicCASInternal(S* addr, T cmp, T val) template GPUdi() uint32_t GPUCommonMath::AtomicAddInternal(S* addr, T val) { -#if defined(GPUCA_GPUCODE) && defined(__OPENCLCPP__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS)) +#if defined(GPUCA_GPUCODE) && defined(__OPENCL__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CLANG_C11_ATOMICS)) return ::atomic_fetch_add(addr, val); #elif defined(GPUCA_GPUCODE) && defined(__OPENCL__) return ::atomic_add(addr, val); @@ -502,7 +502,7 @@ GPUdi() uint32_t GPUCommonMath::AtomicAddInternal(S* addr, T val) template GPUdi() void GPUCommonMath::AtomicMaxInternal(S* addr, T val) { -#if defined(GPUCA_GPUCODE) && defined(__OPENCLCPP__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS)) +#if defined(GPUCA_GPUCODE) && defined(__OPENCL__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CLANG_C11_ATOMICS)) ::atomic_fetch_max(addr, val); #elif defined(GPUCA_GPUCODE) && defined(__OPENCL__) ::atomic_max(addr, val); @@ -518,7 +518,7 @@ GPUdi() void GPUCommonMath::AtomicMaxInternal(S* addr, T val) template GPUdi() void GPUCommonMath::AtomicMinInternal(S* addr, T val) { -#if defined(GPUCA_GPUCODE) && defined(__OPENCLCPP__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CPP_CLANG_C11_ATOMICS)) +#if defined(GPUCA_GPUCODE) && defined(__OPENCL__) && (!defined(__clang__) || defined(GPUCA_OPENCL_CLANG_C11_ATOMICS)) ::atomic_fetch_min(addr, val); #elif defined(GPUCA_GPUCODE) && defined(__OPENCL__) ::atomic_min(addr, val); diff --git a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl index e94efce6503fe..863cd82cb56eb 100644 --- a/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl +++ b/GPU/GPUTracking/Base/opencl/GPUReconstructionOCL.cl @@ -15,12 +15,12 @@ // clang-format off #define __OPENCL__ #if defined(__cplusplus) && __cplusplus >= 201703L - #define __OPENCLCPP__ + #define __OPENCL__ #endif #define GPUCA_GPUTYPE_OPENCL -#ifdef __OPENCLCPP__ - #ifdef GPUCA_OPENCLCPP_NO_CONSTANT_MEMORY +#ifdef __OPENCL__ + #ifdef GPUCA_OPENCL_NO_CONSTANT_MEMORY #define GPUCA_NO_CONSTANT_MEMORY #endif #pragma OPENCL EXTENSION cl_khr_fp64 : enable // Allow double precision variables diff --git a/GPU/GPUTracking/Definitions/GPUDef.h b/GPU/GPUTracking/Definitions/GPUDef.h index 7152bf2e1813b..f01e3e6d38332 100644 --- a/GPU/GPUTracking/Definitions/GPUDef.h +++ b/GPU/GPUTracking/Definitions/GPUDef.h @@ -24,7 +24,7 @@ // Macros for masking ptrs in OpenCL kernel calls as uint64_t (The API only allows us to pass buffer objects) #ifdef __OPENCL__ #define GPUPtr1(a, b) uint64_t b - #ifdef __OPENCLCPP__ + #ifdef __OPENCL__ #define GPUPtr2(a, b) ((__generic a) (a) b) #else #define GPUPtr2(a, b) ((__global a) (a) b) From 12658048b173ecec55b4278dc15febce3f1c2078 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 23:10:18 +0100 Subject: [PATCH 34/50] GPU: Remove OpenCL base protections no longer needed --- GPU/Common/GPUCommonDef.h | 3 --- GPU/GPUTracking/Base/GPUMemoryResource.h | 2 -- GPU/GPUTracking/DataTypes/GPUDataTypes.h | 19 ++++--------------- GPU/GPUTracking/utils/bitfield.h | 4 ++-- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index febb8baf94f5d..fca8c3d34bc64 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -32,9 +32,6 @@ #if (!(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 - #endif #ifndef __CINT__ #define GPUCA_NOCOMPAT_ALLCINT // + No ROOT CINT at all #endif diff --git a/GPU/GPUTracking/Base/GPUMemoryResource.h b/GPU/GPUTracking/Base/GPUMemoryResource.h index 6d8125251800f..e61b89d25f2da 100644 --- a/GPU/GPUTracking/Base/GPUMemoryResource.h +++ b/GPU/GPUTracking/Base/GPUMemoryResource.h @@ -23,7 +23,6 @@ namespace GPUCA_NAMESPACE namespace gpu { -#ifdef GPUCA_NOCOMPAT_ALLOPENCL struct GPUMemoryReuse { enum Type : int32_t { NONE = 0, @@ -50,7 +49,6 @@ struct GPUMemoryReuse { Type type = NONE; ID id = 0; }; -#endif class GPUMemoryResource { diff --git a/GPU/GPUTracking/DataTypes/GPUDataTypes.h b/GPU/GPUTracking/DataTypes/GPUDataTypes.h index 1109fd7e74705..b0cf3d25274ee 100644 --- a/GPU/GPUTracking/DataTypes/GPUDataTypes.h +++ b/GPU/GPUTracking/DataTypes/GPUDataTypes.h @@ -21,10 +21,8 @@ // Please add complex data types required on the host but not GPU to GPUHostDataTypes.h and forward-declare! #ifndef GPUCA_GPUCODE_DEVICE #include -#ifdef GPUCA_NOCOMPAT_ALLOPENCL -#include -#endif #endif +#include "GPUCommonTypeTraits.h" #ifdef GPUCA_NOCOMPAT #include "GPUTRDDef.h" @@ -114,16 +112,10 @@ namespace GPUCA_NAMESPACE { namespace gpu { -#ifdef GPUCA_NOCOMPAT_ALLOPENCL #include "utils/bitfield.h" #define ENUM_CLASS class #define ENUM_UINT : uint32_t #define GPUCA_RECO_STEP GPUDataTypes::RecoStep -#else -#define ENUM_CLASS -#define ENUM_UINT -#define GPUCA_RECO_STEP GPUDataTypes -#endif class GPUTPCTrack; class GPUTPCHitId; @@ -172,30 +164,27 @@ class GPUDataTypes TPCRaw = 64, ITSClusters = 128, ITSTracks = 256 }; - -#ifdef GPUCA_NOCOMPAT_ALLOPENCL +#ifndef __OPENCL__ static constexpr const char* const DEVICE_TYPE_NAMES[] = {"INVALID", "CPU", "CUDA", "HIP", "OCL"}; static constexpr const char* const RECO_STEP_NAMES[] = {"TPC Transformation", "TPC Sector Tracking", "TPC Track Merging and Fit", "TPC Compression", "TRD Tracking", "ITS Tracking", "TPC dEdx Computation", "TPC Cluster Finding", "TPC Decompression", "Global Refit"}; static constexpr const char* const GENERAL_STEP_NAMES[] = {"Prepare", "QA"}; - typedef bitfield RecoStepField; - typedef bitfield InOutTypeField; constexpr static int32_t N_RECO_STEPS = sizeof(GPUDataTypes::RECO_STEP_NAMES) / sizeof(GPUDataTypes::RECO_STEP_NAMES[0]); constexpr static int32_t N_GENERAL_STEPS = sizeof(GPUDataTypes::GENERAL_STEP_NAMES) / sizeof(GPUDataTypes::GENERAL_STEP_NAMES[0]); #endif + typedef bitfield RecoStepField; + typedef bitfield InOutTypeField; #ifdef GPUCA_NOCOMPAT static constexpr uint32_t NSLICES = 36; #endif static DeviceType GetDeviceType(const char* type); }; -#ifdef GPUCA_NOCOMPAT_ALLOPENCL struct GPURecoStepConfiguration { GPUDataTypes::RecoStepField steps = 0; GPUDataTypes::RecoStepField stepsGPUMask = GPUDataTypes::RecoStep::AllRecoSteps; GPUDataTypes::InOutTypeField inputs = 0; GPUDataTypes::InOutTypeField outputs = 0; }; -#endif #ifdef GPUCA_NOCOMPAT diff --git a/GPU/GPUTracking/utils/bitfield.h b/GPU/GPUTracking/utils/bitfield.h index 05e90c9208542..9730f6c6c234f 100644 --- a/GPU/GPUTracking/utils/bitfield.h +++ b/GPU/GPUTracking/utils/bitfield.h @@ -15,7 +15,7 @@ #ifndef Q_BITFIELD_H #define Q_BITFIELD_H -#if !defined(GPUCA_NOCOMPAT_ALLOPENCL) && !defined(GPUCA_GPUCODE_COMPILEKERNELS) +#if !defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_GPUCODE_COMPILEKERNELS) #include #endif @@ -92,7 +92,7 @@ class bitfield return retVal; } -#if defined(GPUCA_NOCOMPAT_ALLOPENCL) && !defined(GPUCA_GPUCODE_DEVICE) +#if !defined(GPUCA_GPUCODE_DEVICE) static_assert(std::is_integral::value, "Storage type non integral"); static_assert(sizeof(S) >= sizeof(T), "Storage type has insufficient capacity"); #endif From c639af69686fb0355060821ea81651777346ae6a Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 23:29:23 +0100 Subject: [PATCH 35/50] GPU: Remove all ROOT5 / CINT based protections --- GPU/Common/GPUCommonDef.h | 14 +++----------- GPU/Common/GPUCommonMath.h | 2 +- GPU/GPUTracking/Base/GPUConstantMem.h | 17 ++--------------- GPU/GPUTracking/Base/GPUParam.h | 2 -- .../Base/GPUReconstructionDeviceBase.h | 2 +- GPU/GPUTracking/DataTypes/GPUTRDTrack.h | 12 ------------ GPU/GPUTracking/Definitions/GPULogging.h | 2 +- GPU/GPUTracking/GPUTrackingLinkDef_AliRoot.h | 2 +- GPU/GPUTracking/Global/GPUChainTracking.h | 2 +- GPU/TPCFastTransformation/Spline2D.h | 2 +- GPU/TPCFastTransformation/Spline2DSpec.h | 2 +- GPU/TPCFastTransformation/SplineSpec.h | 2 +- .../TPCFastTransformationLinkDef_AliRoot.h | 2 +- .../devtools/IrregularSpline2D3D.h | 4 ++-- .../devtools/SemiregularSpline2D3D.h | 4 ++-- 15 files changed, 18 insertions(+), 53 deletions(-) diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index fca8c3d34bc64..3d28448202643 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -30,14 +30,11 @@ //Some GPU configuration settings, must be included first #include "GPUCommonDefSettings.h" -#if (!(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__)) && defined(__cplusplus) && __cplusplus >= 201103L +#if defined(__cplusplus) && __cplusplus >= 201103L #define GPUCA_NOCOMPAT // C++11 + No old ROOT5 + No old OpenCL - #ifndef __CINT__ - #define GPUCA_NOCOMPAT_ALLCINT // + No ROOT CINT at all - #endif #endif -#if !(defined(__CINT__) || defined(__ROOTCINT__) || defined(__CLING__) || defined(__ROOTCLING__) || defined(G__ROOT)) // No GPU code for ROOT +#if !(defined(__CLING__) || defined(__ROOTCLING__) || defined(G__ROOT)) // No GPU code for ROOT #if defined(__CUDACC__) || defined(__OPENCL__) || defined(__HIPCC__) || defined(__OPENCL_HOST__) #define GPUCA_GPUCODE // Compiled by GPU compiler #endif @@ -47,7 +44,7 @@ #endif #endif -// Definitions for C++11 features not supported by CINT / OpenCL +// Definitions for C++11 features #ifdef GPUCA_NOCOMPAT #define CON_DELETE = delete #define CON_DEFAULT = default @@ -63,11 +60,6 @@ #define CONSTEXPR #define GPUCA_CPP11_INIT(...) #endif -#if defined(__ROOT__) && !defined(GPUCA_NOCOMPAT) - #define VOLATILE // ROOT5 has a problem with volatile in CINT -#else - #define VOLATILE volatile -#endif // Set AliRoot / O2 namespace #if defined(GPUCA_STANDALONE) || (defined(GPUCA_O2_LIB) && !defined(GPUCA_O2_INTERFACE)) || defined(GPUCA_ALIROOT_LIB) || defined (GPUCA_GPUCODE) diff --git a/GPU/Common/GPUCommonMath.h b/GPU/Common/GPUCommonMath.h index 2b0c27632dec1..a6eb4a46c3ae8 100644 --- a/GPU/Common/GPUCommonMath.h +++ b/GPU/Common/GPUCommonMath.h @@ -531,7 +531,7 @@ GPUdi() void GPUCommonMath::AtomicMinInternal(S* addr, T val) #endif // GPUCA_GPUCODE } -#if (defined(__CUDACC__) || defined(__HIPCC__)) && !defined(__ROOTCINT__) && !defined(G__ROOT) +#if (defined(__CUDACC__) || defined(__HIPCC__)) && !defined(G__ROOT) #define GPUCA_HAVE_ATOMIC_MINMAX_FLOAT template <> GPUdii() void GPUCommonMath::AtomicMaxInternal(GPUglobalref() GPUgeneric() GPUAtomic(float) * addr, float val) diff --git a/GPU/GPUTracking/Base/GPUConstantMem.h b/GPU/GPUTracking/Base/GPUConstantMem.h index c36cec7100b59..e1b5deeb0fe66 100644 --- a/GPU/GPUTracking/Base/GPUConstantMem.h +++ b/GPU/GPUTracking/Base/GPUConstantMem.h @@ -20,21 +20,8 @@ #include "GPUDataTypes.h" #include "GPUErrors.h" -// Dummies for stuff not supported in legacy code (ROOT 5) -#if defined(GPUCA_NOCOMPAT_ALLCINT) #include "GPUTPCGMMerger.h" -#else -namespace GPUCA_NAMESPACE -{ -namespace gpu -{ -class GPUTPCGMMerger -{ -}; -} // namespace gpu -} // namespace GPUCA_NAMESPACE -#endif -#if defined(GPUCA_NOCOMPAT_ALLCINT) && (!defined(GPUCA_GPUCODE) || !defined(GPUCA_ALIROOT_LIB)) +#if (!defined(GPUCA_GPUCODE) || !defined(GPUCA_ALIROOT_LIB)) #include "GPUTRDTracker.h" #else #include "GPUTRDDef.h" @@ -52,7 +39,7 @@ class GPUTRDTracker_t #endif // Dummies for stuff not suppored in legacy code, or for what requires O2 headers while not available -#if defined(GPUCA_NOCOMPAT_ALLCINT) && (!defined(GPUCA_GPUCODE) || !defined(GPUCA_ALIROOT_LIB)) && defined(GPUCA_HAVE_O2HEADERS) +#if (!defined(GPUCA_GPUCODE) || !defined(GPUCA_ALIROOT_LIB)) && defined(GPUCA_HAVE_O2HEADERS) #include "GPUTPCConvert.h" #include "GPUTPCCompression.h" #include "GPUTPCDecompression.h" diff --git a/GPU/GPUTracking/Base/GPUParam.h b/GPU/GPUTracking/Base/GPUParam.h index 48771578c63a4..de18b3ccb7e72 100644 --- a/GPU/GPUTracking/Base/GPUParam.h +++ b/GPU/GPUTracking/Base/GPUParam.h @@ -78,7 +78,6 @@ struct GPUParam_t { }; } // namespace internal -#if !(defined(__CINT__) || defined(__ROOTCINT__)) || defined(__CLING__) // Hide from ROOT 5 CINT struct GPUParam : public internal::GPUParam_t { #ifndef GPUCA_GPUCODE @@ -115,7 +114,6 @@ struct GPUParam : public internal::GPUParam_t GPUd() bool rejectEdgeClusterByY(float uncorrectedY, int32_t iRow, float trackSigmaY) const; }; -#endif } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.h b/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.h index 9746250ea3bd3..5a3f02efe7e3b 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.h +++ b/GPU/GPUTracking/Base/GPUReconstructionDeviceBase.h @@ -25,7 +25,7 @@ namespace GPUCA_NAMESPACE { namespace gpu { -#if !(defined(__CINT__) || defined(__ROOTCINT__) || defined(__CLING__) || defined(__ROOTCLING__) || defined(G__ROOT)) +#if !(defined(__CLING__) || defined(__ROOTCLING__) || defined(G__ROOT)) extern template class GPUReconstructionKernels; #endif diff --git a/GPU/GPUTracking/DataTypes/GPUTRDTrack.h b/GPU/GPUTracking/DataTypes/GPUTRDTrack.h index 437dd32154beb..21080499f6443 100644 --- a/GPU/GPUTracking/DataTypes/GPUTRDTrack.h +++ b/GPU/GPUTracking/DataTypes/GPUTRDTrack.h @@ -36,16 +36,6 @@ class GlobalTrackID; } // namespace o2 //_____________________________________________________________________________ -#if (defined(__CINT__) || defined(__ROOTCINT__)) && !defined(__CLING__) -namespace GPUCA_NAMESPACE -{ -namespace gpu -{ -template -class GPUTRDTrack_t; -} // namespace gpu -} // namespace GPUCA_NAMESPACE -#else #if (!defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB)) || defined(GPUCA_HAVE_O2HEADERS) #include "GPUTRDInterfaceO2Track.h" #endif @@ -150,6 +140,4 @@ class GPUTRDTrack_t : public T } // namespace gpu } // namespace GPUCA_NAMESPACE -#endif // !((defined(__CINT__) || defined(__ROOTCINT__)) && !defined(__CLING__)) - #endif // GPUTRDTRACK_H diff --git a/GPU/GPUTracking/Definitions/GPULogging.h b/GPU/GPUTracking/Definitions/GPULogging.h index 32557edb01d1b..d071cc791b675 100644 --- a/GPU/GPUTracking/Definitions/GPULogging.h +++ b/GPU/GPUTracking/Definitions/GPULogging.h @@ -18,7 +18,7 @@ #include "GPUCommonDef.h" // clang-format off #if !defined(GPUCA_NOCOMPAT) - // Cannot do anything for ROOT5CINT, so just disable + // just disable #define GPUInfo(...) #define GPUImportant(...) #define GPUWarning(...) diff --git a/GPU/GPUTracking/GPUTrackingLinkDef_AliRoot.h b/GPU/GPUTracking/GPUTrackingLinkDef_AliRoot.h index 266228dd79ff6..8974b4bd89460 100644 --- a/GPU/GPUTracking/GPUTrackingLinkDef_AliRoot.h +++ b/GPU/GPUTracking/GPUTrackingLinkDef_AliRoot.h @@ -12,7 +12,7 @@ /// \file GPUTrackingLinkDef_AliRoot.h /// \author David Rohr -#if defined(__CINT__) || defined(__CLING__) +#if defined(__CLING__) #pragma link off all globals; #pragma link off all classes; diff --git a/GPU/GPUTracking/Global/GPUChainTracking.h b/GPU/GPUTracking/Global/GPUChainTracking.h index 6eb20f3093b2f..9ca370d6cc308 100644 --- a/GPU/GPUTracking/Global/GPUChainTracking.h +++ b/GPU/GPUTracking/Global/GPUChainTracking.h @@ -293,7 +293,7 @@ class GPUChainTracking : public GPUChain, GPUReconstructionHelpers::helperDelega // Synchronization and Locks eventStruct* mEvents = nullptr; - VOLATILE int32_t mSliceSelectorReady = 0; + volatile int32_t mSliceSelectorReady = 0; std::array mWriteOutputDone; std::vector mOutputQueue; diff --git a/GPU/TPCFastTransformation/Spline2D.h b/GPU/TPCFastTransformation/Spline2D.h index cbbd91c1d2b8d..9dbca7a2b7767 100644 --- a/GPU/TPCFastTransformation/Spline2D.h +++ b/GPU/TPCFastTransformation/Spline2D.h @@ -22,7 +22,7 @@ #include "FlatObject.h" #include "GPUCommonDef.h" -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L #include #include #endif diff --git a/GPU/TPCFastTransformation/Spline2DSpec.h b/GPU/TPCFastTransformation/Spline2DSpec.h index b0f70752d81cf..801626445a52d 100644 --- a/GPU/TPCFastTransformation/Spline2DSpec.h +++ b/GPU/TPCFastTransformation/Spline2DSpec.h @@ -22,7 +22,7 @@ #include "GPUCommonDef.h" #include "SplineUtil.h" -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L #include #include #endif diff --git a/GPU/TPCFastTransformation/SplineSpec.h b/GPU/TPCFastTransformation/SplineSpec.h index f9c14b6374337..f1cd0e6271668 100644 --- a/GPU/TPCFastTransformation/SplineSpec.h +++ b/GPU/TPCFastTransformation/SplineSpec.h @@ -22,7 +22,7 @@ #include "GPUCommonDef.h" #include "SplineUtil.h" -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L #include #include #endif diff --git a/GPU/TPCFastTransformation/TPCFastTransformationLinkDef_AliRoot.h b/GPU/TPCFastTransformation/TPCFastTransformationLinkDef_AliRoot.h index 8fc2d6bfb88d7..acdd2d701bb86 100644 --- a/GPU/TPCFastTransformation/TPCFastTransformationLinkDef_AliRoot.h +++ b/GPU/TPCFastTransformation/TPCFastTransformationLinkDef_AliRoot.h @@ -12,7 +12,7 @@ /// \file TPCFastTransformationLinkDef_AliRoot.h /// \author Sergey Gorbunov -#if defined(__CINT__) || defined(__CLING__) +#if defined(__CLING__) #pragma link off all globals; #pragma link off all classes; diff --git a/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h b/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h index 9135a991c8fef..63487fe0c3b2d 100644 --- a/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h +++ b/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h @@ -21,7 +21,7 @@ #include "FlatObject.h" #include "GPUCommonDef.h" -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L #include #include #endif @@ -331,7 +331,7 @@ GPUdi() void IrregularSpline2D3D::getSplineVec(const float* correctedData, float // Same as getSpline, but using vectorized calculation. // \param correctedData should be at least 128-bit aligned -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) && defined(__cplusplus) && __cplusplus >= 201703L const IrregularSpline1D& gridU = getGridU(); const IrregularSpline1D& gridV = getGridV(); int32_t nu = gridU.getNumberOfKnots(); diff --git a/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h b/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h index 41128cf508fc2..75a4a6d50ddf2 100644 --- a/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h +++ b/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h @@ -23,7 +23,7 @@ #include "RegularSpline1D.h" #include "FlatObject.h" -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) #include #include #endif @@ -400,7 +400,7 @@ inline void SemiregularSpline2D3D::getSplineVec(const float* correctedData, floa // Same as getSpline, but using vectorized calculation. // \param correctedData should be at least 128-bit aligned -#if !defined(__CINT__) && !defined(__ROOTCINT__) && !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) +#if !defined(__ROOTCLING__) && !defined(GPUCA_GPUCODE) && !defined(GPUCA_NO_VC) //&& !defined(__CLING__) /* Idea: There are 16 knots important for (u, v). From c10424c4c2364fc6ee650df65e5fcb9eace1a054 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 15 Jan 2025 23:42:53 +0100 Subject: [PATCH 36/50] GPU: Remove all C++11 based protections --- .../DataFormatsTPC/CalibdEdxCorrection.h | 4 +- .../include/DataFormatsTPC/ClusterNative.h | 2 +- .../DataFormatsTPC/CompressedClusters.h | 8 +-- .../TPC/include/DataFormatsTPC/Digit.h | 4 +- .../TPC/include/DataFormatsTPC/PIDResponse.h | 4 +- .../include/CommonDataFormat/TimeStamp.h | 4 +- .../Base/include/DetectorsBase/MatCell.h | 4 +- .../Base/include/DetectorsBase/MatLayerCyl.h | 4 +- .../include/DetectorsBase/MatLayerCylSet.h | 6 +- Detectors/Base/include/DetectorsBase/Ray.h | 2 +- GPU/Common/GPUCommonDef.h | 18 +---- GPU/Common/GPUCommonMath.h | 12 +--- GPU/GPUTracking/Base/GPUConstantMem.h | 8 +-- GPU/GPUTracking/Base/GPUGeneralKernels.h | 7 -- GPU/GPUTracking/Base/GPUMemoryResource.h | 2 +- GPU/GPUTracking/Base/GPUParam.cxx | 2 - GPU/GPUTracking/Base/GPUParam.h | 2 +- GPU/GPUTracking/Base/GPUProcessor.h | 4 +- .../DataTypes/CalibdEdxContainer.h | 8 +-- .../DataTypes/CalibdEdxTrackTopologyPol.h | 4 +- .../DataTypes/CalibdEdxTrackTopologySpline.h | 10 +-- GPU/GPUTracking/DataTypes/GPUDataTypes.h | 16 ----- GPU/GPUTracking/DataTypes/GPUSettings.h | 2 - .../DataTypes/GPUTPCGMPolynomialField.cxx | 2 - GPU/GPUTracking/DataTypes/GPUTPCGeometry.h | 72 +++++++++---------- .../Definitions/GPUDefGPUParameters.h | 2 - GPU/GPUTracking/Definitions/GPULogging.h | 28 ++------ .../Global/AliHLTGPUDumpComponent.h | 4 +- GPU/GPUTracking/Merger/GPUTPCGMMerger.h | 6 +- .../Merger/GPUTPCGMPhysicalTrackModel.h | 2 +- .../Merger/GPUTPCGMPolynomialFieldManager.h | 2 +- GPU/GPUTracking/Merger/GPUTPCGMPropagator.h | 2 +- .../SliceTracker/GPUTPCSliceData.h | 6 +- .../SliceTracker/GPUTPCSliceOutput.h | 8 +-- GPU/GPUTracking/SliceTracker/GPUTPCTrack.h | 2 +- GPU/GPUTracking/SliceTracker/GPUTPCTracker.h | 4 +- GPU/GPUTracking/TPCClusterFinder/CfFragment.h | 2 +- GPU/GPUTracking/TPCClusterFinder/ChargePos.h | 2 +- .../TPCClusterFinder/PackedCharge.h | 2 +- .../TRDTracking/GPUTRDInterfaces.h | 16 ++--- .../TRDTracking/GPUTRDSpacePoint.h | 2 - GPU/GPUTracking/TRDTracking/GPUTRDTracker.h | 6 +- .../TRDTracking/GPUTRDTrackletWord.h | 14 ++-- GPU/GPUTracking/utils/qconfig.h | 2 +- GPU/TPCFastTransformation/ChebyshevFit1D.h | 2 +- .../CorrectionMapsHelper.h | 2 +- .../MultivariatePolynomial.h | 4 +- .../MultivariatePolynomialHelper.h | 4 +- .../NDPiecewisePolynomials.h | 4 +- GPU/TPCFastTransformation/Spline.h | 4 +- GPU/TPCFastTransformation/Spline1D.h | 4 +- GPU/TPCFastTransformation/Spline1DHelper.h | 6 +- GPU/TPCFastTransformation/Spline1DHelperOld.h | 6 +- GPU/TPCFastTransformation/Spline1DSpec.h | 6 +- GPU/TPCFastTransformation/Spline2D.h | 4 +- GPU/TPCFastTransformation/Spline2DHelper.h | 6 +- GPU/TPCFastTransformation/Spline2DSpec.h | 6 +- GPU/TPCFastTransformation/SplineHelper.h | 6 +- GPU/TPCFastTransformation/SplineSpec.h | 6 +- .../TPCFastSpaceChargeCorrection.h | 4 +- GPU/TPCFastTransformation/TPCFastTransform.h | 8 +-- .../TPCFastTransformGeo.h | 6 +- .../TPCFastTransformManager.h | 6 +- .../TPCFastTransformQA.h | 6 +- .../devtools/IrregularSpline1D.h | 6 +- .../devtools/IrregularSpline2D3D.h | 6 +- .../devtools/IrregularSpline2D3DCalibrator.h | 2 +- .../devtools/RegularSpline1D.h | 4 +- .../devtools/SemiregularSpline2D3D.h | 6 +- GPU/Utils/FlatObject.h | 8 +-- 70 files changed, 188 insertions(+), 267 deletions(-) diff --git a/DataFormats/Detectors/TPC/include/DataFormatsTPC/CalibdEdxCorrection.h b/DataFormats/Detectors/TPC/include/DataFormatsTPC/CalibdEdxCorrection.h index 22ee80992f432..8a731a61c8a2d 100644 --- a/DataFormats/Detectors/TPC/include/DataFormatsTPC/CalibdEdxCorrection.h +++ b/DataFormats/Detectors/TPC/include/DataFormatsTPC/CalibdEdxCorrection.h @@ -49,9 +49,9 @@ class CalibdEdxCorrection } CalibdEdxCorrection(std::string_view fileName) { loadFromFile(fileName); } #else - CalibdEdxCorrection() CON_DEFAULT; + CalibdEdxCorrection() = default; #endif - ~CalibdEdxCorrection() CON_DEFAULT; + ~CalibdEdxCorrection() = default; GPUd() float getCorrection(const StackID& stack, ChargeType charge, float tgl = 0, float snp = 0) const { diff --git a/DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h b/DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h index a996f59f51f9e..f3070d456afb1 100644 --- a/DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h +++ b/DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h @@ -76,7 +76,7 @@ struct ClusterNative { GPUd() static float unpackPad(uint16_t pad) { return float(pad) * (1.f / scalePadPacked); } GPUd() static float unpackTime(uint32_t time) { return float(time) * (1.f / scaleTimePacked); } - GPUdDefault() ClusterNative() CON_DEFAULT; + GPUdDefault() ClusterNative() = default; GPUd() ClusterNative(uint32_t time, uint8_t flags, uint16_t pad, uint8_t sigmaTime, uint8_t sigmaPad, uint16_t qmax, uint16_t qtot) : padPacked(pad), sigmaTimePacked(sigmaTime), sigmaPadPacked(sigmaPad), qMax(qmax), qTot(qtot) { setTimePackedFlags(time, flags); diff --git a/DataFormats/Detectors/TPC/include/DataFormatsTPC/CompressedClusters.h b/DataFormats/Detectors/TPC/include/DataFormatsTPC/CompressedClusters.h index 46da2da2a702e..18ad5c6819344 100644 --- a/DataFormats/Detectors/TPC/include/DataFormatsTPC/CompressedClusters.h +++ b/DataFormats/Detectors/TPC/include/DataFormatsTPC/CompressedClusters.h @@ -77,8 +77,8 @@ struct CompressedClustersOffsets : public CompressedClustersPtrs_x class TimeStamp { public: - GPUhdDefault() TimeStamp() CON_DEFAULT; - GPUhdDefault() ~TimeStamp() CON_DEFAULT; + GPUhdDefault() TimeStamp() = default; + GPUhdDefault() ~TimeStamp() = default; GPUdi() TimeStamp(T time) { mTimeStamp = time; } GPUhdi() T getTimeStamp() const { return mTimeStamp; } GPUdi() void setTimeStamp(T t) { mTimeStamp = t; } diff --git a/Detectors/Base/include/DetectorsBase/MatCell.h b/Detectors/Base/include/DetectorsBase/MatCell.h index 88143ddf44b03..40c5fd3db1f69 100644 --- a/Detectors/Base/include/DetectorsBase/MatCell.h +++ b/Detectors/Base/include/DetectorsBase/MatCell.h @@ -31,7 +31,7 @@ struct MatCell { float meanX2X0; ///< fraction of radiaton lenght GPUd() MatCell() : meanRho(0.f), meanX2X0(0.f) {} - GPUdDefault() MatCell(const MatCell& src) CON_DEFAULT; + GPUdDefault() MatCell(const MatCell& src) = default; GPUd() void set(const MatCell& c) { @@ -55,7 +55,7 @@ struct MatBudget : MatCell { float length; ///< length in material GPUd() MatBudget() : length(0.f) {} - GPUdDefault() MatBudget(const MatBudget& src) CON_DEFAULT; + GPUdDefault() MatBudget(const MatBudget& src) = default; GPUd() void scale(float scale) { diff --git a/Detectors/Base/include/DetectorsBase/MatLayerCyl.h b/Detectors/Base/include/DetectorsBase/MatLayerCyl.h index 869234e03f6c1..ca015fa457a1a 100644 --- a/Detectors/Base/include/DetectorsBase/MatLayerCyl.h +++ b/Detectors/Base/include/DetectorsBase/MatLayerCyl.h @@ -56,8 +56,8 @@ class MatLayerCyl : public o2::gpu::FlatObject #ifndef GPUCA_GPUCODE MatLayerCyl(); - MatLayerCyl(const MatLayerCyl& src) CON_DELETE; - ~MatLayerCyl() CON_DEFAULT; + MatLayerCyl(const MatLayerCyl& src) = delete; + ~MatLayerCyl() = default; #endif #ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version diff --git a/Detectors/Base/include/DetectorsBase/MatLayerCylSet.h b/Detectors/Base/include/DetectorsBase/MatLayerCylSet.h index 83fed8caf42eb..c74ce365d378f 100644 --- a/Detectors/Base/include/DetectorsBase/MatLayerCylSet.h +++ b/Detectors/Base/include/DetectorsBase/MatLayerCylSet.h @@ -52,9 +52,9 @@ class MatLayerCylSet : public o2::gpu::FlatObject public: #ifndef GPUCA_GPUCODE - MatLayerCylSet() CON_DEFAULT; - ~MatLayerCylSet() CON_DEFAULT; - MatLayerCylSet(const MatLayerCylSet& src) CON_DELETE; + MatLayerCylSet() = default; + ~MatLayerCylSet() = default; + MatLayerCylSet(const MatLayerCylSet& src) = delete; #endif GPUd() const MatLayerCylSetLayout* get() const { return reinterpret_cast(mFlatBufferPtr); } diff --git a/Detectors/Base/include/DetectorsBase/Ray.h b/Detectors/Base/include/DetectorsBase/Ray.h index 304ad5f00b03f..a72208c41af0d 100644 --- a/Detectors/Base/include/DetectorsBase/Ray.h +++ b/Detectors/Base/include/DetectorsBase/Ray.h @@ -49,7 +49,7 @@ class Ray GPUd() Ray() : mP{0.f}, mD{0.f}, mDistXY2(0.f), mDistXY2i(0.f), mDistXYZ(0.f), mXDxPlusYDy(0.f), mXDxPlusYDyRed(0.f), mXDxPlusYDy2(0.f), mR02(0.f), mR12(0.f) { } - GPUdDefault() ~Ray() CON_DEFAULT; + GPUdDefault() ~Ray() = default; #ifndef GPUCA_ALIGPUCODE // this part is unvisible on GPU version Ray(const math_utils::Point3D point0, const math_utils::Point3D point1); diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index 3d28448202643..2b3164d16d981 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -30,10 +30,6 @@ //Some GPU configuration settings, must be included first #include "GPUCommonDefSettings.h" -#if defined(__cplusplus) && __cplusplus >= 201103L - #define GPUCA_NOCOMPAT // C++11 + No old ROOT5 + No old OpenCL -#endif - #if !(defined(__CLING__) || defined(__ROOTCLING__) || defined(G__ROOT)) // No GPU code for ROOT #if defined(__CUDACC__) || defined(__OPENCL__) || defined(__HIPCC__) || defined(__OPENCL_HOST__) #define GPUCA_GPUCODE // Compiled by GPU compiler @@ -45,20 +41,10 @@ #endif // Definitions for C++11 features -#ifdef GPUCA_NOCOMPAT - #define CON_DELETE = delete - #define CON_DEFAULT = default - #define GPUCA_CPP11_INIT(...) __VA_ARGS__ - #if defined(__cplusplus) && __cplusplus >= 201703L - #define CONSTEXPR constexpr - #else - #define CONSTEXPR - #endif +#if defined(__cplusplus) && __cplusplus >= 201703L + #define CONSTEXPR constexpr #else - #define CON_DELETE - #define CON_DEFAULT #define CONSTEXPR - #define GPUCA_CPP11_INIT(...) #endif // Set AliRoot / O2 namespace diff --git a/GPU/Common/GPUCommonMath.h b/GPU/Common/GPUCommonMath.h index a6eb4a46c3ae8..ec1c3d54096a3 100644 --- a/GPU/Common/GPUCommonMath.h +++ b/GPU/Common/GPUCommonMath.h @@ -145,12 +145,6 @@ class GPUCommonMath template GPUd() CONSTEXPR static T nextMultipleOf(T val); -#ifdef GPUCA_NOCOMPAT - GPUdi() static float Sum2() // Needed for legacy C++, For >=17 the below if constexpr handles the case - { - return 0.f; - } - template GPUdi() static float Sum2(float w, Args... args) { @@ -161,7 +155,6 @@ class GPUCommonMath } return 0; } -#endif private: template @@ -441,11 +434,8 @@ GPUhdi() float GPUCommonMath::Copysign(float x, float y) return copysign(x, y); #elif defined(GPUCA_GPUCODE) && !defined(__OPENCL__) return copysignf(x, y); -#elif defined(__cplusplus) && __cplusplus >= 201103L - return std::copysignf(x, y); #else - x = GPUCommonMath::Abs(x); - return (y >= 0) ? x : -x; + return std::copysignf(x, y); #endif // GPUCA_GPUCODE } diff --git a/GPU/GPUTracking/Base/GPUConstantMem.h b/GPU/GPUTracking/Base/GPUConstantMem.h index e1b5deeb0fe66..26c7726d13ca6 100644 --- a/GPU/GPUTracking/Base/GPUConstantMem.h +++ b/GPU/GPUTracking/Base/GPUConstantMem.h @@ -80,7 +80,7 @@ struct GPUConstantMem { GPUKernelDebugOutput debugOutput; #endif -#if defined(GPUCA_HAVE_O2HEADERS) && defined(GPUCA_NOCOMPAT) +#if defined(GPUCA_HAVE_O2HEADERS) template GPUd() auto& getTRDTracker(); #else // GPUCA_HAVE_O2HEADERS @@ -92,7 +92,7 @@ struct GPUConstantMem { #endif // !GPUCA_HAVE_O2HEADERS }; -#if defined(GPUCA_HAVE_O2HEADERS) && defined(GPUCA_NOCOMPAT) +#if defined(GPUCA_HAVE_O2HEADERS) template <> GPUdi() auto& GPUConstantMem::getTRDTracker<0>() { @@ -105,7 +105,6 @@ GPUdi() auto& GPUConstantMem::getTRDTracker<1>() } #endif -#ifdef GPUCA_NOCOMPAT union GPUConstantMemCopyable { #if !defined(__OPENCL__) || defined(__OPENCL_HOST__) GPUh() GPUConstantMemCopyable() {} // NOLINT: We want an empty constructor, not a default one @@ -119,9 +118,8 @@ union GPUConstantMemCopyable { #endif GPUConstantMem v; }; -#endif -#if defined(GPUCA_GPUCODE) && defined(GPUCA_NOCOMPAT) +#if defined(GPUCA_GPUCODE) static constexpr size_t gGPUConstantMemBufferSize = (sizeof(GPUConstantMem) + sizeof(uint4) - 1); #endif } // namespace gpu diff --git a/GPU/GPUTracking/Base/GPUGeneralKernels.h b/GPU/GPUTracking/Base/GPUGeneralKernels.h index 47f26e2443229..9829fe350fde1 100644 --- a/GPU/GPUTracking/Base/GPUGeneralKernels.h +++ b/GPU/GPUTracking/Base/GPUGeneralKernels.h @@ -86,17 +86,10 @@ class GPUKernelTemplate { return &processors; } -#ifdef GPUCA_NOCOMPAT template GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors, Args... args) { } -#else - template - GPUd() static void Thread(int32_t nBlocks, int32_t nThreads, int32_t iBlock, int32_t iThread, GPUsharedref() GPUSharedMemory& smem, processorType& processors) - { - } -#endif }; // Clean memory, ptr multiple of 16, size will be extended to multiple of 16 diff --git a/GPU/GPUTracking/Base/GPUMemoryResource.h b/GPU/GPUTracking/Base/GPUMemoryResource.h index e61b89d25f2da..143a0ead26235 100644 --- a/GPU/GPUTracking/Base/GPUMemoryResource.h +++ b/GPU/GPUTracking/Base/GPUMemoryResource.h @@ -79,7 +79,7 @@ class GPUMemoryResource GPUMemoryResource(GPUProcessor* proc, void* (GPUProcessor::*setPtr)(void*), MemoryType type, const char* name = "") : mProcessor(proc), mPtr(nullptr), mPtrDevice(nullptr), mSetPointers(setPtr), mName(name), mSize(0), mOverrideSize(0), mReuse(-1), mType(type) { } - GPUMemoryResource(const GPUMemoryResource&) CON_DEFAULT; + GPUMemoryResource(const GPUMemoryResource&) = default; void* SetPointers(void* ptr) { diff --git a/GPU/GPUTracking/Base/GPUParam.cxx b/GPU/GPUTracking/Base/GPUParam.cxx index 661ae830ca6f3..39b5a18c51eff 100644 --- a/GPU/GPUTracking/Base/GPUParam.cxx +++ b/GPU/GPUTracking/Base/GPUParam.cxx @@ -229,9 +229,7 @@ void GPUParam::LoadClusterErrors(bool Print) if (Print) { typedef std::numeric_limits flt; std::cout << std::scientific; -#if __cplusplus >= 201103L std::cout << std::setprecision(flt::max_digits10 + 2); -#endif std::cout << "ParamS0Par[2][3][7]=" << std::endl; std::cout << " { " << std::endl; for (int32_t i = 0; i < 2; i++) { diff --git a/GPU/GPUTracking/Base/GPUParam.h b/GPU/GPUTracking/Base/GPUParam.h index de18b3ccb7e72..1a3ff9065dc94 100644 --- a/GPU/GPUTracking/Base/GPUParam.h +++ b/GPU/GPUTracking/Base/GPUParam.h @@ -22,7 +22,7 @@ #include "GPUTPCGeometry.h" #include "GPUTPCGMPolynomialField.h" -#if !defined(GPUCA_GPUCODE) && defined(GPUCA_NOCOMPAT) +#if !defined(GPUCA_GPUCODE) namespace o2::base { template diff --git a/GPU/GPUTracking/Base/GPUProcessor.h b/GPU/GPUTracking/Base/GPUProcessor.h index af8dd895f4ecf..eb635ae210b73 100644 --- a/GPU/GPUTracking/Base/GPUProcessor.h +++ b/GPU/GPUTracking/Base/GPUProcessor.h @@ -46,8 +46,8 @@ class GPUProcessor #ifndef GPUCA_GPUCODE GPUProcessor(); ~GPUProcessor(); - GPUProcessor(const GPUProcessor&) CON_DELETE; - GPUProcessor& operator=(const GPUProcessor&) CON_DELETE; + GPUProcessor(const GPUProcessor&) = delete; + GPUProcessor& operator=(const GPUProcessor&) = delete; #endif GPUd() GPUconstantref() const GPUConstantMem* GetConstantMem() const; // Body in GPUConstantMem.h to avoid circular headers diff --git a/GPU/GPUTracking/DataTypes/CalibdEdxContainer.h b/GPU/GPUTracking/DataTypes/CalibdEdxContainer.h index 152bb67daacc5..5781984b33222 100644 --- a/GPU/GPUTracking/DataTypes/CalibdEdxContainer.h +++ b/GPU/GPUTracking/DataTypes/CalibdEdxContainer.h @@ -61,17 +61,17 @@ class CalibdEdxContainer : public o2::gpu::FlatObject public: /// Default constructor: creates an empty uninitialized object #ifndef GPUCA_GPUCODE - CalibdEdxContainer() CON_DEFAULT; + CalibdEdxContainer() = default; #endif /// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead - CalibdEdxContainer(const CalibdEdxContainer&) CON_DELETE; + CalibdEdxContainer(const CalibdEdxContainer&) = delete; /// Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead - CalibdEdxContainer& operator=(const CalibdEdxContainer&) CON_DELETE; + CalibdEdxContainer& operator=(const CalibdEdxContainer&) = delete; /// Destructor - ~CalibdEdxContainer() CON_DEFAULT; + ~CalibdEdxContainer() = default; /// \return returns the topology correction for the cluster charge /// \param region region of the TPC diff --git a/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologyPol.h b/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologyPol.h index ff053e1f4bf48..20d53ff80a9c8 100644 --- a/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologyPol.h +++ b/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologyPol.h @@ -54,10 +54,10 @@ class CalibdEdxTrackTopologyPol : public o2::gpu::FlatObject /// \parma name name of the object CalibdEdxTrackTopologyPol(std::string_view fileName, std::string_view name = "CalibdEdxTrackTopologyPol") { loadFromFile(fileName.data(), name.data()); }; /// Default constructor: creates an empty uninitialized object - CalibdEdxTrackTopologyPol() CON_DEFAULT; + CalibdEdxTrackTopologyPol() = default; /// destructor - ~CalibdEdxTrackTopologyPol() CON_DEFAULT; + ~CalibdEdxTrackTopologyPol() = default; #endif #ifdef GPUCA_HAVE_O2HEADERS diff --git a/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologySpline.h b/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologySpline.h index d9d4b9e35592d..9d7cc1d3b8dfc 100644 --- a/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologySpline.h +++ b/GPU/GPUTracking/DataTypes/CalibdEdxTrackTopologySpline.h @@ -76,7 +76,7 @@ class CalibdEdxTrackTopologySpline : public o2::gpu::FlatObject #if !defined(GPUCA_GPUCODE) /// Default constructor - CalibdEdxTrackTopologySpline() CON_DEFAULT; + CalibdEdxTrackTopologySpline() = default; /// constructor with initialization of the splines from file /// \param dEdxSplinesFile path to root file containing the splines @@ -92,13 +92,13 @@ class CalibdEdxTrackTopologySpline : public o2::gpu::FlatObject #else /// Disable constructors for the GPU implementation - CalibdEdxTrackTopologySpline() CON_DELETE; - CalibdEdxTrackTopologySpline(const CalibdEdxTrackTopologySpline&) CON_DELETE; - CalibdEdxTrackTopologySpline& operator=(const CalibdEdxTrackTopologySpline&) CON_DELETE; + CalibdEdxTrackTopologySpline() = delete; + CalibdEdxTrackTopologySpline(const CalibdEdxTrackTopologySpline&) = delete; + CalibdEdxTrackTopologySpline& operator=(const CalibdEdxTrackTopologySpline&) = delete; #endif /// Destructor - ~CalibdEdxTrackTopologySpline() CON_DEFAULT; + ~CalibdEdxTrackTopologySpline() = default; /// _____________ FlatObject functionality, see FlatObject class for description ____________ diff --git a/GPU/GPUTracking/DataTypes/GPUDataTypes.h b/GPU/GPUTracking/DataTypes/GPUDataTypes.h index b0cf3d25274ee..d252bb39857c2 100644 --- a/GPU/GPUTracking/DataTypes/GPUDataTypes.h +++ b/GPU/GPUTracking/DataTypes/GPUDataTypes.h @@ -23,7 +23,6 @@ #include #endif #include "GPUCommonTypeTraits.h" -#ifdef GPUCA_NOCOMPAT #include "GPUTRDDef.h" struct AliHLTTPCClusterMCLabel; @@ -41,7 +40,6 @@ namespace constants } // namespace constants } // namespace tpc } // namespace o2 -#endif namespace o2 { @@ -56,13 +54,9 @@ class MatLayerCylSet; } // namespace base namespace track { -#ifdef GPUCA_NOCOMPAT template class TrackParametrizationWithError; using TrackParCov = TrackParametrizationWithError; -#else -class TrackParCov; -#endif } // namespace track namespace trd { @@ -173,9 +167,7 @@ class GPUDataTypes #endif typedef bitfield RecoStepField; typedef bitfield InOutTypeField; -#ifdef GPUCA_NOCOMPAT static constexpr uint32_t NSLICES = 36; -#endif static DeviceType GetDeviceType(const char* type); }; @@ -186,8 +178,6 @@ struct GPURecoStepConfiguration { GPUDataTypes::InOutTypeField outputs = 0; }; -#ifdef GPUCA_NOCOMPAT - template struct DefaultPtr { typedef T type; @@ -332,12 +322,6 @@ struct GPUTrackingInOutPointers { // Common const GPUSettingsTF* settingsTF = nullptr; }; -#else -struct GPUTrackingInOutPointers { -}; -struct GPUCalibObjectsConst { -}; -#endif #undef ENUM_CLASS #undef ENUM_UINT diff --git a/GPU/GPUTracking/DataTypes/GPUSettings.h b/GPU/GPUTracking/DataTypes/GPUSettings.h index b853d80754080..499287dc3200d 100644 --- a/GPU/GPUTracking/DataTypes/GPUSettings.h +++ b/GPU/GPUTracking/DataTypes/GPUSettings.h @@ -48,7 +48,6 @@ class GPUSettings static CONSTEXPR const uint32_t TPC_MAX_TF_TIME_BIN = ((256 * 3564 + 2 * 8 - 2) / 8); }; -#ifdef GPUCA_NOCOMPAT // Settings describing the global run parameters struct GPUSettingsGRP { // All new members must be sizeof(int32_t) resp. sizeof(float) for alignment reasons!, default value for newly added members for old data will be 0. @@ -79,7 +78,6 @@ struct GPUSettingsDeviceBackend { uint8_t forceDeviceType = 1; // Fail if device initialization fails, otherwise falls back to CPU GPUReconstruction* master = nullptr; // GPUReconstruction master object }; -#endif } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.cxx b/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.cxx index cb367a0f4b416..37d32ed4c1bc5 100644 --- a/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.cxx +++ b/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.cxx @@ -29,9 +29,7 @@ void GPUTPCGMPolynomialField::Print() const const double kCLight = gpu_common_constants::kCLight; typedef std::numeric_limits flt; cout << std::scientific; -#if __cplusplus >= 201103L cout << std::setprecision(flt::max_digits10 + 2); -#endif cout << " nominal field " << mNominalBz << " [kG * (2.99792458E-4 GeV/c/kG/cm)]" << " == " << mNominalBz / kCLight << " [kG]" << endl; diff --git a/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h b/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h index 75b08047834bb..fcafa34547828 100644 --- a/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h +++ b/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h @@ -35,32 +35,32 @@ namespace gpu class GPUTPCGeometry // TODO: Make values constexpr { #ifdef GPUCA_TPC_GEOMETRY_O2 - const float mX[GPUCA_ROW_COUNT] GPUCA_CPP11_INIT(= {85.225f, 85.975f, 86.725f, 87.475f, 88.225f, 88.975f, 89.725f, 90.475f, 91.225f, 91.975f, 92.725f, 93.475f, 94.225f, 94.975f, 95.725f, 96.475f, 97.225f, 97.975f, 98.725f, 99.475f, 100.225f, 100.975f, - 101.725f, 102.475f, 103.225f, 103.975f, 104.725f, 105.475f, 106.225f, 106.975f, 107.725f, 108.475f, 109.225f, 109.975f, 110.725f, 111.475f, 112.225f, 112.975f, 113.725f, 114.475f, 115.225f, 115.975f, 116.725f, 117.475f, - 118.225f, 118.975f, 119.725f, 120.475f, 121.225f, 121.975f, 122.725f, 123.475f, 124.225f, 124.975f, 125.725f, 126.475f, 127.225f, 127.975f, 128.725f, 129.475f, 130.225f, 130.975f, 131.725f, 135.2f, 136.2f, 137.2f, - 138.2f, 139.2f, 140.2f, 141.2f, 142.2f, 143.2f, 144.2f, 145.2f, 146.2f, 147.2f, 148.2f, 149.2f, 150.2f, 151.2f, 152.2f, 153.2f, 154.2f, 155.2f, 156.2f, 157.2f, 158.2f, 159.2f, - 160.2f, 161.2f, 162.2f, 163.2f, 164.2f, 165.2f, 166.2f, 167.2f, 168.2f, 171.4f, 172.6f, 173.8f, 175.f, 176.2f, 177.4f, 178.6f, 179.8f, 181.f, 182.2f, 183.4f, 184.6f, 185.8f, - 187.f, 188.2f, 189.4f, 190.6f, 191.8f, 193.f, 194.2f, 195.4f, 196.6f, 197.8f, 199.f, 200.2f, 201.4f, 202.6f, 203.8f, 205.f, 206.2f, 209.65f, 211.15f, 212.65f, 214.15f, 215.65f, - 217.15f, 218.65f, 220.15f, 221.65f, 223.15f, 224.65f, 226.15f, 227.65f, 229.15f, 230.65f, 232.15f, 233.65f, 235.15f, 236.65f, 238.15f, 239.65f, 241.15f, 242.65f, 244.15f, 245.65f}); + const float mX[GPUCA_ROW_COUNT] = {85.225f, 85.975f, 86.725f, 87.475f, 88.225f, 88.975f, 89.725f, 90.475f, 91.225f, 91.975f, 92.725f, 93.475f, 94.225f, 94.975f, 95.725f, 96.475f, 97.225f, 97.975f, 98.725f, 99.475f, 100.225f, 100.975f, + 101.725f, 102.475f, 103.225f, 103.975f, 104.725f, 105.475f, 106.225f, 106.975f, 107.725f, 108.475f, 109.225f, 109.975f, 110.725f, 111.475f, 112.225f, 112.975f, 113.725f, 114.475f, 115.225f, 115.975f, 116.725f, 117.475f, + 118.225f, 118.975f, 119.725f, 120.475f, 121.225f, 121.975f, 122.725f, 123.475f, 124.225f, 124.975f, 125.725f, 126.475f, 127.225f, 127.975f, 128.725f, 129.475f, 130.225f, 130.975f, 131.725f, 135.2f, 136.2f, 137.2f, + 138.2f, 139.2f, 140.2f, 141.2f, 142.2f, 143.2f, 144.2f, 145.2f, 146.2f, 147.2f, 148.2f, 149.2f, 150.2f, 151.2f, 152.2f, 153.2f, 154.2f, 155.2f, 156.2f, 157.2f, 158.2f, 159.2f, + 160.2f, 161.2f, 162.2f, 163.2f, 164.2f, 165.2f, 166.2f, 167.2f, 168.2f, 171.4f, 172.6f, 173.8f, 175.f, 176.2f, 177.4f, 178.6f, 179.8f, 181.f, 182.2f, 183.4f, 184.6f, 185.8f, + 187.f, 188.2f, 189.4f, 190.6f, 191.8f, 193.f, 194.2f, 195.4f, 196.6f, 197.8f, 199.f, 200.2f, 201.4f, 202.6f, 203.8f, 205.f, 206.2f, 209.65f, 211.15f, 212.65f, 214.15f, 215.65f, + 217.15f, 218.65f, 220.15f, 221.65f, 223.15f, 224.65f, 226.15f, 227.65f, 229.15f, 230.65f, 232.15f, 233.65f, 235.15f, 236.65f, 238.15f, 239.65f, 241.15f, 242.65f, 244.15f, 245.65f}; - const uint8_t mNPads[GPUCA_ROW_COUNT] GPUCA_CPP11_INIT(= {66, 66, 66, 68, 68, 68, 70, 70, 70, 72, 72, 72, 74, 74, 74, 74, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 82, 82, 82, 84, 84, 84, 86, 86, 86, 88, 88, 88, - 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 92, 92, 92, 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 100, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 80, 82, 82, - 82, 84, 84, 84, 84, 86, 86, 86, 88, 88, 88, 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 102, 102, 102, 104, 104, 104, 106, 110, - 110, 112, 112, 112, 114, 114, 114, 116, 116, 116, 118, 118, 118, 118, 118, 120, 120, 122, 122, 124, 124, 124, 126, 126, 128, 128, 128, 130, 130, 132, 132, 132, 134, 134, 136, 136, 138, 138}); + const uint8_t mNPads[GPUCA_ROW_COUNT] = {66, 66, 66, 68, 68, 68, 70, 70, 70, 72, 72, 72, 74, 74, 74, 74, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 82, 82, 82, 84, 84, 84, 86, 86, 86, 88, 88, 88, + 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 92, 92, 92, 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 100, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 80, 82, 82, + 82, 84, 84, 84, 84, 86, 86, 86, 88, 88, 88, 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 102, 102, 102, 104, 104, 104, 106, 110, + 110, 112, 112, 112, 114, 114, 114, 116, 116, 116, 118, 118, 118, 118, 118, 120, 120, 122, 122, 124, 124, 124, 126, 126, 128, 128, 128, 130, 130, 132, 132, 132, 134, 134, 136, 136, 138, 138}; - const uint8_t mRegion[GPUCA_ROW_COUNT] GPUCA_CPP11_INIT(= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}); - const uint8_t mRegionRows[10] GPUCA_CPP11_INIT(= {17, 15, 16, 15, 18, 16, 16, 14, 13, 12}); - const uint8_t mRegionStart[10] GPUCA_CPP11_INIT(= {0, 17, 32, 48, 63, 81, 97, 113, 127, 140}); + const uint8_t mRegion[GPUCA_ROW_COUNT] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; + const uint8_t mRegionRows[10] = {17, 15, 16, 15, 18, 16, 16, 14, 13, 12}; + const uint8_t mRegionStart[10] = {0, 17, 32, 48, 63, 81, 97, 113, 127, 140}; - const uint8_t mSampaMapping[10] GPUCA_CPP11_INIT(= {0, 0, 1, 1, 2, 3, 3, 4, 4, 2}); - const uint8_t mChannelOffset[10] GPUCA_CPP11_INIT(= {0, 16, 0, 16, 0, 0, 16, 0, 16, 16}); - const uint8_t mSectorFECOffset[5] GPUCA_CPP11_INIT(= {0, 15, 15 + 18, 15 + 18 + 18, 15 + 18 + 18 + 20}); + const uint8_t mSampaMapping[10] = {0, 0, 1, 1, 2, 3, 3, 4, 4, 2}; + const uint8_t mChannelOffset[10] = {0, 16, 0, 16, 0, 0, 16, 0, 16, 16}; + const uint8_t mSectorFECOffset[5] = {0, 15, 15 + 18, 15 + 18 + 18, 15 + 18 + 18 + 20}; - 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}); + const float mPadHeight[10] = {.75f, .75f, .75f, .75f, 1.f, 1.f, 1.2f, 1.2f, 1.5f, 1.5f}; + const float mPadWidth[10] = {.416f, .420f, .420f, .436f, .6f, .6f, .608f, .588f, .604f, .607f}; - static CONSTEXPR float FACTOR_T2Z GPUCA_CPP11_INIT(= 250.f / 512.f); // Used in compression, must remain constant at 250cm, 512 time bins! + static CONSTEXPR float FACTOR_T2Z = 250.f / 512.f; // Used in compression, must remain constant at 250cm, 512 time bins! public: GPUd() int32_t GetRegion(int32_t row) const { return mRegion[row]; } @@ -74,23 +74,23 @@ class GPUTPCGeometry // TODO: Make values constexpr GPUd() int32_t EndOROC1() const { return 97; } GPUd() int32_t EndOROC2() const { return 127; } #else - const float mX[GPUCA_ROW_COUNT] GPUCA_CPP11_INIT(= {85.195f, 85.945f, 86.695f, 87.445f, 88.195f, 88.945f, 89.695f, 90.445f, 91.195f, 91.945f, 92.695f, 93.445f, 94.195f, 94.945f, 95.695f, 96.445f, 97.195f, 97.945f, 98.695f, 99.445f, 100.195f, 100.945f, 101.695f, - 102.445f, 103.195f, 103.945f, 104.695f, 105.445f, 106.195f, 106.945f, 107.695f, 108.445f, 109.195f, 109.945f, 110.695f, 111.445f, 112.195f, 112.945f, 113.695f, 114.445f, 115.195f, 115.945f, 116.695f, 117.445f, 118.195f, 118.945f, - 119.695f, 120.445f, 121.195f, 121.945f, 122.695f, 123.445f, 124.195f, 124.945f, 125.695f, 126.445f, 127.195f, 127.945f, 128.695f, 129.445f, 130.195f, 130.945f, 131.695f, 135.180f, 136.180f, 137.180f, 138.180f, 139.180f, 140.180f, - 141.180f, 142.180f, 143.180f, 144.180f, 145.180f, 146.180f, 147.180f, 148.180f, 149.180f, 150.180f, 151.180f, 152.180f, 153.180f, 154.180f, 155.180f, 156.180f, 157.180f, 158.180f, 159.180f, 160.180f, 161.180f, 162.180f, 163.180f, - 164.180f, 165.180f, 166.180f, 167.180f, 168.180f, 169.180f, 170.180f, 171.180f, 172.180f, 173.180f, 174.180f, 175.180f, 176.180f, 177.180f, 178.180f, 179.180f, 180.180f, 181.180f, 182.180f, 183.180f, 184.180f, 185.180f, 186.180f, - 187.180f, 188.180f, 189.180f, 190.180f, 191.180f, 192.180f, 193.180f, 194.180f, 195.180f, 196.180f, 197.180f, 198.180f, 199.430f, 200.930f, 202.430f, 203.930f, 205.430f, 206.930f, 208.430f, 209.930f, 211.430f, 212.930f, 214.430f, - 215.930f, 217.430f, 218.930f, 220.430f, 221.930f, 223.430f, 224.930f, 226.430f, 227.930f, 229.430f, 230.930f, 232.430f, 233.930f, 235.430f, 236.930f, 238.430f, 239.930f, 241.430f, 242.930f, 244.430f, 245.930f}); + const float mX[GPUCA_ROW_COUNT] = {85.195f, 85.945f, 86.695f, 87.445f, 88.195f, 88.945f, 89.695f, 90.445f, 91.195f, 91.945f, 92.695f, 93.445f, 94.195f, 94.945f, 95.695f, 96.445f, 97.195f, 97.945f, 98.695f, 99.445f, 100.195f, 100.945f, 101.695f, + 102.445f, 103.195f, 103.945f, 104.695f, 105.445f, 106.195f, 106.945f, 107.695f, 108.445f, 109.195f, 109.945f, 110.695f, 111.445f, 112.195f, 112.945f, 113.695f, 114.445f, 115.195f, 115.945f, 116.695f, 117.445f, 118.195f, 118.945f, + 119.695f, 120.445f, 121.195f, 121.945f, 122.695f, 123.445f, 124.195f, 124.945f, 125.695f, 126.445f, 127.195f, 127.945f, 128.695f, 129.445f, 130.195f, 130.945f, 131.695f, 135.180f, 136.180f, 137.180f, 138.180f, 139.180f, 140.180f, + 141.180f, 142.180f, 143.180f, 144.180f, 145.180f, 146.180f, 147.180f, 148.180f, 149.180f, 150.180f, 151.180f, 152.180f, 153.180f, 154.180f, 155.180f, 156.180f, 157.180f, 158.180f, 159.180f, 160.180f, 161.180f, 162.180f, 163.180f, + 164.180f, 165.180f, 166.180f, 167.180f, 168.180f, 169.180f, 170.180f, 171.180f, 172.180f, 173.180f, 174.180f, 175.180f, 176.180f, 177.180f, 178.180f, 179.180f, 180.180f, 181.180f, 182.180f, 183.180f, 184.180f, 185.180f, 186.180f, + 187.180f, 188.180f, 189.180f, 190.180f, 191.180f, 192.180f, 193.180f, 194.180f, 195.180f, 196.180f, 197.180f, 198.180f, 199.430f, 200.930f, 202.430f, 203.930f, 205.430f, 206.930f, 208.430f, 209.930f, 211.430f, 212.930f, 214.430f, + 215.930f, 217.430f, 218.930f, 220.430f, 221.930f, 223.430f, 224.930f, 226.430f, 227.930f, 229.430f, 230.930f, 232.430f, 233.930f, 235.430f, 236.930f, 238.430f, 239.930f, 241.430f, 242.930f, 244.430f, 245.930f}; - const uint8_t mNPads[GPUCA_ROW_COUNT] GPUCA_CPP11_INIT(= {68, 68, 68, 68, 70, 70, 70, 72, 72, 72, 74, 74, 74, 76, 76, 76, 78, 78, 78, 80, 80, 80, 82, 82, 82, 84, 84, 84, 86, 86, 86, 88, 88, 88, 90, 90, 90, 92, 92, 92, - 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 100, 102, 102, 102, 104, 104, 104, 106, 106, 106, 108, 108, 74, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 80, 82, 82, 82, 84, 84, - 84, 86, 86, 86, 86, 88, 88, 88, 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 96, 96, 96, 96, 98, 98, 98, 100, 100, 100, 100, 102, 102, 102, 104, 104, 104, 106, 106, 106, 106, 108, - 108, 108, 110, 110, 110, 110, 112, 112, 114, 114, 114, 116, 116, 118, 118, 120, 120, 122, 122, 122, 124, 124, 126, 126, 128, 128, 130, 130, 130, 132, 132, 134, 134, 136, 136, 138, 138, 138, 140}); + const uint8_t mNPads[GPUCA_ROW_COUNT] = {68, 68, 68, 68, 70, 70, 70, 72, 72, 72, 74, 74, 74, 76, 76, 76, 78, 78, 78, 80, 80, 80, 82, 82, 82, 84, 84, 84, 86, 86, 86, 88, 88, 88, 90, 90, 90, 92, 92, 92, + 94, 94, 94, 96, 96, 96, 98, 98, 98, 100, 100, 100, 102, 102, 102, 104, 104, 104, 106, 106, 106, 108, 108, 74, 76, 76, 76, 76, 78, 78, 78, 80, 80, 80, 80, 82, 82, 82, 84, 84, + 84, 86, 86, 86, 86, 88, 88, 88, 90, 90, 90, 90, 92, 92, 92, 94, 94, 94, 96, 96, 96, 96, 98, 98, 98, 100, 100, 100, 100, 102, 102, 102, 104, 104, 104, 106, 106, 106, 106, 108, + 108, 108, 110, 110, 110, 110, 112, 112, 114, 114, 114, 116, 116, 118, 118, 120, 120, 122, 122, 122, 124, 124, 126, 126, 128, 128, 130, 130, 130, 132, 132, 134, 134, 136, 136, 138, 138, 138, 140}; - const float mPadHeight[3] GPUCA_CPP11_INIT(= {.75f, 1.f, 1.5f}); - const float mPadWidth[3] GPUCA_CPP11_INIT(= {.4f, .6f, .6f}); + const float mPadHeight[3] = {.75f, 1.f, 1.5f}; + const float mPadWidth[3] = {.4f, .6f, .6f}; - static CONSTEXPR float FACTOR_T2Z GPUCA_CPP11_INIT(= 250.f / 1024.f); // Used in compression, must remain constant at 250cm, 1024 time bins! + static CONSTEXPR float FACTOR_T2Z = 250.f / 1024.f; // Used in compression, must remain constant at 250cm, 1024 time bins! public: GPUd() int32_t GetRegion(int32_t row) const { return (row < 63 ? 0 : row < 63 + 64 ? 1 : 2); } @@ -102,7 +102,7 @@ class GPUTPCGeometry // TODO: Make values constexpr GPUd() int32_t EndOROC2() const { return GPUCA_ROW_COUNT; } #endif private: - static CONSTEXPR float FACTOR_Z2T GPUCA_CPP11_INIT(= 1.f / FACTOR_T2Z); + static CONSTEXPR float FACTOR_Z2T = 1.f / FACTOR_T2Z; public: GPUd() static CONSTEXPR float TPCLength() { return 250.f - 0.275f; } diff --git a/GPU/GPUTracking/Definitions/GPUDefGPUParameters.h b/GPU/GPUTracking/Definitions/GPUDefGPUParameters.h index 3852d37f6facf..7cd41e1a4f846 100644 --- a/GPU/GPUTracking/Definitions/GPUDefGPUParameters.h +++ b/GPU/GPUTracking/Definitions/GPUDefGPUParameters.h @@ -617,13 +617,11 @@ // #define GPUCA_KERNEL_DEBUGGER_OUTPUT // Some assertions to make sure out parameters are not invalid -#ifdef GPUCA_NOCOMPAT static_assert(GPUCA_MAXN >= GPUCA_NEIGHBOURS_FINDER_MAX_NNEIGHUP, "Invalid GPUCA_NEIGHBOURS_FINDER_MAX_NNEIGHUP"); static_assert(GPUCA_ROW_COUNT >= GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE, "Invalid GPUCA_TRACKLET_SELECTOR_HITS_REG_SIZE"); #ifdef GPUCA_GPUCODE static_assert(GPUCA_M_FIRST(GPUCA_LB_GPUTPCCompressionKernels_step1unattached) * 2 <= GPUCA_TPC_COMP_CHUNK_SIZE, "Invalid GPUCA_TPC_COMP_CHUNK_SIZE"); #endif -#endif // Derived parameters #ifdef GPUCA_USE_TEXTURES diff --git a/GPU/GPUTracking/Definitions/GPULogging.h b/GPU/GPUTracking/Definitions/GPULogging.h index d071cc791b675..79f888501745f 100644 --- a/GPU/GPUTracking/Definitions/GPULogging.h +++ b/GPU/GPUTracking/Definitions/GPULogging.h @@ -17,15 +17,7 @@ #include "GPUCommonDef.h" // clang-format off -#if !defined(GPUCA_NOCOMPAT) - // just disable - #define GPUInfo(...) - #define GPUImportant(...) - #define GPUWarning(...) - #define GPUAlarm(...) - #define GPUError(...) - #define GPUFatal(...) -#elif defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_GPU_DEBUG_PRINT) +#if defined(GPUCA_GPUCODE_DEVICE) && !defined(GPUCA_GPU_DEBUG_PRINT) // Compile-time disable for performance-reasons #define GPUInfo(...) #define GPUImportant(...) @@ -73,19 +65,11 @@ } #define GPUAlarm(...) GPUWarning(__VA_ARGS__) #define GPUError(...) GPUWarning(__VA_ARGS__) - #ifdef GPUCA_NOCOMPAT - #define GPUFatal(string, ...) \ - { \ - fprintf(stderr, string "\n", ##__VA_ARGS__); \ - throw std::exception(); \ - } - #else - #define GPUFatal(string, ...) \ - { \ - fprintf(stderr, string "\n", __VA_ARGS__); \ - exit(1); \ - } - #endif + #define GPUFatal(string, ...) \ + { \ + fprintf(stderr, string "\n", __VA_ARGS__); \ + exit(1); \ + } #endif #elif defined(GPUCA_ALIROOT_LIB) // Forward to HLT Logging functions for AliRoot diff --git a/GPU/GPUTracking/Global/AliHLTGPUDumpComponent.h b/GPU/GPUTracking/Global/AliHLTGPUDumpComponent.h index 4174b6b8aab46..a4977e6859968 100644 --- a/GPU/GPUTracking/Global/AliHLTGPUDumpComponent.h +++ b/GPU/GPUTracking/Global/AliHLTGPUDumpComponent.h @@ -42,8 +42,8 @@ class AliHLTGPUDumpComponent : public AliHLTProcessor AliHLTGPUDumpComponent(); - AliHLTGPUDumpComponent(const AliHLTGPUDumpComponent&) CON_DELETE; - AliHLTGPUDumpComponent& operator=(const AliHLTGPUDumpComponent&) CON_DELETE; + AliHLTGPUDumpComponent(const AliHLTGPUDumpComponent&) = delete; + AliHLTGPUDumpComponent& operator=(const AliHLTGPUDumpComponent&) = delete; virtual ~AliHLTGPUDumpComponent(); diff --git a/GPU/GPUTracking/Merger/GPUTPCGMMerger.h b/GPU/GPUTracking/Merger/GPUTPCGMMerger.h index b3b23270f566f..af5f7d177e6cc 100644 --- a/GPU/GPUTracking/Merger/GPUTPCGMMerger.h +++ b/GPU/GPUTracking/Merger/GPUTPCGMMerger.h @@ -63,9 +63,9 @@ class GPUTPCGMMerger : public GPUProcessor { public: GPUTPCGMMerger(); - ~GPUTPCGMMerger() CON_DEFAULT; - GPUTPCGMMerger(const GPUTPCGMMerger&) CON_DELETE; - const GPUTPCGMMerger& operator=(const GPUTPCGMMerger&) const CON_DELETE; + ~GPUTPCGMMerger() = default; + GPUTPCGMMerger(const GPUTPCGMMerger&) = delete; + const GPUTPCGMMerger& operator=(const GPUTPCGMMerger&) const = delete; static CONSTEXPR const int32_t NSLICES = GPUCA_NSLICES; //* N slices struct memory { diff --git a/GPU/GPUTracking/Merger/GPUTPCGMPhysicalTrackModel.h b/GPU/GPUTracking/Merger/GPUTPCGMPhysicalTrackModel.h index c77ef99e3790c..c65e6df6c320f 100644 --- a/GPU/GPUTracking/Merger/GPUTPCGMPhysicalTrackModel.h +++ b/GPU/GPUTracking/Merger/GPUTPCGMPhysicalTrackModel.h @@ -34,7 +34,7 @@ namespace gpu class GPUTPCGMPhysicalTrackModel { public: - GPUdDefault() GPUTPCGMPhysicalTrackModel() CON_DEFAULT; + GPUdDefault() GPUTPCGMPhysicalTrackModel() = default; GPUd() GPUTPCGMPhysicalTrackModel(const GPUTPCGMTrackParam& t); GPUd() void Set(const GPUTPCGMTrackParam& t); diff --git a/GPU/GPUTracking/Merger/GPUTPCGMPolynomialFieldManager.h b/GPU/GPUTracking/Merger/GPUTPCGMPolynomialFieldManager.h index 59f9cfcacb3d6..a58c3485321fd 100644 --- a/GPU/GPUTracking/Merger/GPUTPCGMPolynomialFieldManager.h +++ b/GPU/GPUTracking/Merger/GPUTPCGMPolynomialFieldManager.h @@ -39,7 +39,7 @@ class GPUTPCGMPolynomialFieldManager k2kG, k5kG }; // known fitted polynomial fields, stored in constants - GPUTPCGMPolynomialFieldManager() CON_DEFAULT; + GPUTPCGMPolynomialFieldManager() = default; /* Get appropriate pre-calculated polynomial field for the given field value nominalFieldkG */ diff --git a/GPU/GPUTracking/Merger/GPUTPCGMPropagator.h b/GPU/GPUTracking/Merger/GPUTPCGMPropagator.h index c6a188ced5435..0a35875764ae5 100644 --- a/GPU/GPUTracking/Merger/GPUTPCGMPropagator.h +++ b/GPU/GPUTracking/Merger/GPUTPCGMPropagator.h @@ -65,7 +65,7 @@ class GPUTPCGMPropagator rejectInterReject = 3 }; - GPUdDefault() GPUTPCGMPropagator() CON_DEFAULT; + GPUdDefault() GPUTPCGMPropagator() = default; struct MaterialCorrection { GPUhd() MaterialCorrection() : radLen(28811.7f), rho(1.025e-3f), radLenInv(1.f / radLen), DLMax(0.f), EP2(0.f), sigmadE2(0.f), k22(0.f), k33(0.f), k43(0.f), k44(0.f) {} diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h b/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h index 9ab74d969d965..c45c35c667f25 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSliceData.h @@ -34,7 +34,7 @@ class GPUTPCSliceData GPUTPCSliceData() : mNumberOfHits(0), mNumberOfHitsPlusAlign(0), mClusterIdOffset(0), mGPUTextureBase(nullptr), mRows(nullptr), mLinkUpData(nullptr), mLinkDownData(nullptr), mClusterData(nullptr) {} #ifndef GPUCA_GPUCODE_DEVICE - ~GPUTPCSliceData() CON_DEFAULT; + ~GPUTPCSliceData() = default; void InitializeRows(const GPUParam& p); void SetMaxData(); void SetClusterData(const GPUTPCClusterData* data, int32_t nClusters, int32_t clusterIdOffset); @@ -123,8 +123,8 @@ class GPUTPCSliceData private: #ifndef GPUCA_GPUCODE - GPUTPCSliceData& operator=(const GPUTPCSliceData&) CON_DELETE; // ROOT 5 tries to use this if it is not private - GPUTPCSliceData(const GPUTPCSliceData&) CON_DELETE; // + GPUTPCSliceData& operator=(const GPUTPCSliceData&) = delete; // ROOT 5 tries to use this if it is not private + GPUTPCSliceData(const GPUTPCSliceData&) = delete; // #endif GPUd() void CreateGrid(GPUconstantref() const GPUConstantMem* mem, GPUTPCRow* GPUrestrict() row, float yMin, float yMax, float zMin, float zMax); GPUd() void SetRowGridEmpty(GPUTPCRow& GPUrestrict() row); diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h b/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h index 5108c3f2ec8bb..6d322601789b6 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCSliceOutput.h @@ -65,10 +65,10 @@ class GPUTPCSliceOutput GPUhd() void SetNTrackClusters(uint32_t v) { mNTrackClusters = v; } private: - GPUTPCSliceOutput() CON_DELETE; // NOLINT: Must be private or ROOT tries to use them! - ~GPUTPCSliceOutput() CON_DELETE; // NOLINT - GPUTPCSliceOutput(const GPUTPCSliceOutput&) CON_DELETE; // NOLINT - GPUTPCSliceOutput& operator=(const GPUTPCSliceOutput&) CON_DELETE; // NOLINT + GPUTPCSliceOutput() = delete; // NOLINT: Must be private or ROOT tries to use them! + ~GPUTPCSliceOutput() = delete; // NOLINT + GPUTPCSliceOutput(const GPUTPCSliceOutput&) = delete; // NOLINT + GPUTPCSliceOutput& operator=(const GPUTPCSliceOutput&) = delete; // NOLINT GPUhd() void SetMemorySize(size_t val) { mMemorySize = val; } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h b/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h index 50c99cd3ad6ec..9553435fc49ab 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrack.h @@ -37,7 +37,7 @@ class GPUTPCTrack GPUTPCTrack() : mFirstHitID(0), mNHits(0), mLocalTrackId(-1), mParam() { } - ~GPUTPCTrack() CON_DEFAULT; + ~GPUTPCTrack() = default; #endif //! GPUCA_GPUCODE GPUhd() int32_t NHits() const { return mNHits; } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h index 5a320a8863992..bd1ca018186e4 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTracker.h @@ -44,8 +44,8 @@ class GPUTPCTracker : public GPUProcessor #ifndef GPUCA_GPUCODE_DEVICE GPUTPCTracker(); ~GPUTPCTracker(); - GPUTPCTracker(const GPUTPCTracker&) CON_DELETE; - GPUTPCTracker& operator=(const GPUTPCTracker&) CON_DELETE; + GPUTPCTracker(const GPUTPCTracker&) = delete; + GPUTPCTracker& operator=(const GPUTPCTracker&) = delete; void SetSlice(int32_t iSlice); void InitializeProcessor(); diff --git a/GPU/GPUTracking/TPCClusterFinder/CfFragment.h b/GPU/GPUTracking/TPCClusterFinder/CfFragment.h index ae95bfdc61358..48e3cbf6200fe 100644 --- a/GPU/GPUTracking/TPCClusterFinder/CfFragment.h +++ b/GPU/GPUTracking/TPCClusterFinder/CfFragment.h @@ -41,7 +41,7 @@ struct CfFragment { tpccf::TPCTime totalSliceLength = 0; tpccf::TPCFragmentTime maxSubSliceLength = 0; - GPUdDefault() CfFragment() CON_DEFAULT; + GPUdDefault() CfFragment() = default; GPUd() CfFragment(tpccf::TPCTime totalSliceLen, tpccf::TPCFragmentTime maxSubSliceLen) : CfFragment(0, false, 0, totalSliceLen, maxSubSliceLen) {} diff --git a/GPU/GPUTracking/TPCClusterFinder/ChargePos.h b/GPU/GPUTracking/TPCClusterFinder/ChargePos.h index f5ca9dbedd5ac..f852212d180f8 100644 --- a/GPU/GPUTracking/TPCClusterFinder/ChargePos.h +++ b/GPU/GPUTracking/TPCClusterFinder/ChargePos.h @@ -28,7 +28,7 @@ struct ChargePos { tpccf::GlobalPad gpad; tpccf::TPCFragmentTime timePadded; - GPUdDefault() ChargePos() CON_DEFAULT; + GPUdDefault() ChargePos() = default; constexpr GPUhdi() ChargePos(tpccf::Row row, tpccf::Pad pad, tpccf::TPCFragmentTime t) : gpad(tpcGlobalPadIdx(row, pad)), timePadded(t + GPUCF_PADDING_TIME) diff --git a/GPU/GPUTracking/TPCClusterFinder/PackedCharge.h b/GPU/GPUTracking/TPCClusterFinder/PackedCharge.h index 644e2074d92ca..9d13f431adc2b 100644 --- a/GPU/GPUTracking/TPCClusterFinder/PackedCharge.h +++ b/GPU/GPUTracking/TPCClusterFinder/PackedCharge.h @@ -38,7 +38,7 @@ class PackedCharge IsSplitMask = 1 << (ChargeBits + 1), }; - GPUdDefault() PackedCharge() CON_DEFAULT; + GPUdDefault() PackedCharge() = default; GPUdi() explicit PackedCharge(tpccf::Charge q) : PackedCharge(q, false, false) {} GPUdi() PackedCharge(tpccf::Charge q, bool peak3x3, bool wasSplit) { diff --git a/GPU/GPUTracking/TRDTracking/GPUTRDInterfaces.h b/GPU/GPUTracking/TRDTracking/GPUTRDInterfaces.h index 8436f584e59f5..f0ae1bde58334 100644 --- a/GPU/GPUTracking/TRDTracking/GPUTRDInterfaces.h +++ b/GPU/GPUTracking/TRDTracking/GPUTRDInterfaces.h @@ -51,7 +51,7 @@ class trackInterface : public AliExternalTrackParam public: trackInterface() : AliExternalTrackParam(){}; trackInterface(const trackInterface& param) : AliExternalTrackParam(param){}; - trackInterface(const AliExternalTrackParam& param) CON_DELETE; + trackInterface(const AliExternalTrackParam& param) = delete; trackInterface(const AliHLTExternalTrackParam& param) : AliExternalTrackParam() { float paramTmp[5] = {param.fY, param.fZ, param.fSinPhi, param.fTgl, param.fq1Pt}; @@ -102,8 +102,8 @@ class propagatorInterface : public AliTrackerBase public: typedef void propagatorParam; propagatorInterface(const propagatorParam* = nullptr) : AliTrackerBase(), mParam(nullptr){}; - propagatorInterface(const propagatorInterface&) CON_DELETE; - propagatorInterface& operator=(const propagatorInterface&) CON_DELETE; + propagatorInterface(const propagatorInterface&) = delete; + propagatorInterface& operator=(const propagatorInterface&) = delete; bool propagateToX(float x, float maxSnp, float maxStep) { return PropagateTrackToBxByBz(mParam, x, 0.13957f, maxStep, false, maxSnp); } int32_t getPropagatedYZ(float x, float& projY, float& projZ) @@ -207,8 +207,8 @@ template <> class trackInterface : public GPUTPCGMTrackParam { public: - GPUdDefault() trackInterface() CON_DEFAULT; - GPUd() trackInterface(const GPUTPCGMTrackParam& param) CON_DELETE; + GPUdDefault() trackInterface() = default; + GPUd() trackInterface(const GPUTPCGMTrackParam& param) = delete; GPUd() trackInterface(const GPUTPCGMMergedTrack& trk) : GPUTPCGMTrackParam(trk.GetParam()), mAlpha(trk.GetAlpha()) {} GPUd() trackInterface(const gputpcgmmergertypes::GPUTPCOuterParam& param) : GPUTPCGMTrackParam(), mAlpha(param.alpha) { @@ -220,10 +220,8 @@ class trackInterface : public GPUTPCGMTrackParam SetCov(i, param.C[i]); } }; -#ifdef GPUCA_NOCOMPAT GPUdDefault() trackInterface(const trackInterface& param) = default; GPUdDefault() trackInterface& operator=(const trackInterface& param) = default; -#endif #ifdef GPUCA_ALIROOT_LIB trackInterface(const AliHLTExternalTrackParam& param) : GPUTPCGMTrackParam(), mAlpha(param.fAlpha) { @@ -319,8 +317,8 @@ class propagatorInterface : public GPUTPCGMPropagator this->SetFitInProjections(0); this->SelectFieldRegion(GPUTPCGMPropagator::TRD); }; - propagatorInterface(const propagatorInterface&) CON_DELETE; - propagatorInterface& operator=(const propagatorInterface&) CON_DELETE; + propagatorInterface(const propagatorInterface&) = delete; + propagatorInterface& operator=(const propagatorInterface&) = delete; GPUd() void setTrack(trackInterface* trk) { SetTrack(trk, trk->getAlpha()); diff --git a/GPU/GPUTracking/TRDTracking/GPUTRDSpacePoint.h b/GPU/GPUTracking/TRDTracking/GPUTRDSpacePoint.h index 1af4812e5b23f..23e26d8354343 100644 --- a/GPU/GPUTracking/TRDTracking/GPUTRDSpacePoint.h +++ b/GPU/GPUTracking/TRDTracking/GPUTRDSpacePoint.h @@ -60,9 +60,7 @@ class GPUTRDSpacePoint : public o2::trd::CalibratedTracklet { }; -#ifdef GPUCA_NOCOMPAT static_assert(sizeof(GPUTRDSpacePoint) == sizeof(o2::trd::CalibratedTracklet), "Incorrect memory layout"); -#endif } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/TRDTracking/GPUTRDTracker.h b/GPU/GPUTracking/TRDTracking/GPUTRDTracker.h index 3d387d3694fe5..96a5547ad28de 100644 --- a/GPU/GPUTracking/TRDTracking/GPUTRDTracker.h +++ b/GPU/GPUTracking/TRDTracking/GPUTRDTracker.h @@ -54,8 +54,8 @@ class GPUTRDTracker_t : public GPUProcessor public: #ifndef GPUCA_GPUCODE GPUTRDTracker_t(); - GPUTRDTracker_t(const GPUTRDTracker_t& tracker) CON_DELETE; - GPUTRDTracker_t& operator=(const GPUTRDTracker_t& tracker) CON_DELETE; + GPUTRDTracker_t(const GPUTRDTracker_t& tracker) = delete; + GPUTRDTracker_t& operator=(const GPUTRDTracker_t& tracker) = delete; ~GPUTRDTracker_t(); void SetMaxData(const GPUTrackingInOutPointers& io); @@ -194,7 +194,7 @@ class GPUTRDTracker_t : public GPUProcessor float mAngleToDyC; // parameterization for conversion track angle -> tracklet deflection /// ---- end error parametrization ---- bool mDebugOutput; // store debug output - static CONSTEXPR const float sRadialOffset GPUCA_CPP11_INIT(= -0.1f); // due to (possible) mis-calibration of t0 -> will become obsolete when tracklet conversion is done outside of the tracker + static CONSTEXPR const float sRadialOffset = -0.1f; // due to (possible) mis-calibration of t0 -> will become obsolete when tracklet conversion is done outside of the tracker float mMaxEta; // TPC tracks with higher eta are ignored float mRoadZ; // in z, a constant search road is used float mZCorrCoefNRC; // tracklet z-position depends linearly on track dip angle diff --git a/GPU/GPUTracking/TRDTracking/GPUTRDTrackletWord.h b/GPU/GPUTracking/TRDTracking/GPUTRDTrackletWord.h index 2b6c058323704..542700b7fe355 100644 --- a/GPU/GPUTracking/TRDTracking/GPUTRDTrackletWord.h +++ b/GPU/GPUTracking/TRDTracking/GPUTRDTrackletWord.h @@ -34,9 +34,9 @@ class GPUTRDTrackletWord public: GPUd() GPUTRDTrackletWord(uint32_t trackletWord = 0); GPUd() GPUTRDTrackletWord(uint32_t trackletWord, int32_t hcid); - GPUdDefault() GPUTRDTrackletWord(const GPUTRDTrackletWord& rhs) CON_DEFAULT; - GPUdDefault() GPUTRDTrackletWord& operator=(const GPUTRDTrackletWord& rhs) CON_DEFAULT; - GPUdDefault() ~GPUTRDTrackletWord() CON_DEFAULT; + GPUdDefault() GPUTRDTrackletWord(const GPUTRDTrackletWord& rhs) = default; + GPUdDefault() GPUTRDTrackletWord& operator=(const GPUTRDTrackletWord& rhs) = default; + GPUdDefault() ~GPUTRDTrackletWord() = default; #ifndef GPUCA_GPUCODE_DEVICE GPUTRDTrackletWord(const AliTRDtrackletWord& rhs); GPUTRDTrackletWord(const AliTRDtrackletMCM& rhs); @@ -88,9 +88,9 @@ class GPUTRDTrackletWord : private o2::trd::Tracklet64 { public: GPUd() GPUTRDTrackletWord(uint64_t trackletWord = 0) : o2::trd::Tracklet64(trackletWord){}; - GPUdDefault() GPUTRDTrackletWord(const GPUTRDTrackletWord& rhs) CON_DEFAULT; - GPUdDefault() GPUTRDTrackletWord& operator=(const GPUTRDTrackletWord& rhs) CON_DEFAULT; - GPUdDefault() ~GPUTRDTrackletWord() CON_DEFAULT; + GPUdDefault() GPUTRDTrackletWord(const GPUTRDTrackletWord& rhs) = default; + GPUdDefault() GPUTRDTrackletWord& operator=(const GPUTRDTrackletWord& rhs) = default; + GPUdDefault() ~GPUTRDTrackletWord() = default; // ----- Override operators < and > to enable tracklet sorting by HCId ----- GPUd() bool operator<(const GPUTRDTrackletWord& t) const { return (getHCID() < t.getHCID()); } @@ -106,9 +106,7 @@ class GPUTRDTrackletWord : private o2::trd::Tracklet64 // IMPORTANT: Do not add members, this class must keep the same memory layout as o2::trd::Tracklet64 }; -#ifdef GPUCA_NOCOMPAT static_assert(sizeof(GPUTRDTrackletWord) == sizeof(o2::trd::Tracklet64), "Incorrect memory layout"); -#endif } // namespace gpu } // namespace GPUCA_NAMESPACE diff --git a/GPU/GPUTracking/utils/qconfig.h b/GPU/GPUTracking/utils/qconfig.h index d19ad370acc7d..79a9bd757b531 100644 --- a/GPU/GPUTracking/utils/qconfig.h +++ b/GPU/GPUTracking/utils/qconfig.h @@ -321,7 +321,7 @@ enum qConfigRetVal { qcrOK = 0, #endif #define AddOptionSet(name, type, value, optname, optnameshort, help, ...) #define AddSubConfig(name, instance) name instance; -#if !defined(QCONFIG_GENRTC) && defined(GPUCA_NOCOMPAT) && !defined(GPUCA_GPUCODE_DEVICE) +#if !defined(QCONFIG_GENRTC) && !defined(GPUCA_GPUCODE_DEVICE) #define BeginConfig(name, instance) \ struct name { \ bool operator==(const name&) const = default; diff --git a/GPU/TPCFastTransformation/ChebyshevFit1D.h b/GPU/TPCFastTransformation/ChebyshevFit1D.h index 1378563b4d8f3..f1726ce063f64 100644 --- a/GPU/TPCFastTransformation/ChebyshevFit1D.h +++ b/GPU/TPCFastTransformation/ChebyshevFit1D.h @@ -41,7 +41,7 @@ class ChebyshevFit1D reset(order, xMin, xMax); } - ~ChebyshevFit1D() CON_DEFAULT; + ~ChebyshevFit1D() = default; void reset(int32_t order, double xMin, double xMax); diff --git a/GPU/TPCFastTransformation/CorrectionMapsHelper.h b/GPU/TPCFastTransformation/CorrectionMapsHelper.h index 7a35077f04aef..100f871f2ec63 100644 --- a/GPU/TPCFastTransformation/CorrectionMapsHelper.h +++ b/GPU/TPCFastTransformation/CorrectionMapsHelper.h @@ -124,7 +124,7 @@ class CorrectionMapsHelper void setUpdatedMapMShape() { mUpdatedFlags |= UpdateFlags::MapMShapeBit; } void setUpdatedLumi() { mUpdatedFlags |= UpdateFlags::LumiBit; } -#if !defined(GPUCA_GPUCODE_DEVICE) && defined(GPUCA_NOCOMPAT) +#if !defined(GPUCA_GPUCODE_DEVICE) void setCorrMap(std::unique_ptr&& m); void setCorrMapRef(std::unique_ptr&& m); void setCorrMapMShape(std::unique_ptr&& m); diff --git a/GPU/TPCFastTransformation/MultivariatePolynomial.h b/GPU/TPCFastTransformation/MultivariatePolynomial.h index 77deff08782d5..8da69b6978134 100644 --- a/GPU/TPCFastTransformation/MultivariatePolynomial.h +++ b/GPU/TPCFastTransformation/MultivariatePolynomial.h @@ -62,11 +62,11 @@ class MultivariatePolynomial : public FlatObject, public MultivariatePolynomialH } #else /// default constructor - MultivariatePolynomial() CON_DEFAULT; + MultivariatePolynomial() = default; #endif /// default destructor - ~MultivariatePolynomial() CON_DEFAULT; + ~MultivariatePolynomial() = default; /// Copy constructor MultivariatePolynomial(const MultivariatePolynomial& obj) { this->cloneFromObject(obj, nullptr); } diff --git a/GPU/TPCFastTransformation/MultivariatePolynomialHelper.h b/GPU/TPCFastTransformation/MultivariatePolynomialHelper.h index e4518efea37c6..69c2052f83138 100644 --- a/GPU/TPCFastTransformation/MultivariatePolynomialHelper.h +++ b/GPU/TPCFastTransformation/MultivariatePolynomialHelper.h @@ -163,10 +163,10 @@ class MultivariatePolynomialHelper<0, 0, false> : public MultivariatePolynomialP MultivariatePolynomialHelper(const uint32_t nDim, const uint32_t degree, const bool interactionOnly) : mDim{nDim}, mDegree{degree}, mInteractionOnly{interactionOnly} { assert(mDegree <= FMaxdegree); }; /// default constructor - MultivariatePolynomialHelper() CON_DEFAULT; + MultivariatePolynomialHelper() = default; /// Destructor - ~MultivariatePolynomialHelper() CON_DEFAULT; + ~MultivariatePolynomialHelper() = default; /// printing the formula of the polynomial void print() const; diff --git a/GPU/TPCFastTransformation/NDPiecewisePolynomials.h b/GPU/TPCFastTransformation/NDPiecewisePolynomials.h index 9498645b76220..596c915950948 100644 --- a/GPU/TPCFastTransformation/NDPiecewisePolynomials.h +++ b/GPU/TPCFastTransformation/NDPiecewisePolynomials.h @@ -91,10 +91,10 @@ class NDPiecewisePolynomials : public FlatObject }; #endif // !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) /// default constructor - NDPiecewisePolynomials() CON_DEFAULT; + NDPiecewisePolynomials() = default; /// default destructor - ~NDPiecewisePolynomials() CON_DEFAULT; + ~NDPiecewisePolynomials() = default; /// Copy constructor NDPiecewisePolynomials(const NDPiecewisePolynomials& obj) { cloneFromObject(obj, nullptr); } diff --git a/GPU/TPCFastTransformation/Spline.h b/GPU/TPCFastTransformation/Spline.h index 51d9970028f22..9b514c984785d 100644 --- a/GPU/TPCFastTransformation/Spline.h +++ b/GPU/TPCFastTransformation/Spline.h @@ -95,8 +95,8 @@ class Spline } #else /// Disable constructors for the GPU implementation - Spline() CON_DELETE; - Spline(const Spline&) CON_DELETE; + Spline() = delete; + Spline(const Spline&) = delete; #endif #if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB) diff --git a/GPU/TPCFastTransformation/Spline1D.h b/GPU/TPCFastTransformation/Spline1D.h index c977e0bbaee35..62c6f82ad166a 100644 --- a/GPU/TPCFastTransformation/Spline1D.h +++ b/GPU/TPCFastTransformation/Spline1D.h @@ -161,8 +161,8 @@ class Spline1D } #else /// Disable constructors for the GPU implementation - Spline1D() CON_DELETE; - Spline1D(const Spline1D&) CON_DELETE; + Spline1D() = delete; + Spline1D(const Spline1D&) = delete; #endif #if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB) diff --git a/GPU/TPCFastTransformation/Spline1DHelper.h b/GPU/TPCFastTransformation/Spline1DHelper.h index e8388d68a6e05..31a100d28c319 100644 --- a/GPU/TPCFastTransformation/Spline1DHelper.h +++ b/GPU/TPCFastTransformation/Spline1DHelper.h @@ -41,13 +41,13 @@ class Spline1DHelper Spline1DHelper(); /// Copy constructor: disabled - Spline1DHelper(const Spline1DHelper&) CON_DEFAULT; + Spline1DHelper(const Spline1DHelper&) = default; /// Assignment operator: disabled - Spline1DHelper& operator=(const Spline1DHelper&) CON_DEFAULT; + Spline1DHelper& operator=(const Spline1DHelper&) = default; /// Destructor - ~Spline1DHelper() CON_DEFAULT; + ~Spline1DHelper() = default; /// _______________ Main functionality ________________________ diff --git a/GPU/TPCFastTransformation/Spline1DHelperOld.h b/GPU/TPCFastTransformation/Spline1DHelperOld.h index eaf2f185aa23c..013b4974c8c60 100644 --- a/GPU/TPCFastTransformation/Spline1DHelperOld.h +++ b/GPU/TPCFastTransformation/Spline1DHelperOld.h @@ -56,13 +56,13 @@ class Spline1DHelperOld Spline1DHelperOld(); /// Copy constructor: disabled - Spline1DHelperOld(const Spline1DHelperOld&) CON_DEFAULT; + Spline1DHelperOld(const Spline1DHelperOld&) = default; /// Assignment operator: disabled - Spline1DHelperOld& operator=(const Spline1DHelperOld&) CON_DEFAULT; + Spline1DHelperOld& operator=(const Spline1DHelperOld&) = default; /// Destructor - ~Spline1DHelperOld() CON_DEFAULT; + ~Spline1DHelperOld() = default; /// _______________ Main functionality ________________________ diff --git a/GPU/TPCFastTransformation/Spline1DSpec.h b/GPU/TPCFastTransformation/Spline1DSpec.h index f8af1980d81ae..65223d551e2ee 100644 --- a/GPU/TPCFastTransformation/Spline1DSpec.h +++ b/GPU/TPCFastTransformation/Spline1DSpec.h @@ -66,13 +66,13 @@ class Spline1DContainer : public FlatObject /// _____________ C++ constructors / destructors __________________________ /// Default constructor, required by the Root IO - Spline1DContainer() CON_DEFAULT; + Spline1DContainer() = default; /// Disable all other constructors - Spline1DContainer(const Spline1DContainer&) CON_DELETE; + Spline1DContainer(const Spline1DContainer&) = delete; /// Destructor - ~Spline1DContainer() CON_DEFAULT; + ~Spline1DContainer() = default; /// _______________ Construction interface ________________________ diff --git a/GPU/TPCFastTransformation/Spline2D.h b/GPU/TPCFastTransformation/Spline2D.h index 9dbca7a2b7767..ccd68b029c0f1 100644 --- a/GPU/TPCFastTransformation/Spline2D.h +++ b/GPU/TPCFastTransformation/Spline2D.h @@ -92,8 +92,8 @@ class Spline2D } #else /// Disable constructors for the GPU implementation - Spline2D() CON_DELETE; - Spline2D(const Spline2D&) CON_DELETE; + Spline2D() = delete; + Spline2D(const Spline2D&) = delete; #endif #if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) && !defined(GPUCA_ALIROOT_LIB) diff --git a/GPU/TPCFastTransformation/Spline2DHelper.h b/GPU/TPCFastTransformation/Spline2DHelper.h index dc509dc33ea57..19630adacd581 100644 --- a/GPU/TPCFastTransformation/Spline2DHelper.h +++ b/GPU/TPCFastTransformation/Spline2DHelper.h @@ -46,13 +46,13 @@ class Spline2DHelper Spline2DHelper(); /// Copy constructor: disabled - Spline2DHelper(const Spline2DHelper&) CON_DELETE; + Spline2DHelper(const Spline2DHelper&) = delete; /// Assignment operator: disabled - Spline2DHelper& operator=(const Spline2DHelper&) CON_DELETE; + Spline2DHelper& operator=(const Spline2DHelper&) = delete; /// Destructor - ~Spline2DHelper() CON_DEFAULT; + ~Spline2DHelper() = default; /// _______________ Main functionality ________________________ diff --git a/GPU/TPCFastTransformation/Spline2DSpec.h b/GPU/TPCFastTransformation/Spline2DSpec.h index 801626445a52d..ab8c3cb39754d 100644 --- a/GPU/TPCFastTransformation/Spline2DSpec.h +++ b/GPU/TPCFastTransformation/Spline2DSpec.h @@ -58,13 +58,13 @@ class Spline2DContainer : public FlatObject /// _____________ C++ constructors / destructors __________________________ /// Default constructor - Spline2DContainer() CON_DEFAULT; + Spline2DContainer() = default; /// Disable all other constructors - Spline2DContainer(const Spline2DContainer&) CON_DELETE; + Spline2DContainer(const Spline2DContainer&) = delete; /// Destructor - ~Spline2DContainer() CON_DEFAULT; + ~Spline2DContainer() = default; /// _______________ Construction interface ________________________ diff --git a/GPU/TPCFastTransformation/SplineHelper.h b/GPU/TPCFastTransformation/SplineHelper.h index 06b1cd9412c0f..ab558f82eaa17 100644 --- a/GPU/TPCFastTransformation/SplineHelper.h +++ b/GPU/TPCFastTransformation/SplineHelper.h @@ -46,13 +46,13 @@ class SplineHelper SplineHelper(); /// Copy constructor: disabled - SplineHelper(const SplineHelper&) CON_DELETE; + SplineHelper(const SplineHelper&) = delete; /// Assignment operator: disabled - SplineHelper& operator=(const SplineHelper&) CON_DELETE; + SplineHelper& operator=(const SplineHelper&) = delete; /// Destructor - ~SplineHelper() CON_DEFAULT; + ~SplineHelper() = default; /// _______________ Main functionality ________________________ diff --git a/GPU/TPCFastTransformation/SplineSpec.h b/GPU/TPCFastTransformation/SplineSpec.h index f1cd0e6271668..d4e64b8dad1f6 100644 --- a/GPU/TPCFastTransformation/SplineSpec.h +++ b/GPU/TPCFastTransformation/SplineSpec.h @@ -58,13 +58,13 @@ class SplineContainer : public FlatObject /// _____________ C++ constructors / destructors __________________________ /// Default constructor - SplineContainer() CON_DEFAULT; + SplineContainer() = default; /// Disable all other constructors - SplineContainer(const SplineContainer&) CON_DELETE; + SplineContainer(const SplineContainer&) = delete; /// Destructor - ~SplineContainer() CON_DEFAULT; + ~SplineContainer() = default; /// _______________ Construction interface ________________________ diff --git a/GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h b/GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h index 8fec1be5c459a..70ca6c99ed853 100644 --- a/GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h +++ b/GPU/TPCFastTransformation/TPCFastSpaceChargeCorrection.h @@ -88,10 +88,10 @@ class TPCFastSpaceChargeCorrection : public FlatObject TPCFastSpaceChargeCorrection(); /// Copy constructor: disabled to avoid ambiguity. Use cloneTo[In/Ex]ternalBuffer() instead - TPCFastSpaceChargeCorrection(const TPCFastSpaceChargeCorrection&) CON_DELETE; + TPCFastSpaceChargeCorrection(const TPCFastSpaceChargeCorrection&) = delete; /// Assignment operator: disabled to avoid ambiguity. Use cloneTo[In/Ex]ternalBuffer() instead - TPCFastSpaceChargeCorrection& operator=(const TPCFastSpaceChargeCorrection&) CON_DELETE; + TPCFastSpaceChargeCorrection& operator=(const TPCFastSpaceChargeCorrection&) = delete; /// Destructor ~TPCFastSpaceChargeCorrection(); diff --git a/GPU/TPCFastTransformation/TPCFastTransform.h b/GPU/TPCFastTransformation/TPCFastTransform.h index 80c8a04f849c6..936a19d3f30fa 100644 --- a/GPU/TPCFastTransformation/TPCFastTransform.h +++ b/GPU/TPCFastTransformation/TPCFastTransform.h @@ -50,7 +50,7 @@ struct TPCSlowSpaceChargeCorrection { o2::tpc::SpaceCharge* mCorr{nullptr}; ///< reference space charge corrections #else - ~TPCSlowSpaceChargeCorrection() CON_DEFAULT; + ~TPCSlowSpaceChargeCorrection() = default; /// setting dummy corrections for GPU GPUd() void getCorrections(const float gx, const float gy, const float gz, const int32_t slice, float& gdxC, float& gdyC, float& gdzC) const @@ -104,10 +104,10 @@ class TPCFastTransform : public FlatObject TPCFastTransform(); /// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead - TPCFastTransform(const TPCFastTransform&) CON_DELETE; + TPCFastTransform(const TPCFastTransform&) = delete; /// Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead - TPCFastTransform& operator=(const TPCFastTransform&) CON_DELETE; + TPCFastTransform& operator=(const TPCFastTransform&) = delete; inline void destroy() { @@ -122,7 +122,7 @@ class TPCFastTransform : public FlatObject delete mCorrectionSlow; } #else - ~TPCFastTransform() CON_DEFAULT; + ~TPCFastTransform() = default; #endif /// _____________ FlatObject functionality, see FlatObject class for description ____________ diff --git a/GPU/TPCFastTransformation/TPCFastTransformGeo.h b/GPU/TPCFastTransformation/TPCFastTransformGeo.h index ec1915dc4288d..a24dcbf1e80c2 100644 --- a/GPU/TPCFastTransformation/TPCFastTransformGeo.h +++ b/GPU/TPCFastTransformation/TPCFastTransformGeo.h @@ -65,13 +65,13 @@ class TPCFastTransformGeo TPCFastTransformGeo(); /// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead - TPCFastTransformGeo(const TPCFastTransformGeo&) CON_DEFAULT; + TPCFastTransformGeo(const TPCFastTransformGeo&) = default; /// Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead - TPCFastTransformGeo& operator=(const TPCFastTransformGeo&) CON_DEFAULT; + TPCFastTransformGeo& operator=(const TPCFastTransformGeo&) = default; /// Destructor - ~TPCFastTransformGeo() CON_DEFAULT; + ~TPCFastTransformGeo() = default; /// _____________ FlatObject functionality, see FlatObject class for description ____________ diff --git a/GPU/TPCFastTransformation/TPCFastTransformManager.h b/GPU/TPCFastTransformation/TPCFastTransformManager.h index d932c41ca8c18..14a85f1030bd8 100644 --- a/GPU/TPCFastTransformation/TPCFastTransformManager.h +++ b/GPU/TPCFastTransformation/TPCFastTransformManager.h @@ -43,13 +43,13 @@ class TPCFastTransformManager TPCFastTransformManager(); /// Copy constructor: disabled - TPCFastTransformManager(const TPCFastTransformManager&) CON_DELETE; + TPCFastTransformManager(const TPCFastTransformManager&) = delete; /// Assignment operator: disabled - TPCFastTransformManager& operator=(const TPCFastTransformManager&) CON_DELETE; + TPCFastTransformManager& operator=(const TPCFastTransformManager&) = delete; /// Destructor - ~TPCFastTransformManager() CON_DEFAULT; + ~TPCFastTransformManager() = default; /// _______________ Main functionality ________________________ diff --git a/GPU/TPCFastTransformation/TPCFastTransformQA.h b/GPU/TPCFastTransformation/TPCFastTransformQA.h index f27f9be04efb9..6030ceedc5c94 100644 --- a/GPU/TPCFastTransformation/TPCFastTransformQA.h +++ b/GPU/TPCFastTransformation/TPCFastTransformQA.h @@ -46,13 +46,13 @@ class TPCFastTransformQA TPCFastTransformQA(); /// Copy constructor: disabled - TPCFastTransformQA(const TPCFastTransformQA&) CON_DELETE; + TPCFastTransformQA(const TPCFastTransformQA&) = delete; /// Assignment operator: disabled - TPCFastTransformQA& operator=(const TPCFastTransformQA&) CON_DELETE; + TPCFastTransformQA& operator=(const TPCFastTransformQA&) = delete; /// Destructor - ~TPCFastTransformQA() CON_DEFAULT; + ~TPCFastTransformQA() = default; /// _______________ Main functionality ________________________ diff --git a/GPU/TPCFastTransformation/devtools/IrregularSpline1D.h b/GPU/TPCFastTransformation/devtools/IrregularSpline1D.h index e15aa4b701002..62229c2afe087 100644 --- a/GPU/TPCFastTransformation/devtools/IrregularSpline1D.h +++ b/GPU/TPCFastTransformation/devtools/IrregularSpline1D.h @@ -133,13 +133,13 @@ class IrregularSpline1D : public FlatObject IrregularSpline1D(); /// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject instead - IrregularSpline1D(const IrregularSpline1D&) CON_DELETE; + IrregularSpline1D(const IrregularSpline1D&) = delete; /// Assignment operator: disabled to avoid ambiguity. Use cloneFromObject instead - IrregularSpline1D& operator=(const IrregularSpline1D&) CON_DELETE; + IrregularSpline1D& operator=(const IrregularSpline1D&) = delete; /// Destructor - ~IrregularSpline1D() CON_DEFAULT; + ~IrregularSpline1D() = default; /// _____________ FlatObject functionality, see FlatObject class for description ____________ diff --git a/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h b/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h index 63487fe0c3b2d..99550cc12219f 100644 --- a/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h +++ b/GPU/TPCFastTransformation/devtools/IrregularSpline2D3D.h @@ -70,13 +70,13 @@ class IrregularSpline2D3D : public FlatObject IrregularSpline2D3D(); /// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead - IrregularSpline2D3D(const IrregularSpline2D3D&) CON_DELETE; + IrregularSpline2D3D(const IrregularSpline2D3D&) = delete; /// Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead - IrregularSpline2D3D& operator=(const IrregularSpline2D3D&) CON_DELETE; + IrregularSpline2D3D& operator=(const IrregularSpline2D3D&) = delete; /// Destructor - ~IrregularSpline2D3D() CON_DEFAULT; + ~IrregularSpline2D3D() = default; /// _____________ FlatObject functionality, see FlatObject class for description ____________ diff --git a/GPU/TPCFastTransformation/devtools/IrregularSpline2D3DCalibrator.h b/GPU/TPCFastTransformation/devtools/IrregularSpline2D3DCalibrator.h index 12696710e0a5b..4b3ba8f787a79 100644 --- a/GPU/TPCFastTransformation/devtools/IrregularSpline2D3DCalibrator.h +++ b/GPU/TPCFastTransformation/devtools/IrregularSpline2D3DCalibrator.h @@ -57,7 +57,7 @@ class IrregularSpline2D3DCalibrator IrregularSpline2D3DCalibrator(); /// Destructor - ~IrregularSpline2D3DCalibrator() CON_DEFAULT; + ~IrregularSpline2D3DCalibrator() = default; /// set size of the raster grid void setRasterSize(int32_t nKnotsU, int32_t nKnotsV); diff --git a/GPU/TPCFastTransformation/devtools/RegularSpline1D.h b/GPU/TPCFastTransformation/devtools/RegularSpline1D.h index aa5acbe411dcd..b97903f7d5aac 100644 --- a/GPU/TPCFastTransformation/devtools/RegularSpline1D.h +++ b/GPU/TPCFastTransformation/devtools/RegularSpline1D.h @@ -37,10 +37,10 @@ class RegularSpline1D /// _____________ Constructors / destructors __________________________ /// Default constructor - RegularSpline1D() CON_DEFAULT; + RegularSpline1D() = default; /// Destructor - ~RegularSpline1D() CON_DEFAULT; + ~RegularSpline1D() = default; /// Constructor. Number of knots will be set to at least 5 void construct(int32_t numberOfKnots); diff --git a/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h b/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h index 75a4a6d50ddf2..4e14b69583d74 100644 --- a/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h +++ b/GPU/TPCFastTransformation/devtools/SemiregularSpline2D3D.h @@ -58,13 +58,13 @@ class SemiregularSpline2D3D : public FlatObject SemiregularSpline2D3D(); /// Copy constructor: disabled to avoid ambiguity. Use cloneFromObject() instead - SemiregularSpline2D3D(const SemiregularSpline2D3D&) CON_DELETE; + SemiregularSpline2D3D(const SemiregularSpline2D3D&) = delete; /// Assignment operator: disabled to avoid ambiguity. Use cloneFromObject() instead - SemiregularSpline2D3D& operator=(const SemiregularSpline2D3D&) CON_DELETE; + SemiregularSpline2D3D& operator=(const SemiregularSpline2D3D&) = delete; /// Destructor - ~SemiregularSpline2D3D() CON_DEFAULT; + ~SemiregularSpline2D3D() = default; /// _____________ FlatObject functionality, see FlatObject class for description ____________ diff --git a/GPU/Utils/FlatObject.h b/GPU/Utils/FlatObject.h index d9b3ca8370813..99fcdab8a6cae 100644 --- a/GPU/Utils/FlatObject.h +++ b/GPU/Utils/FlatObject.h @@ -179,12 +179,12 @@ class FlatObject /// Default constructor / destructor #ifndef GPUCA_GPUCODE - FlatObject() CON_DEFAULT; // No object derrived from FlatObject should be created on the GPU + FlatObject() = default; // No object derrived from FlatObject should be created on the GPU ~FlatObject(); - FlatObject(const FlatObject&) CON_DELETE; - FlatObject& operator=(const FlatObject&) CON_DELETE; + FlatObject(const FlatObject&) = delete; + FlatObject& operator=(const FlatObject&) = delete; #else - FlatObject() CON_DELETE; + FlatObject() = delete; #endif protected: From 518b10d464deefeaaa580a66ebef898c7089b4dc Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:55:50 +0100 Subject: [PATCH 37/50] DPL: fix small leak when receiving WS messages from the driver (#13871) --- Framework/Core/src/DPLWebSocket.cxx | 9 +++++---- Framework/Core/src/runDataProcessing.cxx | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Framework/Core/src/DPLWebSocket.cxx b/Framework/Core/src/DPLWebSocket.cxx index 77018f8cb44b4..a39e98c6f5310 100644 --- a/Framework/Core/src/DPLWebSocket.cxx +++ b/Framework/Core/src/DPLWebSocket.cxx @@ -167,10 +167,10 @@ struct GUIWebSocketHandler : public WebSocketHandler { } } } - void endFragmentation() override{}; - void control(char const* frame, size_t s) override{}; - void beginChunk() override{}; - void endChunk() override{}; + void endFragmentation() override {}; + void control(char const* frame, size_t s) override {}; + void beginChunk() override {}; + void endChunk() override {}; /// The driver context were we want to accumulate changes /// which we got from the websocket. @@ -415,6 +415,7 @@ void websocket_client_callback(uv_stream_t* stream, ssize_t nread, const uv_buf_ try { LOG(debug) << "Data received from server"; parse_http_request(buf->base, nread, context->client); + free(buf->base); } catch (RuntimeErrorRef& ref) { auto& err = o2::framework::error_from_ref(ref); LOG(error) << "Error while parsing request: " << err.what; diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index c8f77ab7082e6..f4fe042592e0a 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -491,6 +491,7 @@ void websocket_callback(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) } catch (WSError& e) { LOG(error) << "Error while parsing request: " << e.message; handler->error(e.code, e.message.c_str()); + free(buf->base); } } From e16c81036ccd76b591f5dde4c9e5da65a32a7136 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Sun, 19 Jan 2025 14:29:02 +0100 Subject: [PATCH 38/50] DPL: Reduce some verbosity from FATAL to ERROR --- Framework/Core/src/runDataProcessing.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index f4fe042592e0a..28bbde2d474de 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -978,16 +978,16 @@ void doDPLException(RuntimeErrorRef& e, char const* processName) if (err.maxBacktrace != 0) { LOGP(fatal, "Unhandled o2::framework::runtime_error reached the top of main of {}, device shutting down." - " Reason: {}" - "\n Backtrace follow: \n", + " Reason: {}", processName, err.what); + LOGP(error, "Backtrace follow:"); BacktraceHelpers::demangled_backtrace_symbols(err.backtrace, err.maxBacktrace, STDERR_FILENO); } else { LOGP(fatal, "Unhandled o2::framework::runtime_error reached the top of main of {}, device shutting down." - " Reason: {}" - "\n Recompile with DPL_ENABLE_BACKTRACE=1 to get more information.", + " Reason: {}", processName, err.what); + LOGP(error, "Recompile with DPL_ENABLE_BACKTRACE=1 to get more information."); } } From a0bd8e9f67480c93e7dc5c329b656f0ac91890ec Mon Sep 17 00:00:00 2001 From: David Rohr Date: Sun, 19 Jan 2025 21:00:07 +0100 Subject: [PATCH 39/50] GPU: Add missing headeres and some protections --- GPU/GPUTracking/Debug/GPUTPCClusterFilter.cxx | 2 ++ GPU/GPUTracking/Global/GPUChainTrackingDebugAndProfiling.cxx | 2 ++ GPU/GPUTracking/SliceTracker/GPUTPCTrackerComponent.cxx | 2 +- GPU/TPCFastTransformation/NDPiecewisePolynomials.h | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GPU/GPUTracking/Debug/GPUTPCClusterFilter.cxx b/GPU/GPUTracking/Debug/GPUTPCClusterFilter.cxx index cdd0e4879f949..e513162aad87c 100644 --- a/GPU/GPUTracking/Debug/GPUTPCClusterFilter.cxx +++ b/GPU/GPUTracking/Debug/GPUTPCClusterFilter.cxx @@ -13,6 +13,7 @@ /// \author David Rohr #include "GPUTPCClusterFilter.h" +#ifdef GPUCA_HAVE_O2HEADERS #include "DataFormatsTPC/ClusterNative.h" using namespace o2::gpu; @@ -29,3 +30,4 @@ bool GPUTPCClusterFilter::filter(uint32_t sector, uint32_t row, o2::tpc::Cluster // Note that this function might be called multiple times for the same cluster, in which case the final modified cl reference goes into the output clusters. return true; } +#endif diff --git a/GPU/GPUTracking/Global/GPUChainTrackingDebugAndProfiling.cxx b/GPU/GPUTracking/Global/GPUChainTrackingDebugAndProfiling.cxx index 7d4a3420995ad..1b959cac94fd0 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingDebugAndProfiling.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingDebugAndProfiling.cxx @@ -301,6 +301,7 @@ void GPUChainTracking::SanityCheck() void GPUChainTracking::RunTPCClusterFilter(o2::tpc::ClusterNativeAccess* clusters, std::function allocator, bool applyClusterCuts) { +#ifdef GPUCA_HAVE_O2HEADERS GPUTPCClusterFilter clusterFilter(*clusters); o2::tpc::ClusterNative* outputBuffer = nullptr; for (int32_t iPhase = 0; iPhase < 2; iPhase++) { @@ -337,4 +338,5 @@ void GPUChainTracking::RunTPCClusterFilter(o2::tpc::ClusterNativeAccess* cluster outputBuffer = allocator(countTotal); } } +#endif } diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCTrackerComponent.cxx b/GPU/GPUTracking/SliceTracker/GPUTPCTrackerComponent.cxx index 581e2926365f4..4539cf334bddd 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCTrackerComponent.cxx +++ b/GPU/GPUTracking/SliceTracker/GPUTPCTrackerComponent.cxx @@ -374,7 +374,7 @@ int32_t GPUTPCTrackerComponent::ConfigureSlices() GPUSettingsProcessing devProc; grp.solenoidBzNominalGPU = fSolenoidBz; - grp.continuousMaxTimeBin = 0; // triggered events + grp.grpContinuousMaxTimeBin = 0; // triggered events if (mNeighboursSearchArea > 0) { rec.tpc.neighboursSearchArea = mNeighboursSearchArea; } diff --git a/GPU/TPCFastTransformation/NDPiecewisePolynomials.h b/GPU/TPCFastTransformation/NDPiecewisePolynomials.h index 596c915950948..77001acf851e8 100644 --- a/GPU/TPCFastTransformation/NDPiecewisePolynomials.h +++ b/GPU/TPCFastTransformation/NDPiecewisePolynomials.h @@ -22,6 +22,7 @@ #if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE) #include +#include #endif class TFile; From 41919acf1e5dea76da3371f7cfbcfe664de1be66 Mon Sep 17 00:00:00 2001 From: Roman Lietava Date: Mon, 20 Jan 2025 19:17:55 +0100 Subject: [PATCH 40/50] Ctpdev: 3 things (#13875) * dev: 3 things * clang --- .../include/DataFormatsCTP/CTPRateFetcher.h | 5 ++ .../CTP/include/DataFormatsCTP/Scalers.h | 2 +- .../Detectors/CTP/src/CTPRateFetcher.cxx | 44 +++++++++++--- .../Detectors/CTP/src/Configuration.cxx | 13 ++++- DataFormats/Detectors/CTP/src/Scalers.cxx | 23 ++++++-- Detectors/CTP/macro/CMakeLists.txt | 13 ++++- Detectors/CTP/macro/CheckCTPConfig.C | 58 +++++++++++++++++++ Detectors/CTP/macro/GetRates.C | 28 +++++++++ Detectors/CTP/macro/TestGetRates.C | 32 ++++++++++ .../workflowScalers/src/ctp-ccdb-orbit.cxx | 12 ++-- 10 files changed, 209 insertions(+), 21 deletions(-) create mode 100644 Detectors/CTP/macro/CheckCTPConfig.C create mode 100644 Detectors/CTP/macro/GetRates.C create mode 100644 Detectors/CTP/macro/TestGetRates.C diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/CTPRateFetcher.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/CTPRateFetcher.h index 89605fbd28e1f..d47e53419bdf1 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/CTPRateFetcher.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/CTPRateFetcher.h @@ -32,6 +32,9 @@ class CTPRateFetcher double fetchNoPuCorr(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string sourceName); void setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, bool initScalers); void updateScalers(ctp::CTPRunScalers& scalers); + int getRates(std::array& rates, o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName); // rates at start,stop and middle of the run + void setOrbit(bool orb) { mOrbit = orb; } + void setOutsideLimits(bool qc) { mOutsideLimits = qc; } private: double fetchCTPratesInputs(uint64_t timeStamp, int input); @@ -41,6 +44,8 @@ class CTPRateFetcher double pileUpCorrection(double rate); int mRunNumber = -1; + bool mOutsideLimits = 0; + bool mOrbit = 0; o2::ctp::CTPConfiguration mConfig{}; o2::ctp::CTPRunScalers mScalers{}; o2::parameters::GRPLHCIFData mLHCIFdata{}; diff --git a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h index 518b3b4f10a69..c10ac070d4d35 100644 --- a/DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h +++ b/DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h @@ -125,7 +125,7 @@ class CTPRunScalers void printLMBRateVsT() const; // prints LMB interaction rate vs time for debugging // returns the pair of global (levelled) interaction rate, as well as interpolated // rate in Hz at a certain orbit number within the run - std::pair getRate(uint32_t orbit, int classindex, int type) const; + std::pair getRate(uint32_t orbit, int classindex, int type, bool qc = 0) const; /// same with absolute timestamp (not orbit) as argument std::pair getRateGivenT(double timestamp, int classindex, int type, bool qc = 0) const; diff --git a/DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx b/DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx index 6be4c3b301802..28da2033e7b29 100644 --- a/DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx +++ b/DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx @@ -61,6 +61,23 @@ void CTPRateFetcher::updateScalers(ctp::CTPRunScalers& scalers) mScalers.convertRawToO2(); } // +int CTPRateFetcher::getRates(std::array& rates, o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName) // rates at start,stop and middle of the run +{ + setupRun(runNumber, ccdb, 0, 1); + mOrbit = 1; + mOutsideLimits = 1; + auto orbitlimits = mScalers.getOrbitLimit(); + // std::cout << "1st orbit:" << orbitlimits.first << " last:" << orbitlimits.second << " Middle:" << (orbitlimits.first + orbitlimits.second)/2 << std::endl; + double rate0 = fetch(ccdb, orbitlimits.first, mRunNumber, sourceName); + double rateLast = fetch(ccdb, orbitlimits.second, mRunNumber, sourceName); + double rateM = fetch(ccdb, (orbitlimits.first + orbitlimits.second) / 2, mRunNumber, sourceName); + // std::cout << rate0 << " " << rateLast << " " << rateM << std::endl; + rates[0] = rate0; + rates[1] = rateLast; + rates[2] = rateM; + return 0; +} +// double CTPRateFetcher::fetchCTPratesClasses(uint64_t timeStamp, const std::string& className, int inputType) { auto triggerRate = fetchCTPratesClassesNoPuCorr(timeStamp, className, inputType); @@ -84,14 +101,23 @@ double CTPRateFetcher::fetchCTPratesClassesNoPuCorr(uint64_t timeStamp, const st LOG(warn) << "Trigger class " << className << " not found in CTPConfiguration"; return -2.; } - auto rate{mScalers.getRateGivenT(timeStamp * 1.e-3, classIndex, inputType, 1)}; - return rate.second; + if (mOrbit) { + auto rate{mScalers.getRate((uint32_t)timeStamp, classIndex, inputType, mOutsideLimits)}; + return rate.second; + } else { + auto rate{mScalers.getRateGivenT(timeStamp * 1.e-3, classIndex, inputType, mOutsideLimits)}; + return rate.second; + } } double CTPRateFetcher::fetchCTPratesInputs(uint64_t timeStamp, int input) { std::vector& recs = mScalers.getScalerRecordO2(); if (recs[0].scalersInps.size() == 48) { - return pileUpCorrection(mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7, 1).second); + if (mOrbit) { + return pileUpCorrection(mScalers.getRate((uint32_t)timeStamp, input, 7, mOutsideLimits).second); + } else { + return pileUpCorrection(mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7, mOutsideLimits).second); + } } else { LOG(error) << "Inputs not available"; return -1.; @@ -101,7 +127,11 @@ double CTPRateFetcher::fetchCTPratesInputsNoPuCorr(uint64_t timeStamp, int input { std::vector& recs = mScalers.getScalerRecordO2(); if (recs[0].scalersInps.size() == 48) { - return mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7, 1).second; + if (mOrbit) { + return mScalers.getRate((uint32_t)timeStamp, input, 7, mOutsideLimits).second; + } else { + return mScalers.getRateGivenT(timeStamp * 1.e-3, input, 7, mOutsideLimits).second; // qc flag implemented only for time + } } else { LOG(error) << "Inputs not available"; return -1.; @@ -127,13 +157,13 @@ void CTPRateFetcher::setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, u return; } mRunNumber = runNumber; - LOG(debug) << "Setting up CTP scalers for run " << mRunNumber; - std::map metadata; - auto ptrLHCIFdata = ccdb->getSpecific("GLO/Config/GRPLHCIF", timeStamp, metadata); + LOG(info) << "Setting up CTP scalers for run " << mRunNumber; + auto ptrLHCIFdata = ccdb->getSpecific("GLO/Config/GRPLHCIF", timeStamp); if (ptrLHCIFdata == nullptr) { LOG(fatal) << "GRPLHCIFData not in database, timestamp:" << timeStamp; } mLHCIFdata = *ptrLHCIFdata; + std::map metadata; metadata["runNumber"] = std::to_string(mRunNumber); auto ptrConfig = ccdb->getSpecific("CTP/Config/Config", timeStamp, metadata); if (ptrConfig == nullptr) { diff --git a/DataFormats/Detectors/CTP/src/Configuration.cxx b/DataFormats/Detectors/CTP/src/Configuration.cxx index 57272d70ed9e3..2ae8fc1b03ffc 100644 --- a/DataFormats/Detectors/CTP/src/Configuration.cxx +++ b/DataFormats/Detectors/CTP/src/Configuration.cxx @@ -608,9 +608,16 @@ int CTPConfiguration::processConfigurationLineRun3v2(std::string& line, int& lev break; } case DESCRIPTORS: { - if ((tokens.size() < 2) && (line.find("DTRUE") == std::string::npos)) { - LOG(warning) << "Dsecriptor:" << line; - break; + if ((tokens.size() < 2)) { + if (line.find("TRUE") != std::string::npos) { + CTPDescriptor desc; + desc.name = tokens[0]; + mDescriptors.push_back(desc); + break; + } else { + LOG(warning) << "Unexpected Descriptor:" << line; + break; + } } CTPDescriptor desc; desc.name = tokens[0]; diff --git a/DataFormats/Detectors/CTP/src/Scalers.cxx b/DataFormats/Detectors/CTP/src/Scalers.cxx index 1ebeb239aa034..f70a035427ade 100644 --- a/DataFormats/Detectors/CTP/src/Scalers.cxx +++ b/DataFormats/Detectors/CTP/src/Scalers.cxx @@ -662,7 +662,7 @@ void CTPRunScalers::printLMBRateVsT() const // rate in Hz at a certain orbit number within the run // type - 7 : inputs // type - 1..6 : lmb,lma,l0b,l0a,l1b,l1a -std::pair CTPRunScalers::getRate(uint32_t orbit, int classindex, int type) const +std::pair CTPRunScalers::getRate(uint32_t orbit, int classindex, int type, bool qc) const { if (mScalerRecordO2.size() <= 1) { LOG(error) << "not enough data"; @@ -709,11 +709,24 @@ std::pair CTPRunScalers::getRate(uint32_t orbit, int classindex, return -1; // wrong type } }; - - if (nextindex == 0 || nextindex == mScalerRecordO2.size()) { + // qc flag decides what to return if time outside run + if (nextindex == 0) { // orbit is out of bounds - LOG(info) << "query orbit " << orbit << " out of bounds; Just returning the global rate"; - return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1); + if (qc == 0) { + LOG(info) << "query orbit " << orbit << " before first record; Just returning the global rate"; + return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1); + } else { + LOG(info) << "query orbit " << orbit << " before first record; Returning the first rate"; + return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* first rate */ calcRate(0, 1)); + } + } else if (nextindex == mScalerRecordO2.size()) { + if (qc == 0) { + LOG(info) << "query orbit " << orbit << " after last record; Just returning the global rate"; + return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1); + } else { + LOG(info) << "query orbit " << orbit << " after last record; Returning the last rate"; + return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* last rate */ calcRate(mScalerRecordO2.size() - 2, mScalerRecordO2.size() - 1)); + } } else { return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ calcRate(nextindex - 1, nextindex)); } diff --git a/Detectors/CTP/macro/CMakeLists.txt b/Detectors/CTP/macro/CMakeLists.txt index 96f336c840241..8608c1a8b7846 100644 --- a/Detectors/CTP/macro/CMakeLists.txt +++ b/Detectors/CTP/macro/CMakeLists.txt @@ -73,4 +73,15 @@ o2_add_test_root_macro(CreateBKForRun.C PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP O2::CCDB LABELS ctp) - +o2_add_test_root_macro(CheckCTPConfig.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP + O2::CCDB + LABELS ctp) +o2_add_test_root_macro(GetRates.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP + O2::CCDB + LABELS ctp) +o2_add_test_root_macro(TestGetRates.C + PUBLIC_LINK_LIBRARIES O2::DataFormatsCTP + O2::CCDB + LABELS ctp) \ No newline at end of file diff --git a/Detectors/CTP/macro/CheckCTPConfig.C b/Detectors/CTP/macro/CheckCTPConfig.C new file mode 100644 index 0000000000000..24a5e354f3fcd --- /dev/null +++ b/Detectors/CTP/macro/CheckCTPConfig.C @@ -0,0 +1,58 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// \file CreateCTPConfig.C +/// \brief create CTP config, test it and add to database +/// \author Roman Lietava + +#if !defined(__CLING__) || defined(__ROOTCLING__) + +#include +#include "CCDB/CcdbApi.h" +#include "CCDB/BasicCCDBManager.h" +#include "DataFormatsCTP/Configuration.h" +#include +#include +#include +#endif +using namespace o2::ctp; +int CheckCTPConfig(std::string cfgRun3str = "/home/rl/backup24/runs/559781.rcfg2", int writeToFile = 0) +{ + // + // run3 config + // + if (cfgRun3str.find(".rcfg") == std::string::npos) { + std::cout << "No file name:" << cfgRun3str << std::endl; + return 1; + } else { + std::string filename = cfgRun3str; + std::ifstream in; + in.open(filename); + if (!in) { + std::cout << "Can not open file:" << filename << std::endl; + return 2; + } + std::stringstream buffer; + buffer << in.rdbuf(); + cfgRun3str = buffer.str(); + } + // + CTPConfiguration ctpcfg; + int ret = ctpcfg.loadConfigurationRun3(cfgRun3str); + ctpcfg.printStream(std::cout); + std::cout << "CTP config done" << std::endl; + // ctpcfg.checkConfigConsistency(); + auto ctpclasses = ctpcfg.getCTPClasses(); + for (auto const& cls : ctpclasses) { + std::cout << cls.descriptor->name << ":" << std::hex << cls.descriptor->getInputsMask() << std::endl; + } + return ret; +} diff --git a/Detectors/CTP/macro/GetRates.C b/Detectors/CTP/macro/GetRates.C new file mode 100644 index 0000000000000..d2b65d821114a --- /dev/null +++ b/Detectors/CTP/macro/GetRates.C @@ -0,0 +1,28 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include +#include +#include +#endif +using namespace o2::ctp; + +void TestFetcher(int runNumber = 535087) +{ + auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); + std::pair pp = ccdb.getRunDuration(runNumber); + long ts = pp.first + 60; + std::cout << "Run duration:" << pp.first << " " << pp.second << std::endl; + // Opening run + CTPRateFetcher fetcher; + fetcher.setupRun(runNumber, &ccdb, ts, 1); +} diff --git a/Detectors/CTP/macro/TestGetRates.C b/Detectors/CTP/macro/TestGetRates.C new file mode 100644 index 0000000000000..47790426d66c7 --- /dev/null +++ b/Detectors/CTP/macro/TestGetRates.C @@ -0,0 +1,32 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#if !defined(__CLING__) || defined(__ROOTCLING__) +#include +#include +#include +#endif +using namespace o2::ctp; + +void TestGetRates(int runNumber = 557251) +{ + auto& ccdb = o2::ccdb::BasicCCDBManager::instance(); + // Opening run + std::pair pp = ccdb.getRunDuration(runNumber); + long ts = pp.first + 60; + std::cout << "Run duration:" << pp.first << " " << pp.second << std::endl; + CTPRateFetcher fetcher; + fetcher.setupRun(runNumber, &ccdb, ts, 1); + fetcher.setOrbit(1); + std::array rates; + fetcher.getRates(rates, &ccdb, runNumber, "T0VTX"); + std::cout << "Start:" << rates[0] << " End:" << rates[1] << " Middle:" << rates[2] << std::endl; +} diff --git a/Detectors/CTP/workflowScalers/src/ctp-ccdb-orbit.cxx b/Detectors/CTP/workflowScalers/src/ctp-ccdb-orbit.cxx index 13c06730d18ce..0f4203d994402 100644 --- a/Detectors/CTP/workflowScalers/src/ctp-ccdb-orbit.cxx +++ b/Detectors/CTP/workflowScalers/src/ctp-ccdb-orbit.cxx @@ -57,6 +57,7 @@ int main(int argc, char** argv) add_option("run-number,r", bpo::value()->default_value(123), "run number"); add_option("testReset,t", bpo::value()->default_value(0), "0 = CTP/Calib/OrbitReset; 1 = CTP/Calib/OrbitResetTest"); add_option("sox-orbit,x", bpo::value()->default_value(0), "SOX orbit"); + add_option("timestamp,s", bpo::value()->default_value(0), "timestamp of SOX/orbit reading; if 0 timestamp is calulated inside this code"); // opt_all.add(opt_general).add(opt_hidden); @@ -78,8 +79,11 @@ int main(int argc, char** argv) std::string action = vm["action"].as(); std::vector vect; std::string ccdbPath; - auto now = std::chrono::system_clock::now(); - long tt = std::chrono::duration_cast(now.time_since_epoch()).count(); + long tt = vm["timestamp"].as(); + if (tt == 0) { + auto now = std::chrono::system_clock::now(); + tt = std::chrono::duration_cast(now.time_since_epoch()).count(); + } vect.push_back(tt); if (action == "sox") { // write to CTP/Calib/FirstRunOrbit @@ -115,10 +119,10 @@ int main(int argc, char** argv) if (action == "sox") { int64_t runnum = vm["run-number"].as(); metadata["runNumber"] = std::to_string(runnum); - std::cout << "Storing:" << ccdbPath << " " << metadata["runNumber"] << " tmin:" << tmin << " tmax:" << tmax << std::endl; + std::cout << "Storing:" << ccdbPath << " " << metadata["runNumber"] << " tmin:" << tmin << " tmax:" << tmax << " ts:" << tt << std::endl; api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax); } else { - std::cout << "Storing:" << ccdbPath << " tmin:" << tmin << " tmax:" << tmax << std::endl; + std::cout << "Storing:" << ccdbPath << " tmin:" << tmin << " tmax:" << tmax << " ts:" << tt << std::endl; api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax); } } From 4d5a07fdc1774bf65ae222ce76992a311ea52d32 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 21 Jan 2025 08:55:04 +0100 Subject: [PATCH 41/50] DPL Analysis: simplify the persist method with requirements (#13881) --- .../Core/include/Framework/TableBuilder.h | 86 ++++++++++--------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/Framework/Core/include/Framework/TableBuilder.h b/Framework/Core/include/Framework/TableBuilder.h index 65f361edc0c3b..1be53dc39567a 100644 --- a/Framework/Core/include/Framework/TableBuilder.h +++ b/Framework/Core/include/Framework/TableBuilder.h @@ -661,29 +661,27 @@ class TableBuilder } public: - template + template + requires(sizeof...(ARGS) == 0) static constexpr int countColumns() { - using args_pack_t = framework::pack; - if constexpr (sizeof...(ARGS) == 1 && - std::is_bounded_array>::value == false && - std::is_arithmetic_v> == false && - framework::is_base_of_template_v> == false) { - using objType_t = pack_element_t<0, framework::pack>; - using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); - return framework::pack_size(argsPack_t{}); - } else if constexpr (sizeof...(ARGS) == 1 && - (std::is_bounded_array>::value == true || - framework::is_base_of_template_v> == true)) { - using objType_t = pack_element_t<0, framework::pack>; - using argsPack_t = framework::pack; + if constexpr (std::is_bounded_array_v == false && + std::is_arithmetic_v == false && + framework::is_base_of_template_v == false) { + using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); return framework::pack_size(argsPack_t{}); - } else if constexpr (sizeof...(ARGS) >= 1) { - return sizeof...(ARGS); } else { - static_assert(o2::framework::always_static_assert_v, "Unmanaged case"); + return 1; } } + + template + requires(sizeof...(ARGS) > 0) + static constexpr int countColumns() + { + return 1 + sizeof...(ARGS); + } + void setLabel(const char* label); TableBuilder(arrow::MemoryPool* pool = arrow::default_memory_pool()) @@ -699,38 +697,44 @@ class TableBuilder /// Creates a lambda which is suitable to persist things /// in an arrow::Table - template ()> - auto persist(std::array const& columnNames) - { - using args_pack_t = framework::pack; - if constexpr (sizeof...(ARGS) == 1 && - std::is_bounded_array>::value == false && - std::is_arithmetic_v> == false && - framework::is_base_of_template_v> == false) { - using objType_t = pack_element_t<0, framework::pack>; - using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); + template + requires(sizeof...(ARGS) > 0) + auto persist(std::array const& columnNames) + { + auto persister = persistTuple(framework::pack{}, columnNames); + // Callback used to fill the builders + return [persister = persister](unsigned int slot, typename BuilderMaker::FillType const& arg, typename BuilderMaker::FillType... args) -> void { + persister(slot, std::forward_as_tuple(arg, args...)); + }; + } + + // Special case for a single parameter to handle the serialization of struct + // which can be decomposed + template + requires(sizeof...(ARGS) == 0) + auto persist(std::array()> const& columnNames) + { + if constexpr (std::is_bounded_array_v == false && + std::is_arithmetic_v == false && + framework::is_base_of_template_v == false) { + using argsPack_t = decltype(tuple_to_pack(framework::to_tuple(std::declval()))); auto persister = persistTuple(argsPack_t{}, columnNames); - return [persister = persister](unsigned int slot, objType_t const& obj) -> void { + return [persister = persister](unsigned int slot, ARG0 const& obj) -> void { auto t = to_tuple(obj); persister(slot, t); }; - } else if constexpr (sizeof...(ARGS) == 1 && - (std::is_bounded_array>::value == true || - framework::is_base_of_template_v> == true)) { - using objType_t = pack_element_t<0, framework::pack>; - auto persister = persistTuple(framework::pack{}, columnNames); + } else if constexpr ((std::is_bounded_array_v == true || + framework::is_base_of_template_v == true)) { + auto persister = persistTuple(framework::pack{}, columnNames); // Callback used to fill the builders - return [persister = persister](unsigned int slot, typename BuilderMaker::FillType const& arg) -> void { + return [persister = persister](unsigned int slot, typename BuilderMaker::FillType const& arg) -> void { persister(slot, std::forward_as_tuple(arg)); }; - } else if constexpr (sizeof...(ARGS) >= 1) { - auto persister = persistTuple(framework::pack{}, columnNames); - // Callback used to fill the builders - return [persister = persister](unsigned int slot, typename BuilderMaker::FillType... args) -> void { - persister(slot, std::forward_as_tuple(args...)); - }; } else { - static_assert(o2::framework::always_static_assert_v, "Unmanaged case"); + auto persister = persistTuple(framework::pack{}, columnNames); + return [persister = persister](unsigned int slot, typename BuilderMaker::FillType const& arg) -> void { + persister(slot, std::forward_as_tuple(arg)); + }; } } From 42f238b723b9cc1511ed9c484552b8a2f8250298 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 27 Nov 2024 15:22:35 +0100 Subject: [PATCH 42/50] ITS3: Add metalstack to geometry --- .../ITS3/base/include/ITS3Base/SpecsV2.h | 17 +++++++++++++---- .../ITS3/macros/test/TestSensorGeometry.C | 2 +- .../include/ITS3Simulation/ITS3Layer.h | 1 + .../Upgrades/ITS3/simulation/src/ITS3Layer.cxx | 11 ++++++++++- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h index d3efde58d0e0d..03264ae80a3d8 100644 --- a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h +++ b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h @@ -106,16 +106,25 @@ constexpr std::array nHoles{11, 11, 11}; // how constexpr std::array radiusHoles{1.0 * mm, 1.0 * mm, 2.0 * mm}; // what is the radius of the holes for each layer? constexpr EColor color{kGray}; } // namespace carbonfoam +namespace metalstack +{ +constexpr float thickness{5 * mu}; // physical thickness of the copper metal stack +constexpr float length{segment::length}; +constexpr float width{segment::width}; +constexpr EColor color{kBlack}; +} // namespace metalstack constexpr unsigned int nLayers{3}; constexpr unsigned int nTotLayers{7}; constexpr unsigned int nSensorsIB{2 * nLayers}; constexpr float equatorialGap{1 * mm}; constexpr std::array nSegments{3, 4, 5}; -constexpr float thickness{50 * mu}; //< Physical Thickness of chip -constexpr float effThickness{66 * mu}; //< Physical thickness + metal substrate +constexpr float epitaxialThickness{10 * mu}; +constexpr float psubThickness{40 * mu}; +constexpr float thickness{epitaxialThickness + psubThickness}; // physical thickness of chip +constexpr float effThickness{epitaxialThickness + psubThickness / 2.0}; // correction to the epitaxial layer constexpr std::array radii{19.0006 * mm, 25.228 * mm, 31.4554 * mm}; // middle radius e.g. inner radius+thickness/2. -constexpr std::array radiiInner{radii[0] - thickness / 2.f, radii[1] - thickness / 2.f, radii[2] - thickness / 2.f}; // inner radius -constexpr std::array radiiOuter{radii[0] + thickness / 2.f, radii[1] + thickness / 2.f, radii[2] + thickness / 2.f}; // inner radius +constexpr std::array radiiInner{radii[0] - thickness / 2.0, radii[1] - thickness / 2.0, radii[2] - thickness / 2.0}; // inner radius +constexpr std::array radiiOuter{radii[0] + thickness / 2.0, radii[1] + thickness / 2.0, radii[2] + thickness / 2.0}; // inner radius namespace detID { constexpr unsigned int mDetIDs{2 * 12 * 12 * 12}; //< 2 Hemispheres * (3,4,5=12 segments in a layer) * 12 RSUs in a segment * 12 Tiles in a RSU diff --git a/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C b/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C index 1a0ec73e34f31..b3221fd2dfbc2 100644 --- a/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C +++ b/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C @@ -45,7 +45,7 @@ void TestSensorGeometry(bool checkFull = false) if (checkFull) { gGeoManager->CheckGeometryFull(); } - gGeoManager->CheckOverlaps(0.0001); + gGeoManager->CheckOverlaps(0.00001); TIter nextOverlap{gGeoManager->GetListOfOverlaps()}; while ((obj = (TObject*)nextOverlap())) { LOGP(info, "Overlap in {}", obj->GetName()); diff --git a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h index 7543650e04a71..8e0b74cc90617 100644 --- a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h +++ b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h @@ -82,6 +82,7 @@ class ITS3Layer TGeoMedium* mSilicon{nullptr}; TGeoMedium* mAir{nullptr}; TGeoMedium* mCarbon{nullptr}; + TGeoMedium* mCopper{nullptr}; void getMaterials(bool create = false); TGeoMedium* getMaterial(const char* matName, bool create = false); diff --git a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx index 26e47e03057c2..8b5fdfc1a1a63 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx @@ -47,6 +47,7 @@ void ITS3Layer::getMaterials(bool create) mSilicon = getMaterial("IT3_SI$", create); mAir = getMaterial("IT3_AIR$", create); mCarbon = getMaterial("IT3_CARBON$", create); + mCopper = getMaterial("IT3_COPPER$", create); } TGeoMedium* ITS3Layer::getMaterial(const char* matName, bool create) @@ -276,11 +277,19 @@ void ITS3Layer::createChip() mChip = new TGeoVolumeAssembly(its3TGeo::getITS3ChipPattern(mNLayer)); mChip->VisibleDaughters(); + auto phiOffset = constants::segment::width / mR * o2m::Rad2Deg; for (unsigned int i{0}; i < constants::nSegments[mNLayer]; ++i) { - double phiOffset = constants::segment::width / mR * o2m::Rad2Deg; auto rot = new TGeoRotation("", 0, 0, phiOffset * i); mChip->AddNode(mSegment, i, rot); } + + // Add metal stack positioned radially outward + auto zMoveMetal = new TGeoTranslation(0, 0, constants::metalstack::length / 2. - constants::segment::lec::length); + auto metal = new TGeoTubeSeg(mRmax, mRmax + constants::metalstack::thickness, constants::metalstack::length / 2., 0, 3.0 * phiOffset); + auto metalVol = new TGeoVolume(Form("metal%d", mNLayer), metal, mCopper); + metalVol->SetLineColor(constants::metalstack::color); + metalVol->RegisterYourself(); + mChip->AddNode(metalVol, 0, zMoveMetal); } void ITS3Layer::createCarbonForm() From 73eb4ed67f3da7dd1ceab52110ae689717088f63 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Thu, 23 Jan 2025 15:17:09 +0100 Subject: [PATCH 43/50] ITS3: correction to epitaxial layer Signed-off-by: Felix Schlepper --- .../ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h | 1 + Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h index dbdf90574ce5d..d49714829a2d8 100644 --- a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h +++ b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h @@ -69,6 +69,7 @@ class SegmentationSuperAlpide static constexpr float mPitchRow{constants::pixelarray::width / static_cast(mNRows)}; static constexpr float mSensorLayerThickness{constants::thickness}; static constexpr float mSensorLayerThicknessEff{constants::effThickness}; + static constexpr float mSensorLayerThicknessCorr{constants::corrThickness}; static constexpr std::array mRadii{constants::radii}; /// Transformation from the curved surface to a flat surface diff --git a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h index 03264ae80a3d8..394a3674e84ec 100644 --- a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h +++ b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h @@ -118,10 +118,11 @@ constexpr unsigned int nTotLayers{7}; constexpr unsigned int nSensorsIB{2 * nLayers}; constexpr float equatorialGap{1 * mm}; constexpr std::array nSegments{3, 4, 5}; -constexpr float epitaxialThickness{10 * mu}; -constexpr float psubThickness{40 * mu}; +constexpr float epitaxialThickness{10 * mu}; // eptixial layer (charge collection) +constexpr float psubThickness{40 * mu}; // silicon substrate constexpr float thickness{epitaxialThickness + psubThickness}; // physical thickness of chip -constexpr float effThickness{epitaxialThickness + psubThickness / 2.0}; // correction to the epitaxial layer +constexpr float effThickness{epitaxialThickness / 2.0 + psubThickness}; // effective physical thickness +constexpr float corrThickness{effThickness - thickness / 2.0}; // correction to get into the epitxial layer constexpr std::array radii{19.0006 * mm, 25.228 * mm, 31.4554 * mm}; // middle radius e.g. inner radius+thickness/2. constexpr std::array radiiInner{radii[0] - thickness / 2.0, radii[1] - thickness / 2.0, radii[2] - thickness / 2.0}; // inner radius constexpr std::array radiiOuter{radii[0] + thickness / 2.0, radii[1] + thickness / 2.0, radii[2] + thickness / 2.0}; // inner radius From 3886c800c869237e99830027a3f1567d226637c4 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 18 Dec 2024 10:19:33 +0100 Subject: [PATCH 44/50] ITS3: small readme changes Signed-off-by: Felix Schlepper --- Detectors/Upgrades/ITS3/README.md | 105 ++++++++++++++++++++++++++++-- 1 file changed, 101 insertions(+), 4 deletions(-) diff --git a/Detectors/Upgrades/ITS3/README.md b/Detectors/Upgrades/ITS3/README.md index 6d3b0d8d821fb..afcea6a5c3e17 100644 --- a/Detectors/Upgrades/ITS3/README.md +++ b/Detectors/Upgrades/ITS3/README.md @@ -35,7 +35,7 @@ export ALICEO2_CCDB_LOCALCACHE=${PWD}/ccdb Simulate diamond -``` bash +```bash # append to o2-sim --configKeyValues="Diamond.width[2]=6.;"" ``` @@ -86,13 +86,27 @@ TODO ```bash # Create Full Geometry -o2-sim -g pythia8pp -j10 --detectorList ALICE2.1 --run 303901 -n0 +o2-sim --detectorList ALICE2.1 --run 303901 -n0 cp o2sim_geometry.root ${ALICEO2_CCDB_LOCALCACHE}/GLO/Config/Geometry/snapshot.root o2-create-aligned-geometry-workflow -b --configKeyValues "HBFUtils.startTime=1547978230000" --condition-remap="file://${ALICEO2_CCDB_LOCALCACHE}=GLO/Config/Geometry" cp o2sim_geometry-aligned.root ${ALICEO2_CCDB_LOCALCACHE}/GLO/Config/GeometryAligned/snapshot.root cp its_GeometryTGeo.root ${ALICEO2_CCDB_LOCALCACHE}/ITS/Config/Geometry/snapshot.root ``` +or copying the ideal geometry to the aligned one and: + +```cpp +{ + o2::base::GeometryManager::loadGeometry(""); + auto itsTGeo = o2::its::GeometryTGeo::Instance(); + itsTGeo->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G, o2::math_utils::TransformType::T2GRot)); + TFile outF("its_GeometryTGeo.root", "recreate"); + outF.WriteObjectAny(itsTGeo, "o2::its::GeometryTGeo", "ccdb_object"); + outF.Close(); + itsTGeo->destroy(); +} +``` + ### Regenerating the TopologyDictionary 1. Clusterization w/o tracking @@ -158,7 +172,7 @@ The file `hijing.C` can be found [here](https://alice.its.cern.ch/jira/browse/AO 2. (optional) Run the macro `CreateITS3StaticDeadMap.C` and/or visualize with `CheckTileNumbering.C` 3. Move the ccdb object into `${ALICEO2_CCDB_LOCALCACHE}/IT3/Calib/DeadMap`, this is not optional since there is no default object uploaded 4. Run digitizer with `ITS3Params.useDeadChannelMap=true;`, e.g.: -``` bash +```bash o2-sim-digitizer-workflow --configKeyValues="ITS3Params.useDeadChannelMap=true;" ``` @@ -168,6 +182,89 @@ o2-sim-digitizer-workflow --configKeyValues="ITS3Params.useDeadChannelMap=true;" 1. Create misalignment parameters with `CreateMisalignmentITS3.C` 2. Visualize with `ShowCoefficients.C` 3. Run digitizer -``` bash +```bash o2-sim-digitizer-workflow -b --configKeyValues="ITS3Params.applyMisalignmentHits=true;ITS3Params.misalignmentHitsParams=misparams.root" ``` + + +### Misc +#### Setup to run SIM+DIGIT+TRACKING +```bash + +#!/bin/bash + +export IGNORE_VALIDITYCHECK_OF_CCDB_LOCALCACHE=1 +export ALICEO2_CCDB_LOCALCACHE=$PWD/ccdb + +BASE_DIR="batch_" +TOTAL_DIRS=4 +SIM_CMD="o2-sim -g pythia8pp --detectorList ALICE2.1 -m IT3 --run 303901 -n2000 --field ccdb -j8" +DIGIT_CMD="o2-sim-digitizer-workflow -b --interactionRate 675000 --run --configKeyValues=\"HBFUtils.runNumber=303901;HBFUtils.nHBFPerTF=32;ITSAlpideParam.roFrameLengthInBC=198\"" +RECO_CMD="o2-its3-reco-workflow -b --run --configKeyValues=\"ITSVertexerParam.phiCut=0.5;ITSVertexerParam.clusterContributorsCut=3;ITSVertexerParam.tanLambdaCut=0.2;ITSCATrackerParam.useTrackFollower=0;ITSCATrackerParam.findShortTracks=1;HBFUtils.runNumber=303901;HBFUtils.nHBFPerTF=32;ITSAlpideParam.roFrameLengthInBC=198\" --tracking-mode async" + +for ((i = 1; i <= TOTAL_DIRS; i++)); do + DIR="${BASE_DIR}${i}" + + if [ ! -d "$DIR" ]; then + mkdir "$DIR" + fi + + if [ -f "${DIR}/sim_done" ]; then + echo "Skipping SIM ${DIR} because _done exists." + continue + fi + + cd "$DIR" + + echo "Executing SIM command in ${DIR}..." + eval $SIM_CMD >sim.log + + touch sim_done + + cd .. +done + +for ((i = 1; i <= TOTAL_DIRS; i++)); do + DIR="${BASE_DIR}${i}" + + if [ ! -d "$DIR" ]; then + mkdir "$DIR" + fi + + if [ -f "${DIR}/digit_done" ]; then + echo "Skipping DIGIT ${DIR} because _done exists." + continue + fi + + cd "$DIR" + + echo "Executing DIGIT command in ${DIR}..." + eval $DIGIT_CMD >digit.log + + touch digit_done + + cd .. +done + +for ((i = 1; i <= TOTAL_DIRS; i++)); do + DIR="${BASE_DIR}${i}" + + if [ ! -d "$DIR" ]; then + mkdir "$DIR" + fi + + if [ -f "${DIR}/reco_done" ]; then + echo "Skipping RECO ${DIR} because _done exists." + continue + fi + + cd "$DIR" + + echo "Executing RECO command in ${DIR}..." + eval $RECO_CMD >reco.log + + touch reco_done + + cd .. +done +``` From be3242aa24e28bf1d6587cbd403e39636bf9e7f5 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 22 Jan 2025 17:57:50 +0100 Subject: [PATCH 45/50] ITS3: Fix metal stack geo Signed-off-by: Felix Schlepper --- Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx index 8b5fdfc1a1a63..cca97241de4f8 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx @@ -285,7 +285,7 @@ void ITS3Layer::createChip() // Add metal stack positioned radially outward auto zMoveMetal = new TGeoTranslation(0, 0, constants::metalstack::length / 2. - constants::segment::lec::length); - auto metal = new TGeoTubeSeg(mRmax, mRmax + constants::metalstack::thickness, constants::metalstack::length / 2., 0, 3.0 * phiOffset); + auto metal = new TGeoTubeSeg(mRmax, mRmax + constants::metalstack::thickness, constants::metalstack::length / 2., 0, constants::nSegments[mNLayer] * phiOffset); auto metalVol = new TGeoVolume(Form("metal%d", mNLayer), metal, mCopper); metalVol->SetLineColor(constants::metalstack::color); metalVol->RegisterYourself(); From 8fd0debbf0e87ab44cff2ae1e1339bee9843f7e3 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Wed, 22 Jan 2025 21:41:02 +0100 Subject: [PATCH 46/50] ITS3: change severity to debug Signed-off-by: Felix Schlepper --- .../ITS3/simulation/src/DescriptorInnerBarrelITS3.cxx | 4 ++-- Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Detectors/Upgrades/ITS3/simulation/src/DescriptorInnerBarrelITS3.cxx b/Detectors/Upgrades/ITS3/simulation/src/DescriptorInnerBarrelITS3.cxx index 6d1bc621b5287..540e1d41f1c62 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/DescriptorInnerBarrelITS3.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/DescriptorInnerBarrelITS3.cxx @@ -18,14 +18,14 @@ ClassImp(DescriptorInnerBarrelITS3); void DescriptorInnerBarrelITS3::createLayer(int iLayer, TGeoVolume* dest) { - LOGP(info, "ITS3-IB: Creating Layer {}", iLayer); + LOGP(debug, "ITS3-IB: Creating Layer {}", iLayer); mIBLayers[iLayer] = std::make_unique(iLayer); mIBLayers[iLayer]->createLayer(dest); } void DescriptorInnerBarrelITS3::createServices(TGeoVolume* dest) { - LOGP(info, "ITS3-IB: Creating Services"); + LOGP(debug, "ITS3-IB: Creating Services"); mServices = std::make_unique(); mServices->createCYSSAssembly(dest); } diff --git a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx index cca97241de4f8..7459ec0c370f0 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx @@ -76,7 +76,7 @@ void ITS3Layer::createLayer(TGeoVolume* motherVolume) createLayerImpl(); mBuilt = true; - LOGP(info, "ITS3-Layer: Created Layer {} with mR={} (minR={}, maxR={})", mNLayer, mR, mRmin, mRmax); + LOGP(debug, "ITS3-Layer: Created Layer {} with mR={} (minR={}, maxR={})", mNLayer, mR, mRmin, mRmax); if (motherVolume == nullptr) { return; } From 0c4389301977eb555241c440b194afd8048a98c0 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Thu, 23 Jan 2025 09:35:06 +0100 Subject: [PATCH 47/50] ITS3: modify layer geo Signed-off-by: Felix Schlepper --- .../include/ITS3Simulation/ITS3Layer.h | 18 +++++++++--------- .../Upgrades/ITS3/simulation/src/ITS3Layer.cxx | 15 +++------------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h index 8e0b74cc90617..1cc575f729146 100644 --- a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h +++ b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h @@ -20,13 +20,12 @@ #include #include -#include "Framework/Logger.h" -#include +#include "ITS3Base/SpecsV2.h" namespace o2::its3 { -/// This class defines the Geometry for the ITS3 using TGeo. +/// This class defines the geometry for the ITS3 IB layers. class ITS3Layer { // The hierarchy will be the following: @@ -56,11 +55,10 @@ class ITS3Layer return mNames[static_cast((b == BuildLevel::kAll) ? BuildLevel::kLayer : b)]; } - explicit ITS3Layer(int layer = 0) : mNLayer(layer) - { - LOGP(debug, "Called on {} layer {}", layer, mNLayer); - init(); - } + explicit ITS3Layer(int layer = 0) : mNLayer(layer), + mR(o2::its3::constants::radii[mNLayer]), + mRmin(o2::its3::constants::radiiInner[mNLayer]), + mRmax(o2::its3::constants::radiiOuter[mNLayer]) {} explicit ITS3Layer(TGeoVolume* motherVolume, int layer = 0) : ITS3Layer(layer) { @@ -101,7 +99,9 @@ class ITS3Layer double mRmin{}; // Minimum Radius double mRmax{0}; // Maximum Radius - // Individual Pieces + // Individual pieces + // since TGeo manages the resources itself one should not use these pointers + // after initializition anymore! TGeoVolume* mPixelArray{nullptr}; TGeoVolumeAssembly* mTile{nullptr}; TGeoVolumeAssembly* mRSU{nullptr}; diff --git a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx index 7459ec0c370f0..b288a08df1b47 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx @@ -18,11 +18,11 @@ #include "TGeoVolume.h" #include "TGeoCompositeShape.h" +#include "Framework/Logger.h" #include "CommonConstants/MathConstants.h" #include "ITSBase/GeometryTGeo.h" #include "ITS3Base/SpecsV2.h" #include "ITS3Simulation/ITS3Layer.h" -#include "fairlogger/Logger.h" namespace o2m = o2::constants::math; namespace its3c = o2::its3::constants; @@ -31,13 +31,6 @@ namespace o2::its3 { using its3TGeo = o2::its::GeometryTGeo; -void ITS3Layer::init() -{ - mR = its3c::radii[mNLayer]; - mRmin = its3c::radiiInner[mNLayer]; - mRmax = its3c::radiiOuter[mNLayer]; -} - void ITS3Layer::getMaterials(bool create) { if (gGeoManager == nullptr) { @@ -59,11 +52,11 @@ TGeoMedium* ITS3Layer::getMaterial(const char* matName, bool create) } else { // create dummy auto matDummy = gGeoManager->GetMaterial("MAT_DUMMY$"); if (matDummy == nullptr) { - LOGP(info, "Created Dummy material"); + LOGP(warn, "Created Dummy material"); matDummy = new TGeoMaterial("MAT_DUMMY$", 26.98, 13, 2.7); } mat = new TGeoMedium(matName, 1, matDummy); - LOGP(info, "Created medium {}", matName); + LOGP(warn, "Created medium {}", matName); } } return mat; @@ -76,12 +69,10 @@ void ITS3Layer::createLayer(TGeoVolume* motherVolume) createLayerImpl(); mBuilt = true; - LOGP(debug, "ITS3-Layer: Created Layer {} with mR={} (minR={}, maxR={})", mNLayer, mR, mRmin, mRmax); if (motherVolume == nullptr) { return; } // Add it to motherVolume - LOGP(debug, " `-> Attaching to motherVolume '{}'", motherVolume->GetName()); auto* trans = new TGeoTranslation(0, 0, -constants::segment::lengthSensitive / 2.); motherVolume->AddNode(mLayer, 0, trans); } From ef4cb8707cc2cb4dc2c897ad050c9967b76d5bd8 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Thu, 23 Jan 2025 15:51:21 +0100 Subject: [PATCH 48/50] ITS3: make segmentation class header only Signed-off-by: Felix Schlepper --- Detectors/Upgrades/ITS3/base/CMakeLists.txt | 12 ++++----- .../ITS3Base/SegmentationSuperAlpide.h | 18 +++++-------- .../Upgrades/ITS3/base/src/ITS3BaseLinkDef.h | 1 - .../ITS3/base/src/SegmentationSuperAlpide.cxx | 20 --------------- .../ITS3Reconstruction/TopologyDictionary.h | 12 +++++---- .../reconstruction/src/TopologyDictionary.cxx | 12 ++++----- .../include/ITS3Simulation/Digitizer.h | 2 ++ .../ITS3/simulation/src/Digitizer.cxx | 25 +++++++++---------- 8 files changed, 38 insertions(+), 64 deletions(-) delete mode 100644 Detectors/Upgrades/ITS3/base/src/SegmentationSuperAlpide.cxx diff --git a/Detectors/Upgrades/ITS3/base/CMakeLists.txt b/Detectors/Upgrades/ITS3/base/CMakeLists.txt index 8695e2323bbab..306226e5088cf 100644 --- a/Detectors/Upgrades/ITS3/base/CMakeLists.txt +++ b/Detectors/Upgrades/ITS3/base/CMakeLists.txt @@ -9,11 +9,9 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. -o2_add_library(ITS3Base - SOURCES src/SegmentationSuperAlpide.cxx - src/ITS3Params.cxx - PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::MathUtils O2::DetectorsBase) +o2_add_library( + ITS3Base + SOURCES src/ITS3Params.cxx + PUBLIC_LINK_LIBRARIES O2::CommonConstants O2::MathUtils O2::DetectorsBase) -o2_target_root_dictionary(ITS3Base - HEADERS include/ITS3Base/SegmentationSuperAlpide.h - include/ITS3Base/ITS3Params.h) +o2_target_root_dictionary(ITS3Base HEADERS include/ITS3Base/ITS3Params.h) diff --git a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h index d49714829a2d8..524d6b59352a2 100644 --- a/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h +++ b/Detectors/Upgrades/ITS3/base/include/ITS3Base/SegmentationSuperAlpide.h @@ -53,10 +53,10 @@ class SegmentationSuperAlpide // | | | // x----------------------x public: - virtual ~SegmentationSuperAlpide() = default; + ~SegmentationSuperAlpide() = default; SegmentationSuperAlpide(const SegmentationSuperAlpide&) = default; SegmentationSuperAlpide(SegmentationSuperAlpide&&) = delete; - SegmentationSuperAlpide& operator=(const SegmentationSuperAlpide&) = delete; + SegmentationSuperAlpide& operator=(const SegmentationSuperAlpide&) = default; SegmentationSuperAlpide& operator=(SegmentationSuperAlpide&&) = delete; constexpr SegmentationSuperAlpide(int layer) : mLayer{layer} {} @@ -85,9 +85,8 @@ class SegmentationSuperAlpide { // MUST align the flat surface with the curved surface with the original pixel array is on float dist = std::hypot(xCurved, yCurved); - float phiReadout = constants::tile::readout::width / constants::radii[mLayer]; float phi = std::atan2(yCurved, xCurved); - xFlat = mRadii[mLayer] * (phi - phiReadout) - constants::pixelarray::width / 2.; + xFlat = (mRadii[mLayer] * phi) - constants::pixelarray::width / 2.; yFlat = dist - mRadii[mLayer]; } @@ -105,9 +104,8 @@ class SegmentationSuperAlpide { // MUST align the flat surface with the curved surface with the original pixel array is on float dist = yFlat + mRadii[mLayer]; - float phiReadout = constants::tile::readout::width / mRadii[mLayer]; - xCurved = dist * std::cos(phiReadout + (xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]); - yCurved = dist * std::sin(phiReadout + (xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]); + xCurved = dist * std::cos((xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]); + yCurved = dist * std::sin((xFlat + constants::pixelarray::width / 2.) / mRadii[mLayer]); } /// Transformation from Geant detector centered local coordinates (cm) to @@ -196,13 +194,9 @@ class SegmentationSuperAlpide } } - const int mLayer{0}; ///< chip layer - - ClassDef(SegmentationSuperAlpide, 1); + int mLayer{0}; ///< chip layer }; -/// Segmentation array -extern const std::array SuperSegmentations; } // namespace o2::its3 #endif diff --git a/Detectors/Upgrades/ITS3/base/src/ITS3BaseLinkDef.h b/Detectors/Upgrades/ITS3/base/src/ITS3BaseLinkDef.h index dc0557824e0f8..144711b052a1b 100644 --- a/Detectors/Upgrades/ITS3/base/src/ITS3BaseLinkDef.h +++ b/Detectors/Upgrades/ITS3/base/src/ITS3BaseLinkDef.h @@ -15,7 +15,6 @@ #pragma link off all classes; #pragma link off all functions; -#pragma link C++ class o2::its3::SegmentationSuperAlpide + ; #pragma link C++ class o2::its3::ITS3Params + ; #pragma link C++ class o2::conf::ConfigurableParamHelper < o2::its3::ITS3Params> + ; diff --git a/Detectors/Upgrades/ITS3/base/src/SegmentationSuperAlpide.cxx b/Detectors/Upgrades/ITS3/base/src/SegmentationSuperAlpide.cxx deleted file mode 100644 index 26ca09f351bec..0000000000000 --- a/Detectors/Upgrades/ITS3/base/src/SegmentationSuperAlpide.cxx +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2019-2020 CERN and copyright holders of ALICE O2. -// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. -// All rights not expressly granted are reserved. -// -// This software is distributed under the terms of the GNU General Public -// License v3 (GPL Version 3), copied verbatim in the file "COPYING". -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#include "ITS3Base/SegmentationSuperAlpide.h" - -ClassImp(o2::its3::SegmentationSuperAlpide); - -namespace o2::its3 -{ - -const std::array SuperSegmentations{0, 1, 2}; -} diff --git a/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h b/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h index a11131ed9f61f..c810ddc49fd76 100644 --- a/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h +++ b/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h @@ -17,6 +17,7 @@ #include "DataFormatsITSMFT/TopologyDictionary.h" #include "DataFormatsITSMFT/ClusterPattern.h" +#include "ITS3Base/SegmentationSuperAlpide.h" namespace o2::its3 { @@ -125,7 +126,7 @@ class TopologyDictionary /// Returns the local position of a compact cluster template - static math_utils::Point3D getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup = true); + math_utils::Point3D getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup = true) const; static TopologyDictionary* loadFrom(const std::string& fileName = "", const std::string& objName = "ccdb_object"); @@ -134,10 +135,11 @@ class TopologyDictionary private: static constexpr int STopoSize{8 * 255 + 1}; - std::unordered_map mCommonMap{}; ///< Map of pair - std::unordered_map mGroupMap{}; ///< Map of pair - int mSmallTopologiesLUT[STopoSize]{}; ///< Look-Up Table for the topologies with 1-byte linearised matrix - std::vector mVectorOfIDs{}; ///< Vector of topologies and groups + std::unordered_map mCommonMap{}; ///< Map of pair + std::unordered_map mGroupMap{}; ///< Map of pair + int mSmallTopologiesLUT[STopoSize]{}; ///< Look-Up Table for the topologies with 1-byte linearised matrix + std::vector mVectorOfIDs{}; ///< Vector of topologies and groups + std::array mSuperSegmentations{0, 1, 2}; ///< Segmentations for IB layers ClassDefNV(TopologyDictionary, 3); }; diff --git a/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx b/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx index 66a4b0a6878cd..903d852f84a1f 100644 --- a/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx +++ b/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx @@ -143,18 +143,18 @@ math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::C locCl.SetZ(locCl.Z() + this->getZCOG(cl.getPatternID()) * itsmft::SegmentationAlpide::PitchCol); } else { auto layer = its3::constants::detID::getDetID2Layer(cl.getSensorID()); - its3::SuperSegmentations[layer].detectorToLocalUnchecked(cl.getRow(), cl.getCol(), locCl); + mSuperSegmentations[layer].detectorToLocalUnchecked(cl.getRow(), cl.getCol(), locCl); locCl.SetX(locCl.X() + this->getXCOG(cl.getPatternID()) * its3::SegmentationSuperAlpide::mPitchRow); locCl.SetZ(locCl.Z() + this->getZCOG(cl.getPatternID()) * its3::SegmentationSuperAlpide::mPitchCol); float xCurved{0.f}, yCurved{0.f}; - its3::SuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved); + mSuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved); locCl.SetXYZ(xCurved, yCurved, locCl.Z()); } return locCl; } template -math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) +math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) const { auto refRow = cl.getRow(); auto refCol = cl.getCol(); @@ -169,9 +169,9 @@ math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::C o2::itsmft::SegmentationAlpide::detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl); } else { auto layer = its3::constants::detID::getDetID2Layer(cl.getSensorID()); - its3::SuperSegmentations[layer].detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl); + mSuperSegmentations[layer].detectorToLocalUnchecked(refRow + xCOG, refCol + zCOG, locCl); float xCurved{0.f}, yCurved{0.f}; - its3::SuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved); + mSuperSegmentations[layer].flatToCurved(locCl.X(), locCl.Y(), xCurved, yCurved); locCl.SetXYZ(xCurved, yCurved, locCl.Z()); } return locCl; @@ -194,6 +194,6 @@ TopologyDictionary* TopologyDictionary::loadFrom(const std::string& fname, const // Explicitly instaniate templates template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl) const; -template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup); +template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) const; } // namespace o2::its3 diff --git a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h index 7ece842b6f61f..67b0cc7456a46 100644 --- a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h +++ b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h @@ -108,6 +108,8 @@ class Digitizer : public TObject uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs) uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs) + const std::array mSuperSegmentations{0, 1, 2}; + o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr; // simulated response const o2::its::GeometryTGeo* mGeometry = nullptr; ///< ITS3 geometry diff --git a/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx b/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx index f1519c1d04063..b85574402de5b 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx @@ -26,7 +26,6 @@ using o2::itsmft::Hit; using Segmentation = o2::itsmft::SegmentationAlpide; -using SuperSegmentation = o2::its3::SegmentationSuperAlpide; using o2::itsmft::AlpideRespSimMat; using o2::itsmft::PreDigit; @@ -143,7 +142,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast) for (size_t iChip{0}; iChip < mChips.size(); ++iChip) { auto& chip = mChips[iChip]; if (constants::detID::isDetITS3(iChip)) { // Check if this is a chip of ITS3 - chip.addNoise(mROFrameMin, mROFrameMin, &mParams, SuperSegmentation::mNRows, SuperSegmentation::mNCols); + chip.addNoise(mROFrameMin, mROFrameMin, &mParams, SegmentationSuperAlpide::mNRows, SegmentationSuperAlpide::mNCols); } else { chip.addNoise(mROFrameMin, mROFrameMin, &mParams); } @@ -238,8 +237,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID if (innerBarrel) { // transform the point on the curved surface to a flat one float xFlatE{0.f}, yFlatE{0.f}, xFlatS{0.f}, yFlatS{0.f}; - SuperSegmentations[layer].curvedToFlat(xyzLocS.X(), xyzLocS.Y(), xFlatS, yFlatS); - SuperSegmentations[layer].curvedToFlat(xyzLocE.X(), xyzLocE.Y(), xFlatE, yFlatE); + mSuperSegmentations[layer].curvedToFlat(xyzLocS.X(), xyzLocS.Y(), xFlatS, yFlatS); + mSuperSegmentations[layer].curvedToFlat(xyzLocE.X(), xyzLocE.Y(), xFlatE, yFlatE); // update the local coordinates with the flattened ones xyzLocS.SetXYZ(xFlatS, yFlatS, xyzLocS.Z()); xyzLocE.SetXYZ(xFlatE, yFlatE, xyzLocE.Z()); @@ -255,14 +254,14 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID int rowS = -1, colS = -1, rowE = -1, colE = -1, nSkip = 0; if (innerBarrel) { // get entrance pixel row and col - while (!SuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), rowS, colS)) { // guard-ring ? + while (!mSuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), rowS, colS)) { // guard-ring ? if (++nSkip >= nSteps) { return; // did not enter to sensitive matrix } xyzLocS += step; } // get exit pixel row and col - while (!SuperSegmentations[layer].localToDetector(xyzLocE.X(), xyzLocE.Z(), rowE, colE)) { // guard-ring ? + while (!mSuperSegmentations[layer].localToDetector(xyzLocE.X(), xyzLocE.Z(), rowE, colE)) { // guard-ring ? if (++nSkip >= nSteps) { return; // did not enter to sensitive matrix } @@ -298,8 +297,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID rowS = 0; } - int maxNrows{innerBarrel ? SuperSegmentation::mNRows : Segmentation::NRows}; - int maxNcols{innerBarrel ? SuperSegmentation::mNCols : Segmentation::NCols}; + int maxNrows{innerBarrel ? SegmentationSuperAlpide::mNRows : Segmentation::NRows}; + int maxNcols{innerBarrel ? SegmentationSuperAlpide::mNCols : Segmentation::NCols}; if (rowE >= maxNrows) { rowE = maxNrows - 1; } @@ -327,19 +326,19 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID // take into account that the AlpideSimResponse depth defintion has different min/max boundaries // although the max should coincide with the surface of the epitaxial layer, which in the chip // local coordinates has Y = +SensorLayerThickness/2 - float thickness = innerBarrel ? SuperSegmentation::mSensorLayerThickness : Segmentation::SensorLayerThickness; + float thickness = innerBarrel ? SegmentationSuperAlpide::mSensorLayerThickness : Segmentation::SensorLayerThickness; xyzLocS.SetY(xyzLocS.Y() + mAlpSimResp->getDepthMax() - thickness / 2.); // collect charge in evey pixel which might be affected by the hit for (int iStep = nSteps; iStep--;) { // Get the pixel ID if (innerBarrel) { - SuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), row, col); + mSuperSegmentations[layer].localToDetector(xyzLocS.X(), xyzLocS.Z(), row, col); } else { Segmentation::localToDetector(xyzLocS.X(), xyzLocS.Z(), row, col); } if (row != rowPrev || col != colPrev) { // update pixel and coordinates of its center if (innerBarrel) { - if (!SuperSegmentations[layer].detectorToLocal(row, col, cRowPix, cColPix)) { + if (!mSuperSegmentations[layer].detectorToLocal(row, col, cRowPix, cColPix)) { continue; } } else if (!Segmentation::detectorToLocal(row, col, cRowPix, cColPix)) { @@ -350,8 +349,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID } bool flipCol = false, flipRow = false; // note that response needs coordinates along column row (locX) (locZ) then depth (locY) - double rowMax{0.5f * (innerBarrel ? SuperSegmentation::mPitchRow : Segmentation::PitchRow)}; - double colMax{0.5f * (innerBarrel ? SuperSegmentation::mPitchCol : Segmentation::PitchCol)}; + double rowMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchRow : Segmentation::PitchRow)}; + double colMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchCol : Segmentation::PitchCol)}; auto rspmat = mAlpSimResp->getResponse(xyzLocS.X() - cRowPix, xyzLocS.Z() - cColPix, xyzLocS.Y(), flipRow, flipCol, rowMax, colMax); xyzLocS += step; From c707b0aab9ec8a92d5a918bc87a9d048169ba00a Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Thu, 23 Jan 2025 10:58:41 +0100 Subject: [PATCH 49/50] ITS3: move pixelarray to start at zero phi Signed-off-by: Felix Schlepper --- .../ITS3/macros/test/CheckDigitsDensity.C | 6 +-- .../ITS3/macros/test/CheckDigitsITS3.C | 15 +++--- .../macros/test/CheckSuperAlpideSegment.C | 54 +++++++++---------- .../test/CheckSuperAlpideSegmentTrans.C | 16 +++--- .../ITS3/macros/test/CheckTileNumbering.C | 4 +- .../macros/test/CompareClustersAndDigits.C | 14 ++--- .../ITS3/macros/test/CreateDictionariesITS3.C | 5 +- .../ITS3/macros/test/TestSensorGeometry.C | 19 ++++--- .../ITS3Reconstruction/TopologyDictionary.h | 11 ++-- .../reconstruction/src/TopologyDictionary.cxx | 6 ++- .../include/ITS3Simulation/ITS3Layer.h | 4 +- .../ITS3/simulation/src/ITS3Layer.cxx | 21 ++++---- 12 files changed, 88 insertions(+), 87 deletions(-) diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckDigitsDensity.C b/Detectors/Upgrades/ITS3/macros/test/CheckDigitsDensity.C index 0c8d9c3bdfbec..bb07c1a49b7f0 100755 --- a/Detectors/Upgrades/ITS3/macros/test/CheckDigitsDensity.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckDigitsDensity.C @@ -64,7 +64,7 @@ void CheckDigitsDensity(int nEvents = 10000, std::string digitFileName = "it3dig { gROOT->SetBatch(batch); LOGP(debug, "Checking Digit ITS3 Density"); - // Vars + std::array mSuperSegmentations{0, 1, 2}; // Geometry o2::base::GeometryManager::loadGeometry(geomFileName); @@ -103,8 +103,8 @@ void CheckDigitsDensity(int nEvents = 10000, std::string digitFileName = "it3dig // goto curved coordinates float x{0.f}, y{0.f}, z{0.f}; float xFlat{0.f}, yFlat{0.f}; - its3::SuperSegmentations[layer].detectorToLocal(row, col, xFlat, z); - its3::SuperSegmentations[layer].flatToCurved(xFlat, 0., x, y); + mSuperSegmentations[layer].detectorToLocal(row, col, xFlat, z); + mSuperSegmentations[layer].flatToCurved(xFlat, 0., x, y); const o2::math_utils::Point3D locD(x, y, z); const auto gloD = gman->getMatrixL2G(id)(locD); // convert to global const auto R = std::hypot(gloD.X(), gloD.Y()); diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckDigitsITS3.C b/Detectors/Upgrades/ITS3/macros/test/CheckDigitsITS3.C index 16aa3adc8101c..0ce9b4ed798f1 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CheckDigitsITS3.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckDigitsITS3.C @@ -51,6 +51,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil using o2::itsmft::Hit; using o2::itsmft::SegmentationAlpide; + std::array mSuperSegmentations{0, 1, 2}; TFile* f = TFile::Open("CheckDigits.root", "recreate"); TNtuple* nt = new TNtuple("ntd", "digit ntuple", "id:x:y:z:rowD:colD:rowH:colH:xlH:zlH:xlcH:zlcH:dx:dz"); @@ -165,8 +166,8 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil if (isIB) { // ITS3 IB float xFlat{0.f}, yFlat{0.f}; - its3::SuperSegmentations[layer].detectorToLocal(ix, iz, xFlat, z); - its3::SuperSegmentations[layer].flatToCurved(xFlat, 0., x, y); + mSuperSegmentations[layer].detectorToLocal(ix, iz, xFlat, z); + mSuperSegmentations[layer].flatToCurved(xFlat, 0., x, y); } else { // ITS2 OB SegmentationAlpide::detectorToLocal(ix, iz, x, z); @@ -202,12 +203,12 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil if (isIB) { float xFlat{0.}, yFlat{0.}; - its3::SuperSegmentations[layer].curvedToFlat(xyzLocM.X(), xyzLocM.Y(), xFlat, yFlat); + mSuperSegmentations[layer].curvedToFlat(xyzLocM.X(), xyzLocM.Y(), xFlat, yFlat); xyzLocM.SetCoordinates(xFlat, yFlat, xyzLocM.Z()); - its3::SuperSegmentations[layer].curvedToFlat(locD.X(), locD.Y(), xFlat, yFlat); + mSuperSegmentations[layer].curvedToFlat(locD.X(), locD.Y(), xFlat, yFlat); locD.SetCoordinates(xFlat, yFlat, locD.Z()); - if (auto v1 = !its3::SuperSegmentations[layer].localToDetector(xyzLocM.X(), xyzLocM.Z(), row, col), - v2 = !its3::SuperSegmentations[layer].detectorToLocal(row, col, xlc, zlc); + if (auto v1 = !mSuperSegmentations[layer].localToDetector(xyzLocM.X(), xyzLocM.Z(), row, col), + v2 = !mSuperSegmentations[layer].detectorToLocal(row, col, xlc, zlc); v1 || v2) { continue; } @@ -223,7 +224,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil (isIB) ? ++nDigitFilledIB : ++nDigitFilledOB; } // end loop on digits array - } // end loop on ROFRecords array + } // end loop on ROFRecords array auto canvXY = new TCanvas("canvXY", "", 1600, 1600); canvXY->Divide(2, 2); diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegment.C b/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegment.C index 76ac02959415d..a0ccee366841d 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegment.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegment.C @@ -24,14 +24,6 @@ #include "TGLViewer.h" #include "TMath.h" -#include "TEveGeoNode.h" -#include "TEveManager.h" -#include "TEveViewer.h" -#include "TEvePointSet.h" -#include "TEveTrackPropagator.h" -#include "TEveTrack.h" -#include "TEveVSDStructs.h" - #include "TFile.h" #include "TGraph.h" #include "TH1D.h" @@ -64,21 +56,22 @@ void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false, static constexpr unsigned int mNCols{SegmentationSuperAlpide::mNCols}; static constexpr unsigned int mNRows{SegmentationSuperAlpide::mNRows}; static constexpr unsigned int nPixels{mNCols * mNRows}; + std::array mSuperSegmentations{0, 1, 2}; if (isTestDetectorToLocal || isTestFlatToCurved) { namespace cp = constants::pixelarray; - TH2I* h_raw_col = new TH2I("h_raw_col", "raws and cols sown;raw;col", mNRows, 0, mNRows, mNCols, 0, mNCols); - TH2D* h_xLocal_zLocal = new TH2D("h_xLocal_zLocal", "x and z from raws and cols;xLocal;zLocal", mNRows, -cp::length / 2, cp::length / 2, mNCols, -cp::width / 2, cp::width / 2); - TH2I* h_raw_col_translate = new TH2I("h_raw_col_translate", "raws and cols from x and z;raw;col", mNRows, 0, mNRows, mNCols, 0, mNCols); - TGraph* g_raw_xLocal = new TGraph(); - g_raw_xLocal->SetMarkerStyle(20); - g_raw_xLocal->SetMarkerSize(0.2); + TH2I* h_row_col = new TH2I("h_row_col", "rows and cols sown;row;col", mNRows, 0, mNRows, mNCols, 0, mNCols); + TH2D* h_xLocal_zLocal = new TH2D("h_xLocal_zLocal", "x and z from rows and cols;xLocal;zLocal", mNRows, -cp::length / 2, cp::length / 2, mNCols, -cp::width / 2, cp::width / 2); + TH2I* h_row_col_translate = new TH2I("h_row_col_translate", "rows and cols from x and z;row;col", mNRows, 0, mNRows, mNCols, 0, mNCols); + TGraph* g_row_xLocal = new TGraph(); + g_row_xLocal->SetMarkerStyle(20); + g_row_xLocal->SetMarkerSize(0.2); TGraph* g_col_zLocal = new TGraph(); g_col_zLocal->SetMarkerStyle(20); g_col_zLocal->SetMarkerSize(0.2); - TGraph* g_raw_xLocal_translate = new TGraph(); - g_raw_xLocal_translate->SetMarkerStyle(20); - g_raw_xLocal_translate->SetMarkerSize(0.2); + TGraph* g_row_xLocal_translate = new TGraph(); + g_row_xLocal_translate->SetMarkerStyle(20); + g_row_xLocal_translate->SetMarkerSize(0.2); TGraph* g_col_zLocal_translate = new TGraph(); g_col_zLocal_translate->SetMarkerStyle(20); @@ -92,16 +85,16 @@ void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false, int col_trans = -1; seg.detectorToLocal(i, j, xLocal, zLocal); seg.localToDetector(xLocal, zLocal, row_trans, col_trans); - g_raw_xLocal->SetPoint(nPoint, i, xLocal); + g_row_xLocal->SetPoint(nPoint, i, xLocal); g_col_zLocal->SetPoint(nPoint, j, zLocal); - g_raw_xLocal_translate->SetPoint(nPoint, xLocal, row_trans); + g_row_xLocal_translate->SetPoint(nPoint, xLocal, row_trans); g_col_zLocal_translate->SetPoint(nPoint++, zLocal, col_trans); bool pattern = ((i >= 50 && i <= 100) || (i >= 250 && i <= 350)) && ((j >= 30 && j <= 70) || (j >= 100 && j <= 120)); if (pattern) { - h_raw_col->Fill(i, j); + h_row_col->Fill(i, j); h_xLocal_zLocal->Fill(xLocal, zLocal); - h_raw_col_translate->Fill(row_trans, col_trans); + h_row_col_translate->Fill(row_trans, col_trans); } } } @@ -110,29 +103,30 @@ void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false, // gStyle->SetPalette(kCMYK); c1->Divide(3, 1); c1->cd(1); - h_raw_col->Draw("colz"); + h_row_col->Draw("colz"); c1->cd(2); h_xLocal_zLocal->Draw("colz"); c1->cd(3); - h_raw_col_translate->Draw("colz"); + h_row_col_translate->Draw("colz"); TCanvas* c2 = new TCanvas("c2", "c2", 1600, 400); c2->Divide(4, 1); c2->cd(1); - g_raw_xLocal->SetTitle("xLocal vs raw;raw;xLocal"); - g_raw_xLocal->Draw("same ap"); + g_row_xLocal->SetTitle("xLocal vs row;row;xLocal"); + g_row_xLocal->Draw("same ap"); c2->cd(2); g_col_zLocal->SetTitle("zLocal vs col;col;zLocal"); g_col_zLocal->Draw("same ap"); c2->cd(3); - g_raw_xLocal_translate->SetTitle("raw_translate vs xLocal;xLocal;raw_translate"); - g_raw_xLocal_translate->Draw("same ap"); + g_row_xLocal_translate->SetTitle("row_translate vs xLocal;xLocal;row_translate"); + g_row_xLocal_translate->Draw("same ap"); c2->cd(4); g_col_zLocal_translate->SetTitle("col_translate vs zLocal;zLocal;col_translate"); g_col_zLocal_translate->Draw("same ap"); } if (isTestLocalToGlobal) { + o2::base::GeometryManager::loadGeometry(); namespace cp = constants::pixelarray; TH2D* h_xCurved_yCurved = new TH2D("h_xCurved_yCurved", "from flat to curved;x;y", 200, -1, 4, 200, -2, 3); TH2D* h_xFlat_yFlat = new TH2D("h_xFlat_yFlat", "from curved to flat ;x;y", 200, -1, 4, 200, -2, 3); @@ -170,11 +164,11 @@ void CheckSuperAlpideSegment(bool isTestDetectorToLocal = false, float xLocal_translate = 0; float yLocal_translate = 0; - SuperSegmentations[iLayer].detectorToLocal(row, col, xLocal, zLocal); - SuperSegmentations[iLayer].flatToCurved(xLocal, 0., xCurved, yCurved); + mSuperSegmentations[iLayer].detectorToLocal(row, col, xLocal, zLocal); + mSuperSegmentations[iLayer].flatToCurved(xLocal, 0., xCurved, yCurved); double posLocal[3] = {xCurved, yCurved, zLocal}; double posGlobal[3] = {0, 0, 0}; - SuperSegmentations[iLayer].curvedToFlat(xCurved, yCurved, xLocal_translate, yLocal_translate); + mSuperSegmentations[iLayer].curvedToFlat(xCurved, yCurved, xLocal_translate, yLocal_translate); matrix->LocalToMaster(posLocal, posGlobal); h_xCurved_yCurved->Fill(xLocal, 0); diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegmentTrans.C b/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegmentTrans.C index 64937f2ad2855..0fd1d0225c78d 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegmentTrans.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckSuperAlpideSegmentTrans.C @@ -41,6 +41,7 @@ constexpr auto nRows{SegmentationSuperAlpide::mNRows}; constexpr auto nCols{SegmentationSuperAlpide::mNCols}; constexpr auto fLength{SegmentationSuperAlpide::mLength}; constexpr auto fWidth{SegmentationSuperAlpide::mWidth}; +std::array mSuperSegmentations{0, 1, 2}; TH2* DrawReverseBins(TH2* h) { @@ -140,10 +141,10 @@ void CheckSuperAlpideSegmentTrans() g_arc_inner->AddPoint(x_inner, y_inner); g_arc_outer->AddPoint(x_outer, y_outer); // Test Segmentation - SuperSegmentations[iLayer].curvedToFlat(x_inner, y_inner, x_inner_flat, y_inner_flat); - SuperSegmentations[iLayer].flatToCurved(x_inner_flat, y_inner_flat, x_inner_curved, y_inner_curved); - SuperSegmentations[iLayer].curvedToFlat(x_outer, y_outer, x_outer_flat, y_outer_flat); - SuperSegmentations[iLayer].flatToCurved(x_outer_flat, y_outer_flat, x_outer_curved, y_outer_curved); + mSuperSegmentations[iLayer].curvedToFlat(x_inner, y_inner, x_inner_flat, y_inner_flat); + mSuperSegmentations[iLayer].flatToCurved(x_inner_flat, y_inner_flat, x_inner_curved, y_inner_curved); + mSuperSegmentations[iLayer].curvedToFlat(x_outer, y_outer, x_outer_flat, y_outer_flat); + mSuperSegmentations[iLayer].flatToCurved(x_outer_flat, y_outer_flat, x_outer_curved, y_outer_curved); g_arc_inner_flat->AddPoint(x_inner_flat, y_inner_flat); g_arc_outer_flat->AddPoint(x_outer_flat, y_outer_flat); h_f2c_res->Fill(x_inner - x_inner_curved, y_inner - y_inner_curved); @@ -201,10 +202,9 @@ void CheckSuperAlpideSegmentTrans() for (int iCol{0}; iCol < nCols; ++iCol) { float xRow{0}, zCol{0}; int iiRow{0}, iiCol{0}; - auto v1 = - SuperSegmentations[iLayer].detectorToLocal(iRow, iCol, xRow, zCol); - auto v2 = SuperSegmentations[iLayer].localToDetector(xRow, zCol, iiRow, - iiCol); + auto v1 = mSuperSegmentations[iLayer].detectorToLocal(iRow, iCol, xRow, zCol); + auto v2 = mSuperSegmentations[iLayer].localToDetector(xRow, zCol, iiRow, + iiCol); // Info("L2D", // "iRow=%d, iCol=%d --d2l(%s)--> xRow=%f, zCol=%f --l2d(%s)--> " // "iiRow=%d, iiCol=%d", diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckTileNumbering.C b/Detectors/Upgrades/ITS3/macros/test/CheckTileNumbering.C index 3a01960b1859d..4550e2c1a17e0 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CheckTileNumbering.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckTileNumbering.C @@ -102,6 +102,8 @@ void CheckTileNumbering(const std::string& inputGeom = "", const std::string& de Int_t colors[NRGBs] = {kWhite, kRed, kGray}; TColor::SetPalette(NRGBs, colors, 1.0); + std::array mSuperSegmentations{0, 1, 2}; + const float phiOffsetL0 = std::asin(o2::its3::constants::equatorialGap / 2.f / o2::its3::constants::radii[0]); const float phiOffsetL1 = std::asin(o2::its3::constants::equatorialGap / 2.f / o2::its3::constants::radii[1]); const float phiOffsetL2 = std::asin(o2::its3::constants::equatorialGap / 2.f / o2::its3::constants::radii[2]); @@ -142,7 +144,7 @@ void CheckTileNumbering(const std::string& inputGeom = "", const std::string& de for (unsigned int iDet{0}; iDet <= o2::its3::constants::detID::l2IDEnd; ++iDet) { int sensorID = o2::its3::constants::detID::getSensorID(iDet); int layerID = o2::its3::constants::detID::getDetID2Layer(iDet); - o2::its3::SuperSegmentations[layerID].flatToCurved(xFlat, 0., x, y); + mSuperSegmentations[layerID].flatToCurved(xFlat, 0., x, y); o2::math_utils::Point3D locC{x, y, z}; auto gloC = gman->getMatrixL2G(iDet)(locC); float phi = o2::math_utils::to02Pi(std::atan2(gloC.Y(), gloC.X())); diff --git a/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C b/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C index f151de72c8ac1..f454745c0f076 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C +++ b/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C @@ -97,6 +97,8 @@ void CompareClustersAndDigits(std::string clusfile = "o2clus_it3.root", std::vector hitVecPool; std::vector mc2hitVec; + std::array mSuperSegmentations{0, 1, 2}; + // Geometry o2::base::GeometryManager::loadGeometry(inputGeom); auto gman = o2::its::GeometryTGeo::Instance(); @@ -282,9 +284,9 @@ void CompareClustersAndDigits(std::string clusfile = "o2clus_it3.root", o2::math_utils::Point3D locHMiddle; if (isIB) { float xFlat{0.}, yFlat{0.}; - o2::its3::SuperSegmentations[layer].curvedToFlat(locHEnd.X(), locHEnd.Y(), xFlat, yFlat); + mSuperSegmentations[layer].curvedToFlat(locHEnd.X(), locHEnd.Y(), xFlat, yFlat); locHEnd.SetXYZ(xFlat, yFlat, locHEnd.Z()); - o2::its3::SuperSegmentations[layer].curvedToFlat(locHStart.X(), locHStart.Y(), xFlat, yFlat); + mSuperSegmentations[layer].curvedToFlat(locHStart.X(), locHStart.Y(), xFlat, yFlat); locHStart.SetXYZ(xFlat, yFlat, locHStart.Z()); } locHMiddle.SetXYZ(0.5f * (locHEnd.X() + locHStart.X()), 0.5f * (locHEnd.Y() + locHStart.Y()), 0.5f * (locHEnd.Z() + locHStart.Z())); @@ -292,10 +294,10 @@ void CompareClustersAndDigits(std::string clusfile = "o2clus_it3.root", int rowHS, colHS, rowHM, colHM, rowHE, colHE, colC, rowC; bool v1, v2, v3, v4; if (isIB) { - v1 = o2::its3::SuperSegmentations[layer].localToDetector(locHStart.X(), locHStart.Z(), rowHS, colHS); - v2 = o2::its3::SuperSegmentations[layer].localToDetector(locHMiddle.X(), locHMiddle.Z(), rowHM, colHM); - v3 = o2::its3::SuperSegmentations[layer].localToDetector(locHEnd.X(), locHEnd.Z(), rowHE, colHE); - v4 = o2::its3::SuperSegmentations[layer].localToDetector(locC.X(), locC.Z(), rowC, colC); + v1 = mSuperSegmentations[layer].localToDetector(locHStart.X(), locHStart.Z(), rowHS, colHS); + v2 = mSuperSegmentations[layer].localToDetector(locHMiddle.X(), locHMiddle.Z(), rowHM, colHM); + v3 = mSuperSegmentations[layer].localToDetector(locHEnd.X(), locHEnd.Z(), rowHE, colHE); + v4 = mSuperSegmentations[layer].localToDetector(locC.X(), locC.Z(), rowC, colC); } else { v1 = o2::itsmft::SegmentationAlpide::localToDetector(locHStart.X(), locHStart.Z(), rowHS, colHS); v2 = o2::itsmft::SegmentationAlpide::localToDetector(locHMiddle.X(), locHMiddle.Z(), rowHM, colHM); diff --git a/Detectors/Upgrades/ITS3/macros/test/CreateDictionariesITS3.C b/Detectors/Upgrades/ITS3/macros/test/CreateDictionariesITS3.C index d8783ba7c8fb9..ac6e1138f24e8 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CreateDictionariesITS3.C +++ b/Detectors/Upgrades/ITS3/macros/test/CreateDictionariesITS3.C @@ -82,6 +82,7 @@ void CreateDictionariesITS3(bool saveDeltas = false, std::vector hitVecPool; std::vector mc2hitVec; o2::its3::TopologyDictionary clusDictOld; + std::array mSuperSegmentations{0, 1, 2}; if (!clusDictFile.empty()) { clusDictOld.readFromFile(clusDictFile); LOGP(info, "Loaded external cluster dictionary with {} entries from {}", clusDictOld.getSize(), clusDictFile); @@ -274,9 +275,9 @@ void CreateDictionariesITS3(bool saveDeltas = false, int layer = gman->getLayer(chipID); if (isIB) { float xFlat{0.}, yFlat{0.}; - o2::its3::SuperSegmentations[layer].curvedToFlat(xyzLocM.X(), xyzLocM.Y(), xFlat, yFlat); + mSuperSegmentations[layer].curvedToFlat(xyzLocM.X(), xyzLocM.Y(), xFlat, yFlat); xyzLocM.SetCoordinates(xFlat, yFlat, xyzLocM.Z()); - o2::its3::SuperSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlat, yFlat); + mSuperSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlat, yFlat); locC.SetCoordinates(xFlat, yFlat, locC.Z()); } dX = xyzLocM.X() - locC.X(); diff --git a/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C b/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C index b3221fd2dfbc2..4b54bbced2929 100644 --- a/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C +++ b/Detectors/Upgrades/ITS3/macros/test/TestSensorGeometry.C @@ -21,7 +21,7 @@ #include "TList.h" #endif -void TestSensorGeometry(bool checkFull = false) +void TestSensorGeometry(bool draw = false, bool checkFull = false) { gGeoManager = new TGeoManager("simple", "Simple geometry"); TGeoMaterial* matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0); @@ -30,8 +30,7 @@ void TestSensorGeometry(bool checkFull = false) auto top = gGeoManager->MakeBox("TOP", Vacuum, 270., 270., 120.); gGeoManager->SetTopVolume(top); - o2::its3::ITS3Layer layer0{0, top, nullptr, - o2::its3::ITS3Layer::BuildLevel::kLayer, true}; + o2::its3::ITS3Layer layer0{2, top, nullptr, o2::its3::ITS3Layer::BuildLevel::kLayer, true}; // Print available medias TIter next{gGeoManager->GetListOfMedia()}; @@ -42,13 +41,17 @@ void TestSensorGeometry(bool checkFull = false) gGeoManager->CloseGeometry(); gGeoManager->SetVisLevel(99); + if (draw) { + gGeoManager->Draw("ogl"); + } + if (checkFull) { gGeoManager->CheckGeometryFull(); - } - gGeoManager->CheckOverlaps(0.00001); - TIter nextOverlap{gGeoManager->GetListOfOverlaps()}; - while ((obj = (TObject*)nextOverlap())) { - LOGP(info, "Overlap in {}", obj->GetName()); + gGeoManager->CheckOverlaps(0.00001); + TIter nextOverlap{gGeoManager->GetListOfOverlaps()}; + while ((obj = (TObject*)nextOverlap())) { + LOGP(info, "Overlap in {}", obj->GetName()); + } } std::unique_ptr f{TFile::Open("geo.root", "RECREATE")}; diff --git a/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h b/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h index c810ddc49fd76..bc5fd73d48c84 100644 --- a/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h +++ b/Detectors/Upgrades/ITS3/reconstruction/include/ITS3Reconstruction/TopologyDictionary.h @@ -126,7 +126,7 @@ class TopologyDictionary /// Returns the local position of a compact cluster template - math_utils::Point3D getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup = true) const; + static math_utils::Point3D getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup = true); static TopologyDictionary* loadFrom(const std::string& fileName = "", const std::string& objName = "ccdb_object"); @@ -135,11 +135,10 @@ class TopologyDictionary private: static constexpr int STopoSize{8 * 255 + 1}; - std::unordered_map mCommonMap{}; ///< Map of pair - std::unordered_map mGroupMap{}; ///< Map of pair - int mSmallTopologiesLUT[STopoSize]{}; ///< Look-Up Table for the topologies with 1-byte linearised matrix - std::vector mVectorOfIDs{}; ///< Vector of topologies and groups - std::array mSuperSegmentations{0, 1, 2}; ///< Segmentations for IB layers + std::unordered_map mCommonMap{}; ///< Map of pair + std::unordered_map mGroupMap{}; ///< Map of pair + int mSmallTopologiesLUT[STopoSize]{}; ///< Look-Up Table for the topologies with 1-byte linearised matrix + std::vector mVectorOfIDs{}; ///< Vector of topologies and groups ClassDefNV(TopologyDictionary, 3); }; diff --git a/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx b/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx index 903d852f84a1f..fa521c3b21b31 100644 --- a/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx +++ b/Detectors/Upgrades/ITS3/reconstruction/src/TopologyDictionary.cxx @@ -136,6 +136,7 @@ TH1F* TopologyDictionary::getTopologyDistribution(const std::string_view hname) template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl) const { + static std::array mSuperSegmentations{0, 1, 2}; math_utils::Point3D locCl; if (!its3::constants::detID::isDetITS3(cl.getSensorID())) { o2::itsmft::SegmentationAlpide::detectorToLocalUnchecked(cl.getRow(), cl.getCol(), locCl); @@ -154,8 +155,9 @@ math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::C } template -math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) const +math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) { + static std::array mSuperSegmentations{0, 1, 2}; auto refRow = cl.getRow(); auto refCol = cl.getCol(); float xCOG = 0, zCOG = 0; @@ -194,6 +196,6 @@ TopologyDictionary* TopologyDictionary::loadFrom(const std::string& fname, const // Explicitly instaniate templates template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl) const; -template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup) const; +template math_utils::Point3D TopologyDictionary::getClusterCoordinates(const itsmft::CompClusterExt& cl, const itsmft::ClusterPattern& patt, bool isGroup); } // namespace o2::its3 diff --git a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h index 1cc575f729146..3ca506845aadd 100644 --- a/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h +++ b/Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h @@ -44,8 +44,8 @@ class ITS3Layer kTile, kRSU, kSegment, - kCarbonForm, kChip, + kCarbonForm, kLayer, kAll, }; @@ -110,7 +110,7 @@ class ITS3Layer TGeoVolumeAssembly* mCarbonForm{nullptr}; TGeoVolumeAssembly* mLayer{nullptr}; - ClassDef(ITS3Layer, 2); + ClassDef(ITS3Layer, 3); }; } // namespace o2::its3 diff --git a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx index b288a08df1b47..153fe8ab620fd 100644 --- a/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx +++ b/Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx @@ -85,13 +85,9 @@ void ITS3Layer::createPixelArray() // A pixel array is pure silicon and the sensitive part of our detector. // It will be segmented into a 442x156 matrix by the // SuperSegmentationAlpide. - // Pixel Array is just a longer version of the biasing but starts in phi at - // biasPhi2. using namespace its3c::pixelarray; - double pixelArrayPhi1 = constants::tile::readout::width / mR * o2m::Rad2Deg; - double pixelArrayPhi2 = width / mR * o2m::Rad2Deg + pixelArrayPhi1; - auto pixelArray = new TGeoTubeSeg(mRmin, mRmax, length / 2., - pixelArrayPhi1, pixelArrayPhi2); + double pixelArrayPhi = width / mR * o2m::Rad2Deg; + auto pixelArray = new TGeoTubeSeg(mRmin, mRmax, length / 2., 0, pixelArrayPhi); mPixelArray = new TGeoVolume(its3TGeo::getITS3PixelArrayPattern(mNLayer), pixelArray, mSilicon); mPixelArray->SetLineColor(color); mPixelArray->RegisterYourself(); @@ -123,8 +119,9 @@ void ITS3Layer::createTile() mTile->AddNode(readoutVol, 0, zMoveReadout); // Pixel Array is just a longer version of the biasing but starts in phi at - // biasPhi2. - mTile->AddNode(mPixelArray, 0); + // readoutPhi2. + auto phiRotPixelArray = new TGeoRotation(Form("its3PhiPixelArrayOffset_%d", mNLayer), readoutPhi2, 0, 0); + mTile->AddNode(mPixelArray, 0, phiRotPixelArray); // Biasing double biasPhi1 = constants::pixelarray::width / mR * o2m::Rad2Deg + readoutPhi2; @@ -191,7 +188,7 @@ void ITS3Layer::createRSU() // Rotation for top half and vertical mirroring double phi = width / mR * o2m::Rad2Deg; - auto rot = new TGeoRotation("", 0, 0, -phi); + auto rot = new TGeoRotation(Form("its3RotHalfBarrel_%d", mNLayer), 0, 0, -phi); rot->ReflectY(true); // Upper Left @@ -270,7 +267,7 @@ void ITS3Layer::createChip() auto phiOffset = constants::segment::width / mR * o2m::Rad2Deg; for (unsigned int i{0}; i < constants::nSegments[mNLayer]; ++i) { - auto rot = new TGeoRotation("", 0, 0, phiOffset * i); + auto rot = new TGeoRotation(Form("its3PhiSegmentOffset_%d_%d", mNLayer, i), 0, 0, phiOffset * i); mChip->AddNode(mSegment, i, rot); } @@ -372,8 +369,8 @@ void ITS3Layer::createLayerImpl() // The offset is the right angle triangle of the middle radius with the // transverse axis. double phiOffset = std::asin(constants::equatorialGap / 2. / mR) * o2m::Rad2Deg; - auto rotTop = new TGeoRotation("", 0, 0, +phiOffset); - auto rotBot = new TGeoRotation("", 0, 0, phiOffset + 180); + auto rotTop = new TGeoRotation(Form("its3CarbonPhiOffsetTop_%d", mNLayer), 0, 0, +phiOffset); + auto rotBot = new TGeoRotation(Form("its3CarbonPhiOffsetBot_%d", mNLayer), 0, 0, phiOffset + 180); mLayer->AddNode(mCarbonForm, 0, rotTop); mLayer->AddNode(mCarbonForm, 1, rotBot); From d6d89fa562176fc9fa826d5e3b64ff79729d94a8 Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Thu, 23 Jan 2025 14:38:41 +0100 Subject: [PATCH 50/50] ITS3: macro fixes Signed-off-by: Felix Schlepper --- .../ITS3/macros/test/CheckClusterSize.C | 19 ++++++++++++++----- .../ITS3/macros/test/CheckClustersITS3.C | 9 +++++---- .../macros/test/CompareClustersAndDigits.C | 16 ++++++++-------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckClusterSize.C b/Detectors/Upgrades/ITS3/macros/test/CheckClusterSize.C index addaaf47269d2..5fffed4fcc580 100755 --- a/Detectors/Upgrades/ITS3/macros/test/CheckClusterSize.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckClusterSize.C @@ -43,6 +43,7 @@ #include "SimulationDataFormat/MCCompLabel.h" #include "SimulationDataFormat/MCEventHeader.h" #include "SimulationDataFormat/MCTrack.h" +#include "ITS3Base/SpecsV2.h" #endif #define ENABLE_UPGRADES #include "SimulationDataFormat/MCTruthContainer.h" @@ -65,7 +66,11 @@ void checkFile(const std::unique_ptr& file); inline auto hist_map(unsigned short id) { - return std::clamp(id, static_cast(0), static_cast(6)) / 2; + int lay = o2::its3::constants::detID::getDetID2Layer(id); + if (lay == -1) { + return nLayers - 1; + } + return lay; } void CheckClusterSize(std::string clusFileName = "o2clus_its.root", @@ -133,7 +138,7 @@ void CheckClusterSize(std::string clusFileName = "o2clus_its.root", std::vector hOtherSecondaryEta; std::vector hOtherSecondaryPt; std::vector hOtherSecondaryPhi; - for (int i = 0; i < 4; ++i) { + for (int i = 0; i < nLayers; ++i) { hPrimary.emplace_back(Form("primary/L%d", i), Form("L%d Primary Cluster Size", i), maxClusterSize, 0, maxClusterSize); hPrimaryEta.emplace_back(Form("primary/EtaL%d", i), Form("L%d Primary Cluster Size vs Eta", i), maxClusterSize, 0, maxClusterSize, 100, -3.0, 3.0); hPrimaryPt.emplace_back(Form("primary/Pt%d", i), Form("L%d Primary Cluster Size vs Pt", i), maxClusterSize, 0, maxClusterSize, 100, 0.0, 10.0); @@ -238,14 +243,15 @@ void CheckClusterSize(std::string clusFileName = "o2clus_its.root", int nROFRec = (int)rofRecVec.size(); auto pattIt = patternsPtr->cbegin(); + int cInvalid{0}, cGood{0}; for (int irof = 0; irof < nROFRec; irof++) { const auto& rofRec = rofRecVec[irof]; - // rofRec.print(); + /*rofRec.print();*/ for (int icl = 0; icl < rofRec.getNEntries(); icl++) { int clEntry = rofRec.getFirstEntry() + icl; const auto& cluster = clusArr[clEntry]; - // cluster.print(); + /*cluster.print();*/ auto pattId = cluster.getPatternID(); auto id = cluster.getSensorID(); @@ -260,13 +266,15 @@ void CheckClusterSize(std::string clusFileName = "o2clus_its.root", const auto& label = (clusLabArr->getLabels(clEntry))[0]; if (!label.isValid() || label.getSourceID() != 0 || !label.isCorrect()) { + ++cInvalid; continue; } + ++cGood; const int trackID = label.getTrackID(); int evID = label.getEventID(); const auto& pInfo = info[evID][trackID]; - if (id > 6) { + if (!o2::its3::constants::detID::isDetITS3(id)) { hOuterBarrel.Fill(clusterSize); } @@ -332,6 +340,7 @@ void CheckClusterSize(std::string clusFileName = "o2clus_its.root", } } } + std::cout << "Good labels: " << cGood << "; invalid: " << cInvalid << '\n'; std::cout << "Done measuring cluster sizes:" << std::endl; for (int i = 0; i < nLayers; ++i) { std::cout << "* Layer " << i << ":\n"; diff --git a/Detectors/Upgrades/ITS3/macros/test/CheckClustersITS3.C b/Detectors/Upgrades/ITS3/macros/test/CheckClustersITS3.C index af03ed7a9877b..13db31b46aa4e 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CheckClustersITS3.C +++ b/Detectors/Upgrades/ITS3/macros/test/CheckClustersITS3.C @@ -57,7 +57,8 @@ void CheckClustersITS3(const std::string& clusfile = "o2clus_its.root", using ROFRec = o2::itsmft::ROFRecord; using MC2ROF = o2::itsmft::MC2ROFRecord; using HitVec = std::vector; - using MC2HITS_map = std::unordered_map; // maps (track_ID<<16 + chip_ID) to entry in the hit vector + using MC2HITS_map = std::unordered_map; // maps (track_ID<<32 + chip_ID) to entry in the hit vector + std::array mSuperSegmentations{0, 1, 2}; std::vector hitVecPool; std::vector mc2hitVec; @@ -234,10 +235,10 @@ void CheckClustersITS3(const std::string& clusfile = "o2clus_its.root", } else { // compare in local flat coordinates float xFlatEnd{0.}, yFlatEnd{0.}; - o2::its3::SuperSegmentations[layer].curvedToFlat(locH.X(), locH.Y(), xFlatEnd, yFlatEnd); + mSuperSegmentations[layer].curvedToFlat(locH.X(), locH.Y(), xFlatEnd, yFlatEnd); locH.SetXYZ(xFlatEnd, yFlatEnd, locH.Z()); float xFlatSta{0.}, yFlatSta{0.}; - o2::its3::SuperSegmentations[layer].curvedToFlat(locHsta.X(), locHsta.Y(), xFlatSta, yFlatSta); + mSuperSegmentations[layer].curvedToFlat(locHsta.X(), locHsta.Y(), xFlatSta, yFlatSta); locHsta.SetXYZ(xFlatSta, yFlatSta, locHsta.Z()); // recalculate x/y in flat // x0 = xFlatSta, dltx = xFlatEnd - x0; @@ -248,7 +249,7 @@ void CheckClustersITS3(const std::string& clusfile = "o2clus_its.root", // not really precise, but okish locH.SetXYZ(0.5f * (locH.X() + locHsta.X()), 0.5f * (locH.Y() + locHsta.Y()), 0.5f * (locH.Z() + locHsta.Z())); - o2::its3::SuperSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlatSta, yFlatSta); + mSuperSegmentations[layer].curvedToFlat(locC.X(), locC.Y(), xFlatSta, yFlatSta); locC.SetXYZ(xFlatSta, yFlatSta, locC.Z()); } diff --git a/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C b/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C index f454745c0f076..486ef2bb8d84d 100644 --- a/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C +++ b/Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigits.C @@ -126,9 +126,9 @@ void CompareClustersAndDigits(std::string clusfile = "o2clus_it3.root", TFile fileC(clusfile.data()); auto* clusTree = dynamic_cast(fileC.Get("o2sim")); std::vector* clusArr = nullptr; - clusTree->SetBranchAddress("IT3ClusterComp", &clusArr); + clusTree->SetBranchAddress("ITSClusterComp", &clusArr); std::vector* patternsPtr = nullptr; - auto pattBranch = clusTree->GetBranch("IT3ClusterPatt"); + auto pattBranch = clusTree->GetBranch("ITSClusterPatt"); if (pattBranch != nullptr) { pattBranch->SetAddress(&patternsPtr); } @@ -146,14 +146,14 @@ void CompareClustersAndDigits(std::string clusfile = "o2clus_it3.root", // ROFrecords std::vector rofRecVec, *rofRecVecP = &rofRecVec; - clusTree->SetBranchAddress("IT3ClustersROF", &rofRecVecP); + clusTree->SetBranchAddress("ITSClustersROF", &rofRecVecP); // Cluster MC labels o2::dataformats::MCTruthContainer* clusLabArr = nullptr; std::vector mc2rofVec, *mc2rofVecP = &mc2rofVec; - if ((hitTree != nullptr) && (clusTree->GetBranch("IT3ClusterMCTruth") != nullptr)) { - clusTree->SetBranchAddress("IT3ClusterMCTruth", &clusLabArr); - clusTree->SetBranchAddress("IT3ClustersMC2ROF", &mc2rofVecP); + if ((hitTree != nullptr) && (clusTree->GetBranch("ITSClusterMCTruth") != nullptr)) { + clusTree->SetBranchAddress("ITSClusterMCTruth", &clusLabArr); + clusTree->SetBranchAddress("ITSClustersMC2ROF", &mc2rofVecP); } clusTree->GetEntry(0); @@ -340,8 +340,8 @@ void CompareClustersAndDigits(std::string clusfile = "o2clus_it3.root", } auto& dat = data[iChip]; gFile->cd(); - /* auto path = gman->getMatrixPath(iChip); */ - TString path; // TODO wrong use above + auto path = gman->getMatrixPath(iChip); + /*TString path; // TODO wrong use above*/ const std::string cpath{path.Data() + 39, path.Data() + path.Length()}; const std::filesystem::path p{cpath}; if (oFile->mkdir(p.parent_path().c_str(), "", true) == nullptr) {