-
Notifications
You must be signed in to change notification settings - Fork 928
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
Use KvikIO to enable file's fast host read and host write #17764
Open
kingcrimsontianyu
wants to merge
10
commits into
rapidsai:branch-25.04
Choose a base branch
from
kingcrimsontianyu:remove-legacy-cufile-integration
base: branch-25.04
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c5797c8
Remove legacy cuFile integration
kingcrimsontianyu 1515ea2
Remove OFF mode
kingcrimsontianyu aba15cc
Use KvikIO for host_read/write
kingcrimsontianyu a355bc0
Revise comment
kingcrimsontianyu e87068b
Remove LIBCUDF_CUFILE_POLICY
kingcrimsontianyu 9d112c9
Update
kingcrimsontianyu fab4e24
Address review comments
kingcrimsontianyu 431d4f0
Minor fix
kingcrimsontianyu 169d9bb
Quick fix
kingcrimsontianyu 8bb6790
Update doc
kingcrimsontianyu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,46 +24,26 @@ | |
|
||
namespace cudf::io { | ||
|
||
namespace cufile_integration { | ||
|
||
namespace { | ||
/** | ||
* @brief Defines which cuFile usage to enable. | ||
*/ | ||
enum class usage_policy : uint8_t { OFF, GDS, ALWAYS, KVIKIO }; | ||
|
||
/** | ||
* @brief Get the current usage policy. | ||
*/ | ||
usage_policy get_env_policy() | ||
{ | ||
static auto const env_val = getenv_or<std::string>("LIBCUDF_CUFILE_POLICY", "KVIKIO"); | ||
if (env_val == "OFF") return usage_policy::OFF; | ||
if (env_val == "GDS") return usage_policy::GDS; | ||
if (env_val == "ALWAYS") return usage_policy::ALWAYS; | ||
if (env_val == "KVIKIO") return usage_policy::KVIKIO; | ||
CUDF_FAIL("Invalid LIBCUDF_CUFILE_POLICY value: " + env_val); | ||
} | ||
} // namespace | ||
|
||
bool is_always_enabled() { return get_env_policy() == usage_policy::ALWAYS; } | ||
|
||
bool is_gds_enabled() { return is_always_enabled() or get_env_policy() == usage_policy::GDS; } | ||
|
||
bool is_kvikio_enabled() { return get_env_policy() == usage_policy::KVIKIO; } | ||
namespace kvikio_integration { | ||
|
||
void set_up_kvikio() | ||
{ | ||
static std::once_flag flag{}; | ||
std::call_once(flag, [] { | ||
// Workaround for https://github.com/rapidsai/cudf/issues/14140, where cuFileDriverOpen errors | ||
// out if no CUDA calls have been made before it. This is a no-op if the CUDA context is already | ||
// initialized. | ||
cudaFree(nullptr); | ||
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. this fits perfectly here :) |
||
|
||
auto const compat_mode = kvikio::getenv_or("KVIKIO_COMPAT_MODE", kvikio::CompatMode::ON); | ||
kvikio::defaults::compat_mode_reset(compat_mode); | ||
|
||
auto const nthreads = getenv_or<unsigned int>("KVIKIO_NTHREADS", 4u); | ||
kvikio::defaults::thread_pool_nthreads_reset(nthreads); | ||
}); | ||
} | ||
} // namespace cufile_integration | ||
|
||
} // namespace kvikio_integration | ||
|
||
namespace nvcomp_integration { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think we have downstream applications depend on this static cuFile library. We probably should keep this option, and forward it to KvikIO (and also add the static cuFile support there). What do you think? @vuule
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.
I have no context on why this option exists. Maybe @robertmaynard or @bdice can help here.
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.
I would assume that it's for Spark builds. It was added in #17315 by @KyleFromNVIDIA so he should confirm.
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.
Yes, I believe so.
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.
I think I need some help on this. In both KvikIO and cuDF's C++ code, we use
dlopen
to dynamically load the cuFile shared library at runtime. So I'm wondering (1) why we still need to link to the cuFile shared library viatarget_link_libraries
at compile-time, and (2) how the cuFile static library is useful to us? (3) Is it possible that the compile-time linking is only necessary for our java code, but not C++? Thanks for any pointer!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.
We shouldn't need the compile-time linking any more for the dynamic library cases if we switch over to using kvikio entirely. I can link you to some Slack threads on that topic. I am less certain about the static library case, in particular what we can assume about cufile's availability as a dynamic library on the target systems where the Spark plugin is deployed.
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.
Based on some offline discussion, we're OK with removing this. If the Spark plugin needs to support cufile we'll have to find a new solution anyway since the current approach probably wouldn't work as-is (we rely on dlopening the library, so it still needs to exist on the end user's side of things; if we really want to make this work with static linking, it's possible that we could use some combination of dlsym and RTLD_NEXT, but for now I think that's out of scope).