Question 11 5 pts To parallelize the following serial code through the OpenMP, we could have used different directives.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Question 11 5 pts To parallelize the following serial code through the OpenMP, we could have used different directives.

Post by answerhappygod »

Question 11 5 Pts To Parallelize The Following Serial Code Through The Openmp We Could Have Used Different Directives 1
Question 11 5 Pts To Parallelize The Following Serial Code Through The Openmp We Could Have Used Different Directives 1 (41.57 KiB) Viewed 120 times
Question 11 5 Pts To Parallelize The Following Serial Code Through The Openmp We Could Have Used Different Directives 2
Question 11 5 Pts To Parallelize The Following Serial Code Through The Openmp We Could Have Used Different Directives 2 (50.87 KiB) Viewed 120 times
Question 11 5 pts To parallelize the following serial code through the OpenMP, we could have used different directives. for(1-0;i<n;i++) a[1] - 5. a = b[1 Take a look at the following options and choose the correct options which parallelize the above- mentioned serial code. Assuming that the statement omp_set_num_threads(NUM THREADS) has been invoked properly to configure how many threads are going to launch. With the statement, we could ignore the num_threads clause in OpenMP parallel directive or parallel for directive. Note: Multiple correct answers in the question.

Note: Multiple correct answers in the question. #pragma omp parallel private(i) shared (N, a, b) #pragma omp for for (i-e; i <N;i++) aſi) - 5. a[1] - b; > #pragma omp parallel shared (N, a, b){ int id, i, Nthrds, istart, iend; id = omp_get_thread_num(); Nthrds- omp_get_num_threads(); istart- idN/Nthrds; iend= (id+1)" N / Nthrds; if (id -- Nthrds-1) iend - N; for(i-istart;Kiend; i++) a[1] - 5. a[1] - ; 3 #pragma omp parallel for private(1) shared (N, a. b) for(i-e;i<n;i++) { a[1] - 5a [] - b; 2 #pragna omp parallel for shared (N, a, b) int id, i, Nthrds, istart, iend; id - omp_get_thread_num(); Ntheds- omp_get_num_threads: istart. idN/Nthrds; iend (id:1) N/Nthrds; if (id Nthrds-1) iend - N for(i-istart; Iciend; i++) afil - 5 a - ; -
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply