Skip to content

Commit

Permalink
check in
Browse files Browse the repository at this point in the history
  • Loading branch information
eqy committed Aug 31, 2024
1 parent 76f2334 commit 01c9522
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libkineto/include/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,4 +502,8 @@ class Config : public AbstractConfig {

constexpr char kUseDaemonEnvVar[] = "KINETO_USE_DAEMON";

#if __linux__
extern int kUseDaemonEnvVarSet;
#endif

} // namespace libkineto
4 changes: 3 additions & 1 deletion libkineto/src/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "Config.h"

#include <assert.h>
#include <stdlib.h>

#include <fmt/chrono.h>
Expand Down Expand Up @@ -243,7 +244,8 @@ Config::Config()
factories->addFeatureConfigs(*this);
}
#if __linux__
enableIpcFabric_ = (getenv(kUseDaemonEnvVar) != nullptr);
assert(libkineto::kUseDaemonEnvVarSet >= 0);
enableIpcFabric_ = libkineto::kUseDaemonEnvVarSet;
#endif
}

Expand Down
8 changes: 7 additions & 1 deletion libkineto/src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include "Logger.h"

namespace KINETO_NAMESPACE {
#if __linux__
int kUseDaemonEnvVarSet = -1;
#endif


#if __linux__ || defined(HAS_CUPTI)
static bool initialized = false;
Expand Down Expand Up @@ -131,7 +135,9 @@ void libkineto_init(bool cpuOnly, bool logOnError) {

// Factory to connect to open source daemon if present
#if __linux__
if (getenv(kUseDaemonEnvVar) != nullptr) {
void *ptr = getenv(kUseDaemonEnvVar);
libkineto::kUseDaemonEnvVarSet = ptr != nullptr;
if (libkineto::kUseDaemonEnvVarSet) {
LOG(INFO) << "Registering daemon config loader, cpuOnly = "
<< cpuOnly;
DaemonConfigLoader::registerFactory();
Expand Down

0 comments on commit 01c9522

Please sign in to comment.