pragma omp parallel for vs. pragma omp parallel
问题 In C++ with openMP, is there any difference between #pragma omp parallel for for(int i=0; i<N; i++) { ... } and #pragma omp parallel for(int i=0; i<N; i++) { ... } ? Thanks! 回答1: #pragma omp parallel for(int i=0; i<N; i++) { ... } This code creates a parallel region, and each individual thread executes what is in your loop. In other words, you do the complete loop N times, instead of N threads splitting up the loop and completing all iterations just once. You can do: #pragma omp parallel {