Unified setup_environ b/t libomni and libomni-dl (#86)
- omnitrace::common::setup_environ provides a standardized exporting of relevant env variables
Este commit está contenido en:
1 padre
7745c12417
commit
a2dcc7381b
10 files changed
+257
-142
No files matched your search
@@ -21,6 +21,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "library.hpp"
|
||||
#include "common/setup.hpp"
|
||||
#include "library/api.hpp"
|
||||
#include "library/components/fork_gotcha.hpp"
|
||||
#include "library/components/functors.hpp"
|
||||
@@ -84,38 +85,16 @@ ensure_finalization(bool _static_init = false)
|
||||
else
|
||||
{
|
||||
OMNITRACE_BASIC_DEBUG_F("\n");
|
||||
// This environment variable forces the ROCR-Runtime to use polling to wait
|
||||
// for signals rather than interrupts. We set this variable to avoid issues with
|
||||
// rocm/roctracer hanging when interrupted by the sampler
|
||||
//
|
||||
// see:
|
||||
// https://github.com/ROCm-Developer-Tools/roctracer/issues/22#issuecomment-572814465
|
||||
tim::set_env("HSA_ENABLE_INTERRUPT", "0", 0);
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0
|
||||
tim::set_env("HSA_TOOLS_LIB", "libomnitrace.so", 0);
|
||||
#endif
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0
|
||||
auto _default_rocm_path =
|
||||
JOIN("", "/opt/rocm-", OMNITRACE_HIP_VERSION_MAJOR, '.',
|
||||
OMNITRACE_HIP_VERSION_MINOR, '.', OMNITRACE_HIP_VERSION_PATCH);
|
||||
auto _rocm_path = tim::get_env("OMNITRACE_ROCM_PATH",
|
||||
tim::get_env("ROCM_PATH", _default_rocm_path));
|
||||
auto _rocp_metrics = JOIN('/', _rocm_path, "rocprofiler/lib/metrics.xml");
|
||||
tim::set_env("HSA_TOOLS_LIB", "libomnitrace.so", 0);
|
||||
tim::set_env("ROCP_TOOL_LIB", "libomnitrace.so", 0);
|
||||
tim::set_env("ROCPROFILER_LOG", "1", 0);
|
||||
tim::set_env("ROCP_HSA_INTERCEPT", "1", 0);
|
||||
tim::set_env("ROCP_METRICS", _rocp_metrics, 0);
|
||||
tim::set_env("HSA_TOOLS_REPORT_LOAD_FAILURE", "1", 0);
|
||||
if(getenv("ROCM_PATH"))
|
||||
{
|
||||
tim::set_env("OMNITRACE_ROCPROFILER_LIBRARY",
|
||||
JOIN('/', tim::get_env<std::string>("ROCM_PATH"),
|
||||
"rocprofiler/lib/librocprofiler64.so"),
|
||||
0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
auto _verbose = get_verbose_env() + ((get_debug_env() || get_debug_init()) ? 16 : 0);
|
||||
auto _search_paths = JOIN(':', tim::get_env<std::string>("OMNITRACE_PATH", ""),
|
||||
tim::get_env<std::string>("PWD"), ".",
|
||||
tim::get_env<std::string>("LD_LIBRARY_PATH", ""),
|
||||
tim::get_env<std::string>("LIBRARY_PATH", ""),
|
||||
tim::get_env<std::string>("PATH", ""));
|
||||
common::setup_environ(_verbose, _search_paths);
|
||||
|
||||
return scope::destructor{ []() { omnitrace_finalize_hidden(); } };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user