Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带long-long int的CUDA atomicAdd()_Cuda_Int_Add_Atomic_Long Integer - Fatal编程技术网

带long-long int的CUDA atomicAdd()

带long-long int的CUDA atomicAdd(),cuda,int,add,atomic,long-integer,Cuda,Int,Add,Atomic,Long Integer,每当我尝试将atomicAdd与(*int,int)以外的任何内容一起使用时,我都会遇到以下错误: error: no instance of overloaded function "atomicAdd" matches the argument list 但是我需要使用比int更大的数据类型。这里有解决办法吗 设备查询: /usr/local/cuda/samples/1_Utilities/deviceQuery/deviceQuery Starting... CUDA Device

每当我尝试将
atomicAdd
(*int,int)
以外的任何内容一起使用时,我都会遇到以下错误:

error: no instance of overloaded function "atomicAdd" matches the argument list
但是我需要使用比
int
更大的数据类型。这里有解决办法吗

设备查询:

/usr/local/cuda/samples/1_Utilities/deviceQuery/deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 680"
  CUDA Driver Version / Runtime Version          5.0 / 5.0
  CUDA Capability Major/Minor version number:    3.0
  Total amount of global memory:                 4095 MBytes (4294246400 bytes)
  ( 8) Multiprocessors x (192) CUDA Cores/MP:    1536 CUDA Cores
  GPU Clock rate:                                1084 MHz (1.08 GHz)
  Memory Clock rate:                             3004 Mhz
  Memory Bus Width:                              256-bit
  L2 Cache Size:                                 524288 bytes
  Max Texture Dimension Size (x,y,z)             1D=(65536), 2D=(65536,65536), 3D=(4096,4096,4096)
  Max Layered Texture Size (dim) x layers        1D=(16384) x 2048, 2D=(16384,16384) x 2048
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 65536
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  2048
  Maximum number of threads per block:           1024
  Maximum sizes of each dimension of a block:    1024 x 1024 x 64
  Maximum sizes of each dimension of a grid:     2147483647 x 65535 x 65535
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Device PCI Bus ID / PCI location ID:           1 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 5.0, CUDA Runtime Version = 5.0, NumDevs = 1, Device0 = GeForce GTX 680
/usr/local/cuda/samples/1\u实用程序/deviceQuery/deviceQuery正在启动。。。
CUDA设备查询(运行时API)版本(CUDART静态链接)
检测到1个支持CUDA的设备
设备0:“GeForce GTX 680”
CUDA驱动程序版本/运行时版本5.0/5.0
CUDA能力主要/次要版本号:3.0
全局内存总量:4095 MB(4294246400字节)
(8)多处理器x(192)个CUDA核/MP:1536个CUDA核
GPU时钟频率:1084 MHz(1.08 GHz)
内存时钟频率:3004 Mhz
内存总线宽度:256位
二级缓存大小:524288字节
最大纹理尺寸大小(x,y,z)1D=(65536),2D=(6553665536),3D=(40964096)
最大分层纹理大小(dim)x层1D=(16384)x 2048,2D=(1638416384)x 2048
恒定内存总量:65536字节
每个块的共享内存总量:49152字节
每个块可用的寄存器总数:65536
经纱尺寸:32
每个多处理器的最大线程数:2048
每个块的最大线程数:1024
块的每个维度的最大大小:1024 x 1024 x 64
网格各尺寸的最大尺寸:2147483647 x 65535 x 65535
最大内存间距:2147483647字节
纹理对齐:512字节
并发复制和内核执行:是,使用1个复制引擎
内核的运行时间限制:是
集成GPU共享主机内存:否
支持主机页锁定内存映射:是
表面对齐要求:是
设备具有ECC支持:已禁用
设备支持统一寻址(UVA):是
设备PCI总线ID/PCI位置ID:1/0
计算模式:

deviceQuery,CUDA驱动程序=CUDART,CUDA驱动程序版本=5.0,CUDA运行时版本=5.0,NumDevs=1,Device0=GeForce GTX 680

我猜编译标志是错误的。如果您正在查找int以外的任何内容,则应使用sm_12或更高版本

如Robert Crovella所述,支持
无符号长整型
变量,但不支持
长整型

从以下位置使用代码:


您可以使用
无符号长整型
吗?还是必须是
长整型
?如果可以使用未签名的版本,它应该可以工作。如果必须使用带符号的64位版本,则可以使用Atomicca为任意原子访问创建中给出的示例的变体。如果您需要帮助,请相应地作出答复,我可以给您一个例子。为什么未签名的长long int /COD>在文档中出现为 AddiICAddio.()/Cuthor,而不是<代码>未签名的长INT//C> >?@ ADAM27。我猜想是英伟达架构上的,
long
int
的大小相同,但
long-long-int
更大。
#include <iostream>

using namespace std;

__global__ void inc(unsigned long long int *foo) {
  atomicAdd(foo, 1);
}

int main() {
  unsigned long long int count = 0, *cuda_count;
  cudaMalloc((void**)&cuda_count, sizeof(unsigned long long int));
  cudaMemcpy(cuda_count, &count, sizeof(unsigned long long int), cudaMemcpyHostToDevice);
  cout << "count: " << count << '\n';
  inc <<< 100, 25 >>> (cuda_count);
  cudaMemcpy(&count, cuda_count, sizeof(unsigned long long int), cudaMemcpyDeviceToHost);
  cudaFree(cuda_count);
  cout << "count: " << count << '\n';
  return 0;
}
count: 0
count: 2500