Beispiel #1
0
 def launch_program(self):
     """launch the main program"""
     sub_path = os.path.join(self.running_dir, 'SubProcesses')
     for path in os.listdir(sub_path):
         if path.startswith('P') and \
                                os.path.isdir(os.path.join(sub_path, path)):
             cur_path =  os.path.join(sub_path, path)
             # make
             misc.compile(cwd=cur_path, mode='unknown')
             # check
             subprocess.call(['./check'], cwd=cur_path)
Beispiel #2
0
    def launch_program(self):
        """launch the main program"""

        # Make pythia8
        print "Running make for pythia8 directory"
        misc.compile(cwd=os.path.join(self.running_dir, os.path.pardir), mode='cpp')
        if self.model_dir:
            print "Running make in %s" % self.model_dir
            misc.compile(cwd=self.model_dir, mode='cpp')
        # Finally run make for executable
        makefile = self.executable.replace("main_","Makefile_")
        print "Running make with %s" % makefile
        misc.compile(arg=['-f', makefile], cwd=self.running_dir, mode='cpp')
        
        print "Running " + self.executable
        
        output = open(os.path.join(self.running_dir, self.name), 'w')
        if not self.executable.startswith('./'):
            self.executable = os.path.join(".", self.executable)
        subprocess.call([self.executable], stdout = output, stderr = output,
                        cwd=self.running_dir)
        
        # Display the cross-section to the screen
        path = os.path.join(self.running_dir, self.name) 
        pydoc.pager(open(path).read())

        print "Output of the run is found at " + \
              os.path.realpath(os.path.join(self.running_dir, self.name))