fbpx
Wikipedia

CuPy

CuPy is an open source library for GPU-accelerated computing with Python programming language, providing support for multi-dimensional arrays, sparse matrices, and a variety of numerical algorithms implemented on top of them.[3] CuPy shares the same API set as NumPy and SciPy, allowing it to be a drop-in replacement to run NumPy/SciPy code on GPU. CuPy supports NVIDIA CUDA GPU platform, and AMD ROCm GPU platform starting in v9.0.[4][5]

CuPy
Original author(s)Seiya Tokui
Developer(s)Community, Preferred Networks, Inc.
Initial releaseSeptember 2, 2015; 7 years ago (2015-09-02).[1]
Stable release
v10.5.0[2] / May 26, 2022; 14 months ago (2022-05-26)[2]
Preview release
v11.0.0b3[2] / May 26, 2022; 14 months ago (2022-05-26)[2]
Repositorygithub.com/cupy/cupy
Written inPython, Cython, CUDA
Operating systemLinux, Windows
PlatformCross-platform
TypeNumerical analysis
LicenseMIT
Websitecupy.dev

CuPy has been initially developed as a backend of Chainer deep learning framework, and later established as an independent project in 2017.[6]

CuPy is a part of the NumPy ecosystem array libraries[7] and is widely adopted to utilize GPU with Python,[8] especially in high-performance computing environments such as Summit,[9] Perlmutter,[10] EULER,[11] and ABCI.[12]

CuPy is a NumFOCUS affiliated project.[13]

Features Edit

CuPy implements NumPy/SciPy-compatible APIs, as well as features to write user-defined GPU kernels or access low-level APIs.[14][15]

NumPy-compatible APIs Edit

The same set of APIs defined in the NumPy package (numpy.*) are available under cupy.* package.

SciPy-compatible APIs Edit

The same set of APIs defined in the SciPy package (scipy.*) are available under cupyx.scipy.* package.

User-defined GPU kernels Edit

  • Kernel templates for element-wise and reduction operations
  • Raw kernel (CUDA C/C++)
  • Just-in-time transpiler (JIT)
  • Kernel fusion

Distributed computing Edit

  • Distributed communication package (cupyx.distributed), providing collective and peer-to-peer primitives

Low-level CUDA features Edit

  • Stream and event
  • Memory pool
  • Profiler
  • Host API binding
  • CUDA Python support[16]

Interoperability Edit

Examples Edit

Array creation Edit

>>> import cupy as cp >>> x = cp.array([1, 2, 3]) >>> x array([1, 2, 3]) >>> y = cp.arange(10) >>> y array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) 

Basic operations Edit

>>> import cupy as cp >>> x = cp.arange(12).reshape(3, 4).astype(cp.float32) >>> x array([[ 0., 1., 2., 3.], [ 4., 5., 6., 7.], [ 8., 9., 10., 11.]], dtype=float32) >>> x.sum(axis=1) array([ 6., 22., 38.], dtype=float32) 

Raw CUDA C/C++ kernel Edit

>>> import cupy as cp >>> kern = cp.RawKernel(r''' ... extern "C" __global__ ... void multiply_elemwise(const float* in1, const float* in2, float* out) { ... int tid = blockDim.x * blockIdx.x + threadIdx.x; ... out[tid] = in1[tid] * in2[tid]; ... } ... ''', 'multiply_elemwise') >>> in1 = cp.arange(16, dtype=cp.float32).reshape(4, 4) >>> in2 = cp.arange(16, dtype=cp.float32).reshape(4, 4) >>> out = cp.zeros((4, 4), dtype=cp.float32) >>> kern((4,), (4,), (in1, in2, out)) # grid, block and arguments >>> out array([[ 0., 1., 4., 9.], [ 16., 25., 36., 49.], [ 64., 81., 100., 121.], [144., 169., 196., 225.]], dtype=float32) 

Applications Edit

See also Edit

References Edit

  1. ^ "Release v1.3.0 – chainer/chainer". Retrieved 25 June 2022 – via GitHub.
  2. ^ a b c d "Releases – cupy/cupy". Retrieved 18 June 2022 – via GitHub.
  3. ^ Okuta, Ryosuke; Unno, Yuya; Nishino, Daisuke; Hido, Shohei; Loomis, Crissman (2017). CuPy: A NumPy-Compatible Library for NVIDIA GPU Calculations (PDF). Proceedings of Workshop on Machine Learning Systems (LearningSys) in The Thirty-first Annual Conference on Neural Information Processing Systems (NIPS).
  4. ^ "CuPy 9.0 Brings AMD GPU Support To This Numpy-Compatible Library - Phoronix". Phoronix. 29 April 2021. Retrieved 21 June 2022.
  5. ^ "AMD Leads High Performance Computing Towards Exascale and Beyond". 28 June 2021. Retrieved 21 June 2022. Most recently, CuPy, an open-source array library with Python, has expanded its traditional GPU support with the introduction of version 9.0 that now offers support for the ROCm stack for GPU-accelerated computing.
  6. ^ "Preferred Networks released Version 2 of Chainer, an Open Source framework for Deep Learning - Preferred Networks, Inc". 2 June 2017. Retrieved 18 June 2022.
  7. ^ "NumPy". numpy.org. Retrieved 21 June 2022.
  8. ^ Gorelick, Micha; Ozsvald, Ian (April 2020). High Performance Python: Practical Performant Programming for Humans (2nd ed.). O'Reilly Media, Inc. p. 190. ISBN 9781492055020.
  9. ^ Oak Ridge Leadership Computing Facility. "Installing CuPy". OLCF User Documentation. Retrieved 21 June 2022.
  10. ^ National Energy Research Scientific Computing Center. "Using Python on Perlmutter". NERSC Documentation. Retrieved 21 June 2022.
  11. ^ ETH Zurich. "CuPy". ScientificComputing. Retrieved 21 June 2022.
  12. ^ National Institute of Advanced Industrial Science and Technology. "Chainer". ABCI 2.0 User Guide. Retrieved 21 June 2022.
  13. ^ "Affiliated Projects - NumFOCUS". Retrieved 18 June 2022.
  14. ^ "Overview". CuPy documentation. Retrieved 18 June 2022.
  15. ^ "Comparison Table". CuPy documentation. Retrieved 18 June 2022.
  16. ^ "CUDA Python | NVIDIA Developer". Retrieved 21 June 2022.
  17. ^ "Welcome to DLPack's documentation!". DLPack 0.6.0 documentation. Retrieved 21 June 2022.
  18. ^ "CUDA Array Interface (Version 3)". Numba 0.55.2+0.g2298ad618.dirty-py3.7-linux-x86_64.egg documentation. Retrieved 21 June 2022.
  19. ^ "NEP 13 — A mechanism for overriding Ufuncs — NumPy Enhancement Proposals". numpy.org. Retrieved 21 June 2022.
  20. ^ "NEP 18 — A dispatch mechanism for NumPy's high level array functions — NumPy Enhancement Proposals". numpy.org. Retrieved 21 June 2022.
  21. ^ Charles R Harris; K. Jarrod Millman; Stéfan J. van der Walt; et al. (16 September 2020). "Array programming with NumPy" (PDF). Nature. 585 (7825): 357–362. arXiv:2006.10256. doi:10.1038/S41586-020-2649-2. ISSN 1476-4687. PMC 7759461. PMID 32939066. Wikidata Q99413970.
  22. ^ "2021 report - Python Data APIs Consortium" (PDF). Retrieved 21 June 2022.
  23. ^ "Purpose and scope". Python array API standard 2021.12 documentation. Retrieved 21 June 2022.
  24. ^ "Install spaCy". spaCy Usage Documentation. Retrieved 21 June 2022.
  25. ^ Patel, Ankur A.; Arasanipalai, Ajay Uppili (May 2021). Applied Natural Language Processing in the Enterprise (1st ed.). O'Reilly Media, Inc. p. 68. ISBN 9781492062578.
  26. ^ "Python Package Introduction". xgboost 1.6.1 documentation. Retrieved 21 June 2022.
  27. ^ "UCBerkeleySETI/turbo_seti: turboSETI -- python based SETI search algorithm". GitHub. Retrieved 21 June 2022.
  28. ^ "Open GPU Data Science | RAPIDS". Retrieved 21 June 2022.
  29. ^ "API Docs". RAPIDS Docs. Retrieved 21 June 2022.
  30. ^ "Efficient Data Sharing between CuPy and RAPIDS". Retrieved 21 June 2022.
  31. ^ "10 Minutes to cuDF and CuPy". Retrieved 21 June 2022.
  32. ^ Alex, Rogozhnikov (2022). Einops: Clear and Reliable Tensor Manipulations with Einstein-like Notation. International Conference on Learning Representations.
  33. ^ "arogozhnikov/einops: Deep learning operations reinvented (for pytorch, tensorflow, jax and others)". GitHub. Retrieved 21 June 2022.
  34. ^ Tokui, Seiya; Okuta, Ryosuke; Akiba, Takuya; Niitani, Yusuke; Ogawa, Toru; Saito, Shunta; Suzuki, Shuji; Uenishi, Kota; Vogel, Brian; Vincent, Hiroyuki Yamazaki (2019). Chainer: A Deep Learning Framework for Accelerating the Research Cycle. Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. doi:10.1145/3292500.3330756.

External links Edit

  • Official website
  • GitHub repository

cupy, open, source, library, accelerated, computing, with, python, programming, language, providing, support, multi, dimensional, arrays, sparse, matrices, variety, numerical, algorithms, implemented, them, shares, same, numpy, scipy, allowing, drop, replaceme. CuPy is an open source library for GPU accelerated computing with Python programming language providing support for multi dimensional arrays sparse matrices and a variety of numerical algorithms implemented on top of them 3 CuPy shares the same API set as NumPy and SciPy allowing it to be a drop in replacement to run NumPy SciPy code on GPU CuPy supports NVIDIA CUDA GPU platform and AMD ROCm GPU platform starting in v9 0 4 5 CuPyOriginal author s Seiya TokuiDeveloper s Community Preferred Networks Inc Initial releaseSeptember 2 2015 7 years ago 2015 09 02 1 Stable releasev10 5 0 2 May 26 2022 14 months ago 2022 05 26 2 Preview releasev11 0 0b3 2 May 26 2022 14 months ago 2022 05 26 2 Repositorygithub wbr com wbr cupy wbr cupyWritten inPython Cython CUDAOperating systemLinux WindowsPlatformCross platformTypeNumerical analysisLicenseMITWebsitecupy wbr devCuPy has been initially developed as a backend of Chainer deep learning framework and later established as an independent project in 2017 6 CuPy is a part of the NumPy ecosystem array libraries 7 and is widely adopted to utilize GPU with Python 8 especially in high performance computing environments such as Summit 9 Perlmutter 10 EULER 11 and ABCI 12 CuPy is a NumFOCUS affiliated project 13 Contents 1 Features 1 1 NumPy compatible APIs 1 2 SciPy compatible APIs 1 3 User defined GPU kernels 1 4 Distributed computing 1 5 Low level CUDA features 1 6 Interoperability 2 Examples 2 1 Array creation 2 2 Basic operations 2 3 Raw CUDA C C kernel 3 Applications 4 See also 5 References 6 External linksFeatures EditCuPy implements NumPy SciPy compatible APIs as well as features to write user defined GPU kernels or access low level APIs 14 15 NumPy compatible APIs Edit The same set of APIs defined in the NumPy package numpy are available under cupy package Multi dimensional array cupy ndarray for boolean integer float and complex data types Module level functions Linear algebra functions Fast Fourier transform Random number generatorSciPy compatible APIs Edit The same set of APIs defined in the SciPy package scipy are available under cupyx scipy package Sparse matrices cupyx scipy sparse matrix of CSR COO CSC and DIA format Discrete Fourier transform Advanced linear algebra Multidimensional image processing Sparse linear algebra Special functions Signal processing Statistical functionsUser defined GPU kernels Edit Kernel templates for element wise and reduction operations Raw kernel CUDA C C Just in time transpiler JIT Kernel fusionDistributed computing Edit Distributed communication package cupyx distributed providing collective and peer to peer primitivesLow level CUDA features Edit Stream and event Memory pool Profiler Host API binding CUDA Python support 16 Interoperability Edit DLPack 17 CUDA Array Interface 18 NEP 13 array ufunc 19 NEP 18 array function 20 21 Array API Standard 22 23 Examples EditArray creation Edit gt gt gt import cupy as cp gt gt gt x cp array 1 2 3 gt gt gt x array 1 2 3 gt gt gt y cp arange 10 gt gt gt y array 0 1 2 3 4 5 6 7 8 9 Basic operations Edit gt gt gt import cupy as cp gt gt gt x cp arange 12 reshape 3 4 astype cp float32 gt gt gt x array 0 1 2 3 4 5 6 7 8 9 10 11 dtype float32 gt gt gt x sum axis 1 array 6 22 38 dtype float32 Raw CUDA C C kernel Edit gt gt gt import cupy as cp gt gt gt kern cp RawKernel r extern C global void multiply elemwise const float in1 const float in2 float out int tid blockDim x blockIdx x threadIdx x out tid in1 tid in2 tid multiply elemwise gt gt gt in1 cp arange 16 dtype cp float32 reshape 4 4 gt gt gt in2 cp arange 16 dtype cp float32 reshape 4 4 gt gt gt out cp zeros 4 4 dtype cp float32 gt gt gt kern 4 4 in1 in2 out grid block and arguments gt gt gt out array 0 1 4 9 16 25 36 49 64 81 100 121 144 169 196 225 dtype float32 Applications EditspaCy 24 25 XGBoost 26 turboSETI Berkeley SETI 27 NVIDIA RAPIDS 28 29 30 31 einops 32 33 Chainer 34 See also EditArray programming List of numerical analysis software DaskReferences Edit Release v1 3 0 chainer chainer Retrieved 25 June 2022 via GitHub a b c d Releases cupy cupy Retrieved 18 June 2022 via GitHub Okuta Ryosuke Unno Yuya Nishino Daisuke Hido Shohei Loomis Crissman 2017 CuPy A NumPy Compatible Library for NVIDIA GPU Calculations PDF Proceedings of Workshop on Machine Learning Systems LearningSys in The Thirty first Annual Conference on Neural Information Processing Systems NIPS CuPy 9 0 Brings AMD GPU Support To This Numpy Compatible Library Phoronix Phoronix 29 April 2021 Retrieved 21 June 2022 AMD Leads High Performance Computing Towards Exascale and Beyond 28 June 2021 Retrieved 21 June 2022 Most recently CuPy an open source array library with Python has expanded its traditional GPU support with the introduction of version 9 0 that now offers support for the ROCm stack for GPU accelerated computing Preferred Networks released Version 2 of Chainer an Open Source framework for Deep Learning Preferred Networks Inc 2 June 2017 Retrieved 18 June 2022 NumPy numpy org Retrieved 21 June 2022 Gorelick Micha Ozsvald Ian April 2020 High Performance Python Practical Performant Programming for Humans 2nd ed O Reilly Media Inc p 190 ISBN 9781492055020 Oak Ridge Leadership Computing Facility Installing CuPy OLCF User Documentation Retrieved 21 June 2022 National Energy Research Scientific Computing Center Using Python on Perlmutter NERSC Documentation Retrieved 21 June 2022 ETH Zurich CuPy ScientificComputing Retrieved 21 June 2022 National Institute of Advanced Industrial Science and Technology Chainer ABCI 2 0 User Guide Retrieved 21 June 2022 Affiliated Projects NumFOCUS Retrieved 18 June 2022 Overview CuPy documentation Retrieved 18 June 2022 Comparison Table CuPy documentation Retrieved 18 June 2022 CUDA Python NVIDIA Developer Retrieved 21 June 2022 Welcome to DLPack s documentation DLPack 0 6 0 documentation Retrieved 21 June 2022 CUDA Array Interface Version 3 Numba 0 55 2 0 g2298ad618 dirty py3 7 linux x86 64 egg documentation Retrieved 21 June 2022 NEP 13 A mechanism for overriding Ufuncs NumPy Enhancement Proposals numpy org Retrieved 21 June 2022 NEP 18 A dispatch mechanism for NumPy s high level array functions NumPy Enhancement Proposals numpy org Retrieved 21 June 2022 Charles R Harris K Jarrod Millman Stefan J van der Walt et al 16 September 2020 Array programming with NumPy PDF Nature 585 7825 357 362 arXiv 2006 10256 doi 10 1038 S41586 020 2649 2 ISSN 1476 4687 PMC 7759461 PMID 32939066 Wikidata Q99413970 2021 report Python Data APIs Consortium PDF Retrieved 21 June 2022 Purpose and scope Python array API standard 2021 12 documentation Retrieved 21 June 2022 Install spaCy spaCy Usage Documentation Retrieved 21 June 2022 Patel Ankur A Arasanipalai Ajay Uppili May 2021 Applied Natural Language Processing in the Enterprise 1st ed O Reilly Media Inc p 68 ISBN 9781492062578 Python Package Introduction xgboost 1 6 1 documentation Retrieved 21 June 2022 UCBerkeleySETI turbo seti turboSETI python based SETI search algorithm GitHub Retrieved 21 June 2022 Open GPU Data Science RAPIDS Retrieved 21 June 2022 API Docs RAPIDS Docs Retrieved 21 June 2022 Efficient Data Sharing between CuPy and RAPIDS Retrieved 21 June 2022 10 Minutes to cuDF and CuPy Retrieved 21 June 2022 Alex Rogozhnikov 2022 Einops Clear and Reliable Tensor Manipulations with Einstein like Notation International Conference on Learning Representations arogozhnikov einops Deep learning operations reinvented for pytorch tensorflow jax and others GitHub Retrieved 21 June 2022 Tokui Seiya Okuta Ryosuke Akiba Takuya Niitani Yusuke Ogawa Toru Saito Shunta Suzuki Shuji Uenishi Kota Vogel Brian Vincent Hiroyuki Yamazaki 2019 Chainer A Deep Learning Framework for Accelerating the Research Cycle Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery amp Data Mining doi 10 1145 3292500 3330756 External links EditOfficial website GitHub repository Retrieved from https en wikipedia org w index php title CuPy amp oldid 1164609829, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.