Re: [Myrinet] [Myricom help #9872] application hangs when using 'call system'
Patrick Geoffray <[email protected]>
| Newsgroups | gmane.network.myrinet.general |
|---|---|
| Organization | Myricom, Inc |
| Message-ID | <[email protected]> |
Patrick Geoffray wrote: > I will see with our Linux guru why vfork in Fortran is not working > properly, actually it works but it has a bad side effect on GM. OK, we know what is happening. In GM-1.5.1, fork() is not supported (again, gm-1.5.2 solves that), but vfork() is safe. popen() is traditionaly using vfork() but system() uses fork(). So system() is defined in GM to used vfork() instead of fork(). Now, there is 2 distincts problems: * Compiling C code, the system() used will be the one provided by GM. With Fortran code, the runtime has a system_.o object that provides a stub to call system() in C. The compiler will take this reference first and miss the one in GM, and at link time it will only find it in the libC, not in the GM lib. So you need to use the flag "-u system" at compile time to tell the compiler to look into the libs for a definition of system. * However, this is not enough. The pthread lib on Linux re-implement vfork() to use fork(), making it unsafe. So even if the system-on-top-of-vfork provided by GM is used, it would produce nasty side effects on memory registration. So, there is 2 solutions: * using gm-1.5.2 when available. Everything works out of the box, with C or Fortran, with or without pthread. * For compatibility with gm-1.5.1 and earlier: removing the (unused by default) pthread lib from the MPICH-GM configure line and add "-u system" to the Fortran flags in the same configure line. That will be done in MPICH-GM-1.2.4..8 in testing right now. Thanks to point it out and to Loic to figure it out. Patrick ---------------------------------------------------------- | Patrick Geoffray, Ph.D. [email protected] | Myricom, Inc. http://www.myri.com | Cell: 865-389-8852 685 Emory Valley Rd (B) | Phone: 865-425-0978 Oak Ridge, TN 37830 ----------------------------------------------------------