Question: include #include void function_1() { for (int i = 0; i != 1; i++) { printf (Function 1 done by thread %d , omp_get_thread_num());

include #include void function_1() { for (int i = 0; i != 1; i++) { printf ("Function 1 done by thread %d " , omp_get_thread_num()); } } void function_2() { for (int j = 0; j != 2; j++) { printf ("Function 2 done by thread %d " , omp_get_thread_num()); } } int main() { int n = 2; //number of threads omp_set_num_threads(n); #pragma omp parallel { #pragma omp sections { #pragma omp section { function_1(); } #pragma omp section { function_2(); } } } } /* gcc sections.c -o sections -fopenmp ./sections 1. What is the expected output? 2. What happens if the number of threads and the number of sections is different? 2.1 More threads than sections? 2.2 Less threads than sections? 3. Which thread executes which section?

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!