[MPICH] DHCP assigned IP addresses and hostnames?

Steve Kargl sgk at troutmask.apl.washington.edu
Fri Nov 17 14:52:58 CST 2006


On Thu, Nov 16, 2006 at 01:04:42PM -0800, Steve Kargl wrote:
> On Thu, Nov 16, 2006 at 02:32:35PM -0600, Ralph Butler wrote:
> > On ThuNov 16, at Thu Nov 16 1:32PM, Steve Kargl wrote:
> > >I've set up mpich2 on a colleagues duo-core opteron laptop
> > >so that he can do some development before moving to the
> > >cluster.  His laptop gets an IP address assigned by DHCP
> > >and his hostname is not a fully qualified domain name.
> > >
> > >I can tell him to update mpd.hosts with the current IP
> > >address upon each reboot, but I haven't found a way to
> > >get around this:
> > >
> > >alien-mobile:fcurra[203] mpdboot
> > >mpdboot_alien-mobile.apl.washington.edu (handle_mpd_output 388):  
> > >from mpd on alien-mobile.apl.washington.edu, invalid port info:
> > >mpd failed: gethostbyname_ex failed for alien- 
> > >mobile.apl.washington.edu
> > >
> > >Is there some way to tell MPICH2 to use localhost and the 127.0.0.1
> > >address?
> > >
> >
> > I believe the following demos what you want.
> > --ralph
> > 
> > (rmbmac:78) % mpd --ifhn=127.0.0.1 &
> > [1] 26620
> > (rmbmac:79) % mpdtrace  -l
> > rmbmac.cs.mtsu.edu_52052 (127.0.0.1)
> > (rmbmac:80) % mpiexec  -n 1 hostname
> > rmbmac.cs.mtsu.edu
> 
> Thanks!  I thought I had tried explicit use of the 127.0.0.1
> address, but apparently I missed this.
> 

I spoke to soon.  In testing, I used hostname to change the
fake name of the laptop to the fully qualified domain name
associated with the IP address of the ethernet nic.  So, the
"mpdboot  --ifhn=127.0.0.1" appeared to work.

To get mpich2 to run on localhost, I had to hack up the
following patch: 


--- mpdboot.orig	Wed Sep  6 13:33:29 2006
+++ mpdboot	Fri Nov 17 12:36:06 2006
@@ -65,7 +65,7 @@
 
 def mpdboot():
     global myHost, fullDirName, rshCmd, user, mpdCmd, debug, verbose
-    myHost = gethostname()
+    myHost = 'alien'
     mpd_set_my_id('mpdboot_%s' % (myHost) )
     fullDirName  = path.abspath(path.split(argv[0])[0])
     rshCmd = 'ssh'
--- mpd.py.orig	Fri Nov 17 12:37:08 2006
+++ mpd.py	Fri Nov 17 12:41:06 2006
@@ -108,7 +108,7 @@
     def __init__(self):
         self.myHost = socket.gethostname()
         try:
-            hostinfo = socket.gethostbyname_ex(self.myHost)
+            hostinfo = '127.0.0.1' #socket.gethostbyname_ex(self.myHost)
             self.myIfhn = hostinfo[2][0]    # chgd below when I get the real value
         except:
             print 'mpd failed: gethostbyname_ex failed for %s' % (self.myHost)
@@ -371,7 +371,7 @@
                     print 'failed to parse --ifhn option'
                     self.usage()
                 try:
-                    hostinfo = socket.gethostbyname_ex(ifhn)
+                    hostinfo = '127.0.0.1' #socket.gethostbyname_ex(ifhn)
                     ifhn = hostinfo[2][0]
                 except:
                     print 'mpd failed: gethostbyname_ex failed for %s' % (ifhn)


I don't know python.  Otherwise, I would add a -localhost
option to permit "mpdboot -localhost".

Crude, my colleague just informed me that mpiexec is now dying with
a gethostbyname_ex failure.

-- 
Steve




More information about the mpich-discuss mailing list