Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!
From: George Bosilca (bosilca_at_[hidden])
Date: 2010-11-29 18:25:35


On Nov 29, 2010, at 17:44 , <ananda.mudar_at_[hidden]> <ananda.mudar_at_[hidden]> wrote:

> George
>
> Thanks for the explanation. I am trying to understand the following line in your mail:
>
> “In fact, any fork done prior to the communication is a non-issue, but it is difficult to identify. Therefore, we output the warning as soon as we detect a fork after MPI_Init.”
>
> Does it mean that if I have a fork() after the communication (ie; mpi_send or mpi_receive etc), I may have to relook at a different implementation to be at safe side? I don’t want to suppress the messages if they result in any corruption later.

The main problem is that openib require to pin memory pages in order to take advantage of RMA features. There is a major issues with these pinned pages and fork, leading to segmentation fault in some specific cases. However, we only pin the pages on the MPI calls related to data transfers. Therefore, if you call fork __before__ any other MPI data transfer function (but after MPI_Init as you use the process rank), your application should be safe.

> How can one be sure that the disabling the warning is ok? Could you please elaborate on what makes forks vulnerable? May be that will guide the developers to make an informed decision on whether to disable them or find another alternative.

No way to know at 100%. Now for an elaborate answer: Once upon a time ... The fork story is a long and boring one, we would all have preferred to never heard about it (believe me). A quick and compressed version can be found on the QLogic download page (http://filedownloads.qlogic.com/files/driver/70277/release_QLogicIB-Basic_4400_Rev_A.html).

> Arbitrary fork() support is not supported in the OpenFabrics software stack. If you use fork() in your application, you must not touch any registered memory before calling some form of exec() to launch another process. Calling system() is safe. This limitation includes both native InfiniBand applications and MPI applications using a RDMA based implementation of MPI (such as OFED's openmpi and mvapich).

  george.

>
>
>
> Thanks
>
> Ananda
>
> ------------------ PREVIOUS MESSAGE ---------------------------------
>
> Subject: Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!
> From: George Bosilca (bosilca_at_[hidden])
> Date: 2010-11-29 12:22:15
>
> • Next message: Jeff Squyres: "Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!"
> • Previous message: ananda.mudar_at_[hidden]: "Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!"
> • In reply to: ananda.mudar_at_[hidden]: "Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!"
> • Next in thread: N.M. Maclaren: "Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!"
> • Reply: N.M. Maclaren: "Re: [OMPI devel] Warning on fork() disappears if I use MPI threads!!"
> If your code doesn't exactly what is described in the code snippet attached to your previous email, then you can safely ignore the warning. In fact, any fork done prior to the communication is a non-issue, but it is difficult to identify. Therefore, we output the warning as soon as we detect a fork after MPI_Init.
>
> You can find more information about the usage of fork in Open MPI at http://www.open-mpi.de/faq/?category=tuning#fork-warning
>
> george.
>
> On Nov 29, 2010, at 12:12 , <ananda.mudar_at_[hidden]> wrote:
>
> > I am posting this question again as it was sent before the long weekend and didn’t see any responses so far. Can anyone please explain the discrepancy I am observing with the scenario explained in the post below?
> >
> > Thanks
> > Ananda
> > Sent: Tuesday, November 23, 2010 2:24 PM
> > To: devel_at_[hidden]
> > Subject: Warning on fork() disappears if I use MPI threads!!
> >
> > Hi
> >
> > I am running into a very wierd problem.
> >
> > If I initialize MPI normally ie; with MPI_Init(), and make one of the MPI process to do "popen()" call, I get the following warning/error message:
> >
> > == Message start ===
> > An MPI process has executed an operation involving a call to the
> > "fork()" system call to create a child process. Open MPI is currently
> > operating in a condition that could result in memory corruption or
> > other system errors; your MPI job may hang, crash, or produce silent
> > data corruption. The use of fork() (or system() or other calls that
> > create child processes) is strongly discouraged.
> > == Message end ====
> >
> > However this error message goes away, if I initialize MPI with threads ie; MPI_Init_thread(). Can anyone explain this discrepancy?
> >
> > I am giving a snippet of the program that causes this problem:
> >
> > == Code snippet start ======
> > if ( rank == 0) {
> > output = popen("ls -l", "r");
> > while((c=getc(output))!=EOF)
> > printf("%c",c);
> > pclose(output);
> > }
> > == Code snippet end ======
> >
> > If this is a design constraint, how can I overcome this problem.
> >
> > Thanks
> > Ananda
> >
> > Ananda B Mudar, PMP
> > Senior Technical Architect
> > Wipro Technologies
> > Ph: 972 765 8093 972 765 8093
> > Please do not print this email unless it is absolutely necessary.
> >
> > The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
> >
> > WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
> >
> > www.wipro.com
> >
> > _______________________________________________
> > devel mailing list
> > devel_at_[hidden]
> > http://www.open-mpi.org/mailman/listinfo.cgi/devel
>
>
>
> Ananda B Mudar, PMP
> Senior Technical Architect
> Wipro Technologies
> Ph: 972 765 8093
> ananda.mudar_at_[hidden]
>
> Please do not print this email unless it is absolutely necessary.
>
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>
> www.wipro.com
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel