From 567dfd74a5c092cec61de6b52ea239ea91b2ed46 Mon Sep 17 00:00:00 2001 From: Jake Awe <50372925+AyodeAwe@users.noreply.github.com> Date: Thu, 8 Jun 2023 12:26:37 -0500 Subject: [PATCH] preprocessor syntax fix (#1582) The `#if _RAFT_HAS_CUDA` references introduced in [this commit](https://github.com/rapidsai/raft/commit/6bc237fdb8cc10cacf8cbe0a2f96630a75328406) 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: https://github.com/rapidsai/raft/pull/1582 --- cpp/include/raft/core/math.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cpp/include/raft/core/math.hpp b/cpp/include/raft/core/math.hpp index f251c14e4a..50d5d85566 100644 --- a/cpp/include/raft/core/math.hpp +++ b/cpp/include/raft/core/math.hpp @@ -22,7 +22,7 @@ #include -#if _RAFT_HAS_CUDA +#if defined(_RAFT_HAS_CUDA) #include #include #endif @@ -108,7 +108,7 @@ RAFT_INLINE_FUNCTION auto cos(T x) #endif } -#if _RAFT_HAS_CUDA +#if defined(_RAFT_HAS_CUDA) template RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> cos(T x) { @@ -149,7 +149,7 @@ RAFT_INLINE_FUNCTION auto sin(T x) #endif } -#if _RAFT_HAS_CUDA +#if defined(_RAFT_HAS_CUDA) template RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> sin(T x) { @@ -219,7 +219,7 @@ RAFT_INLINE_FUNCTION auto exp(T x) #endif } -#if _RAFT_HAS_CUDA +#if defined(_RAFT_HAS_CUDA) template RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> exp(T x) { @@ -260,7 +260,7 @@ RAFT_INLINE_FUNCTION auto log(T x) #endif } -#if _RAFT_HAS_CUDA +#if defined(_RAFT_HAS_CUDA) template RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> log(T x) { @@ -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 RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> max(T x, T y) @@ -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 RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> max(T x) { @@ -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 RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> min(T x, T y) @@ -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 RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> min( T x) @@ -561,7 +561,7 @@ RAFT_INLINE_FUNCTION auto sqrt(T x) #endif } -#if _RAFT_HAS_CUDA +#if defined(_RAFT_HAS_CUDA) template RAFT_DEVICE_INLINE_FUNCTION typename std::enable_if_t, __half> sqrt(T x) {