Skip to content

Commit

Permalink
export libomnitrace-dl.so to OMP_TOOL_LIBRARIES (#27)
Browse files Browse the repository at this point in the history
* export libomnitrace-dl.so to OMP_TOOL_LIBRARIES

* Disable ompt_context_t

- ompt.cpp enables/disables context
- Update timemory submodule :: handles disabled context
  • Loading branch information
jrmadsen authored Jun 10, 2022
1 parent 017e794 commit d4b8e25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion external/timemory
9 changes: 9 additions & 0 deletions source/lib/omnitrace-dl/dl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ struct OMNITRACE_HIDDEN_API indirect
#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0
auto _omni_hsa_lib = m_omnilib;
setenv("HSA_TOOLS_LIB", _omni_hsa_lib.c_str(), 0);
#endif
#if OMNITRACE_USE_OMPT > 0
if(get_env("OMNITRACE_USE_OMPT", true))
{
std::string _omni_omp_libs = find_path("libomnitrace-dl.so");
const char* _omp_libs = getenv("OMP_TOOL_LIBRARIES");
if(_omp_libs) _omni_omp_libs = common::join(':', _omni_omp_libs, _omp_libs);
setenv("OMP_TOOL_LIBRARIES", _omni_omp_libs.c_str(), 1);
}
#endif
m_omnihandle = open(m_omnilib);
m_userhandle = open(m_userlib);
Expand Down
6 changes: 5 additions & 1 deletion source/lib/omnitrace/library/ompt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ namespace ompt
namespace
{
std::unique_ptr<ompt_bundle_t> f_bundle = {};
bool _init_toolset_off = (trait::runtime_enabled<ompt_toolset_t>::set(false), true);
bool _init_toolset_off = (trait::runtime_enabled<ompt_toolset_t>::set(false),
trait::runtime_enabled<ompt_context_t>::set(false), true);
} // namespace

void
setup()
{
trait::runtime_enabled<ompt_toolset_t>::set(true);
trait::runtime_enabled<ompt_context_t>::set(true);
comp::user_ompt_bundle::global_init();
comp::user_ompt_bundle::reset();
tim::auto_lock_t lk{ tim::type_mutex<ompt_handle_t>() };
Expand All @@ -77,6 +79,8 @@ shutdown()
f_bundle->stop();
ompt_context_t::cleanup();
trait::runtime_enabled<ompt_toolset_t>::set(false);
trait::runtime_enabled<ompt_context_t>::set(false);
comp::user_ompt_bundle::reset();
}
f_bundle.reset();
}
Expand Down

0 comments on commit d4b8e25

Please sign in to comment.