Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2007-03-06 09:45:26


OMPI uses the getcwd() library call to determine the pwd, whereas the
shell $PWD variable contains the shell's point of view of what the
PWD is (I *suspect* that the pwd(1) shell command also uses getcwd(),
but I don't know that for sure).

 From the OSX getcwd(3) man page:

      The getcwd() function copies the absolute pathname of the
current working
      directory into the memory referenced by buf and returns a
pointer to buf.
      The size argument is the size, in bytes, of the array
referenced by buf.

 From the Linux getcwd(3) man page:

        The getcwd() function shall place an absolute pathname of
the current
        working directory in the array pointed to by buf, and return
buf. The
        pathname copied to the array shall contain no components that
are sym-
        bolic links. ...

So this at least explains why you're seeing that behavior.

I'm trying to think of a good reason why we're not checking PWD -- I
think the reasons are as follows:

1. LAM/MPI has used getcwd() for about 10 years (I can't speak for
the other MPI's, though)

2. You're the first guy to ask in that time (or the frequency of
asking is so low that I've forgotten)

But these are pretty wimpy reasons. :-) I'll have to check with the
other developers to see if there are any "gotchas" to using PWD if
it's defined and contains a valid alias for the current directory.

On Mar 2, 2007, at 1:12 PM, Grismer, Matthew J Civ AFRL/VAAC wrote:

> I’m using OpenMPI on an Xserve cluster running OS X Server 10.4.8.
> The user directories exist on an XserveRAID connected to the master
> node via fibre channel. So, on the master node the full pathname
> for the user directories is /Volumes/RAID1/users1. The compute
> nodes of the cluster automount the user directories via NFS, so the
> full path to the user directories appears on the nodes as /xhome/
> users1. I created a hostfile list of all the compute nodes on the
> cluster, not including the master node. When I attempt to run a
> program in my home directory matt from the master node with
>
>
>
> mpirun –hostfile nodes –np 4 program
>
>
>
> it fails because it cannot find program. If I add the –wdir option
> and specify the directory as /xhome/users1/matt, everything is fine.
>
>
>
> My question is this, how does OpenMPI determine your working
> directory, and is there a way to fix this without the –wdir
> option? For example, if you look at the PWD environment variable,
> it is always /xhome/users1/matt, even on the master. If you use
> the pwd command, however, you get different the two different
> results on the master and the nodes.
>
>
>
> Thanks.
>
>
>
> Matt
>
>
>
> _____________________________________________________
>
> Matthew Grismer
>
>
>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
Jeff Squyres
Server Virtualization Business Unit
Cisco Systems