From 604c05f4b8eac0a63049f0919dcd82d054bd994b Mon Sep 17 00:00:00 2001 From: paboyle Date: Sun, 28 Jan 2018 01:01:36 +0000 Subject: [PATCH] parallel_for elimination -> thread_loop --- benchmarks/Benchmark_ITT.cc | 18 ++++++------------ benchmarks/Benchmark_comms.cc | 7 +++---- benchmarks/Benchmark_memory_asynch.cc | 4 ++-- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/benchmarks/Benchmark_ITT.cc b/benchmarks/Benchmark_ITT.cc index 36ca76dd..b689866d 100644 --- a/benchmarks/Benchmark_ITT.cc +++ b/benchmarks/Benchmark_ITT.cc @@ -156,7 +156,7 @@ public: dbytes=0; ncomm=0; - parallel_for(int dir=0;dir<8;dir++){ + thread_loop( (int dir=0;dir<8;dir++),{ double tbytes; int mu =dir % 4; @@ -175,18 +175,12 @@ public: tbytes= Grid.StencilSendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank, (void *)&rbuf[dir][0], recv_from_rank, bytes,dir); - -#ifdef GRID_OMP -#pragma omp atomic -#endif - ncomm++; - -#ifdef GRID_OMP -#pragma omp atomic -#endif - dbytes+=tbytes; + thread_critical { + ncomm++; + dbytes+=tbytes; + } } - } + }); Grid.Barrier(); double stop=usecond(); t_time[i] = stop-start; // microseconds diff --git a/benchmarks/Benchmark_comms.cc b/benchmarks/Benchmark_comms.cc index 6140644f..8ece8580 100644 --- a/benchmarks/Benchmark_comms.cc +++ b/benchmarks/Benchmark_comms.cc @@ -485,7 +485,7 @@ int main (int argc, char ** argv) dbytes=0; ncomm=0; - parallel_for(int dir=0;dir<8;dir++){ + thread_loop( (int dir=0;dir<8;dir++),{ double tbytes; int mu =dir % 4; @@ -506,10 +506,9 @@ int main (int argc, char ** argv) tbytes= Grid.StencilSendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank, (void *)&rbuf[dir][0], recv_from_rank, bytes,dir); -#pragma omp atomic - dbytes+=tbytes; + thread_critical { dbytes+=tbytes; } } - } + }); Grid.Barrier(); double stop=usecond(); t_time[i] = stop-start; // microseconds diff --git a/benchmarks/Benchmark_memory_asynch.cc b/benchmarks/Benchmark_memory_asynch.cc index 829a70ba..e833aab5 100644 --- a/benchmarks/Benchmark_memory_asynch.cc +++ b/benchmarks/Benchmark_memory_asynch.cc @@ -78,7 +78,7 @@ int main (int argc, char ** argv) } double start=usecond(); - parallel_for(int t=0;t