diff --git a/Detectors/Base/CMakeLists.txt b/Detectors/Base/CMakeLists.txt index c5bea22e3af97..491a281325ba8 100644 --- a/Detectors/Base/CMakeLists.txt +++ b/Detectors/Base/CMakeLists.txt @@ -40,9 +40,9 @@ o2_add_library(DetectorsBase O2::SimulationDataFormat O2::SimConfig O2::CCDB + O2::GPUDataTypeHeaders MC::VMC TBB::tbb - PRIVATE_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/GPU/GPUTracking/Merger # Must not link to avoid cyclic dependency ) o2_target_root_dictionary(DetectorsBase diff --git a/Detectors/TPC/calibration/CMakeLists.txt b/Detectors/TPC/calibration/CMakeLists.txt index 1cc9ed44bccb5..fced6bae98a8f 100644 --- a/Detectors/TPC/calibration/CMakeLists.txt +++ b/Detectors/TPC/calibration/CMakeLists.txt @@ -60,7 +60,7 @@ o2_add_library(TPCCalibration Microsoft.GSL::GSL O2::DetectorsCalibration O2::GPUO2Interface - O2::GPUTracking + O2::GPUDataTypes O2::TPCFastTransformation O2::DataFormatsCTP O2::CCDB diff --git a/Detectors/TPC/calibration/src/TrackDump.cxx b/Detectors/TPC/calibration/src/TrackDump.cxx index ca8d61643e7ee..200abf766ac54 100644 --- a/Detectors/TPC/calibration/src/TrackDump.cxx +++ b/Detectors/TPC/calibration/src/TrackDump.cxx @@ -13,10 +13,7 @@ #include #include #include -#include "GPUO2Interface.h" -#include "GPUDefOpenCL12Templates.h" -#include "GPUDefConstantsAndSettings.h" -#include "SliceTracker/GPUTPCGeometry.h" +#include "GPUTPCGeometry.h" #include "DataFormatsTPC/Defs.h" #include "DataFormatsTPC/ClusterNative.h" diff --git a/Detectors/TPC/reconstruction/CMakeLists.txt b/Detectors/TPC/reconstruction/CMakeLists.txt index 54c57add3328e..df3bb2ddb4cff 100644 --- a/Detectors/TPC/reconstruction/CMakeLists.txt +++ b/Detectors/TPC/reconstruction/CMakeLists.txt @@ -92,7 +92,7 @@ o2_add_test(AdcClockMonitor o2_add_test(GPUCATracking COMPONENT_NAME tpc LABELS tpc - PUBLIC_LINK_LIBRARIES O2::TPCReconstruction + PUBLIC_LINK_LIBRARIES O2::TPCReconstruction O2::GPUO2Interface SOURCES test/testGPUCATracking.cxx ENVIRONMENT O2_ROOT=${CMAKE_BINARY_DIR}/stage) diff --git a/Detectors/TPC/reconstruction/test/testGPUCATracking.cxx b/Detectors/TPC/reconstruction/test/testGPUCATracking.cxx index 84257f04be9b5..7d01234ac913f 100644 --- a/Detectors/TPC/reconstruction/test/testGPUCATracking.cxx +++ b/Detectors/TPC/reconstruction/test/testGPUCATracking.cxx @@ -27,6 +27,7 @@ #include "CorrectionMapsHelper.h" #include "TPCFastTransform.h" #include "GPUO2Interface.h" +#include "GPUO2InterfaceUtils.h" #include "GPUO2InterfaceConfiguration.h" #include "TPCPadGainCalib.h" #include "CalibdEdxContainer.h" @@ -79,9 +80,9 @@ BOOST_AUTO_TEST_CASE(CATracking_test1) fastTransformHelper->setCorrMap(fastTransform.get()); config.configCalib.fastTransform = fastTransform.get(); config.configCalib.fastTransformHelper = fastTransformHelper.get(); - auto dEdxCalibContainer = GPUO2Interface::getCalibdEdxContainerDefault(); + auto dEdxCalibContainer = GPUO2InterfaceUtils::getCalibdEdxContainerDefault(); config.configCalib.dEdxCalibContainer = dEdxCalibContainer.get(); - std::unique_ptr gainCalib = GPUO2Interface::getPadGainCalibDefault(); + std::unique_ptr gainCalib = GPUO2InterfaceUtils::getPadGainCalibDefault(); config.configCalib.tpcPadGain = gainCalib.get(); tracker.Initialize(config); diff --git a/Detectors/TPC/workflow/CMakeLists.txt b/Detectors/TPC/workflow/CMakeLists.txt index ebd6fc7a6e789..57ce61e1f436e 100644 --- a/Detectors/TPC/workflow/CMakeLists.txt +++ b/Detectors/TPC/workflow/CMakeLists.txt @@ -51,8 +51,8 @@ o2_add_library(TPCWorkflow O2::TPCQC O2::DetectorsCalibration O2::TPCReaderWorkflow O2::CTPWorkflowIO - PRIVATE_LINK_LIBRARIES O2::GPUTracking # For the Zero Suppression includes - O2::GPUWorkflow + O2::GPUWorkflow + PRIVATE_LINK_LIBRARIES O2::GPUTracking ) o2_add_library(TPCWorkflowGUI @@ -62,7 +62,6 @@ o2_add_library(TPCWorkflowGUI O2::TPCMonitor ) - o2_add_executable(chunkeddigit-merger COMPONENT_NAME tpc TARGETVARNAME mergertargetName @@ -250,7 +249,7 @@ o2_add_test(workflow o2_add_executable(digits-to-rawzs COMPONENT_NAME tpc - PUBLIC_LINK_LIBRARIES O2::TPCBase O2::SimulationDataFormat O2::GPUO2Interface O2::GPUTracking O2::DetectorsRaw O2::TPCReconstruction + PUBLIC_LINK_LIBRARIES O2::TPCBase O2::SimulationDataFormat O2::GPUO2Interface O2::DetectorsRaw O2::TPCReconstruction SOURCES src/convertDigitsToRawZS.cxx) o2_add_executable(monitor-workflow diff --git a/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx b/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx index 1abd248b69d6c..36619b573c6e4 100644 --- a/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx +++ b/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx @@ -17,9 +17,7 @@ #include #include -#include "GPUO2Interface.h" -#include "GPUParam.h" -#include "GPUReconstructionConvert.h" +#include "GPUO2InterfaceUtils.h" #include "Framework/ConcreteDataMatcher.h" #include "Framework/InputRecordWalker.h" #include "Framework/Logger.h" @@ -290,9 +288,8 @@ void processLinkZS(o2::framework::RawParser<>& parser, std::unique_ptr digits; - static o2::gpu::GPUParam gpuParam; - static o2::gpu::GPUReconstructionZSDecoder gpuDecoder; - gpuDecoder.DecodePage(digits, (const void*)it.raw(), firstOrbit, gpuParam, static_cast((triggerBC > 0) ? triggerBC : 0)); + static o2::gpu::GPUO2InterfaceUtils::GPUReconstructionZSDecoder gpuDecoder; + gpuDecoder.DecodePage(digits, (const void*)it.raw(), firstOrbit, nullptr, static_cast((triggerBC > 0) ? triggerBC : 0)); for (const auto& digit : digits) { reader->getManager()->getLinkZSCallback()(digit.getCRU(), digit.getRow(), digit.getPad(), digit.getTimeStamp(), digit.getChargeFloat()); } diff --git a/Detectors/TPC/workflow/src/ZSSpec.cxx b/Detectors/TPC/workflow/src/ZSSpec.cxx index 00c78ba463507..181efbb1824e7 100644 --- a/Detectors/TPC/workflow/src/ZSSpec.cxx +++ b/Detectors/TPC/workflow/src/ZSSpec.cxx @@ -35,8 +35,7 @@ #include #include #include -#include "GPUParam.h" -#include "GPUReconstructionConvert.h" +#include "GPUO2InterfaceUtils.h" #include "DetectorsRaw/RawFileWriter.h" #include "DetectorsRaw/HBFUtils.h" #include "DetectorsRaw/RDHUtils.h" @@ -100,10 +99,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector const& tpcSectors, bool outR auto& sizes = processAttributes->sizes; auto& verbosity = processAttributes->verbosity; - GPUParam _GPUParam; - processAttributes->config.configGRP.solenoidBz = 5.00668; - _GPUParam.SetDefaults(&processAttributes->config.configGRP, &processAttributes->config.configReconstruction, &processAttributes->config.configProcessing, nullptr); std::function&)> digitsFilter = nullptr; if (processAttributes->globalConfig.zsOnTheFlyDigitsFilter) { digitsFilter = [processAttributes](std::vector& digits) { @@ -119,7 +115,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector const& tpcSectors, bool outR const auto& inputs = getWorkflowTPCInput(pc, 0, false, false, tpcSectorMask, true); sizes.resize(NSectors * NEndpoints); o2::InteractionRecord ir{0, pc.services().get().firstTForbit}; - o2::gpu::GPUReconstructionConvert::RunZSEncoder(inputs->inputDigits, &zsoutput, sizes.data(), nullptr, &ir, _GPUParam, 4, verify, processAttributes->config.configReconstruction.tpc.zsThreshold, false, digitsFilter); + o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputs->inputDigits, &zsoutput, sizes.data(), nullptr, &ir, processAttributes->config, 4, verify, false, digitsFilter); ZeroSuppressedContainer8kb* page = reinterpret_cast(zsoutput.get()); unsigned int offset = 0; for (unsigned int i = 0; i < NSectors; i++) { @@ -172,7 +168,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector const& tpcSectors, bool outR writer.useCaching(); } ir = o2::raw::HBFUtils::Instance().getFirstSampledTFIR(); - o2::gpu::GPUReconstructionConvert::RunZSEncoder(inputs->inputDigits, nullptr, nullptr, &writer, &ir, _GPUParam, 4, false, processAttributes->config.configReconstruction.tpc.zsThreshold, false, digitsFilter); + o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputs->inputDigits, nullptr, nullptr, &writer, &ir, processAttributes->config, 4, false, false, digitsFilter); writer.writeConfFile("TPC", "RAWDATA", fmt::format("{}tpcraw.cfg", outDir)); } zsoutput.reset(nullptr); diff --git a/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx b/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx index 44e1d81233014..e55b35bdadf52 100644 --- a/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx +++ b/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx @@ -23,10 +23,8 @@ #include "TTree.h" #include "TROOT.h" -#include "GPUO2Interface.h" -#include "GPUReconstructionConvert.h" +#include "GPUO2InterfaceUtils.h" #include "GPUHostDataTypes.h" -#include "GPUParam.h" #include "Framework/Logger.h" #include "DetectorsRaw/RawFileWriter.h" @@ -233,13 +231,10 @@ void convertDigitsToZSfinal(std::string_view digitsFile, std::string_view output void convert(DigitArray& inputDigits, ProcessAttributes* processAttributes, o2::raw::RawFileWriter& writer) { const auto zsThreshold = processAttributes->zsThreshold; - GPUParam _GPUParam; - _GPUParam.SetDefaults(5.00668); - const GPUParam mGPUParam = _GPUParam; o2::InteractionRecord ir = o2::raw::HBFUtils::Instance().getFirstSampledTFIR(); ir.bc = 0; // By convention the TF starts at BC = 0 - o2::gpu::GPUReconstructionConvert::RunZSEncoder(inputDigits, nullptr, nullptr, &writer, &ir, mGPUParam, processAttributes->version, false, zsThreshold, processAttributes->padding, processAttributes->digitsFilter); + o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputDigits, nullptr, nullptr, &writer, &ir, processAttributes->version, false, zsThreshold, processAttributes->padding, processAttributes->digitsFilter); } int main(int argc, char** argv) diff --git a/Detectors/TRD/calibration/CMakeLists.txt b/Detectors/TRD/calibration/CMakeLists.txt index 52444d2855b1f..36d00e92bbc16 100644 --- a/Detectors/TRD/calibration/CMakeLists.txt +++ b/Detectors/TRD/calibration/CMakeLists.txt @@ -28,7 +28,6 @@ o2_add_library(TRDCalibration O2::DetectorsBase O2::DetectorsCalibration O2::MathUtils - O2::GPUTracking O2::DetectorsDCS) o2_target_root_dictionary(TRDCalibration diff --git a/Detectors/TRD/pid/CMakeLists.txt b/Detectors/TRD/pid/CMakeLists.txt index 158103cf007c2..012fa642a3047 100644 --- a/Detectors/TRD/pid/CMakeLists.txt +++ b/Detectors/TRD/pid/CMakeLists.txt @@ -17,7 +17,6 @@ o2_add_library(TRDPID O2::DataFormatsGlobalTracking O2::DetectorsBase O2::MathUtils - O2::GPUTracking O2::Framework O2::ReconstructionDataFormats fmt::fmt diff --git a/Detectors/TRD/qc/CMakeLists.txt b/Detectors/TRD/qc/CMakeLists.txt index e08c795609635..d631de1f54246 100644 --- a/Detectors/TRD/qc/CMakeLists.txt +++ b/Detectors/TRD/qc/CMakeLists.txt @@ -21,8 +21,7 @@ o2_add_library(TRDQC O2::DataFormatsTRD O2::DataFormatsGlobalTracking O2::DetectorsBase - O2::MathUtils - O2::GPUTracking) + O2::MathUtils) o2_target_root_dictionary(TRDQC HEADERS include/TRDQC/Tracking.h diff --git a/GPU/Common/GPUCommonDef.h b/GPU/Common/GPUCommonDef.h index 7a2d18ae2fb84..51ff8b4800de5 100644 --- a/GPU/Common/GPUCommonDef.h +++ b/GPU/Common/GPUCommonDef.h @@ -54,6 +54,7 @@ #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 @@ -63,6 +64,7 @@ #define CON_DELETE #define CON_DEFAULT #define CONSTEXPR + #define GPUCA_CPP11_INIT(...) #endif #if defined(__ROOT__) && !defined(GPUCA_NOCOMPAT) #define VOLATILE // ROOT5 has a problem with volatile in CINT diff --git a/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx b/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx index 04982564b2cc1..1ff3f1ba32546 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx +++ b/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx @@ -1464,10 +1464,14 @@ void GPUReconstructionConvert::RunZSFilter(std::unique_ptr* bu #ifdef GPUCA_O2_LIB template -static inline auto GetDecoder_internal(const GPUParam& param, int version) +static inline auto GetDecoder_internal(const GPUParam* param, int version) { std::shared_ptr enc = std::make_shared(); - enc->param = ¶m; + if (param == nullptr) { + static GPUParam dummyParam; + param = &dummyParam; + } + enc->param = param; enc->zsVersion = version; enc->init(); return [enc](std::vector& outBuffer, const void* page, unsigned int firstTfOrbit, unsigned int triggerBC = 0) { @@ -1485,33 +1489,16 @@ static inline auto GetDecoder_internal(const GPUParam& param, int version) }; } -std::function&, const void*, unsigned int, unsigned int)> GPUReconstructionConvert::GetDecoder(int version, const GPUParam& param) +std::function&, const void*, unsigned int, unsigned int)> GPUReconstructionConvert::GetDecoder(int version, const GPUParam* param) { - if (version >= ZSVersion::ZSVersionRowBased10BitADC && version <= ZSVersion::ZSVersionRowBased12BitADC) { + if (version >= o2::tpc::ZSVersion::ZSVersionRowBased10BitADC && version <= o2::tpc::ZSVersion::ZSVersionRowBased12BitADC) { return GetDecoder_internal(param, version); - } else if (version == ZSVersion::ZSVersionLinkBasedWithMeta) { + } else if (version == o2::tpc::ZSVersion::ZSVersionLinkBasedWithMeta) { return GetDecoder_internal(param, version); - } else if (version >= ZSVersion::ZSVersionDenseLinkBased && version <= ZSVersion::ZSVersionDenseLinkBasedV2) { + } else if (version >= o2::tpc::ZSVersion::ZSVersionDenseLinkBased && version <= o2::tpc::ZSVersion::ZSVersionDenseLinkBasedV2) { return GetDecoder_internal(param, version); } else { throw std::runtime_error("Invalid ZS version "s + std::to_string(version) + ", cannot create decoder"s); } } - -void GPUReconstructionZSDecoder::DecodePage(std::vector& outputBuffer, const void* page, unsigned int tfFirstOrbit, const GPUParam& param, unsigned int triggerBC) -{ - const o2::header::RAWDataHeader* rdh = (const o2::header::RAWDataHeader*)page; - if (o2::raw::RDHUtils::getMemorySize(*rdh) == sizeof(o2::header::RAWDataHeader)) { - return; - } - TPCZSHDR* const hdr = (TPCZSHDR*)(rdh_utils::getLink(o2::raw::RDHUtils::getFEEID(*rdh)) == rdh_utils::DLBZSLinkID ? ((const char*)page + o2::raw::RDHUtils::getMemorySize(*rdh) - sizeof(TPCZSHDRV2)) : ((const char*)page + sizeof(o2::header::RAWDataHeader))); - - if (mDecoders.size() < hdr->version + 1) { - mDecoders.resize(hdr->version + 1); - } - if (mDecoders[hdr->version] == nullptr) { - mDecoders[hdr->version] = GPUReconstructionConvert::GetDecoder(hdr->version, param); - } - mDecoders[hdr->version](outputBuffer, page, tfFirstOrbit, triggerBC); -} #endif diff --git a/GPU/GPUTracking/Base/GPUReconstructionConvert.h b/GPU/GPUTracking/Base/GPUReconstructionConvert.h index 4b195e93ff0fa..62f136015022c 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionConvert.h +++ b/GPU/GPUTracking/Base/GPUReconstructionConvert.h @@ -60,16 +60,7 @@ class GPUReconstructionConvert static int GetMaxTimeBin(const o2::tpc::ClusterNativeAccess& native); static int GetMaxTimeBin(const GPUTrackingInOutDigits& digits); static int GetMaxTimeBin(const GPUTrackingInOutZS& zspages); - static std::function&, const void*, unsigned int, unsigned int)> GetDecoder(int version, const GPUParam& param); -}; - -class GPUReconstructionZSDecoder -{ - public: - void DecodePage(std::vector& outputBuffer, const void* page, unsigned int tfFirstOrbit, const GPUParam& param, unsigned int triggerBC = 0); - - private: - std::vector&, const void*, unsigned int, unsigned int)>> mDecoders; + static std::function&, const void*, unsigned int, unsigned int)> GetDecoder(int version, const GPUParam* param); }; } // namespace gpu diff --git a/GPU/GPUTracking/CMakeLists.txt b/GPU/GPUTracking/CMakeLists.txt index 15074e2639fa1..545a74dbeff25 100644 --- a/GPU/GPUTracking/CMakeLists.txt +++ b/GPU/GPUTracking/CMakeLists.txt @@ -55,7 +55,6 @@ set(SRCS Merger/GPUTPCGMPropagator.cxx Merger/GPUTPCGlobalDebugSortKernels.cxx Merger/GPUTPCGMPhysicalTrackModel.cxx - Merger/GPUTPCGMPolynomialField.cxx Merger/GPUTPCGMPolynomialFieldManager.cxx DataTypes/GPUTRDTrack.cxx TRDTracking/GPUTRDTracker.cxx @@ -65,7 +64,9 @@ set(SRCS set(SRCS_DATATYPES DataTypes/GPUDataTypes.cxx) set(SRCS_O2_DATATYPE_HEADERS + DataTypes/GPUTPCGMPolynomialField.cxx DataTypes/GPUTRDTrackO2.cxx) + set(SRCS_O2_DATATYPES ${SRCS_DATATYPES} Interface/GPUO2InterfaceConfigurableParam.cxx) @@ -107,61 +108,61 @@ set(SRCS_NO_H SliceTracker/GPUTPCTrackerDump.cxx Global/GPUChainTrackingIO.cxx) set(HDRS_INSTALL - SliceTracker/GPUTPCMCInfo.h - SliceTracker/GPUTPCHit.h - SliceTracker/GPUTPCHitId.h - SliceTracker/GPUTPCClusterData.h - SliceTracker/GPUTPCBaseTrackParam.h - SliceTracker/GPUTPCTracklet.h - SliceTracker/GPUTPCSliceOutCluster.h - SliceTracker/GPUTPCTrackLinearisation.h - Merger/GPUTPCGMBorderTrack.h - Merger/GPUTPCGMMergedTrack.h - DataTypes/GPUTPCGMMergedTrackHit.h - DataTypes/GPUTRDDef.h - DataTypes/GPUSettings.h - TRDTracking/GPUTRDTrackPoint.h - TRDTracking/GPUTRDSpacePoint.h - TRDTracking/GPUTRDTrackData.h - TRDTracking/GPUTRDTrackPoint.h - TRDTracking/GPUTRDTrackletLabels.h - Base/GPUReconstructionIncludes.h - SliceTracker/GPUTPCDef.h - SliceTracker/GPUTPCGeometry.h - TRDTracking/GPUTRDGeometry.h - TRDTracking/GPUTRDTrackerDebug.h - TRDTracking/GPUTRDInterfaces.h Base/GPUConstantMem.h + Base/GPUParam.inc Base/GPUParamRTC.h - Base/GPUReconstructionIncludesITS.h Base/GPUReconstructionHelpers.h - TPCConvert/GPUTPCConvertImpl.h + Base/GPUReconstructionIncludes.h + Base/GPUReconstructionIncludesITS.h Base/GPUReconstructionKernelMacros.h + DataCompression/GPUTPCClusterRejection.h + DataCompression/GPUTPCCompressionKernels.inc + DataCompression/TPCClusterDecompressor.inc + DataTypes/GPUdEdxInfo.h + DataTypes/GPUHostDataTypes.h + DataTypes/GPUO2DataTypes.h DataTypes/GPUO2FakeClasses.h - Definitions/GPUSettingsList.h DataTypes/GPUOutputControl.h - DataTypes/GPUTriggerOutputs.h - DataTypes/GPUO2DataTypes.h - DataTypes/GPUHostDataTypes.h - DataTypes/GPUdEdxInfo.h + DataTypes/GPUSettings.h + DataTypes/GPUTPCGeometry.h + DataTypes/GPUTPCGMMergedTrackHit.h + DataTypes/GPUTRDDef.h DataTypes/GPUTRDInterfaceO2Track.h - Base/GPUParam.inc - DataCompression/TPCClusterDecompressor.inc - DataCompression/GPUTPCCompressionKernels.inc - Merger/GPUTPCGMMergerTypes.h - Global/GPUErrorCodes.h - Global/GPUChainTrackingDefs.h - qconfigoptions.h - qa/GPUQAHelper.h - DataCompression/GPUTPCClusterRejection.h - Refit/GPUTrackParamConvert.h - Definitions/GPUDef.h + DataTypes/GPUTriggerOutputs.h + Debug/GPUROOTDump.h Definitions/GPUDefConstantsAndSettings.h Definitions/GPUDefGPUParameters.h + Definitions/GPUDef.h + Definitions/GPUDefMacros.h Definitions/GPUDefOpenCL12Templates.h Definitions/GPULogging.h - Definitions/GPUDefMacros.h - Debug/GPUROOTDump.h + Definitions/GPUSettingsList.h + Global/GPUChainTrackingDefs.h + Global/GPUErrorCodes.h + Merger/GPUTPCGMBorderTrack.h + Merger/GPUTPCGMMergedTrack.h + Merger/GPUTPCGMMergerTypes.h + qa/GPUQAHelper.h + qconfigoptions.h + Refit/GPUTrackParamConvert.h + SliceTracker/GPUTPCBaseTrackParam.h + SliceTracker/GPUTPCClusterData.h + SliceTracker/GPUTPCDef.h + SliceTracker/GPUTPCHit.h + SliceTracker/GPUTPCHitId.h + SliceTracker/GPUTPCMCInfo.h + SliceTracker/GPUTPCSliceOutCluster.h + SliceTracker/GPUTPCTracklet.h + SliceTracker/GPUTPCTrackLinearisation.h + TPCConvert/GPUTPCConvertImpl.h + TRDTracking/GPUTRDGeometry.h + TRDTracking/GPUTRDInterfaces.h + TRDTracking/GPUTRDSpacePoint.h + TRDTracking/GPUTRDTrackData.h + TRDTracking/GPUTRDTrackerDebug.h + TRDTracking/GPUTRDTrackletLabels.h + TRDTracking/GPUTRDTrackPoint.h + TRDTracking/GPUTRDTrackPoint.h ) # Sources for O2 and for Standalone if requested in config file @@ -195,15 +196,18 @@ if(ALIGPU_BUILD_TYPE STREQUAL "O2" OR CONFIG_O2_EXTENSIONS) TPCClusterFinder/GPUTPCCFMCLabelFlattener.cxx TPCClusterFinder/GPUTPCCFDecodeZS.cxx TPCClusterFinder/GPUTPCCFGather.cxx + Refit/GPUTrackingRefit.cxx + Refit/GPUTrackingRefitKernel.cxx + Merger/GPUTPCGMO2Output.cxx) + + set(SRCS_O2_DATATYPES + ${SRCS_O2_DATATYPES} DataTypes/TPCPadGainCalib.cxx DataTypes/TPCPadBitMap.cxx DataTypes/TPCZSLinkMapping.cxx DataTypes/CalibdEdxContainer.cxx DataTypes/CalibdEdxTrackTopologyPol.cxx - DataTypes/CalibdEdxTrackTopologySpline.cxx - Refit/GPUTrackingRefit.cxx - Refit/GPUTrackingRefitKernel.cxx - Merger/GPUTPCGMO2Output.cxx) + DataTypes/CalibdEdxTrackTopologySpline.cxx) set(SRCS_NO_H ${SRCS_NO_H} TPCClusterFinder/GPUTPCClusterFinderDump.cxx) diff --git a/GPU/GPUTracking/Merger/GPUTPCGMPolynomialField.cxx b/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.cxx similarity index 100% rename from GPU/GPUTracking/Merger/GPUTPCGMPolynomialField.cxx rename to GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.cxx diff --git a/GPU/GPUTracking/Merger/GPUTPCGMPolynomialField.h b/GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h similarity index 100% rename from GPU/GPUTracking/Merger/GPUTPCGMPolynomialField.h rename to GPU/GPUTracking/DataTypes/GPUTPCGMPolynomialField.h diff --git a/GPU/GPUTracking/SliceTracker/GPUTPCGeometry.h b/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h similarity index 97% rename from GPU/GPUTracking/SliceTracker/GPUTPCGeometry.h rename to GPU/GPUTracking/DataTypes/GPUTPCGeometry.h index a0cba6a057e52..cc96afce7ccff 100644 --- a/GPU/GPUTracking/SliceTracker/GPUTPCGeometry.h +++ b/GPU/GPUTracking/DataTypes/GPUTPCGeometry.h @@ -17,6 +17,15 @@ #include "GPUCommonDef.h" +#if !defined(GPUCA_NSLICES) && !defined(GPUCA_ROW_COUNT) && defined(GPUCA_HAVE_O2HEADERS) +#include "DataFormatsTPC/Constants.h" +#define GPUCA_NSLICES o2::tpc::constants::MAXSECTOR +#define GPUCA_ROW_COUNT o2::tpc::constants::MAXGLOBALPADROW +#ifndef GPUCA_TPC_GEOMETRY_O2 +#define GPUCA_TPC_GEOMETRY_O2 +#endif +#endif + namespace GPUCA_NAMESPACE { namespace gpu diff --git a/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h b/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h index 80c4bf597c511..ddb3d5e73bb53 100644 --- a/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h +++ b/GPU/GPUTracking/Definitions/GPUDefConstantsAndSettings.h @@ -27,7 +27,7 @@ #endif #if (defined(GPUCA_ALIROOT_LIB) && defined(GPUCA_O2_LIB)) || (defined(GPUCA_ALIROOT_LIB) && defined(GPUCA_STANDALONE)) || (defined(GPUCA_O2_LIB) && defined(GPUCA_STANDALONE)) - #error Invalid Compile Definitions, need to build for either AliRoot or O2 or Standalone + #error Invalid Compile Definitions, need to build for either AliRoot or O2 or Standalone! #endif #define GPUCA_TRACKLET_SELECTOR_MIN_HITS_B5(QPTB5) (CAMath::Abs(QPTB5) > 10 ? 10 : (CAMath::Abs(QPTB5) > 5 ? 15 : 29)) // Minimum hits should depend on Pt, low Pt tracks can have few hits. 29 Hits default, 15 for < 200 mev, 10 for < 100 mev @@ -48,6 +48,9 @@ #define TPC_MAX_TIME_BIN_TRIGGERED 600 +#if defined(GPUCA_NSLICES) || defined(GPUCA_ROW_COUNT) + #error GPUCA_NSLICES or GPUCA_ROW_COUNT already defined, do not include GPUTPCGeometry.h before! +#endif #if defined(GPUCA_HAVE_O2HEADERS) && defined(GPUCA_TPC_GEOMETRY_O2) && (!defined(__OPENCL__) || defined(__OPENCLCPP__)) && !(defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE < 393216) //Use definitions from the O2 headers if available for nicer code and type safety #include "DataFormatsTPC/Constants.h" diff --git a/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h b/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h index 5c7082aa29b5d..f65e670399f34 100644 --- a/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h +++ b/GPU/GPUTracking/Definitions/GPUDefOpenCL12Templates.h @@ -16,13 +16,7 @@ #ifndef GPUDEFOPENCL12TEMPLATES_H #define GPUDEFOPENCL12TEMPLATES_H -#ifdef GPUCA_NOCOMPAT - #define GPUCA_CPP11_INIT(...) __VA_ARGS__ -#else - #define GPUCA_CPP11_INIT(...) -#endif - -//Special macros for OpenCL rev. 1.2 (encode address space in template parameter) +// 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; @@ -88,5 +82,5 @@ enum LocalOrGlobal { Mem_Local, Mem_Global, Mem_Constant, Mem_Plain }; #define MEM_CONSTANT(type) MEM_GLOBAL(type) #endif -#endif //GPUDEFOPENCL12TEMPLATES_H +#endif // GPUDEFOPENCL12TEMPLATES_H // clang-format on diff --git a/GPU/GPUTracking/Interface/CMakeLists.txt b/GPU/GPUTracking/Interface/CMakeLists.txt index 340d08a74d797..baec5b941b4b6 100644 --- a/GPU/GPUTracking/Interface/CMakeLists.txt +++ b/GPU/GPUTracking/Interface/CMakeLists.txt @@ -11,7 +11,7 @@ set(MODULE GPUO2Interface) -set(SRCS GPUO2Interface.cxx GPUO2InterfaceRefit.cxx GPUO2InterfaceQA.cxx GPUO2InterfaceConfiguration.cxx) +set(SRCS GPUO2Interface.cxx GPUO2InterfaceUtils.cxx GPUO2InterfaceRefit.cxx GPUO2InterfaceQA.cxx GPUO2InterfaceConfiguration.cxx) if(OPENGL_FOUND AND GLFW_FOUND diff --git a/GPU/GPUTracking/Interface/GPUO2Interface.cxx b/GPU/GPUTracking/Interface/GPUO2Interface.cxx index f4cb4c1cef43a..d1e4734d45334 100644 --- a/GPU/GPUTracking/Interface/GPUO2Interface.cxx +++ b/GPU/GPUTracking/Interface/GPUO2Interface.cxx @@ -19,11 +19,10 @@ #include "GPUMemorySizeScalers.h" #include "GPUOutputControl.h" #include "GPUO2InterfaceConfiguration.h" +#include "GPUReconstructionConvert.h" #include "GPUParam.inc" #include "GPUQA.h" #include "GPUOutputControl.h" -#include "TPCPadGainCalib.h" -#include "CalibdEdxContainer.h" #include #include #include @@ -235,21 +234,6 @@ int GPUO2Interface::unregisterMemoryForGPU(const void* ptr) return mCtx[0].mRec->unregisterMemoryForGPU(ptr); } -std::unique_ptr GPUO2Interface::getPadGainCalibDefault() -{ - return std::make_unique(); -} - -std::unique_ptr GPUO2Interface::getPadGainCalib(const o2::tpc::CalDet& in) -{ - return std::make_unique(in); -} - -std::unique_ptr GPUO2Interface::getCalibdEdxContainerDefault() -{ - return std::make_unique(); -} - int GPUO2Interface::UpdateCalibration(const GPUCalibObjectsConst& newCalib, const GPUNewCalibValues& newVals, unsigned int iThread) { for (unsigned int i = 0; i < mNContexts; i++) { diff --git a/GPU/GPUTracking/Interface/GPUO2Interface.h b/GPU/GPUTracking/Interface/GPUO2Interface.h index d585b6acd8535..fe8ea37812c41 100644 --- a/GPU/GPUTracking/Interface/GPUO2Interface.h +++ b/GPU/GPUTracking/Interface/GPUO2Interface.h @@ -88,11 +88,6 @@ class GPUO2Interface // Updates all calibration objects that are != nullptr in newCalib int UpdateCalibration(const GPUCalibObjectsConst& newCalib, const GPUNewCalibValues& newVals, unsigned int iThread = 0); - static std::unique_ptr getPadGainCalibDefault(); - static std::unique_ptr getPadGainCalib(const o2::tpc::CalDet& in); - - static std::unique_ptr getCalibdEdxContainerDefault(); - int registerMemoryForGPU(const void* ptr, size_t size); int unregisterMemoryForGPU(const void* ptr); void setErrorCodeOutput(std::vector>* v); diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx new file mode 100644 index 0000000000000..e974704ea9d0b --- /dev/null +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx @@ -0,0 +1,79 @@ +// 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 GPUO2Interface.cxx +/// \author David Rohr + +#include "GPUO2InterfaceUtils.h" +#include "GPUO2InterfaceConfiguration.h" +#include "TPCPadGainCalib.h" +#include "CalibdEdxContainer.h" +#include "TPCBase/Sector.h" +#include "DataFormatsTPC/Digit.h" +#include "GPUParam.h" +#include "GPUReconstructionConvert.h" +#include "DataFormatsTPC/Digit.h" +#include "DetectorsRaw/RDHUtils.h" +#include "TPCBase/CRU.h" +#include "TPCBase/RDHUtils.h" +#include "DataFormatsTPC/ZeroSuppression.h" +#include + +using namespace o2::gpu; + +using DigitArray = std::array, o2::tpc::Sector::MAXSECTOR>; + +std::unique_ptr GPUO2InterfaceUtils::getPadGainCalibDefault() +{ + return std::make_unique(); +} + +std::unique_ptr GPUO2InterfaceUtils::getPadGainCalib(const o2::tpc::CalDet& in) +{ + return std::make_unique(in); +} + +std::unique_ptr GPUO2InterfaceUtils::getCalibdEdxContainerDefault() +{ + return std::make_unique(); +} + +template <> +void GPUO2InterfaceUtils::RunZSEncoder(const DigitArray& in, std::unique_ptr* outBuffer, unsigned int* outSizes, o2::raw::RawFileWriter* raw, const o2::InteractionRecord* ir, int version, bool verify, float threshold, bool padding, std::function&)> digitsFilter) +{ + GPUParam param; + param.SetDefaults(5.00668); + o2::gpu::GPUReconstructionConvert::RunZSEncoder(in, outBuffer, outSizes, raw, ir, param, version, verify, threshold, padding, digitsFilter); +} +template <> +void GPUO2InterfaceUtils::RunZSEncoder(const DigitArray& in, std::unique_ptr* outBuffer, unsigned int* outSizes, o2::raw::RawFileWriter* raw, const o2::InteractionRecord* ir, GPUO2InterfaceConfiguration& config, int version, bool verify, bool padding, std::function&)> digitsFilter) +{ + GPUParam param; + param.SetDefaults(&config.configGRP, &config.configReconstruction, &config.configProcessing, nullptr); + o2::gpu::GPUReconstructionConvert::RunZSEncoder(in, outBuffer, outSizes, raw, ir, param, version, verify, config.configReconstruction.tpc.zsThreshold, padding, digitsFilter); +} + +void GPUO2InterfaceUtils::GPUReconstructionZSDecoder::DecodePage(std::vector& outputBuffer, const void* page, unsigned int tfFirstOrbit, const GPUParam* param, unsigned int triggerBC) +{ + const o2::header::RAWDataHeader* rdh = (const o2::header::RAWDataHeader*)page; + if (o2::raw::RDHUtils::getMemorySize(*rdh) == sizeof(o2::header::RAWDataHeader)) { + return; + } + o2::tpc::TPCZSHDR* const hdr = (o2::tpc::TPCZSHDR*)(o2::tpc::rdh_utils::getLink(o2::raw::RDHUtils::getFEEID(*rdh)) == o2::tpc::rdh_utils::DLBZSLinkID ? ((const char*)page + o2::raw::RDHUtils::getMemorySize(*rdh) - sizeof(o2::tpc::TPCZSHDRV2)) : ((const char*)page + sizeof(o2::header::RAWDataHeader))); + + if (mDecoders.size() < hdr->version + 1) { + mDecoders.resize(hdr->version + 1); + } + if (mDecoders[hdr->version] == nullptr) { + mDecoders[hdr->version] = GPUReconstructionConvert::GetDecoder(hdr->version, param); + } + mDecoders[hdr->version](outputBuffer, page, tfFirstOrbit, triggerBC); +} diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h new file mode 100644 index 0000000000000..d8672f515c06e --- /dev/null +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h @@ -0,0 +1,57 @@ +// 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 GPUO2Interface.h +/// \author David Rohr + +#ifndef GPUO2INTERFACEUTILS_H +#define GPUO2INTERFACEUTILS_H + +#include "GPUO2Interface.h" +#include + +namespace o2 +{ +struct InteractionRecord; +namespace raw +{ +class RawFileWriter; +} // namespace raw +} // namespace o2 + +namespace o2::gpu +{ +struct GPUParam; +struct GPUO2InterfaceConfiguration; +class GPUO2InterfaceUtils +{ + public: + static std::unique_ptr getPadGainCalibDefault(); + static std::unique_ptr getPadGainCalib(const o2::tpc::CalDet& in); + static std::unique_ptr getCalibdEdxContainerDefault(); + template + static void RunZSEncoder(const S& in, std::unique_ptr* outBuffer, unsigned int* outSizes, o2::raw::RawFileWriter* raw, const o2::InteractionRecord* ir, int version, bool verify, float threshold = 0.f, bool padding = false, std::function&)> digitsFilter = nullptr); + template + static void RunZSEncoder(const S& in, std::unique_ptr* outBuffer, unsigned int* outSizes, o2::raw::RawFileWriter* raw, const o2::InteractionRecord* ir, GPUO2InterfaceConfiguration& config, int version, bool verify, bool padding = false, std::function&)> digitsFilter = nullptr); + + class GPUReconstructionZSDecoder + { + public: + void DecodePage(std::vector& outputBuffer, const void* page, unsigned int tfFirstOrbit, const GPUParam* param, unsigned int triggerBC = 0); + + private: + std::vector&, const void*, unsigned int, unsigned int)>> mDecoders; + }; +}; + +} // namespace o2::gpu + +#endif diff --git a/GPU/Workflow/src/GPUWorkflowTPC.cxx b/GPU/Workflow/src/GPUWorkflowTPC.cxx index a259c910a8c95..fdfd94f430ab7 100644 --- a/GPU/Workflow/src/GPUWorkflowTPC.cxx +++ b/GPU/Workflow/src/GPUWorkflowTPC.cxx @@ -47,6 +47,7 @@ #include "GPUO2InterfaceConfiguration.h" #include "GPUO2InterfaceQA.h" #include "GPUO2Interface.h" +#include "GPUO2InterfaceUtils.h" #include "CalibdEdxContainer.h" #include "GPUNewCalibValues.h" #include "TPCPadGainCalib.h" @@ -206,7 +207,7 @@ void GPURecoWorkflowSpec::initFunctionTPCCalib(InitContext& ic) if (std::filesystem::exists(mConfParam->gainCalibFile)) { LOG(info) << "Loading tpc gain correction from file " << mConfParam->gainCalibFile; const auto* gainMap = o2::tpc::utils::readCalPads(mConfParam->gainCalibFile, "GainMap")[0]; - mCalibObjects.mTPCPadGainCalib = GPUO2Interface::getPadGainCalib(*gainMap); + mCalibObjects.mTPCPadGainCalib = GPUO2InterfaceUtils::getPadGainCalib(*gainMap); LOGP(info, "Disabling loading the TPC gain correction map from the CCDB as it was already loaded from input file"); mUpdateGainMapCCDB = false; @@ -214,7 +215,7 @@ void GPURecoWorkflowSpec::initFunctionTPCCalib(InitContext& ic) if (not mConfParam->gainCalibFile.empty()) { LOG(warn) << "Couldn't find tpc gain correction file " << mConfParam->gainCalibFile << ". Not applying any gain correction."; } - mCalibObjects.mTPCPadGainCalib = GPUO2Interface::getPadGainCalibDefault(); + mCalibObjects.mTPCPadGainCalib = GPUO2InterfaceUtils::getPadGainCalibDefault(); mCalibObjects.mTPCPadGainCalib->getGainCorrection(30, 5, 5); } mConfig->configCalib.tpcPadGain = mCalibObjects.mTPCPadGainCalib.get(); @@ -246,7 +247,7 @@ void GPURecoWorkflowSpec::finaliseCCDBTPC(ConcreteDataMatcher& matcher, void* ob } if (mUpdateGainMapCCDB && mSpecConfig.caClusterer) { - mTPCPadGainCalibBufferNew = GPUO2Interface::getPadGainCalib(*gainMap); + mTPCPadGainCalibBufferNew = GPUO2InterfaceUtils::getPadGainCalib(*gainMap); } } else if (matcher == ConcreteDataMatcher(gDataOriginTPC, "PADGAINRESIDUAL", 0)) {