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

Erdos-Renyi generator had bad logic in thrust calls #4362

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

ChuckHastings
Copy link
Collaborator

The random_iterator, a thrust transform iterator that was used for counting and filtering returns the probability, but they copy_if call was assuming it was returning the index.

Modified the logic and then consolidated the copy_if and transform into a single call with an output iterator.

Closes #4359

@ChuckHastings ChuckHastings self-assigned this Apr 19, 2024
@ChuckHastings ChuckHastings added bug Something isn't working non-breaking Non-breaking change and removed cuGraph labels Apr 19, 2024
@ChuckHastings ChuckHastings marked this pull request as ready for review April 19, 2024 20:35
@ChuckHastings ChuckHastings requested a review from a team as a code owner April 19, 2024 20:35

rmm::device_uvector<size_t> indices_v(count, handle.get_stream());
auto generate_random_value = cuda::proclaim_return_type<float>([seed] __device__(size_t index) {
thrust::default_random_engine rng(seed);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be out side the scope of this bug fix PR, but should we better use raft::random::RngState? Using two different random number generation mechanism does not sound ideal.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created an issue to address this.

@ChuckHastings
Copy link
Collaborator Author

/merge

@rapids-bot rapids-bot bot merged commit 450f987 into rapidsai:branch-24.06 Apr 23, 2024
135 checks passed
static_cast<vertex_t>(dst));
}));

handle.sync_stream();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it OK to leave out handle.sync_stream() here, as there is one after the kernel call in cpp/tests/generators/erdos_renyi_test.cpp?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The sync_stream call here was never necessary. Any asynchronous work that is active on this stream will continue to be active when we leave this function call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuGraph non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: erdos_renyi_generator not working properly
5 participants