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

Fix std::lock_guard use for gcc 14 support #639

Merged
merged 4 commits into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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/bench/ann/src/common/thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class fixed_thread_pool {
finished_.store(true, std::memory_order_relaxed);
for (unsigned i = 0; i < threads_.size(); ++i) {
auto& task = tasks_[i];
std::lock_guard<std::mutex>(task.mtx);
std::lock_guard lock(task.mtx);

task.cv.notify_one();
threads_[i].join();
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/neighbors/iface/iface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void build(const raft::device_resources& handle,
const cuvs::neighbors::index_params* index_params,
raft::mdspan<const T, matrix_extent<int64_t>, row_major, Accessor> index_dataset)
{
std::lock_guard(*interface.mutex_);
std::lock_guard lock(*interface.mutex_);

if constexpr (std::is_same<AnnIndexType, ivf_flat::index<T, IdxT>>::value) {
auto idx = cuvs::neighbors::ivf_flat::build(
Expand All @@ -62,7 +62,7 @@ void extend(
std::optional<raft::mdspan<const IdxT, vector_extent<int64_t>, layout_c_contiguous, Accessor2>>
new_indices)
{
std::lock_guard(*interface.mutex_);
std::lock_guard lock(*interface.mutex_);

if constexpr (std::is_same<AnnIndexType, ivf_flat::index<T, IdxT>>::value) {
auto idx =
Expand Down Expand Up @@ -141,7 +141,7 @@ void serialize(const raft::device_resources& handle,
const cuvs::neighbors::iface<AnnIndexType, T, IdxT>& interface,
std::ostream& os)
{
std::lock_guard(*interface.mutex_);
std::lock_guard lock(*interface.mutex_);

if constexpr (std::is_same<AnnIndexType, ivf_flat::index<T, IdxT>>::value) {
ivf_flat::serialize(handle, os, interface.index_.value());
Expand All @@ -157,7 +157,7 @@ void deserialize(const raft::device_resources& handle,
cuvs::neighbors::iface<AnnIndexType, T, IdxT>& interface,
std::istream& is)
{
std::lock_guard(*interface.mutex_);
std::lock_guard lock(*interface.mutex_);

if constexpr (std::is_same<AnnIndexType, ivf_flat::index<T, IdxT>>::value) {
ivf_flat::index<T, IdxT> idx(handle);
Expand All @@ -179,7 +179,7 @@ void deserialize(const raft::device_resources& handle,
cuvs::neighbors::iface<AnnIndexType, T, IdxT>& interface,
const std::string& filename)
{
std::lock_guard(*interface.mutex_);
std::lock_guard lock(*interface.mutex_);

std::ifstream is(filename, std::ios::in | std::ios::binary);
if (!is) { RAFT_FAIL("Cannot open file %s", filename.c_str()); }
Expand Down
Loading