gpt4 book ai didi

concurrency - 使用 CUDA 为 GPU 同时启动多个内核

转载 作者:行者123 更新时间:2023-12-04 16:41:34 36 4
gpt4 key购买 nike

是否可以同时启动两个执行独立任务的内核。例如,如果我有这个 Cuda 代码

// host and device initialization
.......
.......

// launch kernel1
myMethod1 <<<.... >>> (params);

// launch kernel2
myMethod2 <<<.....>>> (params);

假设这些内核是独立的,是否有一种工具可以同时启动它们,为每个内核分配几个网格/块。 CUDA/OpenCL 有没有这个规定。

最佳答案

只有具有 CUDA 计算能力 2.0 及更高版本(即 Fermi)的设备才能支持多个并发内核执行。请参阅 CUDA 3.0 编程指南的第 3.2.6.3 节,其中指出:

Some devices of compute capability 2.0 can execute multiple kernels concurrently. Applications may query this capability by calling cudaGetDeviceProperties() and checking the concurrentKernels property.

The maximum number of kernel launches that a device can execute concurrently is four.

A kernel from one CUDA context cannot execute concurrently with a kernel from another CUDA context.

Kernels that use many textures or a large amount of local memory are less likely to execute concurrently with other kernels.

关于concurrency - 使用 CUDA 为 GPU 同时启动多个内核,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3034971/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com