question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Tracker] Implement all `scipy.*` APIs in CuPy

See original GitHub issue

Implement GPU version of scipy.* functions in cupyx.scipy.* namespace.

This is a tracker issue that summarizes the implementation status of each SciPy public module in CuPy. See the comparison table for details.

Legends

  • πŸ₯š Module not yet available in CuPy.
  • πŸ₯ Module available in CuPy but coverage needs improvement.
  • :shipit: Module available in CuPy and major features are implemented (may still have a few unimplemented APIs).

List of Modules

  • πŸ₯š Clustering package (scipy.cluster)
    • πŸ₯š K-means clustering and vector quantization (scipy.cluster.vq) (#5947)
    • πŸ₯š Hierarchical clustering (scipy.cluster.hierarchy) (#3434)
  • πŸ₯š Constants (scipy.constants)
  • :shipit: Discrete Fourier transforms (scipy.fft)
  • :shipit: Legacy discrete Fourier transforms (scipy.fftpack) (note: deprecated, no further development planned)
  • πŸ₯š Integration and ODEs (scipy.integrate) (#7019)
  • πŸ₯š Interpolation (scipy.interpolate) (#7186)
  • πŸ₯š Input and output (scipy.io)
    • πŸ₯š scipy.io.arff
    • πŸ₯š scipy.io.matlab
    • πŸ₯š scipy.io.wavfile
  • πŸ₯ Linear algebra (scipy.linalg)
    • πŸ₯š Low-level BLAS functions (scipy.linalg.blas)
    • πŸ₯š scipy.linalg.cython_blas (note: unlikely supported in CuPy)
    • πŸ₯š Low-level LAPACK functions (scipy.linalg.lapack)
    • πŸ₯š scipy.linalg.cython_lapack
    • πŸ₯š Interpolative matrix decomposition (scipy.linalg.interpolative)
  • :shipit: Multidimensional image processing (scipy.ndimage)
  • πŸ₯š Orthogonal distance regression (scipy.odr)
  • πŸ₯š Optimization and root finding (scipy.optimize) (#6112)
  • πŸ₯ Signal processing (scipy.signal)
    • πŸ₯š scipy.signal.windows
  • :shipit: Sparse matrices (scipy.sparse)
    • :shipit: Sparse linear algebra (scipy.sparse.linalg)
    • πŸ₯ Compressed sparse graph routines (scipy.sparse.csgraph) (#2431)
  • πŸ₯ Spatial algorithms and data structures (scipy.spatial) (#5946)
    • πŸ₯ Distance computations (scipy.spatial.distance) (#5946)
    • πŸ₯š Spatial transformations (scipy.spatial.transform)
  • πŸ₯ Special functions (scipy.special)
  • πŸ₯ Statistical functions (scipy.stats)
    • πŸ₯š Contingency table functions (scipy.stats.contingency) (note: RAFT could be used)
    • πŸ₯š scipy.stats.distributions
    • πŸ₯š Statistical functions for masked arrays (scipy.stats.mstats) (note: masked arrays unsupported in CuPy)
    • πŸ₯š Quasi-Monte Carlo submodule (scipy.stats.qmc)
    • πŸ₯š Random Number Generators (scipy.stats.sampling) (note: RAFT could be used)

Note: Miscellaneous routines (scipy.misc) is excluded from the list as it is planned to be removed in the upstream (https://github.com/scipy/scipy/issues/15608).

Starter Task

If you are new to CuPy and wondering where to start, here are some good first issues to try. They are relatively simple and independent.

  • APIs under Special functions (scipy.special)
  • APIs under Statistical Functions (scipy.stats)
  • scipy.sparse.block_diag (#7058)
  • scipy.sparse.load_npz
  • scipy.sparse.save_npz
  • scipy.constants.* (hint: most things except for methods can just be borrowed from SciPy)

Steps to Contribute

  1. Fork and star ⭐ the CuPy repository πŸ˜‰

  2. Pick a function you want to work on from any of the modules listed above. You can find the function in the SciPy API Reference to understand what should be implemented. If you want to work on new modules (πŸ₯š), first discuss with us on this issue.

  3. Implement a function in your branch. If you need help, join Gitter or just ask for help in this issue.

  4. Don’t forget to write a test code!

  5. Build CuPy and run tests to confirm that the function runs fine: pip install -e . && pytest tests/cupyx_tests/scipy_tests/PATH_TO_YOUR_TEST See the Contribution Guide for details.

  6. Submit a pull-request to the master branch.

Note that you will need a GPU environment to develop CuPy.

See also: NumPy API Tracker Issue #6078

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:9
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rgommerscommented, Feb 18, 2022

This looks great, thanks @kmaehashi!

Miscellaneous routines (scipy.misc)

Note that we’re quite likely deprecating this module in SciPy 1.9.0 (see https://github.com/scipy/scipy/issues/15608), so I suggest not working on that.

1reaction
cjnoletcommented, Feb 20, 2022

@kmaehashi, RAFT contains hierarchical clustering code as well: https://github.com/cupy/cupy/issues/3434.

RAFT also contains functions for computing contingency table and sampling from various distributions. Wondering if those might be useful here as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CuPy: NumPy & SciPy for GPU
CuPy is an open-source array library for GPU-accelerated computing with Python. CuPy utilizes CUDA Toolkit libraries including cuBLAS, cuRAND, cuSOLVER,Β ...
Read more >
A proposed design for supporting multiple array types across SciPy ...
Let me put it this way, if CuPy.solve has an option that SciPy solve doesn't ... Duck-typing protocol: Implemented using the array-api (choosing...
Read more >
SciPy 1.9.0 Release Notes β€” SciPy v1.9.3 Manual
All users are encouraged to upgrade to this release, as there are a large ... for interactive use, it's not actually recommended for...
Read more >
NumPy
Why NumPy? Powerful n-dimensional arrays. Numerical computing tools. Interoperable. Performant. Open source.
Read more >
Array Libraries Interoperability - Quansight Labs
"NumPy, CuPy, PyTorch or SciPy is not gonna hit as hard as all of them ... Let's see how the use of this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found