Refer to the code below determine whether this code is correct, and if not, correct any mistakes. Find the speedups and efficiencies of the parallel odd-even transposition. Does the program obtain linear speedups? Is it scalable? Is it strongly scalable? Is it weakly scalable? After correcting the mistakes, execute the code in CUDA or OpenMP and measure any performance improvement in terms of speedups and scalability. Process Pi evenprocess =(i%2 ==2); evenphase = 1; for(step =0; step < n; step++,evenphase = !evenphase) { if((evenphase && evenprocess) || (!evenphase && !evenprocess) { send (&a, Pi+1); recv (&x, Pi+1); if (x a) a = x; } }
Refer to the code below determine whether this code is correct, and if not, correct any mistakes. Find the speedups and efficiencies of the parallel odd-even transposition. Does the program obtain linear speedups? Is it scalable? Is it strongly scalable? Is it weakly scalable? After correcting the mistakes, execute the code in CUDA or OpenMP and measure any performance improvement in terms of speedups and scalability.
Process Pi
evenprocess =(i%2 ==2);
evenphase = 1;
for(step =0; step < n; step++,evenphase = !evenphase)
{
if((evenphase && evenprocess) || (!evenphase && !evenprocess)
{
send (&a, Pi+1);
recv (&x, Pi+1);
if (x<a) a =x;
}
else {
recv (&x, Pi-1);
send (&a, Pi-1);
if (x > a) a = x;
}
}
Step by step
Solved in 3 steps