AI-performance / embedded-ai.bench

benchmark for embededded-ai deep learning inference engines, such as NCNN / TNN / MNN / TensorFlow Lite etc.
https://www.ai-performance.com
Other
202 stars 29 forks source link

[CI] 多线程多设备一起跑,提高bench效率 #24

Closed ysh329 closed 4 years ago

ysh329 commented 4 years ago

多线程多设备一起跑,提高bench效率。目前是串行,需要支持一次链接多台设备,多台设备分别跑。

ysh329 commented 4 years ago

参考这篇文章:

最简单的例子:

    def test_run_cmd_multi_thread(self):
        import threading
        from time import sleep, ctime
        import random

        def loop(n, sec):
            logger.info("start loop idx:{}, at {}".format(n, ctime()))
            sleep(sec)
            logger.info("finish loop idx:{}, at {}".format(n, ctime()))
            return random.randint(0,9)

        threads = []
        nloops = range(10)
        for i in nloops:
            t = threading.Thread(target=loop, args=(i, nloops[i]))
            threads.append(t)

        for i in nloops:
            threads[i].start()

        for i in nloops:
            threads[i].join()
ysh329 commented 4 years ago

已支持,见#04aa0011ad8c233327cd094a87d0b74c65ec3565,#28d5a568e6279c454b8f4182456b827f9c5de4a7,#f09a68f81044da911072e4b9058349b11e839037