Skip to content

Commit

Permalink
Skip cufile and nvtx3 when cuda isn't found (#455)
Browse files Browse the repository at this point in the history
Closes #444

Authors:
  - Mads R. B. Kristensen (https://github.com/madsbk)

Approvers:
  - Kyle Edwards (https://github.com/KyleFromNVIDIA)

URL: #455
  • Loading branch information
madsbk authored Sep 19, 2024
1 parent 81070aa commit e926fad
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,37 @@ rapids_find_package(
INSTALL_EXPORT_SET kvikio-exports
)

rapids_find_package(
cuFile
BUILD_EXPORT_SET kvikio-exports
INSTALL_EXPORT_SET kvikio-exports
)
if(NOT cuFile_FOUND)
message(WARNING "Building KvikIO without cuFile")
else()
file(READ "${cuFile_INCLUDE_DIRS}/cufile.h" CUFILE_H_STR)
string(FIND "${CUFILE_H_STR}" "cuFileBatchIOSetUp" cuFileBatchIOSetUp_location)
if(cuFileBatchIOSetUp_location EQUAL "-1")
set(cuFile_BATCH_API_FOUND FALSE)
else()
set(cuFile_BATCH_API_FOUND TRUE)
endif()
message(STATUS "Found cuFile Batch API: ${cuFile_BATCH_API_FOUND}")
string(FIND "${CUFILE_H_STR}" "cuFileReadAsync" cuFileReadAsync_location)
if(cuFileReadAsync_location EQUAL "-1")
set(cuFile_STREAM_API_FOUND FALSE)
if(CUDAToolkit_FOUND)
rapids_find_package(
cuFile
BUILD_EXPORT_SET kvikio-exports
INSTALL_EXPORT_SET kvikio-exports
)
if(NOT cuFile_FOUND)
message(
WARNING "Cannot find cuFile - KvikIO will still work but won't use GPUDirect Storage (GDS)"
)
else()
set(cuFile_STREAM_API_FOUND TRUE)
file(READ "${cuFile_INCLUDE_DIRS}/cufile.h" CUFILE_H_STR)
string(FIND "${CUFILE_H_STR}" "cuFileBatchIOSetUp" cuFileBatchIOSetUp_location)
if(cuFileBatchIOSetUp_location EQUAL "-1")
set(cuFile_BATCH_API_FOUND FALSE)
else()
set(cuFile_BATCH_API_FOUND TRUE)
endif()
message(STATUS "Found cuFile Batch API: ${cuFile_BATCH_API_FOUND}")
string(FIND "${CUFILE_H_STR}" "cuFileReadAsync" cuFileReadAsync_location)
if(cuFileReadAsync_location EQUAL "-1")
set(cuFile_STREAM_API_FOUND FALSE)
else()
set(cuFile_STREAM_API_FOUND TRUE)
endif()
message(STATUS "Found cuFile Stream API: ${cuFile_STREAM_API_FOUND}")
endif()
message(STATUS "Found cuFile Stream API: ${cuFile_STREAM_API_FOUND}")

include(cmake/thirdparty/get_nvtx.cmake)
endif()

include(cmake/thirdparty/get_nvtx.cmake)
include(cmake/thirdparty/get_thread_pool.cmake)

# library targets
Expand Down Expand Up @@ -129,7 +134,8 @@ target_include_directories(
"$<INSTALL_INTERFACE:include>"
)
target_link_libraries(
kvikio INTERFACE Threads::Threads ${CMAKE_DL_LIBS} nvtx3::nvtx3-cpp BS::thread_pool
kvikio INTERFACE Threads::Threads BS::thread_pool ${CMAKE_DL_LIBS}
$<TARGET_NAME_IF_EXISTS:nvtx3::nvtx3-cpp>
)
target_compile_features(kvikio INTERFACE cxx_std_17)

Expand Down

0 comments on commit e926fad

Please sign in to comment.