Skip to content

Commit

Permalink
Adding ifdefs around nvcc-specific pragmas (#13110)
Browse files Browse the repository at this point in the history
This change wraps the NVCC-specific `#pragma` macros inside an `ifdef` to prevent compilation warnings as described in issue #13106

closes #13106

Authors:
  - Mike Wilson (https://github.com/hyperbolic2346)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Nghia Truong (https://github.com/ttnghia)

URL: #13110
  • Loading branch information
hyperbolic2346 authored Apr 11, 2023
1 parent cab6522 commit e9e86f4
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cpp/include/cudf/column/column_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,13 @@ class column_view : public detail::column_view_base {
// they then end up being called by a simple __host__ function
// (eg std::vector destructor) you get a compile error because you're trying to
// call a __host__ __device__ function from a __host__ function.
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
~column_view() = default;
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
column_view(column_view const&) = default; ///< Copy constructor
column_view(column_view&&) = default; ///< Move constructor
/**
Expand Down
8 changes: 8 additions & 0 deletions cpp/include/cudf/detail/aggregation/aggregation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,9 @@ AGG_KIND_MAPPING(aggregation::VARIANCE, var_aggregation);
* @param args Parameter pack forwarded to the `operator()` invocation
* @return Forwards the return value of the callable.
*/
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <typename F, typename... Ts>
CUDF_HOST_DEVICE inline decltype(auto) aggregation_dispatcher(aggregation::Kind k,
F&& f,
Expand Down Expand Up @@ -1478,7 +1480,9 @@ CUDF_HOST_DEVICE inline decltype(auto) aggregation_dispatcher(aggregation::Kind

template <typename Element>
struct dispatch_aggregation {
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <aggregation::Kind k, typename F, typename... Ts>
CUDF_HOST_DEVICE inline decltype(auto) operator()(F&& f, Ts&&... args) const
{
Expand All @@ -1487,7 +1491,9 @@ struct dispatch_aggregation {
};

struct dispatch_source {
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <typename Element, typename F, typename... Ts>
CUDF_HOST_DEVICE inline decltype(auto) operator()(aggregation::Kind k, F&& f, Ts&&... args) const
{
Expand All @@ -1511,7 +1517,9 @@ struct dispatch_source {
* @param args Parameter pack forwarded to the `operator()` invocation
* `F`.
*/
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <typename F, typename... Ts>
CUDF_HOST_DEVICE inline constexpr decltype(auto) dispatch_type_and_aggregation(data_type type,
aggregation::Kind k,
Expand Down
4 changes: 4 additions & 0 deletions cpp/include/cudf/detail/interop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@
// We disable warning 611 because the `arrow::TableBatchReader` only partially
// override the `ReadNext` method of `arrow::RecordBatchReader::ReadNext`
// triggering warning 611-D from nvcc.
#ifdef __CUDACC__
#pragma nv_diag_suppress 611
#pragma nv_diag_suppress 2810
#endif
#include <arrow/api.h>
#ifdef __CUDACC__
#pragma nv_diag_default 611
#pragma nv_diag_default 2810
#endif

#include <cudf/interop.hpp>
#include <cudf/utilities/default_stream.hpp>
Expand Down
6 changes: 5 additions & 1 deletion cpp/include/cudf/interop.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020-2022, NVIDIA CORPORATION.
* Copyright (c) 2020-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,15 @@
// We disable warning 611 because the `arrow::TableBatchReader` only partially
// override the `ReadNext` method of `arrow::RecordBatchReader::ReadNext`
// triggering warning 611-D from nvcc.
#ifdef __CUDACC__
#pragma nv_diag_suppress 611
#pragma nv_diag_suppress 2810
#endif
#include <arrow/api.h>
#ifdef __CUDACC__
#pragma nv_diag_default 611
#pragma nv_diag_default 2810
#endif

#include <cudf/column/column.hpp>
#include <cudf/detail/transform.hpp>
Expand Down
8 changes: 8 additions & 0 deletions cpp/include/cudf/io/datasource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,24 @@
// We disable warning 611 because some Arrow subclasses of
// `arrow::fs::FileSystem` only partially override the `Equals` method,
// triggering warning 611-D from nvcc.
#ifdef __CUDACC__
#pragma nv_diag_suppress 611
#endif
#include <arrow/filesystem/filesystem.h>
#include <arrow/filesystem/s3fs.h>
#ifdef __CUDACC__
#pragma nv_diag_default 611
#endif

// We disable warning 2810 to workaround the compile issue (warning treated as error):
// result.h(263): error #2810-D: ignoring return value type with "nodiscard" attribute
#ifdef __CUDACC__
#pragma nv_diag_suppress 2810
#endif
#include <arrow/result.h>
#ifdef __CUDACC__
#pragma nv_diag_default 2810
#endif

#include <arrow/io/file.h>
#include <arrow/io/interfaces.h>
Expand Down
8 changes: 8 additions & 0 deletions cpp/include/cudf/utilities/type_dispatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ using scalar_device_type_t = typename type_to_scalar_type_impl<T>::ScalarDeviceT
*/
// This pragma disables a compiler warning that complains about the valid usage
// of calling a __host__ functor from this function which is __host__ __device__
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <template <cudf::type_id> typename IdTypeMap = id_to_type_impl,
typename Functor,
typename... Ts>
Expand Down Expand Up @@ -540,7 +542,9 @@ CUDF_HOST_DEVICE __forceinline__ constexpr decltype(auto) type_dispatcher(cudf::
namespace detail {
template <typename T1>
struct double_type_dispatcher_second_type {
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <typename T2, typename F, typename... Ts>
CUDF_HOST_DEVICE __forceinline__ decltype(auto) operator()(F&& f, Ts&&... args) const
{
Expand All @@ -550,7 +554,9 @@ struct double_type_dispatcher_second_type {

template <template <cudf::type_id> typename IdTypeMap>
struct double_type_dispatcher_first_type {
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <typename T1, typename F, typename... Ts>
CUDF_HOST_DEVICE __forceinline__ decltype(auto) operator()(cudf::data_type type2,
F&& f,
Expand Down Expand Up @@ -580,7 +586,9 @@ struct double_type_dispatcher_first_type {
*
* @return The result of invoking `f.template operator<T1, T2>(args)`
*/
#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
template <template <cudf::type_id> typename IdTypeMap = id_to_type_impl, typename F, typename... Ts>
CUDF_HOST_DEVICE __forceinline__ constexpr decltype(auto) double_type_dispatcher(
cudf::data_type type1, cudf::data_type type2, F&& f, Ts&&... args)
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/quantiles/quantiles_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ struct quantile_index {
}
};

#ifdef __CUDACC__
#pragma nv_exec_check_disable
#endif
/* @brief computes a quantile value.
*
* Computes a value for a quantile by interpolating between two values on either
Expand Down

0 comments on commit e9e86f4

Please sign in to comment.