Skip to content

Commit 45522e4

Browse files
Merge pull request #546 from lukemartinlogan/master
Add additional configuration to mdm
2 parents 7cd0fe7 + c03a412 commit 45522e4

8 files changed

Lines changed: 65 additions & 20 deletions

File tree

adapter/real_api.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ struct RealApiIter {
3434
};
3535

3636
struct RealApi {
37-
void *real_lib_next_; /**< TODO(llogan): remove */
38-
void *real_lib_default_; /**< TODO(llogan): remove */
3937
void *real_lib_;
4038
bool is_intercepted_;
4139

@@ -45,25 +43,27 @@ struct RealApi {
4543
auto exists = dlsym(lib, iter->symbol_name_);
4644
void *is_intercepted =
4745
(void*)dlsym(lib, iter->is_intercepted_);
48-
if (!is_intercepted && exists) {
46+
if (!is_intercepted && exists && !iter->lib_path_) {
4947
iter->lib_path_ = info->dlpi_name;
5048
}
5149
return 0;
5250
}
5351

5452
RealApi(const char *symbol_name,
55-
const char *is_intercepted)
56-
: real_lib_next_(nullptr), real_lib_default_(nullptr) {
53+
const char *is_intercepted) {
5754
RealApiIter iter(symbol_name, is_intercepted);
5855
dl_iterate_phdr(callback, (void*)&iter);
5956
if (iter.lib_path_) {
6057
real_lib_ = dlopen(iter.lib_path_, RTLD_GLOBAL | RTLD_NOW);
61-
real_lib_next_ = real_lib_;
62-
real_lib_default_ = real_lib_;
6358
}
6459
void *is_intercepted_ptr = (void*)dlsym(RTLD_DEFAULT,
6560
is_intercepted);
6661
is_intercepted_ = is_intercepted_ptr != nullptr;
62+
/* if (is_intercepted_) {
63+
real_lib_ = RTLD_NEXT;
64+
} else {
65+
real_lib_ = RTLD_DEFAULT;
66+
}*/
6767
}
6868
};
6969

ci/hermes/packages/hermes/package.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Hermes(CMakePackage):
99
version('dev-priv', git='https://github.com/lukemartinlogan/hermes.git', branch='dev')
1010
variant('vfd', default=False, description='Enable HDF5 VFD')
1111
variant('ares', default=False, description='Enable full libfabric install')
12+
variant('debug', default=False, description='Enable debug mode')
1213
depends_on('mochi-thallium~cereal@0.8.3')
1314
depends_on('cereal')
1415
depends_on('catch2@3.0.1')
@@ -26,19 +27,21 @@ def cmake_args(self):
2627
'-DHERMES_RPC_THALLIUM=ON',
2728
'-DHERMES_INSTALL_TESTS=ON',
2829
'-DBUILD_TESTING=ON']
30+
if '+debug' in self.spec:
31+
args.append('-DCMAKE_BUILD_TYPE=Debug')
2932
if '+vfd' in self.spec:
3033
args.append(self.define('HERMES_ENABLE_VFD', 'ON'))
3134
return args
3235

3336
def set_include(self, env, path):
3437
env.append_flags('CFLAGS', '-I{}'.format(path))
3538
env.append_flags('CXXFLAGS', '-I{}'.format(path))
36-
env.append_flags('CPATH', '{}'.format(path))
37-
env.append_flags('CMAKE_PREFIX_PATH', '-I{}'.format(path))
39+
env.prepend_path('CPATH', '{}'.format(path))
40+
env.prepend_path('CMAKE_PREFIX_PATH', '{}'.format(path))
3841

3942
def set_lib(self, env, path):
4043
env.prepend_path('LD_LIBRARY_PATH', path)
41-
env.append_flags('LIBRARY_PATH', '{}'.format(path))
44+
env.prepend_path('LIBRARY_PATH', '{}'.format(path))
4245
env.append_flags('LDFLAGS', '-L{}'.format(path))
4346

4447
def set_flags(self, env):

config/hermes_server_default.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,15 @@ prefetch:
153153
epoch_ms: 50
154154
is_mpi: false
155155

156-
# The shared memory prefix for the hermes shared memory segment. A user name
156+
### Define mdm properties
157+
mdm:
158+
# This represents the number of blobs and buckets before collisions start
159+
# to happen in the unordered_map tables.
160+
est_blob_count: 100000
161+
est_bucket_count: 100000
162+
est_num_traits: 256
163+
164+
# The shared memory prefix for the hermes shared memory segment. A username
157165
# will be automatically appended.
158166
shmem_name: "/hermes_shm_"
159167

src/api/hermes.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void Hermes::LoadClientConfig(std::string config_path) {
104104
if (config_path.empty()) {
105105
config_path = GetEnvSafe(kHermesClientConf);
106106
}
107-
// HILOG(kInfo, "Loading client configuration: {}", config_path)
107+
HILOG(kDebug, "Loading client configuration: {}", config_path)
108108
client_config_.LoadFromFile(config_path);
109109
}
110110

src/config_server.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ void ServerConfig::ParseTraitInfo(YAML::Node yaml_conf) {
167167
}
168168
}
169169

170+
/** parse prefetch information from YAML config */
171+
void ServerConfig::ParseMdmInfo(YAML::Node yaml_conf) {
172+
mdm_.num_blobs_ = yaml_conf["est_blob_count"].as<size_t>();
173+
mdm_.num_bkts_ = yaml_conf["est_blob_count"].as<size_t>();
174+
mdm_.num_traits_ = yaml_conf["est_num_traits"].as<size_t>();
175+
}
176+
170177
/** parse the YAML node */
171178
void ServerConfig::ParseYAML(YAML::Node &yaml_conf) {
172179
if (yaml_conf["devices"]) {
@@ -182,11 +189,14 @@ void ServerConfig::ParseYAML(YAML::Node &yaml_conf) {
182189
ParseBorgInfo(yaml_conf["buffer_organizer"]);
183190
}
184191
if (yaml_conf["tracing"]) {
185-
ParsePrefetchInfo(yaml_conf["tracing"]);
192+
ParseTracingInfo(yaml_conf["tracing"]);
186193
}
187194
if (yaml_conf["prefetch"]) {
188195
ParsePrefetchInfo(yaml_conf["prefetch"]);
189196
}
197+
if (yaml_conf["mdm"]) {
198+
ParseMdmInfo(yaml_conf["mdm"]);
199+
}
190200
if (yaml_conf["system_view_state_update_interval_ms"]) {
191201
system_view_state_update_interval_ms =
192202
yaml_conf["system_view_state_update_interval_ms"].as<int>();

src/config_server.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,18 @@ struct TracingInfo {
247247
std::string output_;
248248
};
249249

250+
/** MDM information */
251+
struct MdmInfo {
252+
/** Number of buckets in mdm bucket map before collisions */
253+
size_t num_bkts_;
254+
255+
/** Number of blobs in mdm blob map before collisions */
256+
size_t num_blobs_;
257+
258+
/** Number of traits in mdm trait map before collisions */
259+
size_t num_traits_;
260+
};
261+
250262
/**
251263
* System configuration for Hermes
252264
*/
@@ -270,6 +282,9 @@ class ServerConfig : public BaseConfig {
270282
/** Prefetcher information */
271283
PrefetchInfo prefetcher_;
272284

285+
/** Metadata Manager information */
286+
MdmInfo mdm_;
287+
273288
/** Trait repo information */
274289
std::vector<std::string> trait_paths_;
275290

@@ -298,6 +313,7 @@ class ServerConfig : public BaseConfig {
298313
void ParsePrefetchInfo(YAML::Node yaml_conf);
299314
void ParseTracingInfo(YAML::Node yaml_conf);
300315
void ParseTraitInfo(YAML::Node yaml_conf);
316+
void ParseMdmInfo(YAML::Node yaml_conf);
301317
};
302318

303319
} // namespace hermes::config

src/config_server_default.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,15 @@ const char* kServerDefaultConfigStr =
156156
" epoch_ms: 50\n"
157157
" is_mpi: false\n"
158158
"\n"
159-
"# The shared memory prefix for the hermes shared memory segment. A user name\n"
159+
"### Define mdm properties\n"
160+
"mdm:\n"
161+
" # This represents the number of blobs and buckets before collisions start\n"
162+
" # to happen in the unordered_map tables.\n"
163+
" est_blob_count: 100000\n"
164+
" est_bucket_count: 100000\n"
165+
" est_num_traits: 256\n"
166+
"\n"
167+
"# The shared memory prefix for the hermes shared memory segment. A username\n"
160168
"# will be automatically appended.\n"
161169
"shmem_name: \"/hermes_shm_\"\n"
162170
"\n"

src/metadata_manager.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ void MetadataManager::shm_init(hipc::ShmArchive<MetadataManagerShm> &header,
3535
header_->node_id_ = rpc_->node_id_;
3636

3737
// Create the metadata maps
38-
HSHM_MAKE_AR(header_->blob_id_map_, alloc, 32000000)
39-
HSHM_MAKE_AR(header_->blob_map_, alloc, 32000000)
40-
HSHM_MAKE_AR(header_->tag_id_map_, alloc, 32000000)
41-
HSHM_MAKE_AR(header_->tag_map_, alloc, 32000000)
42-
HSHM_MAKE_AR(header_->trait_id_map_, alloc, 256)
43-
HSHM_MAKE_AR(header_->trait_map_, alloc, 256)
38+
HSHM_MAKE_AR(header_->blob_id_map_, alloc, config->mdm_.num_blobs_)
39+
HSHM_MAKE_AR(header_->blob_map_, alloc, config->mdm_.num_blobs_)
40+
HSHM_MAKE_AR(header_->tag_id_map_, alloc, config->mdm_.num_bkts_)
41+
HSHM_MAKE_AR(header_->tag_map_, alloc, config->mdm_.num_bkts_)
42+
HSHM_MAKE_AR(header_->trait_id_map_, alloc, config->mdm_.num_traits_)
43+
HSHM_MAKE_AR(header_->trait_map_, alloc, config->mdm_.num_traits_)
4444

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

0 commit comments

Comments
 (0)