Пример #1
0
    def expand_node(self, node, gstate, action):
        logging.debug("--------- Expanding node %s %s ------------", node.uid, gstate)

        if self.debug_compare_states is not None and node.uid in self.debug_compare_states:
            if self.debug_captured_states is None:
                self.debug_captured_states = []
            self.debug_captured_states.append(gstate.copy())

        gcontext = GlobalContext(self, node, gstate)

        if action:
            action.apply_action(gcontext)

        self.fast_expand_node(gcontext)

        if not gcontext.make_node():
            gstate.dispose()
            return

        if not self.slow_expand(gcontext):
            node = gcontext.node
            if any(state.status != State.StatusFinished for state in gstate.states):
                active_pids = [state.pid for state in gstate.states if state.status != State.StatusFinished]
                gcontext = GlobalContext(self, node, gstate)
                message = errormsg.Deadlock(None, gcontext=gcontext, active_pids=active_pids)
                gcontext.add_error_and_throw(message)
            else:
                gstate.mpi_leak_check(self, node)
                node.allocations = sum((state.allocations for state in gstate.states), [])
        gstate.dispose()
Пример #2
0
    def make_initial_node(self):
        initial_node = Node("init", None)
        self.generator.statespace.add_node(initial_node)
        self.generator.statespace.initial_node = initial_node

        gstate = GlobalState(self.generator.process_count)
        gcontext = GlobalContext(self, initial_node, gstate)

        # TODO: Do it in parallel
        for i in xrange(self.generator.process_count):
            context = gcontext.get_context(i)
            if not context.initial_run():
                return False

        gcontext.make_node()
        gcontext.add_to_queue(None, False)
        return True
Пример #3
0
    def start_controllers(self):
        # We do actions separately to allow parallel initialization
        for controller in self.controllers:
            controller.start(capture_syscalls=["write"])
        for controller in self.controllers:
            controller.connect()

        initial_node = Node("init", None)
        self.statespace.add_node(initial_node)
        self.statespace.initial_node = initial_node

        gstate = GlobalState(self.process_count)
        gcontext = GlobalContext(self, initial_node, gstate)

        # TODO: Do it in parallel
        for i in xrange(self.process_count):
            context = gcontext.get_context(i)
            if not context.initial_run():
                return False

        gcontext.make_node()
        gcontext.add_to_queue(None, False)
        return True