[Omp] for loop

Hicham Mouline hicham at mouline.org
Tue Apr 24 06:38:33 PDT 2007


hello

const double up = 1.1 ;
double Sn=1000.0;
double opt[N+1];
int n;
for (n=0; n<=N; ++n) {
  opt[n] = Sn;
  Sn *= up;
}


how can this loop be parallelized? the problem is with the Sn variable.

const double up = 1.1 ;
double Sn=1000.0;
double opt[N+1];
int n;
#pragma omp for default(none) private(n) shared(opt) schedule(...)
for (n=0; n<=N; ++n) {
  opt[n] = Sn;
  Sn *= up;
}

?

rds,


More information about the Omp mailing list