Project
Loading...
Searching...
No Matches
DefaultsHelpers.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 "
Framework/DefaultsHelpers.h
"
13
#include "
Framework/DataTakingContext.h
"
14
#include "
Framework/DeviceConfig.h
"
15
#include <fairmq/ProgOptions.h>
16
17
#include <cstdlib>
18
#include <cstring>
19
#include <stdexcept>
20
21
namespace
o2::framework
22
{
23
24
unsigned
int
DefaultsHelpers::pipelineLength
(
unsigned
int
minLength)
25
{
26
static
bool
override
= getenv(
"DPL_DEFAULT_PIPELINE_LENGTH"
);
27
if
(
override
) {
28
static
unsigned
int
retval = atoi(getenv(
"DPL_DEFAULT_PIPELINE_LENGTH"
));
29
return
std::max(minLength, retval);
30
}
31
DeploymentMode
deploymentMode
=
DefaultsHelpers::deploymentMode
();
32
// just some reasonable numers
33
// The number should really be tuned at runtime for each processor.
34
if
(
deploymentMode
==
DeploymentMode::OnlineDDS
||
deploymentMode
==
DeploymentMode::OnlineECS
||
deploymentMode
==
DeploymentMode::FST
) {
35
return
std::max(minLength, 512u);
36
}
else
{
37
return
std::max(minLength, 64u);
38
}
39
}
40
41
unsigned
int
DefaultsHelpers::pipelineLength
(
const
DeviceConfig
& dc)
42
{
43
static
unsigned
int
minLength = dc.
options
.count(
"timeframes-rate-limit"
) ? std::max(0, atoi(dc.
options
[
"timeframes-rate-limit"
].as<std::string>().c_str())) : 0;
44
return
pipelineLength
(minLength);
45
}
46
47
unsigned
int
DefaultsHelpers::pipelineLength
(
const
fair::mq::ProgOptions& options)
48
{
49
static
unsigned
int
minLength = options.Count(
"timeframes-rate-limit"
) ? std::max(0, atoi(options.GetValue<std::string>(
"timeframes-rate-limit"
).c_str())) : 0;
50
return
pipelineLength
(minLength);
51
}
52
53
static
DeploymentMode
getDeploymentMode_internal()
54
{
55
char
* explicitMode = getenv(
"O2_DPL_DEPLOYMENT_MODE"
);
56
if
(explicitMode !=
nullptr
) {
57
if
(strcmp(explicitMode,
"OnlineDDS"
) == 0) {
58
return
DeploymentMode::OnlineDDS
;
59
}
else
if
(strcmp(explicitMode,
"OnlineECS"
) == 0) {
60
return
DeploymentMode::OnlineECS
;
61
}
else
if
(strcmp(explicitMode,
"OnlineAUX"
) == 0) {
62
return
DeploymentMode::OnlineAUX
;
63
}
else
if
(strcmp(explicitMode,
"Local"
) == 0) {
64
return
DeploymentMode::Local
;
65
}
else
if
(strcmp(explicitMode,
"Grid"
) == 0) {
66
return
DeploymentMode::Grid
;
67
}
else
if
(strcmp(explicitMode,
"FST"
) == 0) {
68
return
DeploymentMode::FST
;
69
}
else
{
70
throw
std::runtime_error(
"Invalid deployment mode"
);
71
}
72
}
73
return
getenv(
"DDS_SESSION_ID"
) !=
nullptr
?
DeploymentMode::OnlineDDS
: (getenv(
"OCC_CONTROL_PORT"
) !=
nullptr
?
DeploymentMode::OnlineECS
: (getenv(
"ALIEN_PROC_ID"
) !=
nullptr
?
DeploymentMode::Grid
: (getenv(
"ALICE_O2_FST"
) ?
DeploymentMode::FST
: (
DeploymentMode::Local
))));
74
}
75
76
DeploymentMode
DefaultsHelpers::deploymentMode
()
77
{
78
static
DeploymentMode
retVal
= getDeploymentMode_internal();
79
return
retVal
;
80
}
81
82
bool
DefaultsHelpers::onlineDeploymentMode
()
83
{
84
switch
(
DefaultsHelpers::deploymentMode
()) {
85
case
DeploymentMode::OnlineAUX
:
86
case
DeploymentMode::OnlineECS
:
87
case
DeploymentMode::OnlineDDS
:
88
return
true
;
89
default
:
90
return
false
;
91
}
92
}
93
94
}
// namespace o2::framework
DataTakingContext.h
DefaultsHelpers.h
DeviceConfig.h
retVal
int32_t retVal
Definition
GPUReconstruction.cxx:61
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
BunchFilling.h:112
o2::framework::DeploymentMode
DeploymentMode
Definition
DataTakingContext.h:21
o2::framework::DeploymentMode::FST
@ FST
o2::framework::DeploymentMode::Local
@ Local
o2::framework::DeploymentMode::Grid
@ Grid
o2::framework::DeploymentMode::OnlineECS
@ OnlineECS
o2::framework::DeploymentMode::OnlineAUX
@ OnlineAUX
o2::framework::DeploymentMode::OnlineDDS
@ OnlineDDS
o2::framework::DefaultsHelpers::deploymentMode
static DeploymentMode deploymentMode()
Definition
DefaultsHelpers.cxx:76
o2::framework::DefaultsHelpers::pipelineLength
static unsigned int pipelineLength(unsigned int minLength)
get max number of timeslices in the queue
Definition
DefaultsHelpers.cxx:24
o2::framework::DefaultsHelpers::onlineDeploymentMode
static bool onlineDeploymentMode()
@true if running online
Definition
DefaultsHelpers.cxx:82
o2::framework::DeviceConfig
Definition
DeviceConfig.h:19
o2::framework::DeviceConfig::options
boost::program_options::variables_map options
Definition
DeviceConfig.h:20
Framework
Core
src
DefaultsHelpers.cxx
Generated on Wed Feb 25 2026 01:14:46 for Project by
1.9.8