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] mdspanify sampleWithoutReplacement #830

Merged

Conversation

mhoemmen
Copy link
Contributor

I added an overload of sampleWithoutReplacement that takes device mdspan instead of raw arrays. The overload uses std::optional<mdspan<...>> to express optional mdspan input or output arguments. I've added a unit test that imitates the existing unit test for the raw-array overload; it builds and passes.

I also opportunistically fixed some unrelated existing small build errors that were blocking forward progress.

@mhoemmen mhoemmen requested a review from a team as a code owner September 20, 2022 18:14
@github-actions github-actions bot added the cpp label Sep 20, 2022
@mhoemmen mhoemmen added enhancement New feature or request non-breaking Non-breaking change labels Sep 20, 2022
@mhoemmen mhoemmen force-pushed the mdspanify-sampleWithoutReplacement-1 branch from 3ae4e34 to fc4ab90 Compare September 20, 2022 19:03
@mhoemmen mhoemmen added feature request New feature or request and removed enhancement New feature or request labels Sep 20, 2022
Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

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

Looks great so far. Just a few minor things.

cpp/include/raft/random/rng.cuh Outdated Show resolved Hide resolved
cpp/include/raft/random/rng.cuh Outdated Show resolved Hide resolved
cpp/include/raft/random/rng.cuh Outdated Show resolved Hide resolved
cpp/include/raft/random/rng.cuh Outdated Show resolved Hide resolved
cpp/include/raft/random/rng.cuh Outdated Show resolved Hide resolved
Rename new sampleWithoutReplacement overload to
sample_without_replacement.

Fix order of parameters: handle, rng, in, out, params.

Use RAFT_EXPECTS instead of ASSERT.

Make sure that users can pass in std::nullopt explicitly
for either or both std::optional parameters.

Use "vector" instead of "array" in documentation,
use [in], [out], and [inout] as appropriate,
and make other documentation improvements.

Make error messages more clear.
@mhoemmen mhoemmen force-pushed the mdspanify-sampleWithoutReplacement-1 branch from 2535318 to 80d7aa9 Compare September 22, 2022 16:27
@mhoemmen mhoemmen force-pushed the mdspanify-sampleWithoutReplacement-1 branch from 80d7aa9 to 6371101 Compare September 22, 2022 16:33
rapids-bot bot pushed a commit that referenced this pull request Sep 23, 2022
I added an overload of `raft::random::permute` that takes device mdspan instead of raw arrays, and `std::optional<mdspan<...>>` for optional output arrays.  I also added two overloads that let users pass in `std::nullopt`.

I've added a unit test that imitates the existing unit test for the raw-array overloads; it builds and passes.  The test ensures that the two `std::nullopt` overloads also compile.

I also opportunistically fixed some unrelated existing small build errors that were blocking forward progress.  That commit is included in PRs #830 and #833 as well, so if it merges, the change should rebase correctly.

Authors:
  - Mark Hoemmen (https://github.com/mhoemmen)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #834
@cjnolet
Copy link
Member

cjnolet commented Sep 23, 2022

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 1dd2feb into rapidsai:branch-22.10 Sep 23, 2022
@mhoemmen mhoemmen deleted the mdspanify-sampleWithoutReplacement-1 branch September 23, 2022 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cpp feature request New feature or request non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants