Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

how to make synchronization inside a nested loop?

$
0
0

#pragma omp parallel num_threads(min_thread) shared(count){

#pragma omp for

        for (int i = 0; i < v_edgeWeight.size(); i++)        {                    // light cpu work                          for (long j=0; j<currentNedges; j++)            {                             // light cpu work                              if ( valid )                {                                  //wait all threads                                   // execute a line once and release all threads                                     }                            }                                                       }        }

i made a function with #pragma omp barrierand #pragma omp single

but the problem is that some threads get stuck at the barrier when some threads exits the loop without reintering the inner loop(which has to be sequential)


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>