From 2cfae19897777c10ad598c86915df20ffe3dafe4 Mon Sep 17 00:00:00 2001 From: "Mads R. B. Kristensen" Date: Wed, 15 May 2024 08:49:34 +0200 Subject: [PATCH] Revert "Defer cuFile feature checks until finding kvikio package (#342)" This reverts commit c434cef59af574af949875c8a436c1e15839edea. --- cpp/CMakeLists.txt | 61 ++++++++----------------------------- cpp/examples/CMakeLists.txt | 14 +-------- 2 files changed, 14 insertions(+), 61 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5bbfb586b6..dedce71f77 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2021-2024, NVIDIA CORPORATION. +# Copyright (c) 2021-2023, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -70,14 +70,14 @@ else() else() set(cuFile_BATCH_API_FOUND TRUE) endif() - message(STATUS "Found cuFile Batch API: ${cuFile_BATCH_API_FOUND}") + message(STATUS "Found cuFile's 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}") + message(STATUS "Found cuFile's Stream API: ${cuFile_STREAM_API_FOUND}") endif() # library targets @@ -91,6 +91,16 @@ target_include_directories( target_link_libraries(kvikio INTERFACE Threads::Threads) target_link_libraries(kvikio INTERFACE CUDA::toolkit) +if(cuFile_FOUND) + target_link_libraries(kvikio INTERFACE cufile::cuFile_interface) + target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_FOUND) + if(cuFile_BATCH_API_FOUND) + target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_BATCH_API_FOUND) + endif() + if(cuFile_STREAM_API_FOUND) + target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_STREAM_API_FOUND) + endif() +endif() target_link_libraries(kvikio INTERFACE ${CMAKE_DL_LIBS}) target_compile_features(kvikio INTERFACE cxx_std_17) @@ -127,56 +137,12 @@ Provide targets for KvikIO: C++ bindings for cuFile. ]=] ) -set(final_code_string - [=[ -get_property(already_set_kvikio DIRECTORY PROPERTY kvikio_already_set_defines SET) -if(NOT already_set_kvikio) - set_property(DIRECTORY PROPERTY kvikio_already_set_defines "ON") - - # Find cuFile and determine which features are supported - find_package(cuFile QUIET) - if(NOT cuFile_FOUND) - message(WARNING "KvikIO: cuFile not found") - 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 "KvikIO: 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 "KvikIO: Found cuFile Stream API: ${cuFile_STREAM_API_FOUND}") - endif() - - # Enable supported cuFile features in KvikIO - if(cuFile_FOUND) - target_link_libraries(kvikio::kvikio INTERFACE cufile::cuFile_interface) - target_compile_definitions(kvikio::kvikio INTERFACE KVIKIO_CUFILE_FOUND) - if(cuFile_BATCH_API_FOUND) - target_compile_definitions(kvikio::kvikio INTERFACE KVIKIO_CUFILE_BATCH_API_FOUND) - endif() - if(cuFile_STREAM_API_FOUND) - target_compile_definitions(kvikio::kvikio INTERFACE KVIKIO_CUFILE_STREAM_API_FOUND) - endif() - endif() -endif() -]=] -) - rapids_export( INSTALL kvikio EXPORT_SET kvikio-exports GLOBAL_TARGETS kvikio NAMESPACE kvikio:: DOCUMENTATION doc_string - FINAL_CODE_BLOCK final_code_string ) # build export targets @@ -186,5 +152,4 @@ rapids_export( GLOBAL_TARGETS kvikio NAMESPACE kvikio:: DOCUMENTATION doc_string - FINAL_CODE_BLOCK final_code_string ) diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt index 42b646022c..bb653ed8fb 100644 --- a/cpp/examples/CMakeLists.txt +++ b/cpp/examples/CMakeLists.txt @@ -1,5 +1,5 @@ # ============================================================================= -# Copyright (c) 2021-2024, NVIDIA CORPORATION. +# Copyright (c) 2021-2023, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -20,18 +20,6 @@ set_target_properties(BASIC_IO_TEST PROPERTIES INSTALL_RPATH "\$ORIGIN/../../lib target_include_directories(BASIC_IO_TEST PRIVATE ../include ${cuFile_INCLUDE_DIRS}) target_link_libraries(BASIC_IO_TEST PRIVATE kvikio CUDA::cudart) -# Enable supported cuFile features in KvikIO examples -if(cuFile_FOUND) - target_link_libraries(BASIC_IO_TEST PRIVATE cufile::cuFile_interface) - target_compile_definitions(BASIC_IO_TEST PRIVATE KVIKIO_CUFILE_FOUND) - if(cuFile_BATCH_API_FOUND) - target_compile_definitions(BASIC_IO_TEST PRIVATE KVIKIO_CUFILE_BATCH_API_FOUND) - endif() - if(cuFile_STREAM_API_FOUND) - target_compile_definitions(BASIC_IO_TEST PRIVATE KVIKIO_CUFILE_STREAM_API_FOUND) - endif() -endif() - if(CMAKE_COMPILER_IS_GNUCXX) set(KVIKIO_CXX_FLAGS "-Wall;-Werror;-Wno-unknown-pragmas") target_compile_options(BASIC_IO_TEST PRIVATE "$<$:${KVIKIO_CXX_FLAGS}>")