嗨我对CUDA中的编程有疑问.我有以下代码:
int main () {
for (;;) {
kernel_1 (x1, x2, ....);
kernel_2 (x1, x2 ...);
kernel_3_Reduction (x1);
// code manipulation host_x1
// Copy the pointer device to host
cpy (host_x1, x1, DeviceToHost)
cpu_code_x1_manipulation;
kernel_ (x1, x2, ....);
}
}
Run Code Online (Sandbox Code Playgroud)
所以当副本发出时,我如何确保kernel_1,kernel_2 kernel_3并完成了他们的任务?
Eug*_*ene 10
在同一个流上启动的所有操作都是同步的.在上面的代码中,所有内核将一个接一个地运行.如果需要并行运行kernel_1和kernel_2,则必须显式指定流.
| 归档时间: |
|
| 查看次数: |
6342 次 |
| 最近记录: |