Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add CUDA 13 & NCCL 2.27 support#9289

Merged
kmaehashi merged 39 commits into
cupy:mainfrom
emcastillo:cuda-13
Aug 10, 2025
Merged

Add CUDA 13 & NCCL 2.27 support#9289
kmaehashi merged 39 commits into
cupy:mainfrom
emcastillo:cuda-13

Conversation

@emcastillo

@emcastillo emcastillo commented Aug 8, 2025

Copy link
Copy Markdown
Member

API changes: Fix prefetch/memAdvise and some device properties.

These changes are 99,9% not mine. I am just upstreaming what folks (@robertmaynard) at Nvidia did.

  • There is no CUDA 13 package for cuTensor for the install_library script.
  • CUDA 13 is only supported by cudnn 9.12.0.46, and this version doesn't seem to be compatible with CuPy.
  • cuTENSOR cuda13 library is pending release
  • CUDA 13 docker image is pending release

xref #9286

@emcastillo

Copy link
Copy Markdown
Member Author

/test full

@leofang leofang self-requested a review August 8, 2025 11:17
@leofang leofang added prio:high to-be-backported Pull-requests to be backported to stable branch blocking Issue/pull-request is mandatory for the upcoming release labels Aug 8, 2025
Comment thread cupy/cuda/memory.pyx Outdated
Comment thread cupy_backends/cuda/api/runtime.pxd Outdated
Comment thread cupy_backends/cuda/api/runtime.pyx Outdated
Comment thread cupy_backends/cuda/libs/_cnvrtc.pxi Outdated
Comment thread install/cupy_builder/_compiler.py Outdated
Comment thread cupy_backends/cuda/libs/cusparse.pyx
Comment thread install/cupy_builder/_compiler.py Outdated
Comment thread install/cupy_builder/_compiler.py Outdated
Comment thread install/cupy_builder/_compiler.py Outdated
Comment thread install/cupy_builder/_compiler.py Outdated
@leofang

leofang commented Aug 9, 2025

Copy link
Copy Markdown
Member

FYI it seems the 13.0 docker images are up!

@kmaehashi

Copy link
Copy Markdown
Member

FYI it seems the 13.0 docker images are up!

I guess our CI is one of the very first user 😄

@kmaehashi

kmaehashi commented Aug 9, 2025

Copy link
Copy Markdown
Member

I discussed with @leofang offline and found that we need to adjust CUDA header discovery logic to support the change in PyPI CUDA packages. I'm looking into it.
https://developer.nvidia.com/blog/whats-new-and-important-in-cuda-toolkit-13-0/#wheel_package_changes_to_cuda_130

edit: done in 3ad708a

@kmaehashi kmaehashi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM except for nits! Let's wait for the CI results.

Comment thread cupy_backends/cuda/api/runtime.pyx Outdated
@kmaehashi

Copy link
Copy Markdown
Member

@emcastillo

emcastillo commented Aug 9, 2025

Copy link
Copy Markdown
Member Author

Tests are failing because the fft static library doesn't support sm_75, I will push a fix

$ cuobjdump --list-elf /usr/local/cuda-13/lib64/libcufft_static.a

ELF file    1: libcufft_static.1.sm_80.cubin
ELF file    2: libcufft_static.2.sm_90.cubin
ELF file    3: libcufft_static.3.sm_100.cubin
ELF file    4: libcufft_static.4.sm_110.cubin
ELF file    5: libcufft_static.5.sm_103.cubin
ELF file    6: libcufft_static.6.sm_120.cubin

Seems the flexCI instances has CC 7.5 GPUs so we need to skip these tests :D

@emcastillo

Copy link
Copy Markdown
Member Author
FAILED cupy_tests/core_tests/test_raw.py::TestRaw_param_3_{backend='nvcc', in_memory=False}::test_dynamical_parallelism
FAILED cupy_tests/core_tests/test_raw.py::TestRawPicklable_param_0_{compile=False, raw='ker'}::test_raw_picklable
FAILED cupy_tests/core_tests/test_raw.py::TestRawPicklable_param_1_{compile=False, raw='mod'}::test_raw_picklable
FAILED cupy_tests/core_tests/test_raw.py::TestRawPicklable_param_2_{compile=False, raw='mod_ker'}::test_raw_picklable
FAILED cupy_tests/core_tests/test_raw.py::TestRawPicklable_param_3_{compile=True, raw='ker'}::test_raw_picklable
FAILED cupy_tests/core_tests/test_raw.py::TestRawPicklable_param_4_{compile=True, raw='mod'}::test_raw_picklable
FAILED cupy_tests/core_tests/test_raw.py::TestRawPicklable_param_5_{compile=True, raw='mod_ker'}::test_raw_picklable
FAILED cupy_tests/cuda_tests/test_compiler.py::TestNvrtcArch::test_compile_cuda9

test_compile_cuda9 seems to be already fixed, the RawKernel tests work fine in my local machine with cc 7.5, may be related to flexCI settings?

@kmaehashi

Copy link
Copy Markdown
Member

I've re-kicked CUDA 13 CI with the latest commit. Let's see how it goes...
#9289 (comment)

@kmaehashi

Copy link
Copy Markdown
Member

https://ci.preferred.jp/cupy.linux.cuda130/197990/ is the CI results for the commit 8d91920.

In addition to Test1dCallbacks, TestNdCallbacks needs to be skipped on sm_75 as well. I've pushed a fix for that.

For test_raw.py test failures, I could reproduce locally using NVCC="ccache nvcc". The problem is described in #4421 (comment) but I'm not sure why this started to happen in CUDA 13 🤔
Let's kick other CIs for older CUDA versions to isolate the problem.

/test mini

@leofang

leofang commented Aug 10, 2025

Copy link
Copy Markdown
Member

For test_raw.py test failures, I could reproduce locally using NVCC="ccache nvcc". The problem is described in #4421 (comment) but I'm not sure why this started to happen in CUDA 13 🤔

Not sure what happened... Looks like an I/O error, could it be out of space?

            if code_type == 'ptx':
>               with open(result_path, 'rb') as ptx_file:
                     ^^^^^^^^^^^^^^^^^^^^^^^
E               FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpzktuvmkn/preprocess.ptx'

@kmaehashi

kmaehashi commented Aug 10, 2025

Copy link
Copy Markdown
Member

No, this is a longstanding bug in ccache that cannot handle --ptx -dc preprocess.cu or --ptx --device-c preprocess.cu option. For some reason ccache automatically appends -o preprocess.o when proxying to nvcc, where it should not (or should append -o preprocess.ptx). I'm still unsure why this started happen here though... Anyway I've added a workaround.

/test mini

@kmaehashi

kmaehashi commented Aug 10, 2025

Copy link
Copy Markdown
Member

Kicked CUDA 13 CIs again.

https://ci.preferred.jp/cupy.linux.cuda130/198024/
https://ci.preferred.jp/cupy.linux.cuda130.multi/198026/
https://ci.preferred.jp/cupy.win.cuda130/198025/

-> all passed!

@kmaehashi kmaehashi enabled auto-merge August 10, 2025 12:32

@kmaehashi kmaehashi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Stamped! Thanks @emcastillo, @robertmaynard and all involved for the hard work!

@kmaehashi kmaehashi merged commit 92b7936 into cupy:main Aug 10, 2025
65 checks passed
@chainer-ci

Copy link
Copy Markdown
Member

@kmaehashi Failed to backport automatically.


Not cleanly cherry-picked

kmaehashi added a commit to kmaehashi/cupy that referenced this pull request Aug 11, 2025
@kmaehashi kmaehashi changed the title Add CUDA 13 support Add CUDA 13 & NCCL 2.27 support Dec 18, 2025
@kmaehashi kmaehashi mentioned this pull request Dec 18, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocking Issue/pull-request is mandatory for the upcoming release cat:enhancement Improvements to existing features prio:high to-be-backported Pull-requests to be backported to stable branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants