Question 11 5 pts To parallelize the following serial code through the OpenMP, we could have used different directives.
Posted: Sun May 15, 2022 1:14 pm
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 - ; -
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 - ; -