Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] To connect two computers as two nodes
From: Gus Correa (gus_at_[hidden])
Date: 2009-05-31 15:37:52


Hi Depesh, list

1) I second Jody's suggestion, the OpenMPI FAQ are an excellent
resource. I would add also the OpenMPI README file.
Read them carefully before you start. Or better, **study** them!

2) As for the connection, I presume you have at least one ethernet port
on each computer.
In this case the cheaper physical connection, without a switch,
is to plugin a Cat5e Ethernet cable across the two computer ports.
If it the NICs are Fast Ethernet (100Mb/s) you may need a crossover
cable, or a crossover cable adapter. For Gigabit Ethernet ports
all may work well with a regular cable.

If you have a cheap 5-8 port Ethernet unmanaged switch (Fast Ethernet or
Gigabit Ethernet), you can use it
instead of direct connection.
The switch should be dedicated only for this objective,
better not hook more computers to it, or use any uplink to another network.
Just plug a regular Ethernet
cable between each computer NIC/port and the switch
(don't use crossover cables).

3) You need to assign IP addresses to the two computers,
or better, to each Ethernet port on each computer.
Actually, what you are doing is to create a private network for MPI
communication, a very simple one with two computers only.

If you are running CentOS, RHEL, of Fedora this is done
in by editing the /etc/syconfig/network-scripts/ifcfg-ethX,
where X is 0,1,2, etc, depending on which port you are using for the
private network.
Before you edit, make a backup copy of the original file (if it exists)
for safety (cp ifcfg-ethX ifcfg-ethX.original).
The you can add or replace lines like these:

DEVICE=ethX
BOOTPROTO=static
HWADDR=rs:tu:vx:yz
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes

NOTE:

A) The network prefix 192.168 is specific for private networks.
B) The netmask 255.255.255.0 would allow up to 254 computers (but you
will use only two).
C) The hdwaddr above should be filled with the hexadecimal MAC address
of your NIC/port, not with rs:tu:vx:yz, of course.
D) You can use IPADDR=192.168.1.1 for one computer, and
IPADDR=192.168.1.2 for the other.

There must be similar files in other Linux distributions
(Ubuntu, SLES, etc), but I am not familiar to those distros,
you need to find the appropriate files if you use those distros.

Be careful so as not to break any existing ifcfg-ethX
configuration file that you may want to keep.
For instance, you may want to keep one port/NIC to connect to the
Internet (if the computers are not on the Internet, this shouldn't be a
problem).
In this case you should use another port/NIC for the
private network. (If you don't have two ports, the best thing to do is
to buy NICs and install on the motherboard slots.)

4) On each computer create a file /etc/hosts with a content like this:

127.0.0.1 localhost.localdomain localhost
192.168.1.1 computer-1
192.168.1.2 computer-2

Where you can replace "computer-1" and "computer-2" by the names you
prefer to use, and I assume you configured the computers with the
private IP addresses 192.168.1.1 and 192.168.1.2.

If the /etc/hosts file is already there,
just add the lines above that are missing.

5) You also need to establish ssh passwordless connections between
the two computers. There are many recipes for this,
if you Google them out. Here is one example:

http://agenda.clustermonkey.net/index.php/Passwordless_SSH_Logins

6) Reboot the computers for the changes to take effect.

7) Check if it works with ping:

On computer-1 do "ping computer-2"
On computer-2 do "ping computer-1"

8) Install OpenMPI from the source files.
Read the README file and the FAQ carefully, particularly the ones
about installation.
Download the tarball file and untar it.
Configure it with a prefix that won't overwrite anything on Linux.
Something like this: ./configure --prefix=/my/path/to/openmpi-1.3.2 .
You can choose the compilers to use during configure also.
Then do make and make install.
Read the FAQ again to learn how to compile and run and MPI program.

9) You will need to create an OpenMPI "hostfile" with this content:

computer-1 slots=1
computer-1 slots=1

You can the /my/path/to/openmpi-1.3.2/openmpi-default-hostfile with
the contents above.

Use "slots=1" if you have single-processor, single-core computers.
If one or both of them are, say, dual-processor quad-core,
then you have 8 slots on each, so use "slots=8" instead.

10) Note: You need to install OpenMPI this on *BOTH* computers,
or install on a directory that is (NFS) mounted on both computers.

I hope this helps.

Gus Correa
---------------------------------------------------------------------
Gustavo Correa
Lamont-Doherty Earth Observatory - Columbia University
Palisades, NY, 10964-8000 - USA
---------------------------------------------------------------------

jody wrote:
> Hi
> I think the best way to start is to look at the FAQ -
> http://www.open-mpi.org/faq/
> there you find explanations on how to prepare your computers,
> how to install Open-MPI, how to compile MPI-Programs and how to run them.
>
> regards
> Jody
>
>
> On Sat, May 30, 2009 at 1:03 PM, deepesh reja<drejaorai_at_[hidden]> wrote:
>> Hi all,
>> I am new to parallel programming. Can you please tell me how i can connect
>> two computers to run a parallel program.
>> Please give me whole idea how to setup all the processors to respond to a
>> parallel program.
>> Thank you.
>>
>> --
>> Regards,
>>
>> Deepesh Reja
>>
>>
>> _______________________________________________
>> users mailing list
>> users_at_[hidden]
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>>
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users