Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-user] Arch help

forgot to attach it sry guys

Regards
Wissam Khalil

#include <omp.h>
#include <iostream>

#define N     1000

using namespace std;

int main ()
{

	int i;
	double a[N], b[N], c[N], d[N];

	/* Some initializations */
	for (i=0; i < N; i++) {
		a[i] = i * 1.5;
		b[i] = i + 22.35;
	}

#pragma omp parallel shared(a,b,c,d) private(i)
	{

#pragma omp sections nowait
		{

#pragma omp section
			for (i=0; i < N; i++)
			{
				c[i] = a[i] + b[i];
				cout<<"c["<<i<<"]="<<c[i]<<endl;
			}

#pragma omp section
			for (i=0; i < N; i++)
			{
				d[i] = a[i] * b[i];
				cout<<"d["<<i<<"]="<<d[i]<<endl;
			}

		}  /* end of sections */

	}  /* end of parallel section */

	return 0;
}

Back to the top