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@open-mpi.org
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

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