Announcing CuPy v13

Kenichi Maehashi
CuPy
Published in
3 min readJan 18, 2024

We are happy to announce that CuPy v13 is now available. This new major release contains the effort of over 270 pull requests, including more SciPy-compatible routines and better packaging. Let’s check out the highlights:

Signal Processing APIs − `cupyx.scipy.signal`

In this release, we have added 140 signal processing routines that are compatible with SciPy’s scipy.signal.* APIs. The API Reference lists all the available signal functions. This work has been done by Evgani Burovski and Edgar Andrés Margffoy Tuay from Quansight, under the support of CZI’s Essential OSS for Science program.

We would also like to highlight cuSignal’s contributions in this release. cuSignal is a library developed by the NVIDIA RAPIDS project that provides GPU-accelerated implementation of signal processing algorithms using CuPy as its backend. cuSignal includes scipy.signal compatible APIs, so we shared the same goals. After a discussion with the cuSignal team, we agreed to merge cuSignal into CuPy to provide users a better experience with a unified library for SciPy routines on GPU. We would like to acknowledge and thank Adam Thompson and everyone involved in the development for creating this great library and agreeing to this transition.

Import CuPy without CUDA

Essentially, CuPy is tightly coupled with underlying GPU toolkits such as NVIDIA CUDA and AMD ROCm. For a long time, CuPy’s installation assumed the toolkit to be installed locally — if not, import cupy has yielded an ImportError. This has been a problem in some scenarios, such as NumPy-based projects with optional GPU support via CuPy. In CuPy v13, all CUDA Toolkit libraries are lazily-loaded, making import cupy to success even when CUDA is not installed.

More NumPy & SciPy-compatible APIs

In addition to the signal processing routines mentioned above, the following fifteen functions have been newly implemented, providing more coverage for NumPy/SciPy APIs.

  • cupy.delete
  • cupy.polynomial.polynomial.polyval
  • cupy.polynomial.polynomial.polyvalfromroots
  • cupyx.scipy.linalg.bandwidth
  • cupyx.scipy.linalg.expm
  • cupyx.scipy.linalg.khatri_rao
  • cupyx.scipy.ndimage.distance_transform_edt
  • cupyx.scipy.ndimage.value_indices
  • cupyx.scipy.interpolate.NdPPoly
  • cupyx.scipy.special.binom
  • cupyx.scipy.special.ellipj
  • cupyx.scipy.special.ellipk
  • cupyx.scipy.special.exprel
  • cupyx.scipy.special.spherical_yn
  • cupyx.scipy.special.zetac

Support for cuTENSOR 2.0

NVIDIA cuTENSOR is a performant and flexible library for accelerating tensor linear algebra. CuPy v13 supports cuTENSOR 2.0, the latest major release of the library, achieving higher performance than cuTENSOR 1.x series.

To enable cuTENSOR support in CuPy, install cuTENSOR by pip install cutensor-cu12 (or cutensor-cu11 for CUDA 11.x) and set CUPY_ACCELERATORS=cub,cutensor environment variable.

Distributed ND-Array (preview)

CuPy v13 added initial support for sharding n-dimensional arrays across multiple GPU devices connected to the same host.

from cupyx.distributed.array import distributed_array

shape = (16, 16)
cpu_array = numpy.random.rand(*shape)

# Set the chunk indexes for each device
# device 0 holds rows 0..8 and device 1 holds rows 8..16
mapping = {
0: [(slice(8), slice(None, None))],
1: [(slice(8, None), slice(None, None))],
}

# The array is allocated in devices 0 and 1
multi_gpu_array = distributed_array(cpu_array, mapping)

The work has been done by @shino16 during the Preferred Networks 2023 summer internship.

Upgrading from CuPy v12 or earlier

As always, we have prepared the Upgrade Guide, which lists the changes that may break your code when migrating between major releases. Especially note that the minimum requirement for CuPy is now CUDA 11.2 and Python 3.9.

Support Us via GitHub Sponsors!

Like many open-source projects, it is important to have a financial backbone to achieve continuous development. As a part of our effort to make the project sustainable, we have enrolled in GitHub Sponsors to accept donations. Please consider sponsoring us to help us support CuPy’s development.

As a NumFOCUS Sponsored Project, funds sponsored through the GitHub Sponsors are collected and disbursed via NumFOCUS, a 501(c)(3) public charity in the United States, which acts as the fiscal sponsor for the project. Anyone can track the financial details on our Open Collective page.

--

--

Kenichi Maehashi
CuPy
Editor for

Working on CuPy & PyTorch development in the Deep Learning Ecosystem Team at Preferred Networks