Questions tagged [cupy]

CuPy is an implementation of NumPy-compatible multi-dimensional array on CUDA.

About CuPy

From the CuPy homepage:

High Performance with CUDA

CuPy is an open-source matrix library accelerated with NVIDIA CUDA. It also uses CUDA-related libraries including cuBLAS, cuDNN, cuRand, cuSolver, cuSPARSE, cuFFT and NCCL to make full use of the GPU architecture.

Highly Compatible with NumPy

CuPy's interface is highly compatible with ; in most cases it can be used as a drop-in replacement. All you need to do is just replace numpy with cupy in your Python code. It supports various methods, indexing, data types, broadcasting and more.

CuPy consists of the core multi-dimensional array class, cupy.ndarray, and many functions on it. It supports a subset of numpy.ndarray interface.

Resources

339 questions
4
votes
2 answers

Spacy + GPU gives error: GPU is not accessible. Was the library installed correctly?

The following code give error: import spacy spacy.require_gpu() Traceback (most recent call last): File "/home/user/PycharmProjects/new_tsg/training/spacy_train_data/spacy_pipeline.py", line 39, in spacy.require_gpu() File…
palandlom
  • 529
  • 6
  • 17
4
votes
1 answer

How to achieve a faster convolve2d using GPU

I was recently learning PyCuda and planning to replace some code of a camera system to speed up image processing. That part was originally using cv2.filter2D. My intention is to accelerate the processing with GPU. Time for signal.convolve2d:…
YFG
  • 41
  • 1
  • 5
4
votes
1 answer

Is "import numpy as cp" good practice to handle non-GPU situations?

I'm writing code that is ideally run on the GPU for speed, using CuPy. However, I want the code to be able run (albeit more slowly) using a numpy implementation. At the moment I am doing the following: import numpy as np if gpu_present: import…
TomNorway
  • 2,584
  • 1
  • 19
  • 26
4
votes
2 answers

Why is the execution time for numpy faster than cupy?

I am playing around with the differences between numpy and cupy and have noticed that within these two similiar programs I have created, the cupy version is much slower despite the fact that is runs on a GPU. Here is the numpy version: import…
RyanNDSU
  • 41
  • 2
4
votes
0 answers

invert sparse matrix in cupy (CUDA GPU programming in python)

How do I invert the following sparse matrix (named row_sparse_cupy below) created with the python library "cupy" using CUDA? The example code is import cupy as cp import numpy as np import scipy.sparse as sp N=100 row_sparse =…
user823
  • 265
  • 2
  • 14
4
votes
1 answer

Why is half-precision complex float arithmetic not supported in Python and CUDA?

NumPY has complex64 corresponding to two float32's. But it also has float16's but no complex32. How come? I have signal processing calculation involving FFT's where I think I'd be fine with complex32, but I don't see how to get there. In…
Lars Ericson
  • 1,952
  • 4
  • 32
  • 45
4
votes
1 answer

Cupy become slower when iterations increase

I'm learning to use cupy. But I've found a problem really confusing. It seems that cupy performs well in a program at first. When it runs for a while, Cupy seems be much slower. Here is the code: import cupy as np from line_profiler import…
Colin
  • 43
  • 4
4
votes
2 answers

Cupy is slower than numpy

I tried to speed up my python code with cupy instead of numpy. The problem here is, that using cupy, my code got drastically slower. Maybe I went a little bit to naive on that problem. Maybe anyone can find a bottleneck in my code: import cupy as…
Bomel
  • 97
  • 1
  • 6
3
votes
1 answer

Transferring a Pointer From C++ To Python Compatible with Host and Device Memory

I have a Python function (named apply_filter), whose execution may involve either the CPU (using NumPy) and GPU (using CuPy). The function takes an input-buffer object, represting a pointer to data either in system memory or on the GPU's global…
Amit
  • 117
  • 7
3
votes
0 answers

Why can't my cupy be installed correctly?

nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2018 NVIDIA Corporation Built on Sat_Aug_25_21:08:01_CDT_2018 Cuda compilation tools, release 10.0, V10.0.130 (wbnlu) tf-docker /data0/congmin > nvidia-smi Fri Dec 4 15:40:43 2020 …
marlon
  • 6,029
  • 8
  • 42
  • 76
3
votes
1 answer

Cupy fft causing memory leak?

In my python script I have some quite extensive use of fft and ifft. To speed things up with my GTX 1060 6GB I use the cupy library. After running into Out Of Memory problems, I discovered that memory leakage was the cause. I created the following…
MazzMan
  • 815
  • 1
  • 9
  • 15
3
votes
1 answer

CuGraph implementation of NetworkX all_pairs_dijkstras

I'm trying to convert a cpu bound algorithm I have to a GPU one, and I'm having all sorts of trouble with cugraph. Some of it is my ignorance, the other part is just the infancy and underdevelopment of cugraph, and the final part is me just sucking…
Moose Sims
  • 141
  • 2
  • 11
3
votes
1 answer

Why is my GPU slower than CPU in matrix operations?

CPU: i7-9750 @2.6GHz (with 16G DDR4 Ram); GPU: Nvidia Geforce GTX 1600 TI (6G); OS: Windows 10-64bit I tried to see how fast the GPU is in doing basic matrix operations compared with CPU, and I basically followed this…
3
votes
1 answer

How to specify a gcc path in pip command?

I am trying to install cupy 5.0.0. cupy5.0.0 needs gcc version not more than 7. My deafault gcc is gcc-9. I cannot use conda environment. Also i dont have sudo permission to change /usr/bin/gcc to point to gcc-7. Is there any way to pass gcc path to…
Bhaswati Saha
  • 33
  • 1
  • 3
3
votes
2 answers

I cannot install cupy with pip

I have attached the error message because I have no idea where to start with it. I have tried updating setuptools and purging and reinstalling pip. I am running Linux Mint 19.3 Cinnamon 4.4.8. If anyone has experienced this problem or has any…
RJ Yarwood
  • 43
  • 1
  • 1
  • 5
1
2
3
22 23