icp/oer/courses/c-openmp/sections/01-introduction/01-parallel-for/content.md

726 B

For this exercise, we are using a simulated workload to see the effect of distributing it to different threads.

Knowledge

In this case we have a simple for-loop. If we would leave the code as is, each thread would just do the same work. But we want to increase the speed by distributing the workload among the threads. To do that, we have to tell the compiler with the directive #pragma omp for, that the for loop should be split up and each thread just does one part of the range.

Task

Parrallelize the loop such that the workload is shared among all threads! You will notice an increase in performance. The time measured time is wall-clock time, meaning the real world time that elapsed during the computation.