Skip to content

Commit

Permalink
Remove boost system, filesystem, and regex
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed Oct 18, 2023
1 parent dd53b82 commit cec3433
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ if(thallium_FOUND)
endif()

# Boost
find_package(Boost REQUIRED COMPONENTS regex system filesystem fiber REQUIRED)
# find_package(Boost REQUIRED COMPONENTS regex system filesystem fiber REQUIRED)
find_package(Boost REQUIRED COMPONENTS fiber REQUIRED)
if (Boost_FOUND)
message(STATUS "found boost at ${Boost_INCLUDE_DIRS}")
endif()
Expand Down
6 changes: 3 additions & 3 deletions include/hermes/bucket.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class Bucket {
* */
void ReorganizeBlob(const BlobId &blob_id,
float score) {
blob_mdm_->AsyncReorganizeBlobRoot(id_, blob_id, score, 0);
blob_mdm_->AsyncReorganizeBlobRoot(id_, blob_id, score, 0, true);
}

/**
Expand All @@ -402,7 +402,7 @@ class Bucket {
void ReorganizeBlob(const BlobId &blob_id,
float score,
Context &ctx) {
blob_mdm_->AsyncReorganizeBlobRoot(id_, blob_id, score, 0);
blob_mdm_->AsyncReorganizeBlobRoot(id_, blob_id, score, 0, true);
}

/**
Expand All @@ -412,7 +412,7 @@ class Bucket {
float score,
u32 node_id,
Context &ctx) {
blob_mdm_->AsyncReorganizeBlobRoot(id_, blob_id, score, node_id);
blob_mdm_->AsyncReorganizeBlobRoot(id_, blob_id, score, node_id, true);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions include/hermes/hermes_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,12 @@ struct BlobInfo {
size_t blob_size_; /**< The overall size of the blob */
size_t max_blob_size_; /**< The amount of space current buffers support */
float score_; /**< The priority of this blob */
float user_score_; /**< The user-defined priority of this blob */
std::atomic<u32> access_freq_; /**< Number of times blob accessed in epoch */
hshm::Timepoint last_access_; /**< Last time blob accessed */
std::atomic<size_t> mod_count_; /**< The number of times blob modified */
std::atomic<size_t> last_flush_; /**< The last mod that was flushed */
bitfield32_t flags_; /**< Flags */

/** Serialization */
template<typename Ar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ class Client : public TaskLibClient {
const TagId &tag_id,
const BlobId &blob_id,
float score,
u32 node_id) {
u32 node_id,
bool user_score) {
// HILOG(kDebug, "Beginning REORGANIZE (task_node={})", task_node);
HRUN_CLIENT->ConstructTask<ReorganizeBlobTask>(
task, task_node, DomainId::GetNode(blob_id.node_id_), id_,
tag_id, blob_id, score, node_id);
tag_id, blob_id, score, node_id, user_score);
}
HRUN_TASK_NODE_PUSH_ROOT(ReorganizeBlob);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ class PutBlobPhase {
#define HERMES_BLOB_DID_CREATE BIT_OPT(u32, 4)
#define HERMES_GET_BLOB_ID BIT_OPT(u32, 5)
#define HERMES_HAS_DERIVED BIT_OPT(u32, 6)
#define HERMES_USER_SCORE_STATIONARY BIT_OPT(u32, 7)

/** A task to put data in a blob */
struct PutBlobTask : public Task, TaskFlags<TF_SRL_ASYM_START | TF_SRL_SYM_END> {
Expand Down Expand Up @@ -1075,6 +1076,7 @@ struct ReorganizeBlobTask : public Task, TaskFlags<TF_SRL_SYM> {
IN BlobId blob_id_;
IN float score_;
IN u32 node_id_;
IN bool is_user_score_;
TEMP int phase_ = ReorganizeBlobPhase::kGet;
TEMP hipc::Pointer data_;
TEMP size_t data_size_;
Expand All @@ -1095,7 +1097,8 @@ struct ReorganizeBlobTask : public Task, TaskFlags<TF_SRL_SYM> {
const TagId &tag_id,
const BlobId &blob_id,
float score,
u32 node_id) : Task(alloc) {
u32 node_id,
bool is_user_score) : Task(alloc) {
// Initialize task
task_node_ = task_node;
lane_hash_ = blob_id.hash_;
Expand All @@ -1110,6 +1113,7 @@ struct ReorganizeBlobTask : public Task, TaskFlags<TF_SRL_SYM> {
blob_id_ = blob_id;
score_ = score;
node_id_ = node_id;
is_user_score_ = is_user_score;
}

/** (De)serialize message call */
Expand Down
57 changes: 43 additions & 14 deletions tasks/hermes_blob_mdm/src/hermes_blob_mdm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,36 @@ class Server : public TaskLib {
if (access_score > 1) {
access_score = 1;
}
return std::max(freq_score, access_score);
float data_score = std::max(freq_score, access_score);
float user_score = blob_info.user_score_;
if (!blob_info.flags_.Any(HERMES_USER_SCORE_STATIONARY)) {
user_score *= data_score;
}
return std::max(data_score, user_score);
}

/** Check if blob should be reorganized */
template<bool UPDATE_SCORE=false>
bool ShouldReorganize(BlobInfo &blob_info,
float score,
TaskNode &task_node) {
for (BufferInfo &buf : blob_info.buffers_) {
TargetInfo &target = *target_map_[buf.tid_];
Histogram &hist = target.monitor_task_->score_hist_;
if constexpr(UPDATE_SCORE) {
target.AsyncUpdateScore(task_node + 1,
blob_info.score_, score);
}
u32 percentile = hist.GetPercentile(score);
size_t rem_cap = target.monitor_task_->rem_cap_;
size_t max_cap = target.max_cap_;
if (rem_cap < max_cap / 10) {
if (percentile < 10 || percentile > 90) {
return true;
}
}
}
return false;
}

/**
Expand All @@ -150,22 +179,11 @@ class Server : public TaskLib {
BlobInfo &blob_info = it.second;
// Update blob scores
float new_score = MakeScore(blob_info, now);
bool reorganize = false;
for (BufferInfo &buf : blob_info.buffers_) {
TargetInfo &target = *target_map_[buf.tid_];
Histogram &hist = target.monitor_task_->score_hist_;
target.AsyncUpdateScore(task->task_node_ + 1,
blob_info.score_, new_score);
u32 percentile = hist.GetPercentile(blob_info.score_);
if (percentile < 10 || percentile > 90) {
reorganize = true;
}
}
if (reorganize) {
if (ShouldReorganize<true>(blob_info, new_score, task->task_node_)) {
blob_mdm_.AsyncReorganizeBlob(task->task_node_ + 1,
blob_info.tag_id_,
blob_info.blob_id_,
new_score, 0);
new_score, 0, false);
}
blob_info.access_freq_ = 0;
blob_info.score_ = new_score;
Expand Down Expand Up @@ -663,6 +681,17 @@ class Server : public TaskLib {
return;
}
BlobInfo &blob_info = it->second;
if (task->is_user_score_) {
blob_info.user_score_ = task->score_;
blob_info.score_ = std::max(blob_info.user_score_,
blob_info.score_);
} else {
blob_info.score_ = task->score_;
}
if (!ShouldReorganize(blob_info, task->score_, task->task_node_)) {
task->SetModuleComplete();
return;
}
task->data_ = HRUN_CLIENT->AllocateBuffer(blob_info.blob_size_).shm_;
task->data_size_ = blob_info.blob_size_;
task->get_task_ = blob_mdm_.AsyncGetBlob(task->task_node_ + 1,
Expand Down

0 comments on commit cec3433

Please sign in to comment.