Hmmm...well, your code runs fine for me: Ralphs-iMac:mpi rhc$ mpirun -n 2 ./thread_init Calling MPI_Init_thread... Calling MPI_Init_thread... MPI_Init_thread returned, provided = 3 MPI_Init_thread returned, provided = 3 Ralphs-iMac:mpi rhc$
I think the key, however, is that you also have to configure with --enable-opal-multi-thread. On Jun 16, 2013, at 8:54 AM, Elias Rudberg <elias.rudb...@it.uu.se> wrote: > Hello! > > I would like to report what seems to be a bug in MPI_Init_thread in OpenMPI > 1.7.1. > > The bug can be reproduced with the following test program > (test_mpi_thread_support.c): > =========================================== > #include <mpi.h> > #include <stdio.h> > int main(int argc, const char* argv[]) { > int provided = -1; > printf("Calling MPI_Init_thread...\n"); > MPI_Init_thread(NULL, NULL, MPI_THREAD_MULTIPLE, &provided); > printf("MPI_Init_thread returned, provided = %d\n", provided); > MPI_Finalize(); > return 0; > } > =========================================== > > When trying to run this when OpenMPI was configured with > --enable-mpi-thread-multiple, the program hangs when trying to run using > anything more than one process. > > Steps I use to reproduce this in Ubuntu: > > (1) Download openmpi-1.7.1.tar.gz > > (2) Configure like this: > ./configure --enable-mpi-thread-multiple > > (3) make > > (4) Compile test program like this: > mpicc test_mpi_thread_support.c > > (5) Run like this: > mpirun -np 2 ./a.out > Then you see the following two lines of output: > Calling MPI_Init_thread... > Calling MPI_Init_thread... > And then it hangs. > > MPI_Init_thread did not hang in earlier OpenMPI versions (for example it > worked in 1.5.* and 1.6.*), so it seems like a bug introduced in 1.7. > > The description above shows how I reproduce this in Ubuntu on my local > desktop computer, but the same problem exists for the OpenMPI 1.7.1 > installation at the UPPMAX computer center where I wan to run my code in the > end. I don't know all details about how they installed it there, but I know > they set --enable-mpi-thread-multiple. So maybe it hangs in 1.7.1 on any > computer as long as you use MPI_THREAD_MULTIPLE. At least I have not seen it > work anywhere. > > Do you agree that this is a bug, or am I doing something wrong? > > Best regards, > Elias > > > _______________________________________________ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users