Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] MPI_Comm_dup hangs
From: Prentice Bisbal (prentice_at_[hidden])
Date: 2010-02-03 13:59:20

I have a problem with MPI_Comm_dup. When I call it in a function, it
causes my application to hang. Are they any common causes for a problem
like this? I'm using OpenMPI 1.2.8. Are there any known bugs that could
be causing this?

My program seems to hang when it gets to MPI_Comm_dup. Here's an example
of how I'm using it.

#include "foo.h"

/* MPI variables */
int my_rank;
int num_proc;
MPI_Comm euclid_comm;

void foo(long *arg1, long *arg2, MPI_Comm old_comm);

int main (int argc, char** argv) {

  /* get options */

  MPI_Init(&argc, &argv);
  MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
  MPI_Comm_size(MPI_COMM_WORLD, &num_proc);

 /* read in some data, yadda, yadda yadda */

 foo(&arg1, &arg2, MPI_COMM_WORLD);

 / *print results from foo */



void foo(long *arg1, long *arg2, MPI_Comm old_comm)
  MPI_Comm foo_comm;
  int foo_my_rank;
  int foo_num_proc;

  MPI_Comm_dup(old_comm, &foo_comm);
  MPI_Comm_rank(foo_comm, &foo_my_rank);
  MPI_Comm_size(foo_comm, &foo_num_proc);

  /* do stuff */