Concurrently running two for loops with same number of loop cycles involving GPU and CPU tasks on two GPU

ε祈祈猫儿з 提交于 2019-12-13 04:33:23

问题


I have two for loops in my code running the same number of loop cycles. These two loops are independent (each loop works on different input data). Within one loop, there are CPU functions and several kernels not running concurrently.

Can I run these iterations on separate GPUs?


回答1:


You can run the involved kernels separately on two different GPUs.

You have to take care about synchronization of the CPU processings on the partial outcomes of the two GPUs. Due to the presence of a sequential part, you will perhaps not experience the maximum possible speedup factor of 2 when working with 2 GPUs.

Starting with CUDA 4.0, you can use cudaSetDevice() to set the current context corresponding to a given device without the need of creating streams to enable multi-gpu processing.



来源:https://stackoverflow.com/questions/18607430/concurrently-running-two-for-loops-with-same-number-of-loop-cycles-involving-gpu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!