unify env variables and use DPRINTF (#89)

* unify handling of env variables

create a class containing all (most?) environment variables used by rocshmem and an object that is instatiated
before library_init, since some of the environment variables need to be
set before we start the bootstraping process.

This allows us to remove two files from the bootstrap directory.

* replace INFO and TRACE macros with DPRINTF

to be more consistent with the rest of the rocSHMEM code
这个提交包含在:
Edgar Gabriel
2025-04-29 06:05:25 -05:00
提交者 GitHub
父节点 c81722c339
当前提交 db74307195
修改 12 个文件,包含 113 行新增227 行删除
+4 -4
查看文件
@@ -34,7 +34,7 @@
#include <iostream>
#include "utils.hpp"
#include "env.hpp"
#include "../util.hpp"
constexpr char HOSTID_FILE[32] = "/proc/sys/kernel/random/boot_id";
@@ -101,7 +101,7 @@ uint64_t computeHostHash(void) {
std::string hostName = getHostName(hashLen, '\0');
strncpy(hostHash, hostName.c_str(), hostName.size());
std::string hostid = env()->hostid;
std::string hostid = rocshmem_env_.get_bootstrap_hostid();
if (hostid != "") {
strncpy(hostHash, hostid.c_str(), hashLen);
} else if (hostName.size() < hashLen) {
@@ -113,7 +113,7 @@ uint64_t computeHostHash(void) {
// Make sure the string is terminated
hostHash[sizeof(hostHash) - 1] = '\0';
TRACE("unique hostname '%s'", hostHash);
DPRINTF("unique hostname '%s'", hostHash);
return getHash(hostHash, strlen(hostHash));
}
@@ -141,7 +141,7 @@ uint64_t computePidHash(void) {
if (len < 0) len = 0;
pname[plen + len] = '\0';
TRACE("unique PID '%s'", pname);
DPRINTF("unique PID '%s'", pname);
return getHash(pname, strlen(pname));
}