-
Notifications
You must be signed in to change notification settings - Fork 91
Defer cuFile feature checks until finding kvikio package #342
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
Changes from 2 commits
6f6d8ef
17c3af0
4cb4cfb
221c2a6
402bb63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # ============================================================================= | ||
| # Copyright (c) 2021-2023, NVIDIA CORPORATION. | ||
| # Copyright (c) 2021-2024, 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 | ||
|
|
@@ -91,16 +91,6 @@ 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) | ||
|
|
||
|
|
@@ -145,11 +135,52 @@ rapids_export( | |
| DOCUMENTATION doc_string | ||
| ) | ||
|
|
||
| set(build_code_string | ||
| [=[ | ||
|
|
||
| # Find cuFile and determine which features are supported | ||
| find_package(cuFile) | ||
| if(NOT cuFile_FOUND) | ||
| message(WARNING "KvikIO: 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 "KvikIO: 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 "KvikIO: Found cuFile's 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() | ||
|
|
||
| ]=] | ||
| ) | ||
|
|
||
| # build export targets | ||
| rapids_export( | ||
| BUILD kvikio | ||
|
Comment on lines
179
to
184
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need any changes in the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes both the |
||
| EXPORT_SET kvikio-exports | ||
| GLOBAL_TARGETS kvikio | ||
| NAMESPACE kvikio:: | ||
| DOCUMENTATION doc_string | ||
| FINAL_CODE_BLOCK build_code_string | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are going to keep adding these defines, includes, link libraries each time
find_packageis called. We want to do this as rarely as possible,One option is to wrap the whole check in something along the lines of: