From 8c2cda8f9e661bae9796b34e3bfb587fee31c856 Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Thu, 10 Aug 2017 17:58:36 +0000 Subject: [PATCH] add C++11 compilation flags and minor bug fixes --- .../src/deviceLib/hip_threadfence_system.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hipamd/tests/src/deviceLib/hip_threadfence_system.cpp b/hipamd/tests/src/deviceLib/hip_threadfence_system.cpp index 673cb4507a..be59d56ab1 100644 --- a/hipamd/tests/src/deviceLib/hip_threadfence_system.cpp +++ b/hipamd/tests/src/deviceLib/hip_threadfence_system.cpp @@ -21,11 +21,13 @@ THE SOFTWARE. */ /* HIT_START - * BUILD: %t %s ../test_common.cpp EXCLUDE_HIP_PLATFORM nvcc + * BUILD: %t %s ../test_common.cpp -std=c++11 * RUN: %t * HIT_END */ +#include +#include #include #include #include @@ -33,15 +35,14 @@ THE SOFTWARE. #include "hip/device_functions.h" #include "test_common.h" - #define HIP_ASSERT(x) (assert((x)==hipSuccess)) -__host__ void fence_system() { - std::atomic_thread_fence(std::memory_order_seq_cst); -} - -__device__ void fence_system() { +__host__ __device__ void fence_system() { +#ifdef __HIP_DEVICE_COMPILE__ __threadfence_system(); +#else + std::atomic_thread_fence(std::memory_order_seq_cst); +#endif } __host__ __device__ void round_robin(const int id, const int num_dev, const int num_iter, volatile int* data, volatile int* flag) {