Beispiel #1
0
 def __init__(self, puid, queue, pipe):
     Process.__init__(self, name='ModelProcessor')
     self._puid = puid
     self._queue = queue
     self._pipe = pipe
     self._logger = xslogging.factory("worker {}".format(puid), level=_lvl)
     self.predictions, self.runtime, self.predtime = 0, 0, 0
     self._stop = False
Beispiel #2
0
 def __init__(self, gpuid, queue, model=None):
     Process.__init__(self, name='ModelProcessor')
     self._gpuid = gpuid
     self._queue = queue
     self.model = model
     self._logger = xslogging.factory("worker {}".format(gpuid), level=_lvl)
     self._predictions = 0
     self._stop = False
     self._logger.debug("initialized")
Beispiel #3
0
    def __init__(self, l_puids):
        """
            Initialize workers based on their Processing Unit Ids
            :param l_puids: list of ids
        """
        self._queue = Queue()
        self._logger = xslogging.factory("scheduler")

        self._lt_puids_pipes = []
        for puid in l_puids:
            (parent_conn, child_conn) = Pipe()
            wkr = WorkerGpu(puid, self._queue,
                            child_conn) if puid >= 0 else WorkerCpu(
                                puid, self._queue, child_conn)
            self._lt_puids_pipes.append((puid, wkr, parent_conn))
Beispiel #4
0
 def __init__(self, l_gpuids):
     self._queue = Queue()
     self._gpuids = l_gpuids
     self._logger = xslogging.factory("scheduler")
     self._workers = list()
     self._init_workers()
Beispiel #5
0
        l_cols_denoised = [
            marcore.denoise(model, col, ratio) for col, ratio in frame_ratios
        ]
        __mean_elapsed_time.append(time.time() - time_start)
        __logger.info("frame took {:.2f} s".format(__mean_elapsed_time[-1]))

    if len(out_path):
        with open(out_path, "wb") as fp:
            [fp.write(col.tobytes()) for col in l_cols_denoised]


#  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~  ~

__sched = workers.Scheduler(l_puids=[-1, 0])
__mean_elapsed_time = []
__logger = xslogging.factory("denoiser")


def test_case(model, _bricks, label):
    global __mean_elapsed_time
    __mean_elapsed_time = []
    save_output = False

    # _bricks = [_bricks[0]]  # todo remove

    for ib, _brick in _bricks:
        _out_path = "./brick_{}.bin".format(ib) if save_output else ""
        denoise_frame(_brick, out_path=_out_path, model=model)

    if model is not None:
        __logger.info("{} approach MET: {:.2f} seconds".format(