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
2
votes
1 answer

Passing CuPy CUDA device pointer to pybind11

I am trying to instantiate an array in GPU memory using CuPy and then pass the pointer to this array to C++ using pybind11. A minimal example of the problem I am running into is shown below. Python import demolib #compiled pybind11 library import…
2
votes
1 answer

Sharing Raw Kernel Cache between Docker Containers

I'm creating a python application that uses cupy.RawKernal. The application runs within a docker container using NVIDIA Container Toolkit. I'd like to avoid having the cupy.RawKernal recompile every time I create a new container (happens frequently…
Kyle R
  • 61
  • 6
2
votes
0 answers

How to convert cupy data into PyTorch tensor?

Recently I've learned that CuPy would utilize GPU to accelerate the computation in deep learning. However, after the following step I still got an unsolvable error: I installed CuPy correctly through https://docs.cupy.dev/en/stable/install.html.…
2
votes
2 answers

Fastest method of bilinear weighting of a 2D point cloud onto a grid

Given a point (0.8, 0.6) and an intensity (3), one can bi-linearly "reverse interpolate" a single point onto a 2x2 grid with integer indices (0,0) -> (1,1). The points and grid are oriented with the first entry increasing downwards, and the second…
TomNorway
  • 2,584
  • 1
  • 19
  • 26
2
votes
0 answers

Distributing a python package based on CUDA availability

I have written a python package that does stuff (the specifics are irrelevant). When using the package, the user can specify whether or not to make use of available GPUs. In my code, I use the CuPy package to utilize the available GPUs. I would now…
Dalco
  • 21
  • 3
2
votes
0 answers

A Good Way to Expose CUPY MemoryPointer in C/C++?

NumPy provides well-defined C APIs so that one can easily handle NumPy array in C/C++ space. For example, if I have a C function that takes C arrays (pointers) as arguments, I can just #include , and pass a NumPy array to it by…
Chen
  • 113
  • 5
2
votes
1 answer

Memory leak in python for loop even if I delete all variables at the end of each iteration

The following two loops will use memory until I run out, but I can't figure out why. I am deleting all of the created variables at the end of each iteration and it still leaks. !pip3 install cupy-cuda101 import cupy as cp import numpy as np from…
xxanissrxx
  • 139
  • 9
2
votes
1 answer

Need Help In Converting cuDF Dataframe to cupy ndarray

I want to convert a cuDF dataframe to cupy ndarray. I'm using this code below: import time import numpy as np import cupy as cp import cudf from numba import cuda df = cudf.read_csv('titanic.csv') arr_cupy =…
Md Kaish Ansari
  • 251
  • 2
  • 7
2
votes
1 answer

AttributeError: module 'cupy' has no attribute 'array'

I have just installed cupy v-6 on Win-10 using conda conda install -c anaconda cupy and the installation was going smoothly, my cuda version is 10.1, Python 3.7.4, when I ran the following code, I get the error: AttributeError: module 'cupy' has no…
Bilal
  • 3,191
  • 4
  • 21
  • 49
2
votes
2 answers

How does anaconda pick cudatoolkit

I have multiple enviroments of anaconda with different cuda toolkits installed on them. env1 has cudatoolkit 10.0.130 env2 has cudatoolkit 10.1.168 env3 has cudatoolkit 10.2.89 I found these by running…
bananagator
  • 551
  • 3
  • 8
  • 26
2
votes
1 answer

Autocorrelation with cupy

I want to calc the autocorrelation of an image on a GPU. However, when I use the cupy correlate function, I get a different result than for the CPU calculation. Is it because cupyx.scipy.ndimage.correlate automatically normalizes the result by the…
DerMäuser
  • 41
  • 4
2
votes
1 answer

CuPy is not working on Ubuntu 18.04 with CUDA 9.0

Conditions: CuPy version 7.0.0 OS/Platform Ubuntu 18.04 CUDA version 9.0 cuDNN/NCCL version 7.6.5 (for cuda 9.0) GPU NVIDIA GTX580 Driver version 390.116 Code 1: import cupy as cp x = cp.arange(6).reshape(2, 3).astype('f') Error Message 1: NVRTC…
Touki Liu
  • 51
  • 5
2
votes
2 answers

How to transfer CuPy arrays to tensorflow

I'm using CuPy to generate some ground truth + network input data on the GPU, which I want to send to a TensorFlow network through the standard API: feed_dict = { network.Labels: labels, network.Network_Input: networkInput } However,…
Ilan
  • 21
  • 1
  • 2
2
votes
1 answer

TypeError: Unsupported type

I needed to run some parts of the code in GPU using cupy instead of numpy. So, I only made comment out for this line # import numpy as np and used this line instead of it import cupy as np the full code: from imutils.video import VideoStream from…
Redhwan
  • 927
  • 1
  • 9
  • 24
2
votes
1 answer

How should I do instead of using numpy.vectorize in CuPy?

How should I apply defined function to cupy.array instead of np.vectorize? Has similar function implemented yet in cupy? I'm writing simulation program in Python 3.6.9. I'd like to do the simulation in GPU(GTX1060, NVIDIA) with CuPy(6.0.0 for…
mas
  • 35
  • 7