Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1934: Add parameter to control minimal retention of historical LB data #1996

Open
wants to merge 82 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7c823e0
#1934: Add parameter to control minimal retention of historical LB data
thearusable Oct 17, 2022
932f1d6
#1934: Add UTs for minimal LB data retention
thearusable Oct 18, 2022
f2b2a6d
#1934: Store LB data in ordered map
thearusable Jan 27, 2023
d31709f
#1934: Update UTs to better reflect which phases are kept
thearusable Jun 6, 2023
7de6353
#1934: Add tests for DynamicCircularBuffer
thearusable Nov 10, 2023
18cf374
#1934: Add continuous dynamic circular buffer container
thearusable Nov 10, 2023
7d49646
#1934: Change node_data_ to new buffer type
thearusable Nov 10, 2023
f801dca
#1934: Use new container type in LB Data Holder
thearusable Nov 14, 2023
b7fb70d
#1934: Update usage of circular buffer after change in the operator[]
thearusable Nov 14, 2023
374aed0
#1934: Update implementation of setting correct buffer size in NodeLB…
thearusable Nov 14, 2023
cda9fd8
#1934: Remove trailing whitespaces
thearusable Nov 14, 2023
c6ec830
#1934: Add missing resize in linear model test
thearusable Nov 14, 2023
bbb3303
#1934: Allow contains to be called when size is zero
thearusable Nov 14, 2023
e2bcfd7
#1934: Add iterator support for buffer type
thearusable Nov 22, 2023
3182b05
#1934: Fix failing tests related to buffers being not initialized
thearusable Nov 23, 2023
a9d4b45
#1934: Add cosmetic changes and reverse some unneded changes
thearusable Nov 24, 2023
8070c2b
#1934: Use CircularPhasesBuffer in ElementLBData
thearusable Nov 28, 2023
0a7f8eb
#1934: Pass the requested retention to ElementLBData
thearusable Nov 28, 2023
4a8ffe2
#1934: Update retention tests to expect correct amount of phases in E…
thearusable Nov 28, 2023
03669cd
#1934: Adjust buffers size in objs of the collection
thearusable Nov 28, 2023
133c88b
#1934: Reaply interface changes after rebase
thearusable Dec 11, 2023
6b6a0e5
#1934: Synchronize buffer size in TestCol before checking for persist…
thearusable Dec 12, 2023
f88eb33
#1934: Set initial timings buffer size to 1
thearusable Dec 12, 2023
5820529
#1934: Remove update of the buffers in the group
thearusable Dec 12, 2023
1c969c1
#1934: Use buffer alias in models
thearusable Dec 12, 2023
ebe1805
#1934: Add more tests for circular phases buffer
thearusable Dec 15, 2023
529659f
#1934: Add more test cases for CircularPhasesBuffer
thearusable Dec 19, 2023
86c60de
#1934: Avoid crashing when container was not resized yet
thearusable Dec 19, 2023
76a65ec
#1934: Finish first version of the CirculaPhasesBuffer
thearusable Dec 19, 2023
c5772d9
#1934: Update tests for CircularPhasesBuffer
thearusable Dec 20, 2023
2c2db3d
#1934: Update implementation of CirculaPhasesBuffer
thearusable Dec 20, 2023
0be51a4
#1934: Add documentation for CirculalPhasesBuffer
thearusable Dec 20, 2023
79d8a10
#1934: Fix compilation issue on Apple Clang
thearusable Dec 21, 2023
e473ec9
#1934: Fix NVCC warning related to unsigned variable
thearusable Dec 29, 2023
34cf664
#1934: Update implementation after resolving conflicts
thearusable Apr 23, 2024
96373a8
#1934: Refactor of the CircularPhasesBuffer to be dynamic in size unt…
thearusable Apr 30, 2024
e0eb2bc
#1934: Remove unnecessary resizes
thearusable Apr 30, 2024
7a43e69
#1934: Update unit tests to check all relevant fields in NodeLBData
thearusable Apr 30, 2024
376c516
#1934: Remove trailing whitespaces
thearusable Apr 30, 2024
0b1fb56
#1934: Remove usage of old LBDataHolder constructor
thearusable May 6, 2024
899cd3e
#1934: Enable serialization of queue in CircularPhasesBuffer
thearusable Jun 6, 2024
f7e26ff
#1934: Add missing include with unordered_map
thearusable Jun 6, 2024
9b066bc
#1934: Update units tests to fix CI failure
thearusable Jun 11, 2024
6ffedd8
#1934: Use common types in tests
thearusable Jun 11, 2024
5ca4a62
#1934: Undo not needed changes
thearusable Jun 11, 2024
3658c6a
#1934: Make CircularBuffer interface more like a map
thearusable Jun 11, 2024
8ec8fe2
#1934: Update collection creation in tests
thearusable Jun 11, 2024
e225d2b
#1934: Remove small changes
thearusable Jul 4, 2024
41f4541
#1934: Update CircularPhasesBuffer to follow vt style of naming varia…
thearusable Jul 15, 2024
3942cad
#1934: Avoid unnecessary copies of data when adding it to cache
thearusable Jul 17, 2024
5e2d8a7
#1934: Remove const from addToCache data parameter
thearusable Jul 18, 2024
9c86660
#1934: Update unit tests to work with new implementation of the buffer
thearusable Aug 22, 2024
ff860c8
#1934: Update implementation of the circular buffer to use std::vector
thearusable Aug 22, 2024
0fc1778
#1934: Add front and back methods to CircularPhasesBuffer
thearusable Aug 26, 2024
4af903f
#1934: Add tests for front and back methods
thearusable Aug 26, 2024
1822f20
#1934: Update usage of circular phases buffer
thearusable Aug 26, 2024
f252c53
#1934: Add resizing functionality to LBDataHolder buffers
thearusable Aug 27, 2024
f519dca
#1934: Update unit tests to use new constructor of LBDataHolder
thearusable Aug 27, 2024
fef230b
#1934: Disable resizing of the buffer to zero
thearusable Aug 28, 2024
35fc771
#1934: Update tests to work correctly with the new buffer type
thearusable Aug 28, 2024
5c34790
#1934: Update implementation of circular buffer to work based on modu…
thearusable Sep 17, 2024
14c17f3
#1934: Update tests for circular buffer to support the new implementa…
thearusable Sep 17, 2024
5a94672
#1934: Update usage of the buffer in the codebase
thearusable Sep 17, 2024
1d828ae
#1934: Update LBDataHolder to use default constructor
thearusable Sep 17, 2024
13b5d7f
#1934: Remove list initializer constructor
thearusable Sep 19, 2024
b36b933
#1934: Update LBDataHolder to resize containers when reading data fro…
thearusable Sep 19, 2024
7f3f0e1
#1934: Update tests to not use the removed constructor
thearusable Sep 19, 2024
77b8fb9
#1934: Update usage of LBDataHolder in the codebase
thearusable Sep 19, 2024
3bc5550
#1934: Fix compilation issues after the PR rebase
thearusable Sep 19, 2024
f4ce66b
#1934: Reset ElementLBData containers after resetting the current phase
thearusable Sep 19, 2024
c9c65e6
#1934: Remove leftovers from previous implementation of the circular …
thearusable Sep 19, 2024
9a056c0
#1934: Update CircularPhasesBuffer documentation
thearusable Sep 19, 2024
b9f2293
#1934: Add resizeHistory method back after resolving conflicts
thearusable Sep 23, 2024
57d0457
#1934: Modify ElementLBData::resetPhase() to reset the head phase of …
thearusable Sep 23, 2024
57b70f7
#1934: Adapt newly added functionality in LBDataHolder to support Cir…
thearusable Sep 23, 2024
ddc3c57
#1934: Remove comparison of signed and unsigned integers in retention…
thearusable Sep 23, 2024
c6db957
#1934: Add LB data retention tests for chckpointing case
thearusable Sep 24, 2024
a4ff0c6
#1934: Improve documentation for CircularPhasesBuffer
thearusable Sep 24, 2024
c9e9120
#1934: Modify test harness to allow for vt restarts
thearusable Sep 26, 2024
0623fc4
#1934: Prepare content of the containers for work after restore from …
thearusable Sep 26, 2024
37b719f
#1934: Update retention test to do a full recreation of the vt objects
thearusable Sep 26, 2024
0b2489f
#1934: Fix retention test checks when LB is disabled
thearusable Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#1934: Make CircularBuffer interface more like a map
  • Loading branch information
thearusable committed Sep 23, 2024
commit 3658c6ab1bb08abfac816fa05a2c8dbe829e7ae5
86 changes: 53 additions & 33 deletions src/vt/utils/container/circular_phases_buffer.h
Original file line number Diff line number Diff line change
@@ -105,79 +105,71 @@ struct CircularPhasesBuffer {
}

/**
* \brief Check if phase is present in the buffer
* \brief Get data related to the phase.
*
* \param[in] phase the phase to look for
*
* \return whether buffer contains the phase or not
* \return reference to the stored data
*/
bool contains(const PhaseType phase) const {
return m_buffer.find(phase) != m_buffer.end();
const StoredType& at(const PhaseType phase) const {
return m_buffer.at(phase);
}

/**
* \brief Get data related to the phase. Insert new data if phase is not present in the buffer.
* \brief Get data related to the phase.
*
* \param[in] phase the phase to look for
*
* \return reference to the stored data
*/
StoredType& operator[](const PhaseType phase) {
if (!contains(phase)) {
addToCache(std::make_pair(phase, StoredType{}));
}
return m_buffer[phase];
}
StoredType& at(const PhaseType phase) { return m_buffer.at(phase); }

/**
* \brief Find data related to the phase.
* \brief Get data related to the phase. Insert new data if phase is not present in the buffer.
*
* \param[in] phase the phase to look for
*
* \return pointer to the stored data or null if not present
* \return reference to the stored data
*/
const StoredType* find(const PhaseType phase) const {
auto iter = m_buffer.find(phase);
if (iter != m_buffer.end()) {
return &iter->second;
StoredType& operator[](const PhaseType phase) {
if (!contains(phase)) {
addToCache(std::make_pair(phase, StoredType{}));
}
return nullptr;
return m_buffer[phase];
}

/**
* \brief Find data related to the phase.
* \brief Find an element for passed phase.
*
* \param[in] phase the phase to look for
*
* \return pointer to the stored data or null if not present
* \return iterator to the requested element.
*/
StoredType* find(const PhaseType phase) {
auto iter = m_buffer.find(phase);
if (iter != m_buffer.end()) {
return &iter->second;
}
return nullptr;
auto find(const PhaseType& phase) {
return m_buffer.find(phase);
}

/**
* \brief Get data related to the phase.
* \brief Find an element for passed phase.
*
* \param[in] phase the phase to look for
*
* \return reference to the stored data
* \return const iterator to the requested element.
*/
const StoredType& at(const PhaseType phase) const {
return m_buffer.at(phase);
auto find(const PhaseType& phase) const {
return m_buffer.find(phase);
}

/**
* \brief Get data related to the phase.
* \brief Check if phase is present in the buffer
*
* \param[in] phase the phase to look for
*
* \return reference to the stored data
* \return whether buffer contains the phase or not
*/
StoredType& at(const PhaseType phase) { return m_buffer.at(phase); }
bool contains(const PhaseType phase) const {
return m_buffer.find(phase) != m_buffer.end();
}

/**
* \brief Resize buffer to the requested size
@@ -240,13 +232,41 @@ struct CircularPhasesBuffer {
*/
auto begin() { return m_buffer.begin(); }

/**
* @brief Get const iterator to the begging of the buffer
*
* @return auto the const begin iterator
*/
auto begin() const { return m_buffer.begin(); }

/**
* @brief Get const iterator to the begging of the buffer
*
* @return auto the const begin iterator
*/
auto cbegin() const { return m_buffer.cbegin(); }

/**
* @brief Get iterator to the space after buffer
*
* @return auto the end iterator
*/
auto end() { return m_buffer.end(); }

/**
* @brief Get const iterator to the space after buffer
*
* @return auto the const end iterator
*/
auto end() const { return m_buffer.end(); }

/**
* @brief Get const iterator to the space after buffer
*
* @return auto the const end iterator
*/
auto cend() const { return m_buffer.cend(); }

private:
/**
* @brief Add new phase to the cache and remove oldest one if buffer exceeds requested size
19 changes: 10 additions & 9 deletions src/vt/vrt/collection/balance/lb_invoke/lb_manager.cc
Original file line number Diff line number Diff line change
@@ -257,15 +257,15 @@ LBManager::runLB(PhaseType phase, vt::Callback<ReassignmentMsg> cb) {
elm::CommMapType const* comm = &empty_comm;

auto const& node_comm = theNodeLBData()->getNodeComm();
if (node_comm->contains(phase)) {
comm = &node_comm->at(phase);
if (auto iter = node_comm->find(phase); iter != node_comm->end()) {
comm = &iter->second;
}

balance::DataMapType empty_data_map;
balance::DataMapType const* data_map = &empty_data_map;
auto const& node_data_map = theNodeLBData()->getUserData();
if (node_data_map->contains(phase)) {
data_map = &node_data_map->at(phase);
if (auto iter = node_data_map->find(phase); iter != node_data_map->end()) {
data_map = &iter->second;
}

vt_debug_print(terse, lb, "LBManager: running strategy\n");
@@ -735,8 +735,9 @@ void LBManager::computeStatistics(

elm::CommMapType empty_comm;
elm::CommMapType const* comm_data = &empty_comm;
if (theNodeLBData()->getNodeComm()->contains(phase)) {
comm_data = &theNodeLBData()->getNodeComm()->at(phase);
auto iter = theNodeLBData()->getNodeComm()->find(phase);
if (iter != theNodeLBData()->getNodeComm()->end()) {
comm_data = &iter->second;
}

std::vector<LoadData> lstats;
@@ -896,12 +897,12 @@ getSharedEdges(elm::CommMapType const& comm_data) {
void makeGraphSymmetric(
PhaseType phase, objgroup::proxy::Proxy<lb::BaseLB> proxy
) {
auto ptr = theNodeLBData()->getNodeComm()->find(phase);
if (!ptr) {
auto iter = theNodeLBData()->getNodeComm()->find(phase);
if (iter == theNodeLBData()->getNodeComm()->end()) {
return;
}

auto shared_edges = getSharedEdges(*ptr);
auto shared_edges = getSharedEdges(iter->second);

for (auto&& elm : shared_edges) {
proxy[elm.first].send<lb::CommMsg, &lb::BaseLB::recvSharedEdges>(
14 changes: 7 additions & 7 deletions src/vt/vrt/collection/balance/model/raw_data.cc
Original file line number Diff line number Diff line change
@@ -60,19 +60,19 @@ void RawData::setLoads(LoadMapBufferType const* proc_load,
}

ObjectIterator RawData::begin() const {
auto ptr = proc_load_->find(last_completed_phase_);
if (ptr) {
return {std::make_unique<LoadMapObjectIterator>(ptr->cbegin(),
ptr->cend())};
auto iter = proc_load_->find(last_completed_phase_);
if (iter != proc_load_->end()) {
return {std::make_unique<LoadMapObjectIterator>(iter->second.cbegin(),
iter->second.cend())};
} else {
return {nullptr};
}
}

int RawData::getNumObjects() const {
auto ptr = proc_load_->find(last_completed_phase_);
if (ptr) {
return ptr->size();
auto iter = proc_load_->find(last_completed_phase_);
if (iter != proc_load_->end()) {
return iter->second.size();
} else {
return 0;
}
3 changes: 2 additions & 1 deletion src/vt/vrt/collection/balance/node_lb_data.cc
Original file line number Diff line number Diff line change
@@ -120,7 +120,8 @@ ElmUserDataType const* NodeLBData::getNodeAttributes() const {
}

CommMapType* NodeLBData::getNodeComm(PhaseType phase) {
return lb_data_->node_comm_.find(phase);
auto iter = lb_data_->node_comm_.find(phase);
return (iter != lb_data_->node_comm_.end()) ? &iter->second : nullptr;
}

void NodeLBData::clearLBData() {