run_driver.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:temci 作者: parttimenerd 项目源码 文件源码
def benchmark(self, block: RunProgramBlock, runs: int,
                  cpuset: CPUSet = None, set_id: int = 0) -> BenchmarkingResultBlock:
        t = time.time()
        block = block.copy()
        try:
            self._setup_block(block)
            gc.collect()
            gc.disable()
        except IOError as err:
            return BenchmarkingResultBlock(error=err)
        try:
            res = self._benchmark(block, runs, cpuset, set_id)
        except BaseException as ex:
            return BenchmarkingResultBlock(error=ex)
        finally:
            gc.enable()
        try:
            self._teardown_block(block)
        except BaseException as err:
            return BenchmarkingResultBlock(error=err)
        t = time.time() - t
        assert isinstance(res, BenchmarkingResultBlock)
        res.data["__ov-time"] = [t / runs] * runs
        # print(res.data)
        return res
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号