LAM/MPI logo

LAM/MPI General User's Mailing List Archives

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

From: Chris James (ctjames_at_[hidden])
Date: 2005-02-08 15:21:27


You could make a system call to get the hostname:

system("echo $HOSTNAME");

MPI_Get_processor_name() may also work, but the exact name returned may
not be the
actual hostname. It will be a name that should identify that particular
node however.

Elie Choueiri wrote:

>Hi all
>
>This seems like a really silly question, but I couldn't find what I
>was looking for elsewhere..
>
>Anyway, I was wondering how to get the IP or hostname of the machine
>I'm currently on from within my MPI program. Hopefully without using
>getenv () as it seems like the environment variables aren't getting
>set properly..
>
>Thanks,
>
>elie
>_______________________________________________
>This list is archived at http://www.lam-mpi.org/MailArchives/lam/
>
>
>