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

[REVIEW] Avoid useless copy when exchanging flag buffers in CSR WeakCC #3096

Merged
merged 4 commits into from
Nov 12, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- PR #3044: Move leftover `linalg` and `stats` to RAFT namespaces
- PR #3067: Deleting prims moved to RAFT and updating header paths
- PR #3074: Reducing dask coordinate descent test runtime
- PR #3096: Avoid memory transfers in CSR WeakCC for DBSCAN
- PR #3088: More readable and robust FIL C++ test management
- PR #3052: Speeding up MNMG KNN Cl&Re testing
- PR #3115: Speeding up MNMG UMAP testing
Expand Down
11 changes: 2 additions & 9 deletions cpp/src_prims/sparse/csr.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <cuda_runtime.h>
#include <stdio.h>

#include <algorithm>
#include <iostream>

namespace MLCommon {
Expand Down Expand Up @@ -802,8 +803,6 @@ void weak_cc_label_batched(Index_ *labels, const Index_ *row_ind,
"Index_ should be 4 or 8 bytes");

bool host_m;
bool *host_fa = (bool *)malloc(sizeof(bool) * N);
bool *host_xa = (bool *)malloc(sizeof(bool) * N);

dim3 blocks(raft::ceildiv(batchSize, Index_(TPB_X)));
dim3 threads(TPB_X);
Expand All @@ -824,20 +823,14 @@ void weak_cc_label_batched(Index_ *labels, const Index_ *row_ind,
CUDA_CHECK(cudaStreamSynchronize(stream));

//** swapping F1 and F2
raft::update_host(host_fa, state->fa, N, stream);
raft::update_host(host_xa, state->xa, N, stream);
raft::update_device(state->fa, host_xa, N, stream);
raft::update_device(state->xa, host_fa, N, stream);
std::swap(state->fa, state->xa);

//** Updating m *
raft::update_host(&host_m, state->m, 1, stream);
CUDA_CHECK(cudaStreamSynchronize(stream));

n_iters++;
} while (host_m);

free(host_fa);
free(host_xa);
}

/**
Expand Down