Skip to content

Commit

Permalink
#2387: trace: add proxy member to theTrace() (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Jan 20, 2025
1 parent 7ee3b85 commit bef9f41
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
15 changes: 14 additions & 1 deletion src/vt/trace/trace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ void Trace::finalize() /*override*/ {
between_sched_event_ = TraceProcessingTag{};
}

void Trace::setProxy(objgroup::proxy::Proxy<Trace> in_proxy) {
proxy_ = in_proxy;
}

/*static*/ std::unique_ptr<Trace> Trace::construct() {
auto ptr = std::make_unique<Trace>();
auto proxy = theObjGroup()->makeCollective<Trace>(
ptr.get(), "Trace"
);
proxy.get()->setProxy(proxy);
return ptr;
}

void Trace::loadAndBroadcastSpec() {
using namespace ::vt::utils::file_spec;

Expand Down Expand Up @@ -199,7 +212,7 @@ void Trace::addUserData(int32_t data) {

void Trace::gatherUserEvents() {
vt::runInEpochCollective([&]{
proxy.reduce<vt::collective::PlusOp>(0, std::move(user_event_));
proxy_.reduce<vt::collective::PlusOp>(0, std::move(user_event_));
});
}

Expand Down
11 changes: 9 additions & 2 deletions src/vt/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
void startup() override;
void finalize() override;

void setProxy(objgroup::proxy::Proxy<Trace> in_proxy);
static std::unique_ptr<Trace> construct();

/**
* \brief Initiate a paired processing event.
*
Expand Down Expand Up @@ -290,7 +293,7 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
/**
* \brief Gathers all user-defined event hashes onto node 0.
*/
void gatherUserEvents() override;
void gatherUserEvents();

/**
* \brief Log a memory usage event
Expand Down Expand Up @@ -387,6 +390,7 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {
| wrote_sts_file_
| trace_write_count_
| spec_proxy_
| proxy_
| trace_enabled_cur_phase_
| flush_event_
| between_sched_event_type_
Expand All @@ -407,7 +411,10 @@ struct Trace : runtime::component::Component<Trace>, TraceLite {

ObjGroupProxyType spec_proxy_ = vt::no_obj_group;


/*
* Objgroup proxy
*/
objgroup::proxy::Proxy<Trace> proxy_;

// Processing event between top-level loops.
TraceEntryIDType between_sched_event_type_ = no_trace_entry_id;
Expand Down
5 changes: 0 additions & 5 deletions src/vt/trace/trace_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ struct TraceLite {

virtual ~TraceLite();

/**
* \brief Gathers all user-defined event hashes onto node 0.
*/
virtual void gatherUserEvents();

/**
* \brief Set zlib incremental flush mode for trace file.
*
Expand Down

0 comments on commit bef9f41

Please sign in to comment.