Skip to content

Add ReverseIterator to cuda.parallel - #4291

Merged
shwina merged 10 commits into
NVIDIA:mainfrom
NaderAlAwar:reverse-iterator-cuda-parallel
Apr 5, 2025
Merged

shwina merged 10 commits into
NVIDIA:mainfrom
NaderAlAwar:reverse-iterator-cuda-parallel

Conversation

@NaderAlAwar

Copy link
Copy Markdown
Contributor

Description

closes #4290

Checklist

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

@NaderAlAwar
NaderAlAwar requested a review from a team as a code owner March 31, 2025 13:46
@NaderAlAwar
NaderAlAwar requested a review from leofang March 31, 2025 13:46
@github-project-automation github-project-automation Bot moved this to Todo in CCCL Mar 31, 2025
@cccl-authenticator-app cccl-authenticator-app Bot moved this from Todo to In Review in CCCL Mar 31, 2025
@github-actions

Copy link
Copy Markdown
Contributor
🟩 CI finished in 1h 11m: Pass: 100%/1 | Total: 1h 11m | Avg: 1h 11m | Max: 1h 11m
  • 🟩 python: Pass: 100%/1 | Total: 1h 11m | Avg: 1h 11m | Max: 1h 11m

    🟩 cpu
      🟩 amd64              Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 ctk
      🟩 12.8               Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 cudacxx
      🟩 nvcc12.8           Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 cxx
      🟩 GCC13              Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 cxx_family
      🟩 GCC                Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 gpu
      🟩 rtx2080            Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    🟩 jobs
      🟩 Test               Pass: 100%/1   | Total:  1h 11m | Avg:  1h 11m | Max:  1h 11m
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@github-actions

Copy link
Copy Markdown
Contributor
🟩 CI finished in 1h 06m: Pass: 100%/1 | Total: 1h 06m | Avg: 1h 06m | Max: 1h 06m
  • 🟩 python: Pass: 100%/1 | Total: 1h 06m | Avg: 1h 06m | Max: 1h 06m

    🟩 cpu
      🟩 amd64              Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 ctk
      🟩 12.8               Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cudacxx
      🟩 nvcc12.8           Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cxx
      🟩 GCC13              Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cxx_family
      🟩 GCC                Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 gpu
      🟩 rtx2080            Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 jobs
      🟩 Test               Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@rwgk rwgk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What you have looks correct to me, but I'd definitely add unit tests to be sure all of get_last_element_ptr() is covered.

shape = get_shape(device_array)
dtype = get_dtype(device_array)

strides_in_bytes = device_array.__cuda_array_interface__["strides"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I must be confused ... maybe you can help me understand:

Yesterday I convinced myself that device_array.__cuda_array_interface__["strides"] is in elements (not bytes)

IIRC you had code to multiply by itemsize, but I don't see this anymore?

But then again, the tests pass...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was mistaken, see https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html:

strides: None or (integer, ...)

If strides is not given, or it is None, the array is in C-contiguous layout. Otherwise, a tuple of int (or long) is
explicitly given for representing the number of bytes to skip to access the next element at each dimension.

The tests revealed this issue, sorry for the confusion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, wow, ChatGPT made this up yesterday!

Screenshot 2025-04-02 at 11 11 16

The link is https://numba.readthedocs.io/en/stable/cuda/cuda_array_interface.html, exactly what you have.

What ChatGPT quotes there was never in the numba documetation! I wanted to be sure, so I systematically looked at all revisions of docs/source/cuda/cuda_array_interface.rst that ever existed, all the way back to 2018-05-08. bytes to skip is consistently there. elements to skip was never there. — My trust in ChatGPT just got a big dent.

My ChatGPT conversation from yesterday: https://chatgpt.com/share/67ed7e3f-3344-8008-b1a5-517728b7246b

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just updated the link: https://chatgpt.com/share/67ed7e3f-3344-8008-b1a5-517728b7246b

Same URL as before, but there is a bit more now:

I apologize for any confusion caused by my earlier misstatement and appreciate your diligence in pointing out the discrepancy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah in my experience it hallucinates pretty badly when you ask for sources

@github-actions

github-actions Bot commented Apr 2, 2025

Copy link
Copy Markdown
Contributor
🟩 CI finished in 1h 09m: Pass: 100%/1 | Total: 1h 09m | Avg: 1h 09m | Max: 1h 09m
  • 🟩 python: Pass: 100%/1 | Total: 1h 09m | Avg: 1h 09m | Max: 1h 09m

    🟩 cpu
      🟩 amd64              Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 ctk
      🟩 12.8               Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cudacxx
      🟩 nvcc12.8           Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cxx
      🟩 GCC13              Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cxx_family
      🟩 GCC                Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 gpu
      🟩 rtx2080            Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 jobs
      🟩 Test               Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@github-actions

github-actions Bot commented Apr 2, 2025

Copy link
Copy Markdown
Contributor
🟩 CI finished in 1h 06m: Pass: 100%/1 | Total: 1h 06m | Avg: 1h 06m | Max: 1h 06m
  • 🟩 python: Pass: 100%/1 | Total: 1h 06m | Avg: 1h 06m | Max: 1h 06m

    🟩 cpu
      🟩 amd64              Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 ctk
      🟩 12.8               Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cudacxx
      🟩 nvcc12.8           Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cxx
      🟩 GCC13              Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 cxx_family
      🟩 GCC                Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 gpu
      🟩 rtx2080            Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    🟩 jobs
      🟩 Test               Pass: 100%/1   | Total:  1h 06m | Avg:  1h 06m | Max:  1h 06m
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@github-actions

github-actions Bot commented Apr 2, 2025

Copy link
Copy Markdown
Contributor
🟥 CI finished in 13m 55s: Pass: 0%/1 | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
  • 🟥 python: Pass: 0%/1 | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s

    🟥 cpu
      🟥 amd64              Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 ctk
      🟥 12.8               Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 cudacxx
      🟥 nvcc12.8           Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 cudacxx_family
      🟥 nvcc               Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 cxx
      🟥 GCC13              Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 cxx_family
      🟥 GCC                Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 gpu
      🟥 rtx2080            Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    🟥 jobs
      🟥 Test               Pass:   0%/1   | Total: 13m 55s | Avg: 13m 55s | Max: 13m 55s
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@github-actions

github-actions Bot commented Apr 3, 2025

Copy link
Copy Markdown
Contributor
🟥 CI finished in 19m 46s: Pass: 0%/1 | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
  • 🟥 python: Pass: 0%/1 | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s

    🟥 cpu
      🟥 amd64              Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 ctk
      🟥 12.8               Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 cudacxx
      🟥 nvcc12.8           Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 cudacxx_family
      🟥 nvcc               Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 cxx
      🟥 GCC13              Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 cxx_family
      🟥 GCC                Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 gpu
      🟥 rtx2080            Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    🟥 jobs
      🟥 Test               Pass:   0%/1   | Total: 19m 46s | Avg: 19m 46s | Max: 19m 46s
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@github-actions

github-actions Bot commented Apr 3, 2025

Copy link
Copy Markdown
Contributor
🟩 CI finished in 1h 09m: Pass: 100%/1 | Total: 1h 09m | Avg: 1h 09m | Max: 1h 09m
  • 🟩 python: Pass: 100%/1 | Total: 1h 09m | Avg: 1h 09m | Max: 1h 09m

    🟩 cpu
      🟩 amd64              Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 ctk
      🟩 12.8               Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cudacxx
      🟩 nvcc12.8           Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cudacxx_family
      🟩 nvcc               Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cxx
      🟩 GCC13              Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 cxx_family
      🟩 GCC                Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 gpu
      🟩 rtx2080            Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    🟩 jobs
      🟩 Test               Pass: 100%/1   | Total:  1h 09m | Avg:  1h 09m | Max:  1h 09m
    

👃 Inspect Changes

Modifications in project?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

Modifications in project or dependencies?

Project
CCCL Infrastructure
libcu++
CUB
Thrust
CUDA Experimental
stdpar
+/- python
CCCL C Parallel Library
Catch2Helper

🏃‍ Runner counts (total jobs: 1)

# Runner
1 linux-amd64-gpu-rtx2080-latest-1

@shwina
shwina merged commit 752cf21 into NVIDIA:main Apr 5, 2025
@github-project-automation github-project-automation Bot moved this from In Review to Done in CCCL Apr 5, 2025
davebayer pushed a commit to davebayer/cccl that referenced this pull request Apr 7, 2025
* Add ReverseIterator implementation and tests

* Remove print statements and fix documentation

* Refactor get_last_element_ptr and add missing iterator tests

* formatting

* fix ordering of classes

* Undo get_shape change

* Address comments

* REmove comment

* Fix input checking

* Get numba dtype when creating iterator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[FEA]: Support ReverseIterator in cuda.parallel

5 participants