mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
parallel_for elimination -> thread_loop
This commit is contained in:
parent
70e276e1ab
commit
604c05f4b8
@ -156,7 +156,7 @@ public:
|
|||||||
dbytes=0;
|
dbytes=0;
|
||||||
ncomm=0;
|
ncomm=0;
|
||||||
|
|
||||||
parallel_for(int dir=0;dir<8;dir++){
|
thread_loop( (int dir=0;dir<8;dir++),{
|
||||||
|
|
||||||
double tbytes;
|
double tbytes;
|
||||||
int mu =dir % 4;
|
int mu =dir % 4;
|
||||||
@ -175,18 +175,12 @@ public:
|
|||||||
tbytes= Grid.StencilSendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank,
|
tbytes= Grid.StencilSendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank,
|
||||||
(void *)&rbuf[dir][0], recv_from_rank,
|
(void *)&rbuf[dir][0], recv_from_rank,
|
||||||
bytes,dir);
|
bytes,dir);
|
||||||
|
thread_critical {
|
||||||
#ifdef GRID_OMP
|
ncomm++;
|
||||||
#pragma omp atomic
|
dbytes+=tbytes;
|
||||||
#endif
|
}
|
||||||
ncomm++;
|
|
||||||
|
|
||||||
#ifdef GRID_OMP
|
|
||||||
#pragma omp atomic
|
|
||||||
#endif
|
|
||||||
dbytes+=tbytes;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Grid.Barrier();
|
Grid.Barrier();
|
||||||
double stop=usecond();
|
double stop=usecond();
|
||||||
t_time[i] = stop-start; // microseconds
|
t_time[i] = stop-start; // microseconds
|
||||||
|
@ -485,7 +485,7 @@ int main (int argc, char ** argv)
|
|||||||
dbytes=0;
|
dbytes=0;
|
||||||
ncomm=0;
|
ncomm=0;
|
||||||
|
|
||||||
parallel_for(int dir=0;dir<8;dir++){
|
thread_loop( (int dir=0;dir<8;dir++),{
|
||||||
|
|
||||||
double tbytes;
|
double tbytes;
|
||||||
int mu =dir % 4;
|
int mu =dir % 4;
|
||||||
@ -506,10 +506,9 @@ int main (int argc, char ** argv)
|
|||||||
tbytes= Grid.StencilSendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank,
|
tbytes= Grid.StencilSendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank,
|
||||||
(void *)&rbuf[dir][0], recv_from_rank, bytes,dir);
|
(void *)&rbuf[dir][0], recv_from_rank, bytes,dir);
|
||||||
|
|
||||||
#pragma omp atomic
|
thread_critical { dbytes+=tbytes; }
|
||||||
dbytes+=tbytes;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Grid.Barrier();
|
Grid.Barrier();
|
||||||
double stop=usecond();
|
double stop=usecond();
|
||||||
t_time[i] = stop-start; // microseconds
|
t_time[i] = stop-start; // microseconds
|
||||||
|
@ -78,7 +78,7 @@ int main (int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
double start=usecond();
|
double start=usecond();
|
||||||
parallel_for(int t=0;t<threads;t++){
|
thread_loop( (int t=0;t<threads;t++),{
|
||||||
|
|
||||||
sum[t] = x[t][0];
|
sum[t] = x[t][0];
|
||||||
for(int i=0;i<Nloop;i++){
|
for(int i=0;i<Nloop;i++){
|
||||||
@ -87,7 +87,7 @@ int main (int argc, char ** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
stop[t]=usecond();
|
stop[t]=usecond();
|
||||||
}
|
});
|
||||||
|
|
||||||
double max_stop=stop[0];
|
double max_stop=stop[0];
|
||||||
double min_stop=stop[0];
|
double min_stop=stop[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user