profiler tic toc in parallel code
ArturSalamatin opened this issue · 1 comments
ArturSalamatin commented
Can I use tic
and toc
methods of amgcl::profiler<> prof
in a parallel_for loop?
Will it give correct values, or it will cause race conditions?
Particularly, I am interested in ppl or tbb
libraries.
Minimal example is something like this:
#include <ppl.h>
concurrency::parallel_for(size_t(0), (size_t)200, [&](size_t sw_face)
{
prof.tic("Name");
calc_func(nt, sw_face); // abstract
prof.toc("Name");
}
, concurrency::auto_partitioner{});
In fact, tic/toc
are to be called inside calc_func
for various internal blocks.
ddemidov commented
No, tic/toc are not thread-safe