从opencl和CUDA切换到C ++多线程? [英] Switch from opencl and CUDA to C++ multithread?

查看:151
本文介绍了从opencl和CUDA切换到C ++多线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用GPU非常困难,因为用户必须进行内存分段和传输,使用本地内存并且在大多数应用程序中性能都会提高10-20倍。

另一方面,使用多线程非常容易和快速。

最好使用像GTX1060这样的低成本GPU并行使用1280个线程,而不是任何其他openCL或基于CUDA的SW



我尝试了什么:



i尝试在使用Gigabyte Radeon的基于compuret的视觉算法中使用OpenCL多线程R6 360显卡和GTX1060

It is very hard to use the GPU because the user has to do memory segmentation and transfer, the use of local memory and in the most applications very low performance increase 10-20x is reached.
In other hand using multithreads is easy and fast.
It would be better use 1280 threads in parallel using a low cost GPU like GTX1060 than any other openCL or CUDA based SW

What I have tried:

i tried using multithreads with OpenCL in compuret based vision algorithms using a Gigabyte Radeon R6 360 graphics board and GTX1060

推荐答案

这取决于你想做什么。当许多短线程运行时,甚至多线程也不是最佳的,因为多线程也意味着CPU的开销。



图形输出和低级计算最好在GPU上完成,当GPU的使用导致CPU使用率降低时计算也是如此。



尽量避免使用大量线程,但需要更少工作量的线程,因此设置和拆除容易丢失重量。您可以通过为操作和结果构建数据包来实现这一点。因此线程获得操作队列和工作负载。



如果必须等待资源或预处理数据,请考虑关键工作路径。
It is depending on what you want to do. Even multithreading isnt optimal, when a lot of short threads are running because multithreading means also overhead in the CPU.

Graphical output and low level computations are best done on GPU, computations also when the usage of the GPU leads to less CPU usage.

Try to avoid lots of threads, but less threads with more work, so setup and tear down looses weight. You may achieve that by building data packets for operations and results. So threads get an operation queue and work load.

Think about the critical work path if you have to wait for resources or preprocessed data.

唯一的解决方案是在GPU上运行C ++ MULTITHREAD,完全是ABANDON OPENCL或cuda。



我说的是提高简单PC的性能多线程41x

和一个非常复杂的opencl sw相比有12x的改进



当然对硬件和驱动程序的修改应该很多制作
The only one solution is to RUN C++ MULTITHREAD on GPU and completely ABANDON OPENCL or cuda forever.

I am speaking about increase the performance of a simple PC with multithread by 41x
And a improvement over a very complex opencl sw by 12x

Of course a lot of modifications on HW and drivers should be made


这篇关于从opencl和CUDA切换到C ++多线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆