#NEWLINE# def run_in_sub( testcase , testspec , options ) : #NEWLINE# #INDENT# mod = __import__ ( '__main__' ) #NEWLINE# from distutils import spawn #NEWLINE# mpirun_exe = None #NEWLINE# if ( spawn . find_executable ( 'mpirun' ) is not None ) : #NEWLINE# #INDENT# mpirun_exe = 'mpirun' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( spawn . find_executable ( 'mpiexec' ) is not None ) : #NEWLINE# #INDENT# mpirun_exe = 'mpiexec' #NEWLINE# #UNINDENT# #UNINDENT# if ( mpirun_exe is None ) : #NEWLINE# #INDENT# raise Exception ( 'mpirun or mpiexec was not found in the system path.' ) #NEWLINE# #UNINDENT# cmd = ( '%s -n %d %s %s %s %s' % ( mpirun_exe , testcase . N_PROCS , sys . executable , mod . __file__ , testspec , ' ' . join ( options ) ) ) #NEWLINE# return subprocess . call ( cmd , shell = True )