LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Michael Lees (mhl_at_[hidden])
Date: 2005-11-22 11:03:24


Hi again,

following my email last week....

It seems when I do
mpirun -np 1 app arg1 arg2 ... arg7 everything works fine
argc = 8 and argv is correct

however,

if I perform the precise same call but simply change "run" => "exec" then,
argc = 6 and argv is wrong

Jeff kindly sent me a test program which worked fine. I've also tried
using the absolute path to mpiexec.
However my application which works fine with mpirun fails with mpiexec
because an incorrect number of command line arguments are passed. I've
tried the -v option but that doesn't really tell me anything new.

I think I tracked down the problem it seems if one of the command line
arguments is '0' the rest of the line is ignored by mpiexec. Using
hello.c (see below) with the following command line arguments "arg1 arg2
arg3 0 arg4 arg5 arg6"

compile hello.c with "mpicc hello.c -o hello"

mpirun....
>mpirun -np 1 hello arg1 arg2 arg3 0 arg4 arg5 arg6
hello arg1 arg2 arg3 0 arg4 arg5 arg6 Hello, world! I am 0 of 1 (argv:
arg1)

mpiexec....
>mpiexec -np 1 hello arg1 arg2 arg3 0 arg4 arg5 arg6
hello arg1 arg2 arg3 Hello, world! I am 0 of 1 (argv: arg1)

It shows mpiexec gives a different result to mpirun.

> lamboot -v
LAM 7.1.1/MPI 2 C++/ROMIO - Indiana University

> mpicc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.4/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.4 20050721 (Red Hat 3.4.4-2)

Is this a bug? If so I'm suprised no one has come across it before?

-- hello.c --
#include <stdio.h>
#include <mpi.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    int rank = 0, size = 0;
    char hostname[BUFSIZ];

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    gethostname(hostname);
    int i =0;
    for(i=0;i<argc;i++){
         printf("%s ",argv[i]);
  }
    printf("Hello, world! I am %d of %d (argv: %s)\n", rank, size,
argv[1]);

    MPI_Finalize();
    return 0;
}

Cheers

-- 
Mike
mhl_at_[hidden]
http://www.cs.nott.ac.uk/~mhl/
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.