Question: Problem 3 ( 1 5 pts ) ( 1 ) The following program executes in serial mode. Please use OpenMP's instructions to turn it into

Problem 3(15 pts)
(1) The following program executes in serial mode. Please use OpenMP's instructions to turn it into a parallel program with 4 threads. (Add your code in the grey area)
```
void main()
{
int i;
double x=0;
for (i=0; i 1000; i++)
{
x = i*0.5;
}
}
```
(2) The following OpenMP code is a multi-thread program. However, it has potential issue for synchronization. Please point out the problem and correct it.
```
void main()
{
int i;
double sum=0;
#pragma omp parallel for
for (i=0; i1000; i++)
sum++;
}
```
Problem 3 ( 1 5 pts ) ( 1 ) The following program

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 Programming Questions!