Ejemplo n.º 1
0
    def run_plugin_instances(self, transport, communicator=MPI.COMM_WORLD):
        out_data = self.get_out_datasets()
        extra_dims = self.extra_dims
        repeat = np.prod(extra_dims) if extra_dims else 1

        param_idx = pu.calc_param_indices(extra_dims)
        out_data_dims = [len(d.get_shape()) for d in out_data]
        param_dims = [range(d - len(extra_dims), d) for d in out_data_dims]
        for i in range(repeat):
            if repeat > 1:
                self.set_parameters_this_instance(param_idx[i])
                for j in range(len(out_data)):
                    out_data[j].get_plugin_data()\
                        .set_fixed_directions(param_dims[j], param_idx[i])

            self.pre_process()

            logging.info("%s.%s", self.__class__.__name__, 'process')
            transport.process(self)

            logging.info("%s.%s", self.__class__.__name__, 'barrier')
            self.exp.barrier(communicator=communicator)

            logging.info("%s.%s", self.__class__.__name__, 'post_process')
            self.post_process()
Ejemplo n.º 2
0
    def _run_plugin_instances(self, transport, communicator=MPI.COMM_WORLD):
        """ Runs the pre_process, process and post_process methods.

        If parameter tuning is required, loop over the methods and set the
        correct parameters for each run. """

        out_data = self.get_out_datasets()
        extra_dims = self.extra_dims
        repeat = np.prod(extra_dims) if extra_dims else 1

        param_idx = pu.calc_param_indices(extra_dims)
        out_data_dims = [len(d.get_shape()) for d in out_data]
        param_dims = [range(d - len(extra_dims), d) for d in out_data_dims]

        if extra_dims:
            init_vars = self.__get_local_dict()

        for i in range(repeat):
            if extra_dims:
                self.__reset_local_vars(init_vars)
                self._set_parameters_this_instance(param_idx[i])
                for j in range(len(out_data)):
                    out_data[j]._get_plugin_data()\
                        .set_fixed_directions(param_dims[j], param_idx[i])

            logging.info("%s.%s", self.__class__.__name__, 'pre_process')
            self.base_pre_process()
            self.pre_process()

            logging.info("%s.%s", self.__class__.__name__, 'process')
            transport._process(self)

            logging.info("%s.%s", self.__class__.__name__, '_barrier')
            self.exp._barrier(communicator=communicator)

            logging.info("%s.%s", self.__class__.__name__, 'post_process')
            self.post_process()
            self.base_post_process()

        for j in range(len(out_data)):
            out_data[j].set_shape(out_data[j].data.shape)
Ejemplo n.º 3
0
    def _run_plugin_instances(self, transport, communicator=MPI.COMM_WORLD):
        """ Runs the pre_process, process and post_process methods.

        If parameter tuning is required, loop over the methods and set the
        correct parameters for each run. """

        out_data = self.get_out_datasets()
        extra_dims = self.extra_dims
        repeat = np.prod(extra_dims) if extra_dims else 1

        param_idx = pu.calc_param_indices(extra_dims)
        out_data_dims = [len(d.get_shape()) for d in out_data]
        param_dims = [range(d - len(extra_dims), d) for d in out_data_dims]

        if extra_dims:
            init_vars = self.__get_local_dict()

        for i in range(repeat):
            if extra_dims:
                self.__reset_local_vars(init_vars)
                self._set_parameters_this_instance(param_idx[i])
                for j in range(len(out_data)):
                    out_data[j]._get_plugin_data()\
                        .set_fixed_directions(param_dims[j], param_idx[i])

            logging.info("%s.%s", self.__class__.__name__, 'pre_process')
            self.base_pre_process()
            self.pre_process()

            logging.info("%s.%s", self.__class__.__name__, 'process')
            transport._process(self)

            logging.info("%s.%s", self.__class__.__name__, '_barrier')
            self.exp._barrier(communicator=communicator)

            logging.info("%s.%s", self.__class__.__name__, 'post_process')
            self.post_process()
            self.base_post_process()

        for j in range(len(out_data)):
            out_data[j].set_shape(out_data[j].data.shape)