简体   繁体   English

以下cuda Kernel语法的含义

[英]Meaning of following syntax of cuda Kernel

What is meaning of following syntax: 以下语法的含义是什么:

Kernel_fun<<<256, 128, 2056>>>(arg1, arg2, arg3);

Which value indicates workgroup and which value indicates thread. 哪个值表示工作组,哪个值表示线程。

From the CUDA Programming Guide , appendix B.22 (as of May 2019): CUDA编程指南 ,附录B.22(截至2019年5月):

The execution configuration is specified by inserting an expression of the form <<< Dg, Db, Ns, S >>> between the function name and the parenthesized argument list, where: 通过在函数名和带括号的参数列表之间插入<<< Dg,Db,Ns,S >>>形式的表达式来指定执行配置,其中:

  • Dg is of type dim3 (see Section B.3.2) and specifies the dimension and size of the grid, such that Dg.x * Dg.y * Dg.z equals the number of blocks being launched; Dg的类型为dim3(参见B.3.2节)并指定网格的尺寸和大小,使得Dg.x * Dg.y * Dg.z等于正在启动的块数; Dg.z must be equal to 1 for devices of compute capability 1.x; 对于计算能力为1.x的设备,Dg.z必须等于1;

  • Db is of type dim3 (see Section B.3.2) and specifies the dimension and size of each block, such that Db.x * Db.y * Db.z equals the number of threads per block; Db的类型为dim3(参见第B.3.2节)并指定每个块的尺寸和大小,使得Db.x * Db.y * Db.z等于每个块的线程数;

  • Ns is of type size_t and specifies the number of bytes in shared memory that is dynamically allocated per block for this call in addition to the statically allocated memory; Ns的类型为size_t,并指定除了静态分配的内存之外,每个块为此调用动态分配的共享内存中的字节数。 this dynamically allocated memory is used by any of the variables declared as an external array as mentioned in Section B.2.3; 这个动态分配的内存被声明为外部数组的任何变量使用,如B.2.3节所述; Ns is an optional argument which defaults to 0; Ns是一个可选参数,默认为0;

  • S is of type cudaStream_t and specifies the associated stream; S的类型为cudaStream_t,并指定相关的流; S is an optional argument which defaults to 0. S是可选参数,默认为0。

In short: <<< number of blocks, number of threads, dynamic memory per block, associated stream >>> 简而言之: <<< number of blocks, number of threads, dynamic memory per block, associated stream >>>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM