def run(self): start_time = CPU_time() self.launch() import mpi if not mpi.world().rank: import sys print >> sys.stderr, "initialization time = %f" % \ (CPU_time() - start_time) return
def _avgCPUTime(self): step = self.step total_cpu_time = CPU_time() - self.start_cpu_time rank = self.communicator.rank if not rank: import sys sys.stderr.write("Average cpu time taken for velocity step = %f\n" % (total_cpu_time / (step+1)) ) return
def initialize(self, application): from CitcomSLib import citcom_init, global_default_values, set_signal # initialize the "struct All_variables E" in C comm = application.solverCommunicator all_variables = citcom_init(comm.handle()) self.communicator = comm self.all_variables = all_variables # defined in child classes self.initializeSolver() # information about clock time self.start_cpu_time = CPU_time() # global interuption handling routine defined once here set_signal() # default values for various parameters global_default_values(self.all_variables) # read input parameters from file(s) and command line inv = self.inventory inv.mesher.initialize(all_variables) inv.tsolver.initialize(all_variables) inv.vsolver.initialize(all_variables) inv.bc.initialize(all_variables) inv.const.initialize(all_variables) inv.ic.initialize(all_variables) inv.output.initialize(all_variables) inv.param.initialize(all_variables) inv.phase.initialize(all_variables) inv.tracer.initialize(all_variables) inv.visc.initialize(all_variables) from CitcomSLib import return_rank, return_pid rank = return_rank(self.all_variables) if rank == 0: pid = return_pid(self.all_variables) stream = open("pid%d.cfg" % pid, "w") else: stream = None # XXX: This is a heck # Write controller inventory to pid file if stream: print >> stream, "[CitcomS.controller]" print >> stream, ("monitoringFrequency=%d" % application.controller.inventory.monitoringFrequency) print >> stream, ("checkpointFrequency=%d" % application.controller.inventory.checkpointFrequency) print >> stream # passing the parameters to C self.setProperties(stream) self.initial_setup() return