MPICH2, mpirun > ssh: Could not resolve hostname

Hello,

I installed my first linux on my laptop (Toshiba Satellite R830-1GZ, 4 cores) and am trying to make an environment for mpirun. For installation of MPICH2 (1.4.1p1), I followed this instruction: Installing MPI | MPI Tutorial .

Also I tried to follow this instruction to check if my installation is correct: MPI Hello World | MPI Tutorial .
I think I succeeded the compilation of the sample program provided there, and executed using “mpirun -np 4 file”. Then I’ve got following message and the program doesn’t run.

ssh: Could not resolve hostname MY_MACHINE_NAME: Name or service not known

Since I want to run the program over single laptop with 4 cores, I don’t think I need host file. I also try other test programs written in Fortran, which work on other clusters, but the results are the same. Could anyone please tell me the reason and how to fix this problem?

Thanks

> mpich2version
MPICH2 Version: 1.4.1p1
MPICH2 Release date: Thu Sep 1 13:53:02 CDT 2011
MPICH2 Device: ch3:nemesis
MPICH2 configure:
MPICH2 CC: gcc -O2
MPICH2 CXX: c++ -O2
MPICH2 F77: ifort -O2
MPICH2 FC: ifort -O2

Just a remark about using these forums.
Please post copied/pasted computer text between CODE tags: http://forums.opensuse.org/english/information-new-users/advanced-how-faq-read-only/451526-posting-code-tags-guide.html

Since I want to run the program over single laptop with 4 cores, I don’t think I need host file. I

I can not follow your strain of thoughts here. Not being able to resolve a hostname means that the gethostbyname() routine can not find an IP address belonging to that host (which is not to strange as MY_MACHINE_NAME is not a real hostname). There is no connection with the number of cores in your CPU.

Thanks. The reason why I thought I didn’t need the host file is that the site, MPI Hello World | MPI Tutorial, says I can disregard the host file, If I am simply running MPI on a laptop or a single machine. Do I have to prepare host file as well? Also my computer does not have SSH access.

I’m not sure if it’s any help, but I had the same issue a year ago when I was using mpi. Try running ‘mpd &’, it starts an mpi demon on your machine, then try executing your compiled program (I’m 99% this is the correct command)
Hope it helps…

Problem solved! I had to run my job as something like:

mpirun -np 4 -host localhost my_program

when I run on a single machine. No host file is needed.

I do not quite understand what you mean with a host file. Because this is about name resolving, I guess you mean /etc/hosts. And I bet you have one. Do:

cat /etc/hosts

and see what is there. I bet also that localhost is defined in one of the lines there.

hcvv wrote:
> ym270;2464540 Wrote:
>> Problem solved! I had to run my job as something like:
>>
>> mpirun -np 4 -host localhost my_program
>>
>> when I run on a single machine. No host file is needed.
> I do not quite understand what you mean with a host file. Because this
> is about name resolving, I guess you mean /etc/hosts. And I bet you have
> one. Do:

No, It’s an mpi-specific config file that’s being referred to. How sad
am I, I actually wasted time looking at the page the OP linked.

Yeah I had localhost defined there (I didn’t know why -host localhost worked, but I think I do now). Thanks alot!