Skip to content

Workflow, submodules, and thread info Updates #352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
conda activate omnitrace-docs
./update-docs.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: ./docs

Expand All @@ -67,4 +67,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion examples/lulesh/external/kokkos
Submodule kokkos updated 695 files
8 changes: 4 additions & 4 deletions source/bin/omnitrace-sample/impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
parser.add_argument({ "--profile-format" }, "Data formats for profiling results")
.min_count(1)
.max_count(3)
.requires({ "profile|flat-profile" })
.required({ "profile|flat-profile" })
.choices({ "text", "json", "console" })
.action([&](parser_t& p) {
auto _v = p.get<std::set<std::string>>("profile");
Expand Down Expand Up @@ -624,7 +624,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
.add_argument({ "--cpus" },
"CPU IDs for frequency sampling. Supports integers and/or ranges")
.dtype("int or range")
.requires({ "host" })
.required({ "host" })
.action([&](parser_t& p) {
update_env(
_env, "OMNITRACE_SAMPLING_CPUS",
Expand All @@ -634,7 +634,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)
.add_argument({ "--gpus" },
"GPU IDs for SMI queries. Supports integers and/or ranges")
.dtype("int or range")
.requires({ "device" })
.required({ "device" })
.action([&](parser_t& p) {
update_env(
_env, "OMNITRACE_SAMPLING_GPUS",
Expand Down Expand Up @@ -709,7 +709,7 @@ parse_args(int argc, char** argv, std::vector<char*>& _env)

parser.add_argument({ "--realtime" }, _realtime_desc)
.min_count(0)
.requires(std::move(_realtime_reqs))
.required(std::move(_realtime_reqs))
.action([&](parser_t& p) {
auto _v = p.get<std::deque<std::string>>("realtime");
update_env(_env, "OMNITRACE_SAMPLING_REALTIME", true);
Expand Down
8 changes: 4 additions & 4 deletions source/lib/core/argparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
.min_count(1)
.max_count(3)
.dtype("string")
.requires({ "profile|flat-profile" })
.required({ "profile|flat-profile" })
.choices({ "text", "json", "console" })
.action([&](parser_t& p) {
auto _v = p.get<strset_t>("profile-format");
Expand Down Expand Up @@ -976,7 +976,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
{ "--cpus" },
"CPU IDs for frequency sampling. Supports integers and/or ranges")
.dtype("int and/or range")
.requires({ "host" })
.required({ "host" })
.action([&](parser_t& p) {
update_env(_data, "OMNITRACE_SAMPLING_CPUS",
join(array_config_t{ "," }, p.get<strvec_t>("cpus")));
Expand All @@ -992,7 +992,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
.add_argument({ "--gpus" },
"GPU IDs for SMI queries. Supports integers and/or ranges")
.dtype("int and/or range")
.requires({ "device" })
.required({ "device" })
.action([&](parser_t& p) {
update_env(_data, "OMNITRACE_SAMPLING_GPUS",
join(array_config_t{ "," }, p.get<strvec_t>("gpus")));
Expand Down Expand Up @@ -1117,7 +1117,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
_parser.add_argument({ "--sample-realtime" }, _realtime_desc)
.min_count(0)
.dtype("[freq] [delay] [tids...]")
.requires(std::move(_realtime_reqs))
.required(std::move(_realtime_reqs))
.action([&](parser_t& p) {
auto _v = p.get<std::deque<std::string>>("sample-realtime");
update_env(_data, "OMNITRACE_SAMPLING_REALTIME", true);
Expand Down
14 changes: 11 additions & 3 deletions source/lib/omnitrace/library/thread_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <timemory/components/timing/backends.hpp>
#include <timemory/process/threading.hpp>

#include <cstdint>

namespace omnitrace
{
namespace
Expand Down Expand Up @@ -105,8 +107,9 @@ init_index_data(int64_t _tid, bool _offset = false)
return itr;
}

const auto unknown_thread = std::optional<thread_info>{};
int64_t peak_num_threads = max_supported_threads;
thread_local int64_t offset_causal_count = 0;
const auto unknown_thread = std::optional<thread_info>{};
int64_t peak_num_threads = max_supported_threads;
} // namespace

std::string
Expand Down Expand Up @@ -187,8 +190,13 @@ thread_info::init(bool _offset)
_info = thread_info{};
_info->is_offset = threading::offset_this_id();
_info->index_data = init_index_data(_tid, _info->is_offset);
_info->causal_count = &causal::delay::get_local();
_info->lifetime.first = tim::get_clock_real_now<uint64_t, std::nano>();

const auto _sequent_tid = _info->index_data->sequent_value;
_info->causal_count = (!_info->is_offset && _sequent_tid < peak_num_threads)
? &causal::delay::get_local(_sequent_tid)
: &offset_causal_count;

if(_info->is_offset) set_thread_state(ThreadState::Disabled);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ target_compile_definitions(thread-limit PRIVATE MAX_THREADS=${OMNITRACE_MAX_THRE
target_link_libraries(thread-limit PRIVATE Threads::Threads tests-compile-options)

set(_thread_limit_environment
"${_base_environment}" "OMNITRACE_USE_PERFETTO=ON" "OMNITRACE_USE_TIMEMORY=ON"
"${_base_environment}" "OMNITRACE_TRACE=ON" "OMNITRACE_PROFILE=ON"
"OMNITRACE_COUT_OUTPUT=ON" "OMNITRACE_USE_SAMPLING=ON" "OMNITRACE_SAMPLING_FREQ=250"
"OMNITRACE_VERBOSE=2" "OMNITRACE_TIMEMORY_COMPONENTS=wall_clock,peak_rss,page_rss")

Expand Down
Loading