Skip to content
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

Provide full TT and TTG names in dot output #12

Open
wants to merge 1 commit into
base: potrf-composition2
Choose a base branch
from
Open
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
47 changes: 44 additions & 3 deletions ttg/ttg/base/tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace ttg {
int64_t instance_id; //!< Unique ID for object; in after-move state will be -1

std::string name;
std::string full_name;
std::vector<TerminalBase *> inputs;
std::vector<TerminalBase *> outputs;
bool trace_instance = false; //!< If true traces just this instance
Expand Down Expand Up @@ -108,24 +109,26 @@ namespace ttg {
protected:
TTBase(TTBase &&other)
: instance_id(other.instance_id)
, is_ttg_(std::move(other.is_ttg_))
, name(std::move(other.name))
, full_name(std::move(other.name))
, inputs(std::move(other.inputs))
, outputs(std::move(other.outputs)) {
, outputs(std::move(other.outputs))
, is_ttg_(std::move(other.is_ttg_)) {
other.instance_id = -1;
}
TTBase &operator=(TTBase &&other) {
instance_id = other.instance_id;
is_ttg_ = std::move(other.is_ttg_);
name = std::move(other.name);
full_name = std::move(other.full_name);
inputs = std::move(other.inputs);
outputs = std::move(other.outputs);
other.instance_id = -1;
return *this;
}

TTBase(const std::string &name, size_t numins, size_t numouts)
: instance_id(next_instance_id()), is_ttg_(false), name(name), inputs(numins), outputs(numouts) {}
: instance_id(next_instance_id()), name(name), inputs(numins), outputs(numouts), is_ttg_(false) {}

static const std::vector<TerminalBase *> *&outputs_tls_ptr_accessor() {
static thread_local const std::vector<TerminalBase *> *outputs_tls_ptr = nullptr;
Expand Down Expand Up @@ -182,10 +185,48 @@ namespace ttg {
return owning_ttg;
}

const void set_ttg(TTBase& ttg) {
// the full name will be different after this call
this->full_name.clear();
this->owning_ttg = &ttg;
}

bool is_ttg() const {
return is_ttg_;
}

private:

void assemble_full_name(std::stringstream& ss, const TTBase* tt) const {
if (nullptr != tt->ttg_ptr()) {
// prepend the owning ttg's name
assemble_full_name(ss, tt->ttg_ptr());
ss << "::";
}
std::cout << "tt name: " << tt->get_name() << std::endl;
std::string name = tt->get_name();
// remove the ' TTG' substring from the owner
auto pos = name.rfind(" TTG");
if (pos != name.npos) {
name.erase(pos);
}
ss << name;
}

public:

/// returns the full name, including the TTG hierarchy
const std::string& get_full_name() {
if (full_name.empty()) {
// populate the name
std::stringstream ss;
assemble_full_name(ss, this);
full_name = ss.str();
std::cout << "get_full_name " << full_name << std::endl;
}
return full_name;
}

/// Sets the name of this operation
void set_name(const std::string &name) { this->name = name; }

Expand Down
44 changes: 23 additions & 21 deletions ttg/ttg/parsec/ttg.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ namespace ttg_parsec {
parsec_profiling_add_dictionary_keyword("PARSEC_TTG_BCAST_ARG_IMPL", "fill:000000", 0, NULL,
(int*)&parsec_ttg_profile_backend_bcast_arg_start,
(int*)&parsec_ttg_profile_backend_bcast_arg_end);
parsec_profiling_add_dictionary_keyword("PARSEC_TTG_DATACOPY", "fill:000000",
parsec_profiling_add_dictionary_keyword("PARSEC_TTG_DATACOPY", "fill:000000",
sizeof(size_t), "size{int64_t}",
(int*)&parsec_ttg_profile_backend_allocate_datacopy,
(int*)&parsec_ttg_profile_backend_free_datacopy);
Expand Down Expand Up @@ -366,7 +366,7 @@ namespace ttg_parsec {
#endif
}

virtual void profile_on() override {
virtual void profile_on() override {
#if defined(PARSEC_PROF_TRACE)
_task_profiling = true;
#endif
Expand Down Expand Up @@ -405,13 +405,13 @@ namespace ttg_parsec {
void register_new_profiling_event(const char *name, int position) {
if(2*position >= profiling_array_size) {
size_t new_profiling_array_size = 64 * ((2*position + 63)/64 + 1);
profiling_array = (int*)realloc((void*)profiling_array,
profiling_array = (int*)realloc((void*)profiling_array,
new_profiling_array_size * sizeof(int));
memset((void*)&profiling_array[profiling_array_size], 0, sizeof(int)*(new_profiling_array_size - profiling_array_size));
profiling_array_size = new_profiling_array_size;
tpool->profiling_array = profiling_array;
}

assert(0 == tpool->profiling_array[2*position]);
assert(0 == tpool->profiling_array[2*position+1]);
parsec_profiling_add_dictionary_keyword(name, "fill:000000", 0, NULL,
Expand Down Expand Up @@ -459,31 +459,31 @@ namespace ttg_parsec {

typedef void (*parsec_static_op_t)(void *); // static_op will be cast to this type

const parsec_symbol_t parsec_taskclass_param0 = {
const parsec_symbol_t parsec_taskclass_param0 = {
.flags = PARSEC_SYMBOL_IS_STANDALONE|PARSEC_SYMBOL_IS_GLOBAL,
.name = "HASH0",
.context_index = 0,
.min = nullptr,
.max = nullptr,
.expr_inc = nullptr,
.cst_inc = 0 };
const parsec_symbol_t parsec_taskclass_param1 = {
const parsec_symbol_t parsec_taskclass_param1 = {
.flags = PARSEC_SYMBOL_IS_STANDALONE|PARSEC_SYMBOL_IS_GLOBAL,
.name = "HASH1",
.context_index = 1,
.min = nullptr,
.max = nullptr,
.expr_inc = nullptr,
.cst_inc = 0 };
const parsec_symbol_t parsec_taskclass_param2 = {
const parsec_symbol_t parsec_taskclass_param2 = {
.flags = PARSEC_SYMBOL_IS_STANDALONE|PARSEC_SYMBOL_IS_GLOBAL,
.name = "KEY0",
.context_index = 2,
.min = nullptr,
.max = nullptr,
.expr_inc = nullptr,
.cst_inc = 0 };
const parsec_symbol_t parsec_taskclass_param3 = {
const parsec_symbol_t parsec_taskclass_param3 = {
.flags = PARSEC_SYMBOL_IS_STANDALONE|PARSEC_SYMBOL_IS_GLOBAL,
.name = "KEY1",
.context_index = 3,
Expand Down Expand Up @@ -724,9 +724,9 @@ namespace ttg_parsec {
if(ttg::default_execution_context().impl().profiling()) {
copy->size = sizeof(Value);
copy->uid = parsec_atomic_fetch_inc_int64(&parsec_ttg_data_copy_uid);
parsec_profiling_ts_trace_flags(ttg::default_execution_context().impl().parsec_ttg_profile_backend_allocate_datacopy,
static_cast<uint64_t>(copy->uid),
PROFILE_OBJECT_ID_NULL, &copy->size,
parsec_profiling_ts_trace_flags(ttg::default_execution_context().impl().parsec_ttg_profile_backend_allocate_datacopy,
static_cast<uint64_t>(copy->uid),
PROFILE_OBJECT_ID_NULL, &copy->size,
PARSEC_PROFILING_EVENT_COUNTER|PARSEC_PROFILING_EVENT_HAS_INFO);
}
#endif
Expand Down Expand Up @@ -848,9 +848,9 @@ namespace ttg_parsec {
#if defined(PARSEC_PROF_TRACE) && defined(PARSEC_TTG_PROFILE_BACKEND)
// Keep track of additional memory usage
if(ttg::default_execution_context().impl().profiling()) {
parsec_profiling_ts_trace_flags(ttg::default_execution_context().impl().parsec_ttg_profile_backend_free_datacopy,
static_cast<uint64_t>(copy->uid),
PROFILE_OBJECT_ID_NULL, &copy->size,
parsec_profiling_ts_trace_flags(ttg::default_execution_context().impl().parsec_ttg_profile_backend_free_datacopy,
static_cast<uint64_t>(copy->uid),
PROFILE_OBJECT_ID_NULL, &copy->size,
PARSEC_PROFILING_EVENT_COUNTER|PARSEC_PROFILING_EVENT_HAS_INFO);
}
#endif
Expand Down Expand Up @@ -981,7 +981,7 @@ namespace ttg_parsec {
inline void ttg_finalize() {
// We need to notify the current taskpool of termination if we are in user termination detection mode
// or the parsec_context_wait() in destroy_worlds() will never complete
if(0 == ttg::default_execution_context().rank())
if(0 == ttg::default_execution_context().rank())
ttg::default_execution_context().impl().final_task();
ttg::detail::set_default_world(ttg::World{}); // reset the default world
ttg::detail::destroy_worlds<ttg_parsec::WorldImpl>();
Expand Down Expand Up @@ -1639,7 +1639,7 @@ namespace ttg_parsec {
parsec_hash_table_nolock_insert(&tasks_table, &task->tt_ht_item);
if( world_impl.dag_profiling() ) {
#if defined(PARSEC_PROF_GRAPHER)
parsec_prof_grapher_task(&task->parsec_task, world_impl.execution_stream()->th_id, 0,
parsec_prof_grapher_task(&task->parsec_task, world_impl.execution_stream()->th_id, 0,
key_hash(make_key(task->parsec_task.taskpool, task->parsec_task.locals), nullptr));
#endif
}
Expand Down Expand Up @@ -1829,7 +1829,7 @@ namespace ttg_parsec {
if(world.impl().profiling()) {
parsec_profiling_ts_trace(world.impl().parsec_ttg_profile_backend_set_arg_end, 0, 0, NULL);
}
#endif
#endif
return;
}
// the target task is remote. Pack the information and send it to
Expand Down Expand Up @@ -2613,8 +2613,10 @@ namespace ttg_parsec {
if(buffer_size == 0)
return buffer;

task_t *task = (task_t*)t;

if constexpr (ttg::meta::is_void_v<keyT>) {
snprintf(buffer, buffer_size, "%s()[]<%d>", t->task_class->name, t->priority);
snprintf(buffer, buffer_size, "%s()[]<%d>", task->tt->get_full_name().c_str(), t->priority);
} else {
// we use the locals array as a scratchpad to store the hash of the key and its actual address
// locals[0] amd locals[1] hold the hash, while locals[2] and locals[3] hold the key pointer
Expand All @@ -2626,7 +2628,7 @@ namespace ttg_parsec {
std::replace(keystr.begin(), keystr.end(), '(', ':');
std::replace(keystr.begin(), keystr.end(), ')', ':');

snprintf(buffer, buffer_size, "%s(%s)[]<%d>", t->task_class->name, keystr.c_str(), t->priority);
snprintf(buffer, buffer_size, "%s(%s)[]<%d>", task->tt->get_full_name().c_str(), keystr.c_str(), t->priority);
}
return buffer;
}
Expand Down Expand Up @@ -2802,12 +2804,12 @@ namespace ttg_parsec {
std::forward<keymapT>(keymap), std::forward<priomapT>(priomap)) {}

// Destructor checks for unexecuted tasks
virtual ~TT() {
virtual ~TT() {
if(nullptr != self.name ) {
free((void*)self.name);
self.name = nullptr;
}
release();
release();
}

static void ht_iter_cb(void *item, void *cb_data) {
Expand Down
2 changes: 1 addition & 1 deletion ttg/ttg/tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace ttg {

private:
void own_my_tts() const {
for (auto &op : tts) op->owning_ttg = this;
for (auto &op : tts) op->set_ttg(this);
}

};
Expand Down