Skip to content

Commit

Permalink
Ensure get_profiler_artifacts_dir respects TT_METAL_HOME by default.
Browse files Browse the repository at this point in the history
Fixes #17939.
  • Loading branch information
jasondavies authored and mo-tenstorrent committed Feb 18, 2025
1 parent b904dcf commit 4a15351
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tt_metal/api/tt-metalium/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ constexpr std::string_view PROFILER_RUNTIME_ROOT_DIR = "generated/profiler/";
constexpr std::string_view PROFILER_LOGS_DIR_NAME = ".logs/";

inline std::string get_profiler_artifacts_dir() {
std::string artifactDir = string(PROFILER_RUNTIME_ROOT_DIR);
const auto PROFILER_ARTIFACTS_DIR = std::getenv("TT_METAL_PROFILER_DIR");
if (PROFILER_ARTIFACTS_DIR != nullptr) {
artifactDir = string(PROFILER_ARTIFACTS_DIR) + "/";
string artifactDir;
if (std::getenv("TT_METAL_PROFILER_DIR")) {
artifactDir = std::getenv("TT_METAL_PROFILER_DIR");
} else {
string prefix;
if (std::getenv("TT_METAL_HOME")) {
prefix = std::getenv("TT_METAL_HOME");
} else {
prefix = "./";
}
if (prefix.back() != '/') {
prefix += "/";
}
artifactDir = prefix + string(PROFILER_RUNTIME_ROOT_DIR);
}
if (artifactDir.back() != '/') {
artifactDir += "/";
}
return artifactDir;
}
Expand Down

0 comments on commit 4a15351

Please sign in to comment.