File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1256,6 +1256,29 @@ def _gen_filename(self, name):
1256
1256
def _gen_outfilename (self ):
1257
1257
raise NotImplementedError
1258
1258
1259
+ class MpiCommandLineInputSpec (CommandLineInputSpec ):
1260
+ use_mpi = traits .Bool (False ,
1261
+ desc = "Whether or not to run the command with mpiexec" ,
1262
+ usedefault = True )
1263
+ n_procs = traits .Int (desc = "Num processors to specify to mpiexec. Do not "
1264
+ "specify if this is managed externally (e.g. through "
1265
+ "SGE)" )
1266
+
1267
+
1268
+ class MpiCommandLine (CommandLine ):
1269
+ input_spec = MpiCommandLineInputSpec
1270
+
1271
+ @property
1272
+ def cmdline (self ):
1273
+ """Adds 'mpiexec' to begining of command"""
1274
+ result = []
1275
+ if self .inputs .use_mpi :
1276
+ result .append ('mpiexec' )
1277
+ if self .inputs .n_procs :
1278
+ result .append ('-n %d' % self .inputs .n_procs )
1279
+ result .append (super (MpiCommandLine , self ).cmdline )
1280
+ return ' ' .join (result )
1281
+
1259
1282
class SEMLikeCommandLine (CommandLine ):
1260
1283
"""By default in SEM derived interface all outputs have corresponding inputs.
1261
1284
However, some SEM commands create outputs that are not defined in the XML.
You can’t perform that action at this time.
0 commit comments