Does this correspond to parallelizing loops containing a function call, or is it much more convenient to parallelize loops that perform the main operation inside.
for example, is it suitable for hosting parallelization directives as shown below?
main(){
..
#omp paralel ..
for (i=0;i<100;i++){
a[i] = foo(&datatype , ...);
...
}
..
}
int foo(datatype *a,...){
}
Thank you, Richard and Feckler, for the comments were helpful, and I will take a deep look at the book rchrd suggested. But by the end of the day, I’m required to make the existing C code (a really big loop, which is located at the top of the program), if possible, parallelize it using openMP.
, .
, , parellelezing , ,
for(i to N){
work1() --(serial)
work2() --(serial)
Work3() --( PARALLEL)
work4() --(serial)
}
#omp parallel for private(Ptr)
for(i to N){
#omp single
{
work1() --(serial)
work2() --(serial)
}
Work3(Ptr) --( PARALLEL)
#omp single
{
work4() --(serial)
}
}