Skip to content

Commit

Permalink
Make initial map size configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemartinlogan committed Jun 13, 2023
1 parent 93e626a commit c03a412
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 9 deletions.
10 changes: 9 additions & 1 deletion config/hermes_server_default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,15 @@ prefetch:
epoch_ms: 50
is_mpi: false

# The shared memory prefix for the hermes shared memory segment. A user name
### Define mdm properties
mdm:
# This represents the number of blobs and buckets before collisions start
# to happen in the unordered_map tables.
est_blob_count: 100000
est_bucket_count: 100000
est_num_traits: 256

# The shared memory prefix for the hermes shared memory segment. A username
# will be automatically appended.
shmem_name: "/hermes_shm_"

Expand Down
12 changes: 11 additions & 1 deletion src/config_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ void ServerConfig::ParseTraitInfo(YAML::Node yaml_conf) {
}
}

/** parse prefetch information from YAML config */
void ServerConfig::ParseMdmInfo(YAML::Node yaml_conf) {
mdm_.num_blobs_ = yaml_conf["est_blob_count"].as<size_t>();
mdm_.num_bkts_ = yaml_conf["est_blob_count"].as<size_t>();
mdm_.num_traits_ = yaml_conf["est_num_traits"].as<size_t>();
}

/** parse the YAML node */
void ServerConfig::ParseYAML(YAML::Node &yaml_conf) {
if (yaml_conf["devices"]) {
Expand All @@ -182,11 +189,14 @@ void ServerConfig::ParseYAML(YAML::Node &yaml_conf) {
ParseBorgInfo(yaml_conf["buffer_organizer"]);
}
if (yaml_conf["tracing"]) {
ParsePrefetchInfo(yaml_conf["tracing"]);
ParseTracingInfo(yaml_conf["tracing"]);
}
if (yaml_conf["prefetch"]) {
ParsePrefetchInfo(yaml_conf["prefetch"]);
}
if (yaml_conf["mdm"]) {
ParseMdmInfo(yaml_conf["mdm"]);
}
if (yaml_conf["system_view_state_update_interval_ms"]) {
system_view_state_update_interval_ms =
yaml_conf["system_view_state_update_interval_ms"].as<int>();
Expand Down
16 changes: 16 additions & 0 deletions src/config_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ struct TracingInfo {
std::string output_;
};

/** MDM information */
struct MdmInfo {
/** Number of buckets in mdm bucket map before collisions */
size_t num_bkts_;

/** Number of blobs in mdm blob map before collisions */
size_t num_blobs_;

/** Number of traits in mdm trait map before collisions */
size_t num_traits_;
};

/**
* System configuration for Hermes
*/
Expand All @@ -270,6 +282,9 @@ class ServerConfig : public BaseConfig {
/** Prefetcher information */
PrefetchInfo prefetcher_;

/** Metadata Manager information */
MdmInfo mdm_;

/** Trait repo information */
std::vector<std::string> trait_paths_;

Expand Down Expand Up @@ -298,6 +313,7 @@ class ServerConfig : public BaseConfig {
void ParsePrefetchInfo(YAML::Node yaml_conf);
void ParseTracingInfo(YAML::Node yaml_conf);
void ParseTraitInfo(YAML::Node yaml_conf);
void ParseMdmInfo(YAML::Node yaml_conf);
};

} // namespace hermes::config
Expand Down
10 changes: 9 additions & 1 deletion src/config_server_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,15 @@ const char* kServerDefaultConfigStr =
" epoch_ms: 50\n"
" is_mpi: false\n"
"\n"
"# The shared memory prefix for the hermes shared memory segment. A user name\n"
"### Define mdm properties\n"
"mdm:\n"
" # This represents the number of blobs and buckets before collisions start\n"
" # to happen in the unordered_map tables.\n"
" est_blob_count: 100000\n"
" est_bucket_count: 100000\n"
" est_num_traits: 256\n"
"\n"
"# The shared memory prefix for the hermes shared memory segment. A username\n"
"# will be automatically appended.\n"
"shmem_name: \"/hermes_shm_\"\n"
"\n"
Expand Down
12 changes: 6 additions & 6 deletions src/metadata_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ void MetadataManager::shm_init(hipc::ShmArchive<MetadataManagerShm> &header,
header_->node_id_ = rpc_->node_id_;

// Create the metadata maps
HSHM_MAKE_AR(header_->blob_id_map_, alloc, 32000000)
HSHM_MAKE_AR(header_->blob_map_, alloc, 32000000)
HSHM_MAKE_AR(header_->tag_id_map_, alloc, 32000000)
HSHM_MAKE_AR(header_->tag_map_, alloc, 32000000)
HSHM_MAKE_AR(header_->trait_id_map_, alloc, 256)
HSHM_MAKE_AR(header_->trait_map_, alloc, 256)
HSHM_MAKE_AR(header_->blob_id_map_, alloc, config->mdm_.num_blobs_)
HSHM_MAKE_AR(header_->blob_map_, alloc, config->mdm_.num_blobs_)
HSHM_MAKE_AR(header_->tag_id_map_, alloc, config->mdm_.num_bkts_)
HSHM_MAKE_AR(header_->tag_map_, alloc, config->mdm_.num_bkts_)
HSHM_MAKE_AR(header_->trait_id_map_, alloc, config->mdm_.num_traits_)
HSHM_MAKE_AR(header_->trait_map_, alloc, config->mdm_.num_traits_)

// Create the DeviceInfo vector
HSHM_MAKE_AR(header_->devices_, alloc, *config->devices_)
Expand Down

0 comments on commit c03a412

Please sign in to comment.