Question: write a parallel OpenMP version of it. ------------------------------------------------------------------------------------------------------------------------------------ #include #include #include #include #define SIZE 10000000 volatile float a[SIZE]; volatile float b[SIZE]; int main(int argc, char

write a parallel OpenMP version of it. write a parallel OpenMP version of it. ------------------------------------------------------------------------------------------------------------------------------------ #include #include #include #include ------------------------------------------------------------------------------------------------------------------------------------

#include #include #include #include

#define SIZE 10000000

volatile float a[SIZE]; volatile float b[SIZE];

int main(int argc, char **argv) { long int i; double sum; struct timeval time1, time2;

srand(time(0)); for (i = 0; i

gettimeofday(&time2, 0); printf("Elapsed time (us) = %d ", (time2.tv_sec-time1.tv_sec)*1000000 + time2.tv_usec - time1.tv_usec);

return 0; }

Run your resulting code on different number of threads, up to 16 threads, and produce a plot of speedup versus number of threads up to 16 threads. For each point what efficiency do you get? What do you think are the underlying overheads leading to the efficiency Hint: The examples in Pacheco's book explaining how OpenMP programs are compiled and run apply to the HPC machines too! Hint 2: Once you have run linuxsh in a terminal window on the HPC machines, you can run multi-threaded OpenMP programs. There is generally no need to claim a cluster node for OpenMP unless you see a large amount of contention. Run your resulting code on different number of threads, up to 16 threads, and produce a plot of speedup versus number of threads up to 16 threads. For each point what efficiency do you get? What do you think are the underlying overheads leading to the efficiency Hint: The examples in Pacheco's book explaining how OpenMP programs are compiled and run apply to the HPC machines too! Hint 2: Once you have run linuxsh in a terminal window on the HPC machines, you can run multi-threaded OpenMP programs. There is generally no need to claim a cluster node for OpenMP unless you see a large amount of contention

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!