Skip to content

Commit

Permalink
Merge pull request #5760 from dalg24/desul_atomics_gnu_and_msvc
Browse files Browse the repository at this point in the history
Desul atomics cleanup enable GCC or MSVC atomics
  • Loading branch information
dalg24 authored Jan 12, 2023
2 parents 7f883bc + 1f68ab4 commit 02941a0
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions tpls/desul/include/desul/atomics/Macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,16 @@ SPDX-License-Identifier: (BSD-3-Clause)

// Macros

#if (!defined(__CUDA_ARCH__) || !defined(__NVCC__)) && \
(!defined(__HIP_DEVICE_COMPILE) || !defined(__HIP_PLATFORM_HCC__)) && \
!defined(__SYCL_DEVICE_ONLY__) && !defined(DESUL_HAVE_OPENMP_ATOMICS)
#define DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS
#endif

// ONLY use GNUC atomics if not compiling for the device
// and we didn't explicitly say to use OpenMP atomics
#if defined(__GNUC__) && defined(DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS)
// ONLY use GNUC atomics if not explicitly say to use OpenMP atomics
#if !defined(DESUL_HAVE_OPENMP_ATOMICS) && defined(__GNUC__)
#define DESUL_HAVE_GCC_ATOMICS
#endif

// Equivalent to above: if we are compiling for the device we
// need to use CUDA/HIP/SYCL atomics instead of MSVC atomics
#if defined(_MSC_VER) && defined(DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS)
// Equivalent to above for MSVC atomics
#if !defined(DESUL_HAVE_OPENMP_ATOMICS) && defined(_MSC_VER)
#define DESUL_HAVE_MSVC_ATOMICS
#endif

#undef DESUL_IMPL_HAVE_GCC_OR_MSVC_ATOMICS

#ifdef __CUDACC__
#define DESUL_HAVE_CUDA_ATOMICS
#endif
Expand Down

0 comments on commit 02941a0

Please sign in to comment.