Skip to content

[Docs]: Fix incorrect index usage in vector_add example in documentation - #1086

Merged
kkraus14 merged 4 commits into
NVIDIA:mainfrom
XXXXRT666:main
Oct 6, 2025
Merged

[Docs]: Fix incorrect index usage in vector_add example in documentation#1086
kkraus14 merged 4 commits into
NVIDIA:mainfrom
XXXXRT666:main

Conversation

@XXXXRT666

@XXXXRT666XXXXRT666 commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

Description

The example kernel in the documentation uses C[tid] = A[tid] + B[tid] inside a loop, which should instead be C[i] = A[i] + B[I], to correctly handle strided indexing across threads.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@copy-pr-bot

Copy link
Copy Markdown
Contributor

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.

@leofang

Copy link
Copy Markdown
Member

Thanks for catching the issue @XXXXRT666, LGTM! It seems we only caught the issue partially in #582. FWIW this bug also exists in the sample https://github.com/NVIDIA/cuda-python/blob/main/cuda_core/examples/vector_add.py on which the doc is based, would you like to fix it as well?

@leofangleofang added bug Something isn't working P0 High priority - Must do! cuda.core Everything related to the cuda.core module example Improvements or additions to code examples labels Oct 6, 2025
@leofangleofang added this to the cuda.core beta 7 milestone Oct 6, 2025
@leofang

Copy link
Copy Markdown
Member

Also please kindly add a release note entry to cuda_core/docs/source/release/0.X.Y-notes.rst 🙂

@XXXXRT666

Copy link
Copy Markdown
ContributorAuthor

FWIW this bug also exists in the sample https://github.com/NVIDIA/cuda-python/blob/main/cuda_core/examples/vector_add.py on which the doc is based, would you like to fix it as well?

I think I have fixed all the [C[tid] = A[tid] + B[tid] problems now. Thanks!

Also please kindly add a release note entry to cuda_core/docs/source/release/0.X.Y-notes.rst 🙂

Done

leofang
leofang previously approved these changes Oct 6, 2025
@leofangleofang added the documentation Improvements or additions to documentation label Oct 6, 2025
@leofang

Copy link
Copy Markdown
Member

/ok to test c7b9d6e

@leofang

Copy link
Copy Markdown
Member

pre-commit.ci autofix

@leofang

Copy link
Copy Markdown
Member

/ok to test efcdc6b

@github-actions

Copy link
Copy Markdown

@kkraus14

Copy link
Copy Markdown
Collaborator

@XXXXRT666 thank for your contribution! Could you please push a commit that is signed-off (https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) which indicates your agreement to our DCO (https://github.com/NVIDIA/cuda-python/blob/main/CONTRIBUTING.md#developer-certificate-of-origin-dco)?

This is required before we're able to merge your pull request.

Signed-off-by: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com>
@XXXXRT666

Copy link
Copy Markdown
ContributorAuthor

Sure, I’ve added a signed-off commit, does this look OK?

@kkraus14

Copy link
Copy Markdown
Collaborator

Sure, I’ve added a signed-off commit, does this look OK?

Perfect, thank you!

@kkraus14

Copy link
Copy Markdown
Collaborator

/ok to test f397f57

@kkraus14
kkraus14 enabled auto-merge (squash) October 6, 2025 16:24
@kkraus14
kkraus14 merged commit 9b7821a into NVIDIA:mainOct 6, 2025
53 of 61 checks passed
github-actionsBot pushed a commit that referenced this pull request Nov 10, 2025
Removed preview folders for the following PRs:
- PR #1021
- PR #1034
- PR #1052
- PR #1059
- PR #1069
- PR #1086
- PR #1090
- PR #1096
- PR #1102
- PR #1103
- PR #1106
- PR #1107
- PR #1117
- PR #1133
- PR #1140
- PR #1166
- PR #1174
- PR #1185
- PR #1188
- PR #1191
... and 41 more
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't workingcuda.coreEverything related to the cuda.core moduledocumentationImprovements or additions to documentationexampleImprovements or additions to code examplesP0High priority - Must do!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@XXXXRT666@leofang@kkraus14