-
Notifications
You must be signed in to change notification settings - Fork 15
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
Scheduler hints and fixes for distributed coordination bugs #169
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9fdfcef
Started fixes for locks
Shillaker a14a1bc
Clearing up groups
Shillaker b6a0c2e
Experiments with waiters/ maps
Shillaker 64dbd92
Add test for flag waiter
Shillaker 9d4570d
Avoid scheduling multiple threads on same thread as 0th group
Shillaker 249daf2
Overloading thread pool
Shillaker 6fca18b
Moved unrelated changes to separate PR
Shillaker ea11f7a
Add locks.cpp
Shillaker 314226f
Only lock on group when it exists
Shillaker bb5af80
Add custom merges
Shillaker 2cd38e0
Overhaul of snapshot diffing
Shillaker db28492
Move spurious logging statement
Shillaker 8ce8375
More snapshotting fixes
Shillaker 627209b
Rearrange scheduler logic
Shillaker e2b8f3a
Fix indexing in scheduler loop
Shillaker d9cca41
Avoid pushing snapshots to master host
Shillaker a32b7a3
Remove last snapshot stuff
Shillaker 4b6eb32
Add scheduler hints
Shillaker 983dfaa
Fix bug in host ordering
Shillaker ce8a870
Sort out reusing ptp messages
Shillaker 41118f9
Naming
Shillaker 52b3877
Fixing up tests
Shillaker d472329
Continuing test fixes
Shillaker e46fe94
Remove ignore regions
Shillaker dd7b6b8
Add distributed locking test
Shillaker ebc21eb
Formatting
Shillaker 11473c8
Fix dist tests and remove unnecessary unit test
Shillaker 0d2708e
Clearer error message when insufficient pool threads
Shillaker 4a76b0b
Bump cores in failing tests
Shillaker ef52533
Factor out scheduler decision making
Shillaker 5af97fd
Fix locking bug
Shillaker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
#pragma once | ||
|
||
#include <faabric/util/logging.h> | ||
|
||
#include <atomic> | ||
#include <condition_variable> | ||
#include <mutex> | ||
#include <shared_mutex> | ||
|
||
#define DEFAULT_FLAG_WAIT_MS 10000 | ||
|
||
namespace faabric::util { | ||
typedef std::unique_lock<std::mutex> UniqueLock; | ||
typedef std::unique_lock<std::shared_mutex> FullLock; | ||
typedef std::shared_lock<std::shared_mutex> SharedLock; | ||
|
||
class FlagWaiter | ||
{ | ||
public: | ||
FlagWaiter(int timeoutMsIn = DEFAULT_FLAG_WAIT_MS); | ||
|
||
void waitOnFlag(); | ||
|
||
void setFlag(bool value); | ||
|
||
private: | ||
int timeoutMs; | ||
|
||
std::mutex flagMx; | ||
std::condition_variable cv; | ||
std::atomic<bool> flag; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
#include <vector> | ||
|
||
#include <faabric/util/logging.h> | ||
#include <faabric/util/macros.h> | ||
|
||
namespace faabric::util { | ||
|
||
|
@@ -19,22 +20,13 @@ enum SnapshotDataType | |
enum SnapshotMergeOperation | ||
{ | ||
Overwrite, | ||
Ignore, | ||
Sum, | ||
Product, | ||
Subtract, | ||
Max, | ||
Min | ||
}; | ||
|
||
struct SnapshotMergeRegion | ||
{ | ||
uint32_t offset = 0; | ||
size_t length = 0; | ||
SnapshotDataType dataType = SnapshotDataType::Raw; | ||
SnapshotMergeOperation operation = SnapshotMergeOperation::Overwrite; | ||
}; | ||
|
||
class SnapshotDiff | ||
{ | ||
public: | ||
|
@@ -44,6 +36,8 @@ class SnapshotDiff | |
size_t size = 0; | ||
const uint8_t* data = nullptr; | ||
|
||
bool noChange = false; | ||
|
||
SnapshotDiff() = default; | ||
|
||
SnapshotDiff(SnapshotDataType dataTypeIn, | ||
|
@@ -58,13 +52,19 @@ class SnapshotDiff | |
data = dataIn; | ||
size = sizeIn; | ||
} | ||
}; | ||
|
||
SnapshotDiff(uint32_t offsetIn, const uint8_t* dataIn, size_t sizeIn) | ||
{ | ||
offset = offsetIn; | ||
data = dataIn; | ||
size = sizeIn; | ||
} | ||
class SnapshotMergeRegion | ||
{ | ||
public: | ||
uint32_t offset = 0; | ||
size_t length = 0; | ||
SnapshotDataType dataType = SnapshotDataType::Raw; | ||
SnapshotMergeOperation operation = SnapshotMergeOperation::Overwrite; | ||
|
||
void addDiffs(std::vector<SnapshotDiff>& diffs, | ||
const uint8_t* original, | ||
const uint8_t* updated); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this class down the file as it now depends on the |
||
|
||
class SnapshotData | ||
|
@@ -84,11 +84,12 @@ class SnapshotData | |
void addMergeRegion(uint32_t offset, | ||
size_t length, | ||
SnapshotDataType dataType, | ||
SnapshotMergeOperation operation); | ||
SnapshotMergeOperation operation, | ||
bool overwrite = false); | ||
|
||
private: | ||
// Note - we care about the order of this map, as we iterate through it in | ||
// order of offsets | ||
// Note - we care about the order of this map, as we iterate through it | ||
// in order of offsets | ||
std::map<uint32_t, SnapshotMergeRegion> mergeRegions; | ||
}; | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be called a "registry" hence the
reg
name, but it was a bit confusing.