-
Notifications
You must be signed in to change notification settings - Fork 933
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
Update vendored thread_pool implementation #16210
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
673374e
Vendor thread pool implementation directly via rapids_cpm_find
wence- 23e8aaa
Update usage of thread pool for new vendored implementation
wence- beb835e
Cargo-cult probable cmake fix
wence- fb2cb16
Merge remote-tracking branch 'upstream/branch-24.08' into wence/fea/1…
wence- 4273081
Adapt groupby-max benchmark to new thread pool
wence- bd61029
Thinko
wence- da55a3f
Turn on pause when finding the library
wence- c732790
pragma once for cmake find.
wence- 6e81007
Typo
wence- 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 |
---|---|---|
|
@@ -24,8 +24,8 @@ | |
#include <cudf/io/orc.hpp> | ||
#include <cudf/utilities/default_stream.hpp> | ||
#include <cudf/utilities/pinned_memory.hpp> | ||
#include <cudf/utilities/thread_pool.hpp> | ||
|
||
#include <BS_thread_pool.hpp> | ||
#include <nvbench/nvbench.cuh> | ||
|
||
#include <vector> | ||
|
@@ -90,7 +90,7 @@ void BM_orc_multithreaded_read_common(nvbench::state& state, | |
auto const num_threads = state.get_int64("num_threads"); | ||
|
||
auto streams = cudf::detail::fork_streams(cudf::get_default_stream(), num_threads); | ||
cudf::detail::thread_pool threads(num_threads); | ||
BS::thread_pool threads(num_threads); | ||
|
||
auto [source_sink_vector, total_file_size, num_files] = write_file_data(state, d_types); | ||
std::vector<cudf::io::source_info> source_info_vector; | ||
|
@@ -112,13 +112,11 @@ void BM_orc_multithreaded_read_common(nvbench::state& state, | |
cudf::io::read_orc(read_opts, stream, rmm::mr::get_current_device_resource()); | ||
}; | ||
|
||
threads.paused = true; | ||
for (size_t i = 0; i < num_files; ++i) { | ||
threads.submit(read_func, i); | ||
} | ||
threads.pause(); | ||
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.
|
||
threads.detach_sequence(decltype(num_files){0}, num_files, read_func); | ||
timer.start(); | ||
threads.paused = false; | ||
threads.wait_for_tasks(); | ||
threads.unpause(); | ||
threads.wait(); | ||
cudf::detail::join_streams(streams, cudf::get_default_stream()); | ||
timer.stop(); | ||
}); | ||
|
@@ -170,7 +168,7 @@ void BM_orc_multithreaded_read_chunked_common(nvbench::state& state, | |
size_t const output_limit = state.get_int64("output_limit"); | ||
|
||
auto streams = cudf::detail::fork_streams(cudf::get_default_stream(), num_threads); | ||
cudf::detail::thread_pool threads(num_threads); | ||
BS::thread_pool threads(num_threads); | ||
auto [source_sink_vector, total_file_size, num_files] = write_file_data(state, d_types); | ||
std::vector<cudf::io::source_info> source_info_vector; | ||
std::transform(source_sink_vector.begin(), | ||
|
@@ -203,13 +201,11 @@ void BM_orc_multithreaded_read_chunked_common(nvbench::state& state, | |
} while (reader.has_next()); | ||
}; | ||
|
||
threads.paused = true; | ||
for (size_t i = 0; i < num_files; ++i) { | ||
threads.submit(read_func, i); | ||
} | ||
threads.pause(); | ||
threads.detach_sequence(decltype(num_files){0}, num_files, read_func); | ||
timer.start(); | ||
threads.paused = false; | ||
threads.wait_for_tasks(); | ||
threads.unpause(); | ||
threads.wait(); | ||
cudf::detail::join_streams(streams, cudf::get_default_stream()); | ||
timer.stop(); | ||
}); | ||
|
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,28 @@ | ||
# ============================================================================= | ||
# Copyright (c) 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 | ||
# | ||
# 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. | ||
# ============================================================================= | ||
|
||
# This function finds rmm and sets any additional necessary environment variables. | ||
function(find_and_configure_thread_pool) | ||
rapids_cpm_find( | ||
BS_thread_pool 4.1.0 | ||
CPM_ARGS | ||
GIT_REPOSITORY https://github.com/bshoshany/thread-pool.git | ||
GIT_TAG 097aa718f25d44315cadb80b407144ad455ee4f9 | ||
GIT_SHALLOW TRUE | ||
) | ||
add_library(BS_thread_pool INTERFACE) | ||
target_include_directories(BS_thread_pool INTERFACE ${BS_thread_pool_SOURCE_DIR}/include) | ||
wence- marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endfunction() | ||
|
||
find_and_configure_thread_pool() |
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.
We should move this off
cudf
and onto theBS_thread_pool
target inget_thread_pool.cmake
as an INTERFACE compile definition.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.
Thanks, done.