Project
Loading...
Searching...
No Matches
tpc-flp-idc.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#include <vector>
13#include <string>
19#include "TPCBase/CRU.h"
20
21using namespace o2::framework;
22
23// we need to add workflow options before including Framework/runDataProcessing
24void customize(std::vector<ConfigParamSpec>& workflowOptions)
25{
26 const std::string cruDefault = "0-" + std::to_string(o2::tpc::CRU::MaxCRU - 1);
27 const int defaultlanes = std::max(1u, std::thread::hardware_concurrency() / 2);
28
29 std::vector<ConfigParamSpec> options{
30 {"configFile", VariantType::String, "", {"configuration file for configurable parameters"}},
31 {"loadStatusMap", VariantType::Bool, false, {"Loading pad status map from the CCDB."}},
32 {"lanes", VariantType::Int, defaultlanes, {"Number of parallel processing lanes (crus are split per device)."}},
33 {"time-lanes", VariantType::Int, 1, {"Number of parallel processing lanes (timeframes are split per device)."}},
34 {"crus", VariantType::String, cruDefault.c_str(), {"List of CRUs, comma separated ranges, e.g. 0-3,7,9-15"}},
35 {"rangeIDC", VariantType::Int, 200, {"Number of 1D-IDCs which will be used for the calculation of the fourier coefficients."}},
36 {"minIDCsPerTF", VariantType::Int, 10, {"minimum number of IDCs per TF (needed for sending to 1D-IDCs to EPNs. Depends on number of orbits per TF. 10 for 128 orbits per TF)."}},
37 {"idc0File", VariantType::String, "", {"file to reference IDC0 object"}},
38 {"disableIDC0CCDB", VariantType::Bool, false, {"Disabling loading the IDC0 object from the CCDB (no normalization is applied for IDC1 calculation)"}},
39 {"enable-synchronous-processing", VariantType::Bool, false, {"Enable calculation and sending of 1D-IDCs for synchronous processing"}},
40 {"n-TFs-buffer", VariantType::Int, 1, {"Buffer n-TFs to reduce the messaged which will be send."}},
41 {"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings (e.g. 'TPCIDCGroupParam.Method=0;')"}}};
42
43 std::swap(workflowOptions, options);
44}
45
47
49{
50 using namespace o2::tpc;
51 o2::conf::ConfigurableParam::updateFromString(config.options().get<std::string>("configKeyValues"));
52 const auto tpcCRUs = o2::RangeTokenizer::tokenize<int>(config.options().get<std::string>("crus"));
53 const auto nCRUs = tpcCRUs.size();
54 const auto nLanes = std::min(static_cast<unsigned long>(config.options().get<int>("lanes")), nCRUs);
55 const auto time_lanes = static_cast<unsigned int>(config.options().get<int>("time-lanes"));
56 const auto crusPerLane = nCRUs / nLanes + ((nCRUs % nLanes) != 0);
57 const auto loadStatusMap = config.options().get<bool>("loadStatusMap");
58 const auto rangeIDC = static_cast<unsigned int>(config.options().get<int>("rangeIDC"));
59 const auto minIDCsPerTF = static_cast<unsigned int>(config.options().get<int>("minIDCsPerTF"));
61
62 const std::string idc0File = config.options().get<std::string>("idc0File");
63 const auto disableIDC0CCDB = config.options().get<bool>("disableIDC0CCDB");
64 const auto enableSynchProc = config.options().get<bool>("enable-synchronous-processing");
65 const int nTFsBufferTmp = config.options().get<int>("n-TFs-buffer");
66
67 // set up configuration
68 o2::conf::ConfigurableParam::updateFromFile(config.options().get<std::string>("configFile"));
69 o2::conf::ConfigurableParam::writeINI("o2tpcflp_configuration.ini");
70
71 WorkflowSpec workflow;
72 if (nLanes <= 0) {
73 return workflow;
74 }
75
76 for (int ilane = 0; ilane < nLanes; ++ilane) {
77 const auto first = tpcCRUs.begin() + ilane * crusPerLane;
78 if (first >= tpcCRUs.end()) {
79 break;
80 }
81 const auto last = std::min(tpcCRUs.end(), first + crusPerLane);
82 const std::vector<uint32_t> rangeCRUs(first, last);
83 int nTFsBuffer = nTFsBufferTmp * rangeCRUs.size();
84 if (nTFsBuffer <= 0) {
85 nTFsBuffer = rangeCRUs.size();
86 }
87 workflow.emplace_back(timePipeline(getTPCFLPIDCSpec(ilane, rangeCRUs, rangeIDC, loadStatusMap, idc0File, disableIDC0CCDB, enableSynchProc, nTFsBuffer), time_lanes));
88 }
89
90 return workflow;
91}
Helper function to tokenize sequences and ranges of integral numbers.
TPC device for processing on FLPs.
static void writeINI(std::string const &filename, std::string const &keyOnly="")
static void updateFromFile(std::string const &, std::string const &paramsList="", bool unchangedOnly=false)
static void updateFromString(std::string const &)
ConfigParamRegistry & options() const
@ MaxCRU
Definition CRU.h:31
static void setMinIDCsPerTF(const unsigned int nMinIDCsPerTF)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
DataProcessorSpec timePipeline(DataProcessorSpec original, size_t count)
Global TPC definitions and constants.
Definition SimTraits.h:167
DataProcessorSpec getTPCFLPIDCSpec(const int ilane, const std::vector< uint32_t > &crus, const unsigned int rangeIDC, const bool loadStatusMap, const std::string idc0File, const bool disableIDC0CCDB, const bool enableSynchProc, const int nTFsBuffer=1)
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52
WorkflowSpec defineDataProcessing(ConfigContext const &config)
This function hooks up the the workflow specifications into the DPL driver.
void customize(std::vector< ConfigParamSpec > &workflowOptions)