Skip to content

Fix per-cluster std indexing in make_blobs - #3170

Open
NIne-WIngEd wants to merge 2 commits into
NVIDIA:mainfrom
NIne-WIngEd:Rayan/fix-make-blobs-cluster-std
Open

NIne-WIngEd wants to merge 2 commits into
NVIDIA:mainfrom
NIne-WIngEd:Rayan/fix-make-blobs-cluster-std

Conversation

@NIne-WIngEd

Copy link
Copy Markdown

Summary

make_blobs documents cluster_std as one value per cluster, but the native kernel currently indexes it by sample row. This uses the sample's label instead. It also uses a safe cluster index for the extra Box-Muller value when that index is beyond the output rows.

The new test uses 65 rows and two clusters with distinct standard deviations. It compares the vector path against a scalar control for float and double output in row-major and column-major layouts.

Fixes #3168. This is a prerequisite for cuML #8482.

Validation

  • clang-format check passed on the changed lines.
  • git diff --check passed.
  • CUDA tests need to run in CI; this Windows PC does not have a CUDA build or GPU runtime.

@copy-pr-bot

copy-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@NIne-WIngEd

Copy link
Copy Markdown
Author

Could a maintainer add the bug and non-breaking labels and authorize CI for aed09ac? I don't have permission to apply labels here, and the CUDA test needs to run upstream.

@viclafargue viclafargue added bug Something isn't working non-breaking Non-breaking change labels Oct 7, 2026
@NVIDIA NVIDIA deleted a comment from copy-pr-bot Bot Oct 7, 2026
@viclafargue

Copy link
Copy Markdown
Contributor

/ok to test aed09ac

@NIne-WIngEd

NIne-WIngEd commented Oct 7, 2026 •

Copy link
Copy Markdown
Author

I fixed the clang-format failure in 6f86d29.

@viclafargue

Copy link
Copy Markdown
Contributor

/ok to test 6f86d29

@NIne-WIngEd
NIne-WIngEd marked this pull request as ready for review October 7, 2026 23:13
@NIne-WIngEd
NIne-WIngEd requested a review from a team as a code owner October 7, 2026 23:13
@NIne-WIngEd

Copy link
Copy Markdown
Author

CI is green on 6f86d29, including the C++ tests. I marked this ready for review. @viclafargue, could you take a look when you get a chance?

@coderabbitai

coderabbitai Bot commented Oct 7, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/raft/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 401fc8cd-2c67-43a0-b74c-7d6f1181db3b
📥 Commits

Reviewing files that changed from the base of the PR and between 5d5e5f1 and 6f86d29.

📒 Files selected for processing (2)
  • cpp/include/raft/random/detail/make_blobs.cuh
  • cpp/tests/random/make_blobs.cu

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Corrected per-cluster standard deviation handling in blob generation, including for row-major and column-major layouts.
  • Tests
    • Added coverage for per-cluster standard deviations with float and double data across both layouts.

Walkthrough

get_mu_sigma now indexes per-cluster standard deviations by cluster label and uses cluster 0 for out-of-range rows. New tests cover float and double outputs in row-major and column-major layouts.

Changes

Per-cluster standard deviation selection

Layer / File(s) Summary
Cluster selection and validation
cpp/include/raft/random/detail/make_blobs.cuh, cpp/tests/random/make_blobs.cu
get_mu_sigma uses the selected cluster label to choose the center offset and standard deviation. Tests verify output values and labels for both layouts and types, including out-of-range rows.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: achirkin

Merge Risk: ⚪ Minimal · up to 6f86d

No actionable issue is established; merge after the normal CUDA CI checks pass.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: correcting per-cluster standard-deviation indexing in make_blobs.
Description check ✅ Passed The description directly explains the indexing fix, safe handling of the extra Box–Muller value, test coverage, validation results, and CI limitation.
Linked Issues check ✅ Passed Issue #3168 requires per-sample lookup by cluster label and a safe lookup for the extra Box-Muller value. In get_mu_sigma, valid rows assign cluster_id = labels[cid], out-of-range rows assign `clu…
Out of Scope Changes check ✅ Passed The changes stay within issue #3168. The kernel change fixes cluster-standard-deviation and center indexing. The added tests validate the reported bug across the required data types and layouts. The a…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[BUG] make_blobs indexes cluster_std by sample row instead of cluster label

2 participants