Changeset 3241 for trunk

Show
Ignore:
Timestamp:
01/06/12 14:59:32 (5 months ago)
Author:
jos
Message:

Always use mpi run when running an mpi binary

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/mcrun2/mcstas.py

    r3216 r3241  
    123123 
    124124        options = self.options 
    125         mpi = self.options.use_mpi 
    126125 
    127126        # Handle proxy options with values 
     
    148147                 for key, value in self.params.items()] 
    149148 
    150         # Run McStas 
    151         if not mpi: 
    152             LOG.debug('Running: %s', self.binpath) 
    153             return Process(self.binpath).run(args, pipe=pipe) 
    154         else: 
     149        return self.runMPI(args, pipe) 
     150 
     151    def runMPI(self, args, pipe=False): 
     152        """ Run McStas, possible via mpi """ 
     153        binpath = self.binpath 
     154        mpi = self.options.use_mpi 
     155        if mpi: 
    155156            LOG.debug('Running via MPI: %s', self.binpath) 
    156             mpi_args = ['-np', str(options.mpi), self.binpath] 
    157             mpi_args += args 
    158             return Process(options.mpirun).run(mpi_args, pipe=pipe) 
     157            binpath = self.options.mpirun 
     158            args = ['-np', str(self.options.mpi), self.binpath] + args 
     159        return Process(binpath).run(args, pipe=pipe) 
    159160 
    160161    def get_info(self): 
    161         return McStasInfo(Process(self.binpath).run(['--info'], pipe=True)) 
     162        return McStasInfo(self.runMPI(['--info'], pipe=True)) 
    162163 
    163164    def cleanup(self):