@@ -48,7 +48,6 @@ option(KvikIO_BUILD_BENCHMARKS "Configure CMake to build benchmarks" ON)
48
48
option (KvikIO_BUILD_EXAMPLES "Configure CMake to build examples" ON )
49
49
option (KvikIO_BUILD_TESTS "Configure CMake to build tests" ON )
50
50
option (KvikIO_REMOTE_SUPPORT "Configure CMake to build with remote IO support" ON )
51
- option (KvikIO_CUDA_SUPPORT "Configure CMake to build with CUDA support" ON )
52
51
53
52
# ##################################################################################################
54
53
# * conda environment ------------------------------------------------------------------------------
@@ -72,66 +71,65 @@ if(KvikIO_REMOTE_SUPPORT)
72
71
endif ()
73
72
endif ()
74
73
75
- set (cuFile_FOUND 0)
76
- if (KvikIO_CUDA_SUPPORT)
77
- rapids_find_package(
78
- CUDAToolkit REQUIRED
79
- BUILD_EXPORT_SET kvikio-exports
80
- INSTALL_EXPORT_SET kvikio-exports
74
+ # CUDA is now required
75
+ rapids_find_package(
76
+ CUDAToolkit REQUIRED
77
+ BUILD_EXPORT_SET kvikio-exports
78
+ INSTALL_EXPORT_SET kvikio-exports
79
+ )
80
+ include (cmake/thirdparty/get_nvtx.cmake)
81
+
82
+ if (NOT TARGET CUDA::cuFile)
83
+ set (cuFile_FOUND 0)
84
+ message (
85
+ WARNING "Cannot find cuFile - KvikIO will still work but won't use GPUDirect Storage (GDS)"
81
86
)
82
- include (cmake/thirdparty/get_nvtx.cmake)
83
-
84
- if (NOT TARGET CUDA::cuFile)
85
- message (
86
- WARNING "Cannot find cuFile - KvikIO will still work but won't use GPUDirect Storage (GDS)"
87
- )
88
- else ()
89
- set (cuFile_FOUND 1)
90
-
91
- # Check API support
92
- try_compile (
93
- cuFile_BATCH_API_FOUND SOURCE_FROM_CONTENT
94
- batch.cpp
95
- [[#include <cufile.h>
96
- int main() {
97
- cuFileBatchIOSetUp(nullptr, 0);
98
- return 0;
99
- }
100
- ]]
101
- LINK_LIBRARIES CUDA::cuFile rt ${CMAKE_DL_LIBS}
102
- OUTPUT_VARIABLE batch_output
103
- )
104
- message (STATUS "Found cuFile Batch API: ${cuFile_BATCH_API_FOUND} " )
105
- try_compile (
106
- cuFile_STREAM_API_FOUND SOURCE_FROM_CONTENT
107
- stream.cpp
108
- [[#include <cufile.h>
109
- int main() {
110
- CUfileHandle_t fh;
111
- CUstream stream;
112
- cuFileReadAsync(fh, nullptr, nullptr, nullptr, nullptr, nullptr, stream);
113
- return 0;
114
- }
115
- ]]
116
- LINK_LIBRARIES CUDA::cuFile rt ${CMAKE_DL_LIBS}
117
- OUTPUT_VARIABLE stream_output
118
- )
119
- message (STATUS "Found cuFile Stream API: ${cuFile_STREAM_API_FOUND} " )
120
- try_compile (
121
- cuFile_VERSION_API_FOUND SOURCE_FROM_CONTENT
122
- version .cpp
123
- [[#include <cufile.h>
124
- int main() {
125
- int version;
126
- cuFileGetVersion(&version);
127
- return 0;
128
- }
129
- ]]
130
- LINK_LIBRARIES CUDA::cuFile rt ${CMAKE_DL_LIBS}
131
- OUTPUT_VARIABLE version_output
132
- )
133
- message (STATUS "Found cuFile Version API: ${cuFile_VERSION_API_FOUND} " )
134
- endif ()
87
+ else ()
88
+ set (cuFile_FOUND 1)
89
+
90
+ # Check API support
91
+ try_compile (
92
+ cuFile_BATCH_API_FOUND SOURCE_FROM_CONTENT
93
+ batch.cpp
94
+ [[#include <cufile.h>
95
+ int main() {
96
+ cuFileBatchIOSetUp(nullptr, 0);
97
+ return 0;
98
+ }
99
+ ]]
100
+ LINK_LIBRARIES CUDA::cuFile rt ${CMAKE_DL_LIBS}
101
+ OUTPUT_VARIABLE batch_output
102
+ )
103
+ message (STATUS "Found cuFile Batch API: ${cuFile_BATCH_API_FOUND} " )
104
+ try_compile (
105
+ cuFile_STREAM_API_FOUND SOURCE_FROM_CONTENT
106
+ stream.cpp
107
+ [[#include <cufile.h>
108
+ int main() {
109
+ CUfileHandle_t fh;
110
+ CUstream stream;
111
+ cuFileReadAsync(fh, nullptr, nullptr, nullptr, nullptr, nullptr, stream);
112
+ return 0;
113
+ }
114
+ ]]
115
+ LINK_LIBRARIES CUDA::cuFile rt ${CMAKE_DL_LIBS}
116
+ OUTPUT_VARIABLE stream_output
117
+ )
118
+ message (STATUS "Found cuFile Stream API: ${cuFile_STREAM_API_FOUND} " )
119
+ try_compile (
120
+ cuFile_VERSION_API_FOUND SOURCE_FROM_CONTENT
121
+ version .cpp
122
+ [[#include <cufile.h>
123
+ int main() {
124
+ int version;
125
+ cuFileGetVersion(&version);
126
+ return 0;
127
+ }
128
+ ]]
129
+ LINK_LIBRARIES CUDA::cuFile rt ${CMAKE_DL_LIBS}
130
+ OUTPUT_VARIABLE version_output
131
+ )
132
+ message (STATUS "Found cuFile Version API: ${cuFile_VERSION_API_FOUND} " )
135
133
endif ()
136
134
137
135
include (cmake/thirdparty/get_thread_pool.cmake)
@@ -181,7 +179,7 @@ add_library(kvikio::kvikio ALIAS kvikio)
181
179
target_include_directories (
182
180
kvikio
183
181
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include>"
184
- "$<BUILD_INTERFACE:$<$<BOOL: ${KvikIO_CUDA_SUPPORT} >: ${ CUDAToolkit_INCLUDE_DIRS}> >"
182
+ "$<BUILD_INTERFACE:${ CUDAToolkit_INCLUDE_DIRS} >"
185
183
INTERFACE "$<INSTALL_INTERFACE:include>"
186
184
)
187
185
@@ -195,7 +193,6 @@ target_link_libraries(
195
193
target_compile_definitions (
196
194
kvikio
197
195
PUBLIC $<$<BOOL :${KvikIO_REMOTE_SUPPORT} >:KVIKIO_LIBCURL_FOUND>
198
- $<$<BOOL :${KvikIO_CUDA_SUPPORT} >:KVIKIO_CUDA_FOUND>
199
196
$<$<BOOL :${cuFile_FOUND} >:KVIKIO_CUFILE_FOUND>
200
197
$<$<BOOL :${cuFile_BATCH_API_FOUND} >:KVIKIO_CUFILE_BATCH_API_FOUND>
201
198
$<$<BOOL :${cuFile_STREAM_API_FOUND} >:KVIKIO_CUFILE_STREAM_API_FOUND>
@@ -231,10 +228,7 @@ if(KvikIO_BUILD_EXAMPLES)
231
228
add_subdirectory (examples)
232
229
endif ()
233
230
234
- if (CUDAToolkit_FOUND
235
- AND KvikIO_BUILD_TESTS
236
- AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME
237
- )
231
+ if (KvikIO_BUILD_TESTS AND CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME )
238
232
include (cmake/thirdparty/get_gtest.cmake)
239
233
240
234
# include CTest module -- automatically calls enable_testing()
@@ -271,7 +265,6 @@ Provide targets for KvikIO.
271
265
272
266
set (final_code_string
273
267
"
274
- set(KvikIO_CUDA_SUPPORT [=[${KvikIO_CUDA_SUPPORT} ]=])
275
268
set(KvikIO_CUFILE_SUPPORT [=[${cuFile_FOUND} ]=])
276
269
set(KvikIO_REMOTE_SUPPORT [=[${KvikIO_REMOTE_SUPPORT} ]=])
277
270
"
@@ -280,13 +273,11 @@ string(
280
273
APPEND
281
274
final_code_string
282
275
[=[
283
- if(KvikIO_CUDA_SUPPORT)
284
- find_package(CUDAToolkit REQUIRED QUIET)
285
- target_include_directories(kvikio::kvikio INTERFACE ${CUDAToolkit_INCLUDE_DIRS})
276
+ find_package(CUDAToolkit REQUIRED QUIET)
277
+ target_include_directories(kvikio::kvikio INTERFACE ${CUDAToolkit_INCLUDE_DIRS})
286
278
287
- if(KvikIO_CUFILE_SUPPORT AND NOT TARGET CUDA::cuFile)
288
- message(FATAL_ERROR "Compiled with cuFile support but cuFile not found")
289
- endif()
279
+ if(KvikIO_CUFILE_SUPPORT AND NOT TARGET CUDA::cuFile)
280
+ message(FATAL_ERROR "Compiled with cuFile support but cuFile not found")
290
281
endif()
291
282
]=]
292
283
)
0 commit comments