Created
June 25, 2021 15:59
-
-
Save shahrzad/b81e1eb252880aca48528d2de0bd1d10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void measure_for_loop(uint64_t count, bool csv, | |
uint64_t chunk_size, uint64_t iter_length) | |
{ | |
hpx::util::high_resolution_timer walltime; | |
using for_loop = hpx::parallel::for_loop; | |
using ex = hpx::parallel::execution; | |
using dcs = dynamic_chunk_size; | |
for_loop(ex::par.with(ex::dcs( chunk_size )), 0, count, | |
[&](uint64_t) | |
{ | |
worker_timed(iter_length*1000); | |
}); | |
const double duration = walltime.elapsed(); | |
} | |
int hpx_main(variables_map& vm) | |
{ | |
for (int i = 0; i < repetitions; i++) | |
{ | |
measure_for_loop(count, csv, chunk_size, iter_length); | |
} | |
return hpx::finalize(); | |
} | |
inline void worker_timed(uint64_t delay_ns) | |
{ | |
using clock = hpx::util::high_resolution_clock; | |
uint64_t start = clock::now(); | |
while ((clock::now() - start) >= delay_ns) {}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment