Fix paje trace with MPI and TaskManager

This commit is contained in:
Matthias Hochsteger 2020-08-10 12:20:17 +02:00
parent 87c2901e32
commit 72447a51d5

View File

@ -422,6 +422,8 @@ namespace ngcore
NgMPI_Comm comm(MPI_COMM_WORLD);
auto rank = comm.Rank();
auto nranks = comm.Size();
if(nranks>1)
{
nthreads = nranks;
thread_aliases.reserve(nthreads);
@ -446,8 +448,10 @@ namespace ngcore
}
thread_aliases.emplace_back( paje.CreateContainer( container_type_thread, container_nodes[host_map[name]], "Rank " + ToString(i) ) );
}
#else // PARALLEL
}
else
#endif // PARALLEL
{
container_nodes.reserve(num_nodes);
for(int i=0; i<num_nodes; i++)
container_nodes.emplace_back( paje.CreateContainer( container_type_node, container_task_manager, "Node " + ToString(i)) );
@ -459,7 +463,7 @@ namespace ngcore
auto name = "Thread " + ToString(i);
thread_aliases.emplace_back( paje.CreateContainer( container_type_thread, container_nodes[i*num_nodes/nthreads], name ) );
}
#endif // PARALLEL
}
std::map<const std::type_info *, int> job_map;
std::map<const std::type_info *, int> job_task_map;
@ -496,6 +500,8 @@ namespace ngcore
timer_names[id] = NgProfiler::GetName(id);
#ifdef PARALLEL
if(nranks>1)
{
for(auto src : IntRange(0, nranks))
{
if(src==MPI_PAJE_WRITER)
@ -514,6 +520,7 @@ namespace ngcore
timer_names[id] = name;
}
}
}
#endif // PARALLEL
for(auto id : timer_ids)
@ -583,6 +590,8 @@ namespace ngcore
}
#ifdef PARALLEL
if(nranks>1)
{
for(auto & event : timer_events)
{
if(event.is_start)
@ -621,6 +630,7 @@ namespace ngcore
paje.PopState( event.time, state_type_timer, thread_aliases[src] );
}
}
}
#endif // PARALLEL
// Merge link event
@ -818,7 +828,7 @@ namespace ngcore
std::sort (events.begin(), events.end());
root.time = 1000.0*static_cast<double>(stop_time-start_time) * seconds_per_tick;
root.time = 1000.0*static_cast<double>(stop_time) * seconds_per_tick;
for(auto & event : events)
{