I want to run a function that contains a for loop (assuming it runs in parallel) in a parallel outer loop. So it looks like this:
void myfunction(){
...
#pragma omp parallel for
for (int i=0;i<10;i++){
do something...
}
}
int main(){
#pragma omp parallel for
for(int i=0;i<5;i++){
myfunction();
}
}
Given the code above, I want to create 5 parallel threads for a loop in a function main(), and I want each of the 5 threads to create other K threads in order to start its own parallel loop.
Although I know how to run nested for loops if the inner loop is not in a separate function, I cannot find a solution for this kind of problem.
, 5- , , .
- ?