is_valid
产品支持情况
- Ascend 950PR/Ascend 950DT:支持
- Atlas A3 训练系列产品/Atlas A3 推理系列产品:不支持
- Atlas A2 训练系列产品/Atlas A2 推理系列产品:不支持
- Atlas 200I/500 A2 推理产品:不支持
- Atlas 推理系列产品AI Core:不支持
- Atlas 推理系列产品Vector Core:不支持
- Atlas 训练系列产品:不支持
功能说明
判断当前grid_group是否可使用sync()接口进行跨线程块同步。grid_group默认支持同步功能,因此接口固定返回true。
函数原型
bool is_valid() const
参数说明
无
返回值说明
固定返回true
约束说明
仅支持SIMT编程场景,不支持SIMD与SIMT混合编程场景。
调用示例
-
SIMT编程场景:
using namespace cooperative_groups; __global__ void simt_kernel(...) { ... grid_group g = this_grid(); if (g.is_valid()) { g.sync(); } ... }