示例#1
0
文件: init.py 项目: dailypips/simx
def create_controller(): # TODO: should this \be moved to the init function?
    """
    Creates a controller entity on this proces. Strictly speaking, this is
    not required, but is highly useful. The controller id will be (!,0) in
    a serial simulation. In a parallel simulation, it will be (!,n) where n is 
    the MPI rank of this python process.
    """
    core.create_entity(('!',core.get_rank()),Controller)
示例#2
0
def create_controller():  # TODO: should this \be moved to the init function?
    """
    Creates a controller entity on this proces. Strictly speaking, this is
    not required, but is highly useful. The controller id will be (!,0) in
    a serial simulation. In a parallel simulation, it will be (!,n) where n is 
    the MPI rank of this python process.
    """
    core.create_entity(('!', core.get_rank()), Controller)
示例#3
0
def get_controller():
    """
    
    A helper function that returns the handle of the
    controller object for this process

    """

    return core.get_entity(('!', core.get_rank()))
示例#4
0
def get_controller():
    """
    
    A helper function that returns the handle of the
    controller object for this process

    """

    return core.get_entity(('!',core.get_rank()))
示例#5
0
    def __init__(self, ID, lp, entity_input, py_obj=None):
        if py_obj is None:
            py_obj = self
        super(Controller, self).__init__(ID, lp, entity_input, py_obj)
        ds.debug2.write("Controller", self.get_id(),
                        "is being created on rank: ", core.get_rank())
        # all other controllers are its neighbors
        nm = core.get_num_machines()
        self.neighbors_ = zip(['!'] * nm, range(nm))
        # remove own id from neighbor list
        self.neighbors_.remove(self.get_id())

        #install process manager service
        self.install_service(pm.ProcessManager, pm.eAddr_ProcessManager)
        self.pmgr_ = self.get_service(pm.eAddr_ProcessManager)
示例#6
0
 def __init__(self,ID,lp,entity_input,py_obj=None):
     if py_obj is None:
         py_obj = self
     super(Controller,self).__init__(ID,lp,entity_input,py_obj)
     ds.debug2.write("Controller",self.get_id(),"is being created on rank: ", 
                  core.get_rank())
     # all other controllers are its neighbors
     nm = core.get_num_machines()
     self.neighbors_ = zip(['!']*nm,range(nm))
     # remove own id from neighbor list
     self.neighbors_.remove(self.get_id())
 
     #install process manager service
     self.install_service(pm.ProcessManager, pm.eAddr_ProcessManager)
     self.pmgr_ = self.get_service(pm.eAddr_ProcessManager)