Skip to content

Commit

Permalink
preprocessor syntax fix (#1582)
Browse files Browse the repository at this point in the history
The `#if _RAFT_HAS_CUDA` references introduced in [this commit](6bc237f) seems to have broken the `clang-tidy-check` that runs in `cugraph-ops`, as shown in the cugraph GHA logs

This PR updates all the `#if _RAFT_HAS_CUDA` references to `#if defined(_RAFT_HAS_CUDA)` as shown in the [official docs](https://en.cppreference.com/w/cpp/preprocessor/conditional).

Authors:
  - Jake Awe (https://github.com/AyodeAwe)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #1582
  • Loading branch information
AyodeAwe authored Jun 8, 2023
1 parent a995c5b commit 567dfd7
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cpp/include/raft/core/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <raft/core/detail/macros.hpp>

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
#include <cuda_bf16.h>
#include <cuda_fp16.h>
#endif
Expand Down Expand Up @@ -108,7 +108,7 @@ RAFT_INLINE_FUNCTION auto cos(T x)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> cos(T x)
{
Expand Down Expand Up @@ -149,7 +149,7 @@ RAFT_INLINE_FUNCTION auto sin(T x)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> sin(T x)
{
Expand Down Expand Up @@ -219,7 +219,7 @@ RAFT_INLINE_FUNCTION auto exp(T x)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> exp(T x)
{
Expand Down Expand Up @@ -260,7 +260,7 @@ RAFT_INLINE_FUNCTION auto log(T x)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> log(T x)
{
Expand Down Expand Up @@ -339,7 +339,7 @@ RAFT_INLINE_FUNCTION auto max(const T1& x, const T2& y)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> max(T x,
T y)
Expand Down Expand Up @@ -381,7 +381,7 @@ constexpr RAFT_INLINE_FUNCTION auto max(const T& x)
return x;
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> max(T x)
{
Expand Down Expand Up @@ -461,7 +461,7 @@ RAFT_INLINE_FUNCTION auto min(const T1& x, const T2& y)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> min(T x,
T y)
Expand Down Expand Up @@ -503,7 +503,7 @@ constexpr RAFT_INLINE_FUNCTION auto min(const T& x)
return x;
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, nv_bfloat16>, __half> min(
T x)
Expand Down Expand Up @@ -561,7 +561,7 @@ RAFT_INLINE_FUNCTION auto sqrt(T x)
#endif
}

#if _RAFT_HAS_CUDA
#if defined(_RAFT_HAS_CUDA)
template <typename T>
RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t<std::is_same_v<T, __half>, __half> sqrt(T x)
{
Expand Down

0 comments on commit 567dfd7

Please sign in to comment.