-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathDeviceSpecHelpers.h
More file actions
131 lines (119 loc) · 5.23 KB
/
DeviceSpecHelpers.h
File metadata and controls
131 lines (119 loc) · 5.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// 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.
#ifndef FRAMEWORK_DEVICESPECHELPERS_H
#define FRAMEWORK_DEVICESPECHELPERS_H
#include "Framework/WorkflowSpec.h"
#include "Framework/ChannelConfigurationPolicy.h"
#include "Framework/DataProcessorSpec.h"
#include "Framework/ChannelSpec.h"
#include "Framework/CompletionPolicy.h"
#include "Framework/DispatchPolicy.h"
#include "Framework/DeviceControl.h"
#include "Framework/DeviceExecution.h"
#include "Framework/DeviceSpec.h"
#include "Framework/AlgorithmSpec.h"
#include "Framework/ConfigParamSpec.h"
#include "Framework/OutputRoute.h"
#include "ResourceManager.h"
#include "DataProcessorInfo.h"
#include "WorkflowHelpers.h"
#include <boost/program_options.hpp>
#include <vector>
#include <string>
#include <map>
namespace o2
{
namespace framework
{
struct InputChannelSpec;
struct OutputChannelSpec;
struct DeviceSpecHelpers {
/// Helper to convert from an abstract dataflow specification, @a workflow,
/// to an actual set of devices which will have to run.
static void dataProcessorSpecs2DeviceSpecs(
const WorkflowSpec& workflow,
std::vector<ChannelConfigurationPolicy> const& channelPolicies,
std::vector<CompletionPolicy> const& completionPolicies,
std::vector<DispatchPolicy> const& dispatchPolicies,
std::vector<DeviceSpec>& devices,
ResourceManager& resourceManager,
std::string const& uniqueWorkflowId,
bool optimizeTopology = false,
unsigned short resourcesMonitoringInterval = 0);
static void dataProcessorSpecs2DeviceSpecs(
const WorkflowSpec& workflow,
std::vector<ChannelConfigurationPolicy> const& channelPolicies,
std::vector<CompletionPolicy> const& completionPolicies,
std::vector<DeviceSpec>& devices,
ResourceManager& resourceManager,
std::string const& uniqueWorkflowId,
bool optimizeTopology = false,
unsigned short resourcesMonitoringInterval = 0)
{
std::vector<DispatchPolicy> dispatchPolicies = DispatchPolicy::createDefaultPolicies();
dataProcessorSpecs2DeviceSpecs(workflow, channelPolicies, completionPolicies,
dispatchPolicies, devices, resourceManager, uniqueWorkflowId, optimizeTopology, resourcesMonitoringInterval);
}
/// Helper to provide the channel configuration string for an input channel
static std::string inputChannel2String(const InputChannelSpec& channel);
/// Helper to provide the channel configuration string for an output channel
static std::string outputChannel2String(const OutputChannelSpec& channel);
/// Rework the infos so that they have a consisten --shm-section-size
/// which is the maximum of the specified value.
static void reworkShmSegmentSize(std::vector<DataProcessorInfo>& infos);
/// Helper to prepare the arguments which will be used to
/// start the various devices.
static void prepareArguments(
bool defaultQuiet,
bool defaultStopped,
std::vector<DataProcessorInfo> const& processorInfos,
std::vector<DeviceSpec> const& deviceSpecs,
std::vector<DeviceExecution>& deviceExecutions,
std::vector<DeviceControl>& deviceControls,
std::string const& uniqueWorkflowId);
/// This takes the list of preprocessed edges of a graph
/// and creates Devices and Channels which are related
/// to the outgoing edges i.e. those which refer
/// to the act of producing data.
static void processOutEdgeActions(
std::vector<DeviceSpec>& devices,
std::vector<DeviceId>& deviceIndex,
std::vector<DeviceConnectionId>& connections,
ResourceManager& resourceManager,
const std::vector<size_t>& outEdgeIndex,
const std::vector<DeviceConnectionEdge>& logicalEdges,
const std::vector<EdgeAction>& actions,
const WorkflowSpec& workflow,
const std::vector<OutputSpec>& outputs,
std::vector<ChannelConfigurationPolicy> const& channelPolicies,
ComputingOffer const& defaultOffer);
/// This takes the list of preprocessed edges of a graph
/// and creates Devices and Channels which are related
/// to the incoming edges i.e. those which refer to
/// the act of consuming data.
static void processInEdgeActions(
std::vector<DeviceSpec>& devices,
std::vector<DeviceId>& deviceIndex,
const std::vector<DeviceConnectionId>& connections,
ResourceManager& resourceManager,
const std::vector<size_t>& inEdgeIndex,
const std::vector<DeviceConnectionEdge>& logicalEdges,
const std::vector<EdgeAction>& actions,
const WorkflowSpec& workflow,
const std::vector<LogicalForwardInfo>& availableForwardsInfo,
std::vector<ChannelConfigurationPolicy> const& channelPolicies,
ComputingOffer const& defaultOffer);
/// return a description of all options to be forwarded to the device
/// by default
static boost::program_options::options_description getForwardedDeviceOptions();
};
} // namespace framework
} // namespace o2
#endif // FRAMEWORK_DEVICESPECHELPERS_H