Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Only use nv_exec_check_disable on nvcc. #411

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cub/detail/device_synchronize.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#pragma once

#include <cub/detail/exec_check_disable.cuh>
#include <cub/util_arch.cuh>
#include <cub/util_namespace.cuh>

Expand All @@ -30,7 +31,7 @@ namespace detail
* Call `cudaDeviceSynchronize()` using the proper API for the current CUB and
* CUDA configuration.
*/
#pragma nv_exec_check_disable
CUB_EXEC_CHECK_DISABLE
CUB_RUNTIME_FUNCTION inline cudaError_t device_synchronize()
{
cudaError_t result = cudaErrorUnknown;
Expand Down
41 changes: 41 additions & 0 deletions cub/detail/exec_check_disable.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2021 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <cub/util_compiler.cuh>

/**
* @def CUB_EXEC_CHECK_DISABLE
* Wrapper around `#pragma nv_exec_check_disable`.
*/

// #pragma nv_exec_check_disable is only recognized by NVCC.
#if defined(__CUDACC__) && \
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
!defined(_NVHPC_CUDA) && \
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
!(defined(__CUDA__) && defined(__clang__))

#if CUB_HOST_COMPILER == CUB_HOST_COMPILER_MSVC
#define CUB_EXEC_CHECK_DISABLE __pragma("nv_exec_check_disable")
alliepiper marked this conversation as resolved.
Show resolved Hide resolved
#else // // !MSVC
#define CUB_EXEC_CHECK_DISABLE _Pragma("nv_exec_check_disable")
#endif // MSVC

#else // !NVCC

#define CUB_EXEC_CHECK_DISABLE

#endif // NVCC