cuda 变量空间

__device__
1)Resides in global memory space,全局共享grid
2)Has the lifetime of the CUDA context in which it is created,整个程序为声明周期
3)Has a distinct object per device,每个device唯一
4)Is accessible from all the threads within the grid and from the host through the runtime library (cudaGetSymbolAddress() / cudaGetSymbolSize() / cudaMemcpyToSymbol() / cudaMemcpyFromSymbol()).

__constant__
相当于全局常量,不会改变
1)Resides in constant memory space,
2)Has the lifetime of the CUDA context in which it is created,
3)Has a distinct object per device,
4)Is accessible from all the threads within the grid and from the host through the runtime library (cudaGetSymbolAddress() / cudaGetSymbolSize() / cudaMemcpyToSymbol() / cudaMemcpyFromSymbol()).

__shared__
1)Resides in the shared memory space of a thread block,
2)Has the lifetime of the block,
3)Has a distinct object per block,
4)Is only accessible from all the threads within the block,
5)Does not have a constant address.

参考:https://www.cnblogs.com/jugg1024/p/4354672.html

__managed__
1)Can be referenced from both device and host code
2)Has the lifetime of an application.

__restrict__

参考:
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#variable-memory-space-specifiers

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值