/include/caffe/common.cuh: error: function "atomicAdd(double *, double)" has already be(代码

Posted BlueOceans

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了/include/caffe/common.cuh: error: function "atomicAdd(double *, double)" has already be(代码相关的知识,希望对你有一定的参考价值。

https://stackoverflow.com/questions/39274472/error-function-atomicadddouble-double-has-already-been-defined

I finally got it working with the help of @Robert Crovella‘s comment. I had to modify the file common.cuh from the DeepLab_v2 master branch in the following way:

#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

 

以上是关于/include/caffe/common.cuh: error: function "atomicAdd(double *, double)" has already be(代码的主要内容,如果未能解决你的问题,请参考以下文章