- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I want to parallelize this function:
Imagen& imagen,
int& maxIteraciones,
float3& colorDentro,
float3& colorAlejandose,
float3& colorFuera,
Complejo& c
){
int i ;
int j ;
float ancho = (float)imagen.ancho;
float alto = (float)imagen. alto;
#pragma omp parallel for shared( imagen, maxIteraciones) private(i,j,x,modulo2, k)
for(i = 0;i for(j = 0; j
Complejo x;
x.x = mezclar( i/ancho , -2.5f, 2.5f);
x.y = mezclar( j/alto, -2.5f, 2.5f);
float modulo2 = 0.0f;
int k = 0;
while( k < maxIteraciones && modulo2 < 4.0f){
x= x.cuadrado()+c;
modulo2 = x.modulo2();
k++;
}
if( k = maxIteraciones){
imagen.at(i,j ) = f3ToRgb( colorDentro );
}else{
imagen.at(i,j) = f3ToRgb( mezclar( float(k)/maxIteraciones,colorAlejandose, colorFuera ) );
}
}
}
}
The compiler throws me this error:
../Operaciones.cpp(50): error: invalid entity for this variable list in omp clause
#pragma omp parallel for shared( imagen, maxIteraciones) private(i,j,x,modulo2, k)
^
compilation aborted for ../Operaciones.cpp (code 2)
make: *** [Operaciones.o] Error 2
Should clases be specified in other private in other way? Some help please :S
Imagen& imagen,
int& maxIteraciones,
float3& colorDentro,
float3& colorAlejandose,
float3& colorFuera,
Complejo& c
){
int i ;
int j ;
float ancho = (float)imagen.ancho;
float alto = (float)imagen. alto;
#pragma omp parallel for shared( imagen, maxIteraciones) private(i,j,x,modulo2, k)
for(i = 0;i
Complejo x;
x.x = mezclar( i/ancho , -2.5f, 2.5f);
x.y = mezclar( j/alto, -2.5f, 2.5f);
float modulo2 = 0.0f;
int k = 0;
while( k < maxIteraciones && modulo2 < 4.0f){
x= x.cuadrado()+c;
modulo2 = x.modulo2();
k++;
}
if( k = maxIteraciones){
imagen.at(i,j ) = f3ToRgb( colorDentro );
}else{
imagen.at(i,j) = f3ToRgb( mezclar( float(k)/maxIteraciones,colorAlejandose, colorFuera ) );
}
}
}
}
The compiler throws me this error:
../Operaciones.cpp(50): error: invalid entity for this variable list in omp clause
#pragma omp parallel for shared( imagen, maxIteraciones) private(i,j,x,modulo2, k)
^
compilation aborted for ../Operaciones.cpp (code 2)
make: *** [Operaciones.o] Error 2
Should clases be specified in other private in other way? Some help please :S
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Section 2.8.3 of the OpenMP* 2.5 spec states:
"Data-sharing attribute clauses apply only to variables whose names are visible in the construct on which the clause appears, except that formal arguments that are passed by reference inherit the data-sharing attributes of the associated actual argument."
x, modulo2 and k are not declared (i.e. visible) until both of the for loop conditions in the parallel region are satisfied. Thus, they aren't visible at the time the parallel region is created and aren't acceptable as input to the private clause. Just remove them from the clause, and this error should go away.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page