• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

celerity / celerity-runtime / 11383943906

17 Oct 2024 11:24AM UTC coverage: 95.303% (-0.005%) from 95.308%
11383943906

push

github

psalz
Update benchmark results for "fat" pushes

2984 of 3368 branches covered (88.6%)

Branch coverage included in aggregate %.

6674 of 6766 relevant lines covered (98.64%)

1484448.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.57
/include/command.h
1
#pragma once
2

3
#include "intrusive_graph.h"
4
#include "ranges.h"
5
#include "task.h"
6
#include "types.h"
7

8
#include <matchbox.hh>
9

10
namespace celerity {
11
namespace detail {
12

13
        enum class command_type { epoch, horizon, execution, push, await_push, reduction, fence };
14

15
        class abstract_command : public intrusive_graph_node<abstract_command>,
16
                                 // Accept visitors to enable matchbox::match() on the command inheritance hierarchy
17
                                 public matchbox::acceptor<class epoch_command, class horizon_command, class execution_command, class push_command,
18
                                     class await_push_command, class reduction_command, class fence_command> {
19
                friend class command_graph;
20

21
          protected:
22
                abstract_command(command_id cid) : m_cid(cid) {}
8,358✔
23

24
          public:
25
                virtual command_type get_type() const = 0;
26

27
                command_id get_cid() const { return m_cid; }
160,800✔
28

29
          private:
30
                // Should only be possible to add/remove dependencies using command_graph.
31
                using parent_type = intrusive_graph_node<abstract_command>;
32
                using parent_type::add_dependency;
33
                using parent_type::remove_dependency;
34

35
                command_id m_cid;
36
        };
37

38
        class push_command final : public matchbox::implement_acceptor<abstract_command, push_command> {
39
                friend class command_graph;
40
                push_command(const command_id cid, const transfer_id& trid, std::vector<std::pair<node_id, region<3>>> target_regions)
534✔
41
                    : acceptor_base(cid), m_trid(trid), m_target_regions(std::move(target_regions)) {}
534✔
42

43
                command_type get_type() const override { return command_type::push; }
×
44

45
          public:
46
                const transfer_id& get_transfer_id() const { return m_trid; }
583✔
47
                const std::vector<std::pair<node_id, region<3>>>& get_target_regions() const { return m_target_regions; }
583✔
48

49
          private:
50
                transfer_id m_trid;
51
                std::vector<std::pair<node_id, region<3>>> m_target_regions;
52
        };
53

54
        class await_push_command final : public matchbox::implement_acceptor<abstract_command, await_push_command> {
55
                friend class command_graph;
56
                await_push_command(const command_id cid, const transfer_id& trid, region<3> region) : acceptor_base(cid), m_trid(trid), m_region(std::move(region)) {}
478✔
57

58
                command_type get_type() const override { return command_type::await_push; }
×
59

60
          public:
61
                const transfer_id& get_transfer_id() const { return m_trid; }
531✔
62
                const region<3>& get_region() const { return m_region; }
917✔
63

64
          private:
65
                transfer_id m_trid;
66
                region<3> m_region;
67
        };
68

69
        class reduction_command final : public matchbox::implement_acceptor<abstract_command, reduction_command> {
70
                friend class command_graph;
71
                reduction_command(command_id cid, const reduction_info& info, const bool has_local_contribution)
68✔
72
                    : acceptor_base(cid), m_info(info), m_has_local_contribution(has_local_contribution) {}
68✔
73

74
                command_type get_type() const override { return command_type::reduction; }
×
75

76
          public:
77
                const reduction_info& get_reduction_info() const { return m_info; }
199✔
78
                bool has_local_contribution() const { return m_has_local_contribution; }
95✔
79

80
          private:
81
                reduction_info m_info;
82
                bool m_has_local_contribution;
83
        };
84

85
        class task_command : public abstract_command {
86
          protected:
87
                task_command(command_id cid, task_id tid) : abstract_command(cid), m_tid(tid) {}
7,278✔
88

89
          public:
90
                task_id get_tid() const { return m_tid; }
23,685✔
91

92
          private:
93
                task_id m_tid;
94
        };
95

96
        class epoch_command final : public matchbox::implement_acceptor<task_command, epoch_command> {
97
                friend class command_graph;
98
                epoch_command(const command_id cid, const task_id tid, const epoch_action action, std::vector<reduction_id> completed_reductions)
1,314✔
99
                    : acceptor_base(cid, tid), m_action(action), m_completed_reductions(std::move(completed_reductions)) {}
1,314✔
100

101
                command_type get_type() const override { return command_type::epoch; }
12✔
102

103
          public:
104
                epoch_action get_epoch_action() const { return m_action; }
1,299✔
105
                const std::vector<reduction_id>& get_completed_reductions() const { return m_completed_reductions; }
1,299✔
106

107
          private:
108
                epoch_action m_action;
109
                std::vector<reduction_id> m_completed_reductions;
110
        };
111

112
        class horizon_command final : public matchbox::implement_acceptor<task_command, horizon_command> {
113
                friend class command_graph;
114
                horizon_command(const command_id cid, const task_id tid, std::vector<reduction_id> completed_reductions)
1,061✔
115
                    : acceptor_base(cid, tid), m_completed_reductions(std::move(completed_reductions)) {}
1,061✔
116

117
                command_type get_type() const override { return command_type::horizon; }
765✔
118

119
          public:
120
                const std::vector<reduction_id>& get_completed_reductions() const { return m_completed_reductions; }
1,088✔
121

122
          private:
123
                std::vector<reduction_id> m_completed_reductions;
124
        };
125

126
        class execution_command final : public matchbox::implement_acceptor<task_command, execution_command> {
127
                friend class command_graph;
128

129
          protected:
130
                execution_command(command_id cid, task_id tid, subrange<3> execution_range) : acceptor_base(cid, tid), m_execution_range(execution_range) {}
4,815✔
131

132
          public:
133
                command_type get_type() const override { return command_type::execution; }
1,035✔
134

135
                const subrange<3>& get_execution_range() const { return m_execution_range; }
9,646✔
136

137
                void set_is_reduction_initializer(bool is_initializer) { m_initialize_reductions = is_initializer; }
14✔
138

139
                bool is_reduction_initializer() const { return m_initialize_reductions; }
4,478✔
140

141
          private:
142
                subrange<3> m_execution_range;
143
                bool m_initialize_reductions = false;
144
        };
145

146
        class fence_command final : public matchbox::implement_acceptor<task_command, fence_command> {
147
                friend class command_graph;
148
                using acceptor_base::acceptor_base;
149

150
                command_type get_type() const override { return command_type::fence; }
×
151
        };
152

153
        /// Hash function for `unordered_sets/maps` of `command *` that is deterministic even as allocation addresses change between application runs.
154
        struct command_hash_by_id {
155
                template <typename Pointer>
156
                constexpr size_t operator()(const Pointer instr) const {
24,349✔
157
                        return std::hash<command_id>()(instr->get_cid());
24,349✔
158
                }
159
        };
160

161
        using command_set = std::unordered_set<abstract_command*, command_hash_by_id>;
162

163
} // namespace detail
164
} // namespace celerity
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc