[cig-commits] r5538 - in cs/pythia/trunk: . mpi pyre/schedulers
leif at geodynamics.org
leif at geodynamics.org
Thu Dec 7 20:13:15 PST 2006
Author: leif
Date: 2006-12-07 20:13:15 -0800 (Thu, 07 Dec 2006)
New Revision: 5538
Modified:
cs/pythia/trunk/mpi/Launcher.py
cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py
cs/pythia/trunk/setup.py
Log:
Removed hard-coded "-np" argument-list code for 'mpirun'.
Instead, apply macro expansion to launcher.command. The
default is
mpirun -np ${nodes}
but on TACC's new Lonestar system, for example, one can
configure this as follows:
[CitcomS.launcher]
command = ibrun
This will cause the "-np" arguments to be omitted entirely,
as required. Also removed the 'extra' property, which is
certainly redundant now (if it wasn't already before).
Also fixed another undefined variable bug, this time in
SchedulerLSF. Once again, it was an an error path that
isn't always taken. You gotta love Python...
Modified: cs/pythia/trunk/mpi/Launcher.py
===================================================================
--- cs/pythia/trunk/mpi/Launcher.py 2006-12-08 02:29:09 UTC (rev 5537)
+++ cs/pythia/trunk/mpi/Launcher.py 2006-12-08 04:13:15 UTC (rev 5538)
@@ -25,10 +25,7 @@
nodegen = pyre.str("nodegen")
nodegen.meta['tip'] = """a printf-style format string, used in conjunction with 'nodelist' to generate the list of machine names (e.g., "n%03d")"""
- extra = pyre.str("extra")
- extra.meta['tip'] = "extra arguments to pass to mpirun"
-
- command = pyre.str("command", default="mpirun")
+ command = pyre.str("command", default="mpirun -np ${nodes}")
def launch(self):
@@ -63,9 +60,22 @@
if self.nodes < 1:
self.nodes = 1
- # build the command
+ # Build the 'mpirun' command. The macro-expansion feature is
+ # to allow the user to express the full range of possible
+ # 'mpirun' commands from a configuration file, while
+ # hard-coding as little as possible here. On a workstation or
+ # Beowulf, the default is usually correct, but on TACC's new
+ # Lonestar system (for example), the proper command is simply
+ # 'ibrun' (the number of nodes is not given).
+
+ from pyre.util import expandMacros
args = self.command.split(' ')
- self._appendMpiRunArgs(args)
+ substitutions = {'nodes': '%d' % self.nodes }
+ args = [expandMacros(arg, substitutions) for arg in args]
+
+ # use only the specific nodes specified explicitly
+ if self.nodelist:
+ self._appendNodeListArgs(args)
args.append(os.path.abspath(self.executable))
args += self.arguments
@@ -73,15 +83,4 @@
return args
- def _appendMpiRunArgs(self, args):
- extra = self.extra
- if extra:
- args.extend(extra.split(' '))
- args.extend(['-np', '%d' % self.nodes])
-
- # use only the specific nodes specified explicitly
- if self.nodelist:
- self._appendNodeListArgs(args)
-
-
# end of file
Modified: cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py
===================================================================
--- cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py 2006-12-08 02:29:09 UTC (rev 5537)
+++ cs/pythia/trunk/pyre/schedulers/SchedulerLSF.py 2006-12-08 04:13:15 UTC (rev 5538)
@@ -50,7 +50,37 @@
return
try:
- exitStatus = self.bsub(script)
+ import os
+ from popen2 import Popen4
+
+ cmd = [self.batchCommand]
+ if self.wait:
+ cmd.append("-K")
+ self._info.log("spawning: %s" % ' '.join(cmd))
+ child = Popen4(cmd)
+ self._info.log("spawned process %d" % child.pid)
+
+ print >> child.tochild, script
+ child.tochild.close()
+
+ if self.wait:
+ self._info.log("Waiting for dispatch...")
+
+ for line in child.fromchild:
+ self._info.line(" " + line.rstrip())
+ status = child.wait()
+ self._info.log()
+
+ exitStatus = None
+ if (os.WIFSIGNALED(status)):
+ statusStr = "signal %d" % os.WTERMSIG(status)
+ elif (os.WIFEXITED(status)):
+ exitStatus = os.WEXITSTATUS(status)
+ statusStr = "exit %d" % exitStatus
+ else:
+ statusStr = "status %d" % status
+ self._info.log("%s: %s" % (cmd[0], statusStr))
+
except IOError, e:
self._error.log("%s: %s" % (self.batchCommand, e))
return
@@ -72,38 +102,4 @@
return
- def bsub(self, script):
- import os
- from popen2 import Popen4
-
- cmd = [self.batchCommand]
- if self.wait:
- cmd.append("-K")
- self._info.log("spawning: %s" % ' '.join(cmd))
- child = Popen4(cmd)
- self._info.log("spawned process %d" % child.pid)
-
- print >> child.tochild, script
- child.tochild.close()
-
- if self.wait:
- self._info.log("Waiting for dispatch...")
-
- for line in child.fromchild:
- self._info.line(" " + line.rstrip())
- status = child.wait()
-
- exitStatus = None
- if (os.WIFSIGNALED(status)):
- statusStr = "signal %d" % os.WTERMSIG(status)
- elif (os.WIFEXITED(status)):
- exitStatus = os.WEXITSTATUS(status)
- statusStr = "exit %d" % exitStatus
- else:
- statusStr = "status %d" % status
- self._info.log("%s: %s" % (cmd[0], statusStr))
-
- return exitStatus
-
-
# end of file
Modified: cs/pythia/trunk/setup.py
===================================================================
--- cs/pythia/trunk/setup.py 2006-12-08 02:29:09 UTC (rev 5537)
+++ cs/pythia/trunk/setup.py 2006-12-08 04:13:15 UTC (rev 5538)
@@ -7,7 +7,7 @@
setup(
name = 'pythia',
- version = '0.8.1.0',
+ version = '0.8.1.1',
zip_safe = False,
packages = find_packages(),
@@ -45,7 +45,6 @@
author_email = 'aivazis at caltech.edu',
description = 'An extensible, object-oriented framework for specifying and staging complex, multi-physics simulations.',
license = 'BSD',
- url = 'http://www.geodynamics.org/cig/software/packages/pythia/',
- download_url = 'http://crust.geodynamics.org/~leif/shipping/', # temporary
+ url = 'http://www.geodynamics.org/cig/software/packages/cs/pythia/',
)
More information about the cig-commits
mailing list