From e926fadbe74908b22784b5b924c4697a8dd590a8 Mon Sep 17 00:00:00 2001 From: "Mads R. B. Kristensen" Date: Thu, 19 Sep 2024 08:12:54 +0200 Subject: [PATCH] Skip cufile and nvtx3 when cuda isn't found (#455) Closes #444 Authors: - Mads R. B. Kristensen (https://github.com/madsbk) Approvers: - Kyle Edwards (https://github.com/KyleFromNVIDIA) URL: https://github.com/rapidsai/kvikio/pull/455 --- cpp/CMakeLists.txt | 52 ++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index f4f3f13109..6a4f89a0d7 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -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 @@ -129,7 +134,8 @@ target_include_directories( "$" ) 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_compile_features(kvikio INTERFACE cxx_std_17)