Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit dcf4d83

Browse files
nicolasvasilacheftynse
authored andcommitted
Use NO_CUDA_SDK rather than undefine CUDA_HOME
This commit starts a series of small cmake and configuration cleanups that will improve things when calling non-NVRTC compilers. The particular cicular change introduced by thi is to allow including `gpu.h` in NO_SDK mode more cleanly. Previously we would unset the variable CUDA_HOME but this is hacky and non intuitive in the light of the `.h.in` configuration file that will be inserted in a subsequent commit. This commit replaces the unsetting by setting a new variable NO_CUDA_SDK.
1 parent 71b01c2 commit dcf4d83

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

tc/core/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ add_library(
120120

121121
${TC_CUDA_CROSS_COMPILE_FILES}
122122
)
123-
# Unsets CUDA_HOME to compile without SDK
123+
# Sets NO_CUDA_SDK to compile without SDK
124124
set_target_properties(tc_core_cuda_no_sdk
125125
PROPERTIES COMPILE_FLAGS
126-
"${CMAKE_CXX_FLAGS} -UCUDA_HOME -Wl,--no-undefined")
126+
"${CMAKE_CXX_FLAGS} -DNO_CUDA_SDK")
127127
target_include_directories(tc_core_cuda_no_sdk PUBLIC ${LLVM_INCLUDE_DIRS})
128128
target_link_libraries(
129129
tc_core_cuda_no_sdk

tc/core/gpu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
// Conditionally include CUDA-specific headers. This file should compile even
1919
// without them.
20-
#ifdef CUDA_HOME
20+
#if defined(CUDA_HOME)
2121
#include "tc/core/cuda/cuda.h"
2222
#endif
2323

@@ -27,7 +27,7 @@ namespace tc {
2727
/// The call is forwarded to the appropriate GPU driver (CUDA in particular).
2828
/// If a thread has no associated GPU device, return 0.
2929
inline size_t querySharedMemorySize() {
30-
#ifdef CUDA_HOME
30+
#if defined(CUDA_HOME) && !defined(NO_CUDA_SDK)
3131
return CudaGPUInfo::GPUInfo().SharedMemorySize();
3232
#else
3333
return 0;

third-party/islpp

Submodule islpp updated from adefea1 to f8cf7cf

0 commit comments

Comments
 (0)