Skip to content

Commit 0eee330

Browse files
committed
#1934: Remove unnecessary resizes
1 parent 453c816 commit 0eee330

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

src/vt/elm/elm_lb_data.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ struct ElementLBData {
131131
bool cur_time_started_ = false;
132132
TimeType cur_time_ = TimeType{0.0};
133133
PhaseType cur_phase_ = fst_lb_phase;
134-
util::container::CircularPhasesBuffer<LoadType> phase_timings_ = {1};
135-
util::container::CircularPhasesBuffer<CommMapType> phase_comm_ = {1};
134+
util::container::CircularPhasesBuffer<LoadType> phase_timings_;
135+
util::container::CircularPhasesBuffer<CommMapType> phase_comm_;
136136

137137
SubphaseType cur_subphase_ = 0;
138-
util::container::CircularPhasesBuffer<std::vector<LoadType>> subphase_timings_ = {1};
139-
util::container::CircularPhasesBuffer<std::vector<CommMapType>> subphase_comm_ = {1};
138+
util::container::CircularPhasesBuffer<std::vector<LoadType>> subphase_timings_;
139+
util::container::CircularPhasesBuffer<std::vector<CommMapType>> subphase_comm_;
140140
};
141141

142142
}} /* end namespace vt::elm */

src/vt/vrt/collection/balance/lb_data_holder.cc

+1-9
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ std::unique_ptr<nlohmann::json> LBDataHolder::toJson(PhaseType phase) const {
169169
}
170170
outputEntity(j["tasks"][i]["entity"], id);
171171

172-
if (node_user_attributes_.find(phase) != node_user_attributes_.end()) {
172+
if (node_user_attributes_.contains(phase)) {
173173
if (node_user_attributes_.at(phase).find(id) != node_user_attributes_.at(phase).end()) {
174174
for (auto const& [key, value] : node_user_attributes_.at(phase).at(id)) {
175175
if (std::holds_alternative<int>(value)) {
@@ -262,14 +262,6 @@ std::unique_ptr<nlohmann::json> LBDataHolder::toJson(PhaseType phase) const {
262262
return std::make_unique<json>(std::move(j));
263263
}
264264

265-
LBDataHolder::LBDataHolder(std::size_t initial_buffers_size)
266-
: node_data_(initial_buffers_size),
267-
node_comm_(initial_buffers_size),
268-
node_subphase_comm_(initial_buffers_size),
269-
user_defined_json_(initial_buffers_size),
270-
user_defined_lb_info_(initial_buffers_size)
271-
{ }
272-
273265
LBDataHolder::LBDataHolder(nlohmann::json const& j)
274266
{
275267
auto this_node = theContext()->getNode();

src/vt/vrt/collection/balance/lb_data_holder.h

+1-8
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,6 @@ namespace vt { namespace vrt { namespace collection { namespace balance {
6767
struct LBDataHolder {
6868
LBDataHolder() = default;
6969

70-
/**
71-
* \brief Create \c LBDataHolder with specified buffers capacity
72-
*
73-
* \param[in] initial_buffers_size the initial size of the buffers
74-
*/
75-
LBDataHolder(std::size_t initial_buffers_size);
76-
7770
/**
7871
* \brief Create \c LBDataHolder from input JSON
7972
*
@@ -158,7 +151,7 @@ struct LBDataHolder {
158151
/// User-defined data from each phase for LB
159152
DataMapBufferType user_defined_lb_info_;
160153
/// User-defined attributes from each phase
161-
std::unordered_map<PhaseType, DataMapType> node_user_attributes_;
154+
DataMapBufferType node_user_attributes_;
162155
/// Node indices for each ID along with the proxy ID
163156
std::unordered_map<ElementIDStruct, std::tuple<VirtualProxyType, std::vector<uint64_t>>> node_idx_;
164157
/// Map from id to objgroup proxy

tests/unit/collection/test_workload_data_migrator.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ setupWorkloads(PhaseType phase, size_t numElements) {
9393
);
9494
}
9595

96-
auto lbdh = std::make_shared<LBDataHolder>(numElements);
96+
auto lbdh = std::make_shared<LBDataHolder>();
9797

9898
for (auto&& elmID : myElemList) {
9999
double tval = elmID.id * 2;
@@ -790,7 +790,7 @@ setupManyWorkloads(
790790
);
791791
}
792792

793-
auto lbdh = std::make_shared<LBDataHolder>(num_phases);
793+
auto lbdh = std::make_shared<LBDataHolder>();
794794

795795
PhaseType stop_phase = initial_phase + num_phases;
796796
for (PhaseType phase = initial_phase; phase < stop_phase; ++phase) {
@@ -804,7 +804,7 @@ setupManyWorkloads(
804804
}
805805
}
806806

807-
auto scrambled_lbdh = std::make_shared<LBDataHolder>(num_phases);
807+
auto scrambled_lbdh = std::make_shared<LBDataHolder>();
808808

809809
for (PhaseType phase = initial_phase; phase < stop_phase; ++phase) {
810810
auto base_load_model = setupBaseModel(phase, lbdh);

0 commit comments

Comments
 (0)