Parallelize while / for loop with OpenMP

Parallelize while / for loop with OpenMP

Postby ltqbx » Sat Apr 02, 2016 9:20 am

Hello Stackoverflow’s community. It’s my first post here, so please, be lenient with me!
I am implementing an algorithm to compute graph layout using force-directed. I would like to add OpenMP directives to accelerate some loops. After reading some courses, I added some OpenMP directives according to my understanding. The code is compiled, but don’t return the same result as the sequential version.
I wonder if you would be kind enough to look at my code and help me to figure out what is going wrong with my OpenMP version.

Please download the archive here:
http://www.mediafire.com/download/3m42w ... wgraph.zip

As you see, the portion of code which I want to parallelize is:
Code: Select all
unsigned long graphLayout(Graph * graph, double * coords, unsigned long maxiter) {
  while(!converged && iter < maxiter) {
    for(int i = 0 ; i < graph->nvtxs ; i++) {
      double force[3];
      // 1) compute repulsive force
      // 2) compute attractive force
      // 3) update position from force
    }
  }
}

Thank you in advance for any help you can provide!
ltqbx
 
Posts: 1
Joined: Sat Apr 02, 2016 9:16 am

Return to OpenMP

Who is online

Users browsing this forum: No registered users and 1 guest

cron