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

Add benchmark for VPIC-style workload #231

Merged
merged 19 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 22 additions & 1 deletion adapter/src/hermes/adapter/stdio/common/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
/**
* Standard header
*/
#include <cstdlib>

/**
* Dependent library header
*/
#include "glog/logging.h"

/**
* Internal header
Expand All @@ -35,10 +37,29 @@ using hermes::adapter::stdio::MapperType;
* Which mapper to be used by STDIO adapter.
*/
const MapperType kMapperType = MapperType::BALANCED;

/**
* Define kPageSize for balanced mapping.
*/
const size_t kPageSize = 1024 * 1024;
const size_t kPageSize = []() {
const char *kPageSizeVar = "HERMES_PAGE_SIZE";
const size_t kDefaultPageSize = 1 * 1024 * 1024;

size_t result = kDefaultPageSize;
char *page_size = getenv(kPageSizeVar);

if (page_size) {
result = (size_t)std::strtoull(page_size, NULL, 0);
if (result == 0) {
LOG(FATAL) << "Invalid value of " << kPageSizeVar << ": " << page_size;
}
}

LOG(INFO) << "Stdio adapter page size: " << result << "\n";

return result;
}();

/**
* String delimiter
*/
Expand Down
11 changes: 10 additions & 1 deletion adapter/src/hermes/adapter/stdio/stdio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,16 @@ void ReadGap(const std::string &filename, size_t seek_offset, u8 *read_ptr,
void PutWithStdioFallback(AdapterStat &stat, const std::string &blob_name,
const std::string &filename, u8 *data, size_t size,
size_t offset) {
hapi::Status status = stat.st_bkid->Put(blob_name, data, size);
hapi::Context ctx;
const char *hermes_write_only = getenv("HERMES_WRITE_ONLY");

if (hermes_write_only && hermes_write_only[0] == '1') {
// Custom DPE for write-only apps like VPIC
ctx.rr_retry = true;
ctx.disable_swap = true;
}

hapi::Status status = stat.st_bkid->Put(blob_name, data, size, ctx);
if (status.Failed()) {
LOG(WARNING) << "Failed to Put Blob " << blob_name << " to Bucket "
<< filename << ". Falling back to stdio." << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/test
)

set(BENCHMARKS mdm_bench dpe_bench)
set(BENCHMARKS mdm_bench dpe_bench vpic_bench)

foreach(benchmark ${BENCHMARKS})
add_executable(${benchmark} ${benchmark}.cc)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/dpe_bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int main(int argc, char **argv) {
case api::PlacementPolicy::kRoundRobin: {
time_point start_tm = now();
result = RoundRobinPlacement(blob_sizes, tgt_state.bytes_available,
output_tmp, targets);
output_tmp, targets, false);
std::cout << "DPE benchmark uses RoundRobin placement.\n\n";
time_point end_tm = now();
dpe_seconds = std::chrono::duration<double>(end_tm - start_tm).count();
Expand Down
Loading