Unverified Commit 9cad97bc authored by Zaida Zhou's avatar Zaida Zhou Committed by GitHub
Browse files

[Fix] Fix compiled error on windows (#1510)

parent 71341e9a
...@@ -37,8 +37,13 @@ __device__ __forceinline__ static void reduceMax(double *address, double val) { ...@@ -37,8 +37,13 @@ __device__ __forceinline__ static void reduceMax(double *address, double val) {
#ifdef __CUDA_ARCH__ #ifdef __CUDA_ARCH__
__device__ __forceinline__ static void reduceAdd(float *address, float val) { __device__ __forceinline__ static void reduceAdd(float *address, float val) {
#if (__CUDA_ARCH__ < 200) #if (__CUDA_ARCH__ < 200)
#ifdef _MSC_VER
#pragma message( \
"compute capability lower than 2.x. fall back to use CAS version of atomicAdd for float32")
#else
#warning \ #warning \
"compute capability lower than 2.x. fall back to use CAS version of atomicAdd for float32" "compute capability lower than 2.x. fall back to use CAS version of atomicAdd for float32"
#endif
int *address_as_i = reinterpret_cast<int *>(address); int *address_as_i = reinterpret_cast<int *>(address);
int old = *address_as_i, assumed; int old = *address_as_i, assumed;
do { do {
...@@ -53,8 +58,13 @@ __device__ __forceinline__ static void reduceAdd(float *address, float val) { ...@@ -53,8 +58,13 @@ __device__ __forceinline__ static void reduceAdd(float *address, float val) {
__device__ __forceinline__ static void reduceAdd(double *address, double val) { __device__ __forceinline__ static void reduceAdd(double *address, double val) {
#if (__CUDA_ARCH__ < 600) #if (__CUDA_ARCH__ < 600)
#ifdef _MSC_VER
#pragma message( \
"compute capability lower than 6.x. fall back to use CAS version of atomicAdd for float64")
#else
#warning \ #warning \
"compute capability lower than 6.x. fall back to use CAS version of atomicAdd for float64" "compute capability lower than 6.x. fall back to use CAS version of atomicAdd for float64"
#endif
unsigned long long *address_as_ull = unsigned long long *address_as_ull =
reinterpret_cast<unsigned long long *>(address); reinterpret_cast<unsigned long long *>(address);
unsigned long long old = *address_as_ull, assumed; unsigned long long old = *address_as_ull, assumed;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment