Пример #1
0
 class Inventory( AbstractComponent.Inventory ):
     
     import pyre.inventory as pinv
     
     tofmin = pinv.float( 'tofmin', default = 0 )
     tofmin.meta['tip'] = 'tof min'
     tofmax = pinv.float( 'tofmax', default = 0.01 )
     tofmax.meta['tip'] = 'tof max'
     ntof = pinv.int( 'ntof', default = 100 )
     ntof.meta['tip'] = 'number of tof channels'
     
     xmin = pinv.float( 'xmin', default = -0.1 )
     xmin.meta['tip'] = 'x min'
     xmax = pinv.float( 'xmax', default = 0.1 )
     xmax.meta['tip'] = 'x max'
     nx = pinv.int( 'nx', default = 100 )
     nx.meta['tip'] = 'number of x bins'
     
     ymin = pinv.float( 'ymin', default = -0.1 )
     ymin.meta['tip'] = 'y min'
     ymax = pinv.float( 'ymax', default = 0.1 )
     ymax.meta['tip'] = 'y max'
     ny = pinv.int( 'ny', default = 100 )
     ny.meta['tip'] = 'number of y bins'
     
     eventsdat = pinv.str( 'eventsdat', default = 'events.dat' )
     eventsdat.meta['tip'] = 'output event data file'
     pass
Пример #2
0
class Launcher(Component):
    
    
    import pyre.inventory as pyre
    
    dry         = pyre.bool("dry")
    nodes       = pyre.int("nodes", default=1); nodes.meta['tip'] = """number of machine nodes"""
    nodelist    = pyre.slice("nodelist");
    executable  = pyre.str("executable")
    arguments   = pyre.list("arguments")


    nodelist.meta['tip'] = """a comma-separated list of machine names in square brackets (e.g., [101-103,105,107])"""

    
    def launch(self):
        raise NotImplementedError("class '%s' must override 'launch'" % self.__class__.__name__)


    def argv(self):
        raise NotImplementedError("class '%s' must override 'argv'" % self.__class__.__name__)


    def comments(self):
        return ["command: " + ' '.join(self.argv())]
Пример #3
0
    class UtilTest(Script):

        componentName = "UtilTest"

        import pyre.inventory as pyre
        answer = pyre.int("answer", default=42)

        def main(self, *args, **kwds):
            print "the answer is", self.answer
            configuration = self.retrieveConfiguration()
            print
            print "the configuration is:"
            print "\n".join([str(item) for item in configuration.render()])
            print
            utilPml = "util.pml"
            print "dumping configuration to", utilPml
            pml = open(utilPml, "w")
            print >> pml, "\n".join(self.weaver.render(configuration))
            pml.close()
            dct = dictFromReg(configuration)
            print
            print "converted configuration to dict:", dct
            print
            print "converted dict back to registry:"
            reg = regFromDict(dct, name=self.name, cls=OdbInventory)
            print "\n".join([str(item) for item in reg.render()])
            print
            utilPml = "util2.pml"
            print "dumping converted registry to", utilPml
            pml = open(utilPml, "w")
            print >> pml, "\n".join(self.weaver.render(reg))
            pml.close()
Пример #4
0
 class Inventory(Script.Inventory):
     import pyre.inventory as inv
     s = inv.str('s', default="abc")
     i = inv.int('i', default=10)
     f = inv.float('f', default=3.0)
     func = inv.facility("func", factory=Sin)
     pass
Пример #5
0
    class Inventory(MultiMonitors.Inventory):

        from mcni.pyre_support import facility
        m1 = facility('m1', default="monitors/NDMonitor(t)")
        m2 = facility('m2', default="monitors/NDMonitor(w)")
        m3 = facility('m3', default="monitors/NDMonitor(t)")
        m4 = facility('m4', default="monitors/NDMonitor(w)")
        m5 = facility('m5', default="monitors/NDMonitor(t)")
        m6 = facility('m6', default="monitors/NDMonitor(w)")

        import pyre.inventory as inv
        xwidth = inv.float(name='xwidth', default=0.77)
        yheight = inv.float(name='yheight', default=0.385)
        tmin = inv.float(name='tmin', default=0.)
        tmax = inv.float(name='tmax', default=0.1)
        nt = inv.int(name='nt', default=100)
        wmin = inv.float(name='wmin', default=0.)
        wmax = inv.float(name='wmax', default=10)
        nw = inv.int(name='nw', default=100)
Пример #6
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as inv

        tracer = inv.bool("tracer", default=False)

        # tracer_ic_method=0 (random generated array)
        # tracer_ic_method=1 (all proc read the same file)
        # tracer_ic_method=2 (each proc reads its own file)
        tracer_ic_method = inv.int("tracer_ic_method", default=0)

        # (tracer_ic_method == 0)
        tracers_per_element = inv.int("tracers_per_element", default=10)

        # (tracer_ic_method == 1)
        tracer_file = inv.str("tracer_file", default="tracer.dat")

        # How many flavors of tracers
        # If tracer_flavors > 0, each element will report the number of
        # tracers of each flavor inside it. This information can be used
        # later for many purposes. One of it is to compute composition,
        # either using absolute method or ratio method.
        tracer_flavors = inv.int("tracer_flavors", default=0)

        # How to initialize tracer flavors
        ic_method_for_flavors = inv.int("ic_method_for_flavors", default=0)
        z_interface = inv.list("z_interface", default=[0.7])
        ictracer_grd_file = inv.str("ictracer_grd_file", default="")
        ictracer_grd_layers = inv.int("ictracer_grd_layers", default=2)

        # Warning level
        itracer_warnings = inv.bool("itracer_warnings", default=True)

        # Enriched internal heat production
        tracer_enriched = inv.bool("tracer_enriched", default=False)
        Q0_enriched = inv.float("Q0_enriched", default=0.0)

        # Regular grid parameters
        regular_grid_deltheta = inv.float("regular_grid_deltheta", default=1.0)
        regular_grid_delphi = inv.float("regular_grid_delphi", default=1.0)

        # Analytical Test Function
        #analytical_tracer_test = inv.int("analytical_tracer_test", default=0)

        chemical_buoyancy = inv.bool("chemical_buoyancy", default=True)

        # ibuoy_type=0 (absolute method, not implemented)
        # ibuoy_type=1 (ratio method)
        buoy_type = inv.int("buoy_type", default=1)
        buoyancy_ratio = inv.list("buoyancy_ratio", default=[1.0])

        # DJB
        hybrid_method = inv.int("hybrid_method", default=0)

        # This is not used anymore and is left here for backward compatibility
        reset_initial_composition = inv.bool("reset_initial_composition",
                                             default=False)
Пример #7
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as prop

        ADV = prop.bool("ADV", default=True)
        filter_temp = prop.bool("filter_temp", default=False)
        monitor_max_T = prop.bool("monitor_max_T", default=True)

        fixed_timestep = prop.float("fixed_timestep", default=0.0)
        finetunedt = prop.float("finetunedt", default=0.9)
        adv_gamma = prop.float("adv_gamma", default=0.5)
        adv_sub_iterations = prop.int("adv_sub_iterations", default=2)

        inputdiffusivity = prop.float("inputdiffusivity", default=1)
Пример #8
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as prop


        Solver = prop.str("Solver", default="cgrad",
                 validator=prop.choice(["cgrad",
                                        "multigrid"]))
        node_assemble = prop.bool("node_assemble", default=True)
        precond = prop.bool("precond", default=True)

        accuracy = prop.float("accuracy", default=1.0e-4)
        inner_accuracy_scale = prop.float("inner_accuracy_scale", default=1.0)

        check_continuity_convergence = prop.bool("check_continuity_convergence", default=True)
        check_pressure_convergence = prop.bool("check_pressure_convergence", default=True)

        mg_cycle = prop.int("mg_cycle", default=1)
        down_heavy = prop.int("down_heavy", default=3)
        up_heavy = prop.int("up_heavy", default=3)

        vlowstep = prop.int("vlowstep", default=1000)
        vhighstep = prop.int("vhighstep", default=3)
        max_mg_cycles = prop.int("max_mg_cycles", default=50)
        piterations = prop.int("piterations", default=1000)

        aug_lagr = prop.bool("aug_lagr", default=True)
        aug_number = prop.float("aug_number", default=2.0e3)

        uzawa = prop.str("uzawa", default="cg",
                         validator=prop.choice(["cg", "bicg"]))
        compress_iter_maxstep = prop.int("compress_iter_maxstep", default=100)

        inner_remove_rigid_rotation = prop.bool("inner_remove_rigid_rotation", default=False)
        remove_rigid_rotation = prop.bool("remove_rigid_rotation", default=True)
        remove_angular_momentum = prop.bool("remove_angular_momentum", default=True)

        only_check_vel_convergence = prop.bool("only_check_vel_convergence", default=False)

        # Not used. Retained here for backward compatibility.
        tole_compressibility = prop.float("tole_compressibility", default=1.0e-7)
        relative_err_accuracy = prop.float("relative_err_accuracy", default=0.001)
Пример #9
0
class SchedulerTACCRanger(SchedulerSGE):

    name = "tacc-ranger"

    import pyre.inventory as pyre

    command = pyre.str("command", default="qsub")
    tpn = pyre.int("tpn",
                   default=16,
                   validator=pyre.choice([1, 2, 4, 8, 12, 15, 16]))
    tpn.meta['tip'] = 'Task per node'
    qsubOptions = pyre.list("qsub-options")

    def schedule(self, job):
        from math import ceil
        # round up to multiple of 16
        nodes = ceil(job.nodes / float(self.tpn))
        self.cores = int(nodes * 16)

        SchedulerSGE.schedule(self, job)
Пример #10
0
    class Inventory(CitcomComponent.Inventory):

        import pyre.inventory as inv

        output_format = inv.str("output_format", default="ascii",
                                validator=inv.choice(["ascii",
                                                      "ascii-gz",
						      "vtk",
                                                      "hdf5"]))
        output_optional = inv.str("output_optional",
                                  default="surf,botm,tracer")

        # experimental vtk output
        gzdir_vtkio = inv.int("gzdir_vtkio", default=0)
        # remove net rotation
        gzdir_rnr = inv.bool("gzdir_rnr", default=False)

        # write additional heat flux files? if yes, how frequent?
        write_q_files = inv.int("write_q_files", default=0)

        # max. degree for spherical harmonics output
        output_ll_max = inv.int("output_ll_max", default=20)

        # self-gravitation, for geoid only
        self_gravitation = inv.bool("self_gravitation", default=False)

        # compute stress/topography by consistent-boundary-flux method
        use_cbf_topo = inv.bool("use_cbf_topo", default=False)

        mega1 = 1024*1024
        #megaq = 256*1024

        # size of collective buffer used by MPI-IO
        cb_block_size = inv.int("cb_block_size", default=mega1)
        cb_buffer_size = inv.int("cb_buffer_size", default=mega1*4)

        # size of data sieve buffer used by HDF5
        sieve_buf_size = inv.int("sieve_buf_size", default=mega1)

        # memory alignment used by HDF5
        output_alignment = inv.int("output_alignment", default=mega1/4)
        output_alignment_threshold = inv.int("output_alignment_threshold",
                                        default=mega1/2)

        # cache for chunked dataset used by HDF5
        cache_mdc_nelmts = inv.int("cache_mdc_nelmts", default=10330)
        cache_rdcc_nelmts = inv.int("cache_rdcc_nelmts", default=521)
        cache_rdcc_nbytes = inv.int("cache_rdcc_nbytes", default=mega1)
Пример #11
0
class SchedulerPBS(BatchScheduler):
    
    
    name = "pbs"
    

    import pyre.inventory as pyre
    
    command       = pyre.str("command", default="qsub")
    qsubOptions   = pyre.list("qsub-options")
    resourceList  = pyre.list("resource-list")
    ppn           = pyre.int("ppn", default=1)
    
    
    def schedule(self, job):
        import pyre.util as util

        # Fix-up the job.
        if not job.task:
            job.task = "jobname"
        job.walltime = util.hms(job.dwalltime.value)
        job.arguments = ' '.join(job.arguments)
        job.resourceList = self.buildResourceList(job)
        
        # Generate the main PBS batch script.
        script = self.retrieveTemplate('batch.sh', ['schedulers', 'scripts', self.name])
        if script is None:
            self._error.log("could not locate batch script template for '%s'" % self.name)
            sys.exit(1)
        
        script.scheduler = self
        script.job = job
        
        if self.dry:
            print script
            return

        try:
            import os
            from popen2 import Popen4

            cmd = [self.command]
            self._info.log("spawning: %s" % ' '.join(cmd))
            child = Popen4(cmd)
            self._info.log("spawned process %d" % child.pid)

            print >> child.tochild, script
            child.tochild.close()

            for line in child.fromchild:
                self._info.line("    " + line.rstrip())
            status = child.wait()
            self._info.log()

            exitStatus = None
            if (os.WIFSIGNALED(status)):
                statusStr = "signal %d" % os.WTERMSIG(status)
            elif (os.WIFEXITED(status)):
                exitStatus = os.WEXITSTATUS(status)
                statusStr = "exit %d" % exitStatus
            else:
                statusStr = "status %d" % status
            self._info.log("%s: %s" % (cmd[0], statusStr))
        
        except IOError, e:
            self._error.log("%s: %s" % (self.command, e))
            return
        
        if exitStatus == 0:
            pass
        else:
            sys.exit("%s: %s: %s" % (sys.argv[0], cmd[0], statusStr))
        
        return