Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip cufile and nvtx3 when cuda isn't found #455

Merged
merged 5 commits into from
Sep 19, 2024
Merged
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
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