构造函数
产品支持情况
产品 |
是否支持 |
|---|---|
Atlas 350 加速卡 |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
功能说明
coalesced_group不提供默认的构造函数,用户使用coalesced_threads函数创建coalesced_group对象。
函数原型
1 | coalesced_group coalesced_threads() |
参数说明
无
返回值说明
返回一个coalesced_group对象,该对象包含当前Warp内所有活跃的线程。
约束说明
无
调用示例
- SIMT编程场景:
1 2 3 4 5 6 7 8 9
using namespace cooperative_groups; __global__ void simt_kernel(...) { ... if (threadIdx.x % 2 == 0) { coalesced_group active = coalesced_threads(); // 该coalesced_group中包含一个warp内所有线程id为偶数的线程 } ... }
- SIMD与SIMT混合编程场景:
1 2 3 4 5 6 7 8 9
using namespace cooperative_groups; __simt_vf__ inline void simt_kernel(...) { ... if (threadIdx.x % 2 == 0) { coalesced_group active = coalesced_threads(); // 该coalesced_group中包含一个warp内所有线程id为偶数的线程 } ... }
父主题: coalesced_group