Paddle-Lite icon indicating copy to clipboard operation
Paddle-Lite copied to clipboard

[thread_pool] add thread pool code,test=develop

Open Leonardo-Ding opened this issue 3 years ago • 3 comments

本PR仅对存量算子做修改,不会影响后续增量算子(带openmp源语修饰的)的合入(因为算子中带openmp源语修饰但编译时关闭openmp编译不会有任何问题),且cmake默认编译选项依然选择openmp, thread_pool默认关闭,只有在.sh脚本中打开thread_pool开关时,thread_pool才会打开,此时openmp关闭,thread_pool和openmp从编译选项上只会二选一;

库体积:本PR在c++_static/with_log=ON下进行测试,thread_pool=ON时,体积为1952K;openmp=ON时,体积为2264K,优化336K,低于之前预期400K~500K的原因是我们的conv算子和element算子里面有更多的并发块修饰;

精度:目前在reset等大部分public模型下已做了精度测试,目前thread_pool和openmp精度对齐;

性能:目前在reset等不带depthwise算子的模型中测试,thread_pool和openmp性能基本对齐,之前QA也已经做过摸底测试,在mobileNet等带depthwise算子的模型中测试,thread_pool多线程性能稍弱于openmp;

限制条件:当前thread_pool的设计模式不支持不同线程对同一内存地址进行写操作,否则结果会发生错误,根据之前讨论结果,目前对arm depthwise等不满足这个限制条件的算子暂不进行修改;

风险点:线程池的接入是优化库体积的重点工作之一,本PR预计合入后会让QA同学进行模型性能和精度的迭代测试,争取在2.10发版前迭代稳定后把thread_pool编译开关默认打开。

Leonardo-Ding avatar May 27 '21 09:05 Leonardo-Ding

Thanks for your contribution!

paddle-bot-old[bot] avatar May 27 '21 09:05 paddle-bot-old[bot]

image 这个有个疑问:打开thread_pool 关闭openmp 时。conv_depthwise 是不是不能跑多线程了,因为它用的open mp

chenjiaoAngel avatar Jul 21 '21 03:07 chenjiaoAngel

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Aug 22 '22 02:08 CLAassistant

Automatically closed by Paddle-bot.

paddle-bot[bot] avatar Mar 05 '24 06:03 paddle-bot[bot]