- Timestamp:
- 01/26/12 21:06:56 (4 months ago)
- Location:
- branches/mcxtrace-1.0/src/mcrun2
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/mcxtrace-1.0/src/mcrun2/main.py
r3269 r3271 168 168 options.use_mpi = True 169 169 options.cc = 'mpicc' 170 options.mpirun = 'mpirun' 170 171 else: 171 172 options.use_mpi = False -
branches/mcxtrace-1.0/src/mcrun2/mcstas.py
r3270 r3271 37 37 self.executable = executable 38 38 39 def run(self, args=None ):39 def run(self, args=None, pipe=False): 40 40 ''' Run external process with args ''' 41 41 42 # Unsafe to use [] as default (reference) 42 43 if args is None: 43 44 args = [] 45 46 # Redirect stdout and stderr? 47 pipe = pipe and PIPE or None 44 48 45 49 # Run executable 46 50 LOG.debug('CMD: %s %s' % (self.executable, args)) 47 51 fid = Popen([self.executable] + args, 48 stdout= None,49 stderr= None)52 stdout=pipe, 53 stderr=pipe) 50 54 stdout, stderr = fid.communicate() 51 55 … … 109 113 110 114 111 def run(self ):115 def run(self, pipe=False): 112 116 ''' Run simulation ''' 113 117 args = [] 114 118 options = self.options 115 print repr(options)116 117 119 mpi = self.options.use_mpi 118 120 … … 138 140 if not mpi: 139 141 LOG.info('Running: %s' % self.binpath) 140 Process(self.binpath).run(args )142 Process(self.binpath).run(args, pipe=pipe) 141 143 else: 142 144 LOG.info('Running via MPI: %s' % self.binpath) 143 145 mpi_args = ['-np', str(options.mpi), self.binpath] 144 146 mpi_args += args 145 Process( 'mpirun').run(mpi_args)147 Process(options.mpirun).run(mpi_args, pipe=pipe) 146 148 147 149
