-
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
Read the footers in parallel when reading multiple Parquet files #17957
Open
vuule
wants to merge
10
commits into
rapidsai:branch-25.04
Choose a base branch
from
vuule:opt-parallel-metadata-ctors
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.
+190
−71
Open
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
567646b
global thread pool + use in metadatas_from_sources
vuule c220be9
style
vuule 9bae1e5
Merge branch 'branch-25.04' of https://github.com/rapidsai/cudf into …
vuule ac4b4c1
Merge branch 'branch-25.04' into opt-parallel-metadata-ctors
vuule e321f66
Merge branch 'branch-25.04' of https://github.com/rapidsai/cudf into …
vuule 225b7c0
pivot
vuule 12a86ef
impl
vuule 4fdead9
Merge branch 'branch-25.04' into fea-host_read_async
vuule 32f7efe
Merge branch 'opt-parallel-metadata-ctors' of https://github.com/vuul…
vuule ba5d555
Merge branch 'fea-host_read_async' into opt-parallel-metadata-ctors
vuule 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2025, 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <BS_thread_pool.hpp> | ||
|
||
namespace cudf::detail { | ||
|
||
/** | ||
* @brief Retrieves a reference to the global host worker thread pool. | ||
* | ||
* This function returns a reference to a thread pool that can be used for executing host-only | ||
* tasks. The pool size is potentially not optimal for tasks that include device operations, like | ||
* copies between host and device and kernel calls. | ||
* | ||
* @return A reference to the host worker thread pool. | ||
*/ | ||
BS::thread_pool& host_worker_pool(); | ||
|
||
} // namespace cudf::detail |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2025, 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "io/utilities/getenv_or.hpp" | ||
|
||
#include <cudf/detail/utilities/host_worker_pool.hpp> | ||
|
||
namespace cudf::detail { | ||
|
||
BS::thread_pool& host_worker_pool() | ||
{ | ||
static const std::size_t default_pool_size = std::min(32u, std::thread::hardware_concurrency()); | ||
static const std::size_t pool_size = getenv_or("LIBCUDF_NUM_HOST_WORKERS", default_pool_size); | ||
static BS::thread_pool pool(pool_size); | ||
return pool; | ||
} | ||
|
||
} // namespace cudf::detail |
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.
Do we have a policy for how we choose the default threadpool size here? For a workload reading ~360 parquet files of 128 MB each, the default thread pool size of 32 might have been a little small. The overall workload took about 20 to read the data. With
LIBCUDF_NUM_HOST_WORKERS=256
the overall workload took 10s. (and no parallelism, like on main, took 60s).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 used 32 because it worked well for my host compression thread pool (where the tasks incude H2D/D2H copies).
I'm fine with just using
hardware_concurrency
, given that this is intended for host-only work.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.
So I have an Intel i9-13900K, which has 8 performance cores and 16 efficiency cores, and std::thread::hardware_concurrency() returns 32 for this. If I was reading a lot of files and my machine tried to use 32 threads, I'd have nothing available for anything else and the OS might stop responding. Perhaps 3/4 or 7/8 of hardware_concurrency() would be better?
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.
Another thought (feel free to ignore): this will be most notable for remote file systems, we're we'll be network bound and spending a lot of time doing nothing. In Python, a single thread making all the network requests asynchronously would likely work as well as a large threadpool. Would something similar be good 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.
yeah, we can do the same as we do when reading the actual data - loop over all sources in a single function. This would take some surgery, but IMO it's worth a try, given that this specific use of the thread pool requires more threads than we normally want.