Skip to content
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

Make thrust nosync execution policy the default thrust policy #2302

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/include/raft/core/device_resources.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class device_resources : public resources {

cusparseHandle_t get_cusparse_handle() const { return resource::get_cusparse_handle(*this); }

rmm::exec_policy& get_thrust_policy() const { return resource::get_thrust_policy(*this); }
rmm::exec_policy_nosync& get_thrust_policy() const { return resource::get_thrust_policy(*this); }

/**
* @brief synchronize a stream on the current container
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/raft/core/resource/thrust_policy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ namespace raft::resource {
class thrust_policy_resource : public resource {
public:
thrust_policy_resource(rmm::cuda_stream_view stream_view)
: thrust_policy_(std::make_unique<rmm::exec_policy>(stream_view))
: thrust_policy_(std::make_unique<rmm::exec_policy_nosync>(stream_view))
{
}
void* get_resource() override { return thrust_policy_.get(); }

~thrust_policy_resource() override {}

private:
std::unique_ptr<rmm::exec_policy> thrust_policy_;
std::unique_ptr<rmm::exec_policy_nosync> thrust_policy_;
};

/**
Expand Down Expand Up @@ -60,13 +60,13 @@ class thrust_policy_resource_factory : public resource_factory {
* @param res raft res object for managing resources
* @return thrust execution policy
*/
inline rmm::exec_policy& get_thrust_policy(resources const& res)
inline rmm::exec_policy_nosync& get_thrust_policy(resources const& res)
{
if (!res.has_resource_factory(resource_type::THRUST_POLICY)) {
rmm::cuda_stream_view stream = get_cuda_stream(res);
res.add_resource_factory(std::make_shared<thrust_policy_resource_factory>(stream));
}
return *res.get_resource<rmm::exec_policy>(resource_type::THRUST_POLICY);
return *res.get_resource<rmm::exec_policy_nosync>(resource_type::THRUST_POLICY);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/raft/spectral/detail/matrix_wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class vector_t {
private:
using thrust_exec_policy_t =
thrust::detail::execute_with_allocator<rmm::mr::thrust_allocator<char>,
thrust::cuda_cub::execute_on_stream_base>;
thrust::cuda_cub::execute_on_stream_nosync_base>;
rmm::device_uvector<value_type> buffer_;
const thrust_exec_policy_t thrust_policy;
};
Expand Down
Loading