Pin*_*oyd 1 c multithreading for-loop openmp
我的问题是这样的一个.但我想做点不同的事......
例如,在我的并行区域内,我想在4个线程上运行我的代码.当每个线程进入for循环时,我想在8个线程上运行我的代码.就像是
#pramga omp parallel num_threads(4)
{
//do something on 4 threads
#pragma omp parallel for num_threads(2)
for(int i=0;i<2;i++){
//do something on 8 threads in total
}
}
Run Code Online (Sandbox Code Playgroud)
那么,有没有办法将每个(4)运行线程"拆分"为两个(新)线程,因此在for循环中有更多(8)个线程正在运行?