error: function "atomicAdd(double *, double)" has already been defined错误解决方法
来源:互联网 发布:淘宝开店电脑认证入口 编辑:程序博客网 时间:2024/05/21 09:17
error: function "atomicAdd(double *, double)" has already been defined错误解决方法
cuda 8.0 提供了对atomicAdd的定义,但atomicAdd在之前的cuda toolkit中并未出现,因此一些程序自定义了atomicAdd函数。
因此,在atomicAdd前添加宏判断即可。
对文件修改成如下即可:
#ifndef CAFFE_COMMON_CUH_#define CAFFE_COMMON_CUH_#include <cuda.h> #if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 600 #else static __inline__ __device__ double atomicAdd(double *address, double val) { unsigned long long int* address_as_ull = (unsigned long long int*)address; unsigned long long int old = *address_as_ull, assumed; if (val==0.0) return __longlong_as_double(old); do { assumed = old; old = atomicCAS(address_as_ull, assumed, __double_as_longlong(val +__longlong_as_double(assumed))); } while (assumed != old); return __longlong_as_double(old); } #endif#endif
阅读全文
0 0
- error: function "atomicAdd(double *, double)" has already been defined错误解决方法
- error: function "atomicAdd(double *, double)" has already been defined
- 编译cuda源程序时出错 error: function “atomicAdd(double *, double)” has already been defined
- caffe/common.cu error: function atomicadd has already been defined
- error: Attribute "buttonBarStyle" has already been defined
- 引用工程时 error: Attribute "color" has already been defined
- Error:(2) Attribute "titleTextColor" has already been defined
- The entry '**' has already been added错误的解决方法
- Attribute "XXX" has already been defined
- Attribute "XXX" has already been defined
- Attribute "roundWidth" has already been defined
- error:Fingerprint has already been taken
- matlab错误:Function 'conv2' is not defined for values of class 'double' and attributes
- weblogic Connection has already been closed解决方法
- error LNK2005: already defined错误
- boost\asio fatal error C1189: #error : WinSock.h has already been included错误处理
- Attribute "xxx" has already been defined
- Android 问题:Attribute "xxx" has already been defined
- java.net.URISyntaxException: Illegal character in scheme name at index 0:
- 第十周项目1
- LeetCode 406. Queue Reconstruction by Height
- vue实战--SPA的实现思路
- Sticks (dfs经典剪枝)
- error: function "atomicAdd(double *, double)" has already been defined错误解决方法
- 杨强:深度学习、强化学习、迁移学习的结合及应用进展
- OpenGL Blending
- 从YouTube改版看“移动优先”——8个移动优先网站设计案例赏析
- (转)Python中的绝对路径和相对路径
- CentOS搭建Socks5 Proxy代理服务器
- 操作系统基础训练十个问题及解答
- bzoj 1901: Zju2112 Dynamic Rankings
- SpringBoot MySql Druid配置主从数据源(多个数据源)