产品 |
是否支持 |
---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
在当前进程或线程中显式创建一个Context。
aclError aclrtCreateContext(aclrtContext *context, int32_t deviceId)
参数名 |
输入/输出 |
说明 |
---|---|---|
context |
输出 |
Context的指针。 |
deviceId |
输入 |
在指定的Device下创建Context。 用户调用aclrtGetDeviceCount接口获取可用的Device数量后,这个Device ID的取值范围:[0, (可用的Device数量-1)] |
返回0表示成功,返回其他值表示失败,请参见aclError。
型号 |
默认Stream的说明 |
---|---|
调用本接口创建的Context中包含2个Stream,1个默认Stream和1个执行内部同步的Stream。 |
|
调用本接口创建的Context中包含1个默认Stream。 |
如果在应用程序中没有调用aclrtSetDevice接口,那么在首次调用aclrtCreateContext接口时,系统内部会根据该接口传入的Device ID,为该Device绑定一个默认Stream(一个Device仅绑定一个默认Stream),因此在首次调用aclrtCreateContext接口时,占用的Stream数量 = Device上绑定的默认Stream + Context中包含的Stream。