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
这个提交包含在:
+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));
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户