Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: [OMPI users] Problems with MPI_Init_Thread(...)
From: devendra rai (rai.devendra_at_[hidden])
Date: 2011-09-19 04:15:42


Hello Community, I am building an application which uses MPI_Ssend(...) and MPI_Recv(...) in threads. So, there is more than one thread which invokes MPI functions. Based on Jeff's inputs, I rebuilt open-mpi with threads support: ./configure --enable-mpi-threads=yes --with-threads=posix ... I believe the above line would do the magic. Now, I learnt that I need to request thread support when initializing MPI application using MPI_Init_thread(...). This is my code fragment: int main(int argc, char *argv[]) {         int rank;         int desired_thread_support = MPI_THREAD_MULTIPLE;         int provided_thread_support;             MPI_Init_thread(&argc, &argv, desired_thread_support, &provided_thread_support);            MPI_Comm_set_errhandler(MPI_COMM_WORLD, MPI_ERRORS_RETURN); I build my application, and run it on 3 nodes. However, I get this error: Sun Sep 18 22:25:11 2011[1,1]<stderr>:*** The MPI_Init_thread() function was called before MPI_INIT was invoked. Sun Sep 18 22:25:11 2011[1,1]<stderr>:*** This is disallowed by the MPI standard. Sun Sep 18 22:25:11 2011[1,1]<stderr>:*** Your MPI job will now abort. Sun Sep 18 22:25:11 2011[1,1]<stderr>:[Morpheus.OTZ:9910] Abort before MPI_INIT completed successfully; not able to guarantee that all other processes were killed! I did read some online examples, and API documentations, and nothing says that I will need to call MPI_Init(...) *followed by* MPI_Init_thread(...). I have open-mpi 1.4.3 from open-mpi official site, running on Linux kernel 2.6.37.6-0.7. I do not understand why this error is happening. Again, the next question is, Am I required to MPI_Init_thread everytime I create a new thread? If yes, will this call be the first line in the thread? Would be nice if someone can throw some pointers. Thanks a lot. Best, Devendra Rai ________________________________