Questions tagged [cupy]
CuPy is an implementation of NumPy-compatible multi-dimensional array on CUDA.
279
questions
0
votes
1
answer
37
views
Run multiple GPU functions on a single GPU in parallel using numba and cupy
I was wondering whether it is possible or even safe to run multiple cupy functions or numba cuda kernels in parallel inside the same code. Currently my code does this:
for i in range(int(nLoop)):
...
-2
votes
0
answers
27
views
Not finding cuda_path
I installed cupy via pip install cupy-cuda112.
However, when I do "import cupy", it shows the error below:
================================================================
Failed to import ...
2
votes
0
answers
16
views
Using NCCL library from cupy in a cython file (.pyx)
I am trying to import the function and definitions on https://github.com/cupy/cupy/blob/master/cupy_backends/cuda/libs/nccl.pyx
To a pyx file with a cimport, but it is not working.
I would like to ...
4
votes
1
answer
25
views
Difference between cupy.asnumpy() and get()
Given a CuPy array a, there are two ways to get a numpy array from it: a.get() and cupy.asnumpy(a). Is there any practical difference between them?
import cupy as cp
a = cp.random.randint(10, size=(...
0
votes
0
answers
10
views
Running cupy.histogram on given axis
I want to run cupy.histogram() parallelly on a 3D tensor of size (1000,10) where the histogram is performed features ( ,10) for each instance. I want to avoid doing the for-loop.
Is there any way to ...
0
votes
0
answers
29
views
Creating Numpy Array from Ctype pointer from Cupy Array
I am trying to share an array between host/device on zero copy memory(Jetson Tx2). I need a way to access the memory from a numpy array and cupy array.
I have initialised memory using cupy and then ...
2
votes
2
answers
93
views
Vectorized numpy: check if point is inside sphere?
I have a numpy array centers which is N row by 3 columns and contains the 3D coordinates of the center of the spheres. Then another Nx1 array radii which contains the radii corresponding to the ...
0
votes
0
answers
37
views
Increase cupy GPU memory in Colab
Can someone help to explain how to increase GPU memory when running cupy in colab? I think the default memory pool has 12GB GPU memory. Where is this 12GB coming from? Is it related to the config and ...
0
votes
0
answers
19
views
Cupy not using GPU in colab
I use cupy to accelerarte np computation. It is faster. However, after using cupy for large matrix computation, I query !nvidia-smi, and found GPU-Util is 0%. Does this mean cupy is not using colab ...
0
votes
0
answers
26
views
how to release gpu after cupy_backends.cuda.api.runtime.CUDARuntimeError: cudaErrorMemoryAllocation: out of memory
after raise cupy_backends.cuda.api.runtime.CUDARuntimeError: cudaErrorMemoryAllocation: out of memory in fastapi, gpu is not freed, how to free gpu
File "/app/app/core/color_retrieval.py", ...
0
votes
0
answers
29
views
Convert a list of cupy array to comination of list
I have a list of cupy.array as follow,
X_train = [[[cp.array([[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.],
[0., 0., 0.]]),
cp.array([0.96376295, 0.4473439 ])]],
[[cp.array([[0., 0., ...
1
vote
1
answer
64
views
Cupy sparse matrix does not correspond to its Scipy equivalence?
I digged the documentation for cupy sparse matrix.
as in scipy I expect to have something like this:
from scipy.sparse import csr_matrix
A_csr = csr_matrix([[1, 2, 0], [0, 0, 3], [4, 0, 5]])
but in ...
0
votes
0
answers
287
views
Failed to import cupy
After installing cupy via "pip install cupy-cuda110", I tried this in python3:
import cupy as cp
However, it failed:
"
$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9....
0
votes
1
answer
62
views
How to use Conda-installed Python module outside environment
I have downloaded cusignal with Conda using:
conda create -n rapids-22.02 -c rapidsai -c nvidia -c conda-forge \
cusignal=22.02 python=3.8 cudatoolkit=11.2
I have many other libraries that I use ...
0
votes
1
answer
71
views
python multiprocessing error along using cupy
Consider simplified example using multiprocessing inside a class that use cupy for simulation.
this part
obj = FUNC(par)
obj.simulate()
done in with cupy, then data copy to CPU. multiprocessing does ...
0
votes
0
answers
106
views
memory handling with dask-cuda on a windows machine
I am currently exploring how to handle memory in dask-cuda in order to write a function that will interpolate values along lines that cross an image.
My machine is a very basic windows 10 laptop with ...
1
vote
1
answer
70
views
Cupy array construction from existing GPU pointer
I would like to construct a Cupy GPU array view of the array that already exists on the GPU and I'm handed the following:
Pointer to the array.
I know the data type and the size of the data.
I'm also ...
0
votes
0
answers
105
views
pyinstaller exe created on Windows 10 does not work in Windows 7, cublasLt64_11.dll missing
I created a exe with pyinstaller on my windows 10 machine. I am using python 3.8.5, cupy-cuda102, and CUDA 10.2. I also installed visual studio 2015. The exe runs fine on my machine. When running the ...
0
votes
0
answers
36
views
How use "export CFLAGS=-I/path/to/cudnn/include" to set cuDNN path
I am new in Python. I try to install CuPy. I follow CuPy Installation instruction. I managed to install CUDA 11.5 and installed cuTENSOR: v1.3 and cuSPARSELt v0.1.0 in /CUDA_PATH. However, cuDNN did ...
1
vote
0
answers
93
views
CUDA memory error calculating shap values although enough memory
I am trying to calculate SHAP Values from a previously trained Random Forest. I am getting the following error:
MemoryError: std::bad_alloc: CUDA error at: /opt/anaconda3/envs/rapids-21.12/include/...
0
votes
0
answers
57
views
Why cupyx.scipy.ndimage.median_filter() is slower than CPU version opencv-python's cv2.medianBlur() API
I just recently came across a case and found that when I use cupyx.scipy.ndimage.median_filter() API, (with CUDA10 or CUDA11), it runs slower than CPU version of opencv-python's API: cv2.medianBlur()
...
0
votes
0
answers
46
views
How to calculate affine transform matrix with cupy.ndimage
I want to do affine transform from source image to get a transformed image. I have some corresponding points, like
src_points = [[x1_src, y1_src], [x2_src, y2_src], [x3_src, y3_src]]
dst_points = [[...
0
votes
0
answers
131
views
Cupy import error DLL load failed: The specified module could not be found
I'm trying to run Cupy example code.
import cupy
array1 = cupy.array([0, 1, 2], dtype=cupy.float32)
dltensor = array1.toDlpack()
array2 = cupy.fromDlpack(dltensor)
cupy.testing.assert_array_equal(...
-2
votes
1
answer
59
views
(python) Argument 'x' has incorrect type
My goal is to try Cupy.
Codes are located here.
When I execute 'train_custom_loop.py' in the ch1 folder.
This error is encountered.
Argument 'x' has incorrect type (expected cupy.core.core.ndarray, ...
1
vote
1
answer
110
views
RAM blowing up on computation
Below is a runnable code snippet using dask and cupy, which I have problems with. I run this on Google Colab with GPU activated.
Basically my problem is, that A and At are arrays which are too big for ...
0
votes
1
answer
133
views
cupy.var (variance) performance much slower than numpy.var trying to understand why
I am hoping to move my custom camera video pipeline to use video memory with a combination of numba and cupy and avoid passing data back to the host memory if at all possible. As part of doing this I ...
0
votes
0
answers
49
views
What is the replacement of put_along_axis in CuPy/NumPy
Array X, shape (a, b, c) is a float ndarray
Array Y, shape (a, b, 1) is an int ndarray
What I want to do is to use Y as the index in the final axis for each rows through all first 2 axis.
If I use ...
0
votes
0
answers
41
views
Pytorch Lightning + Cupy leads to multiprocessing clash
I am trying to use Pytorch Lightning in conjunction with CuPy. Unfortunately, when I try to set the number of workers to more than one, I run into an error
File "cupy/cuda/runtime.pyx", ...
3
votes
3
answers
182
views
Is there any way to boost matrix multiplication using multiple GPUs?
I want to multiply two huge matrices, size is more than 100,000 rows and columns.
I run the task on a server that has several GPUs, let's say 8 RTX 3090 GPUs, their ram size is 24GB, apparently, the ...
0
votes
0
answers
72
views
CuPy: 'pad_width' must be of integral type
when moving my code from Numpy to Cupy I found an error: pad_width must be of integral type.
Example:
import cupy as cp
arr=cp.random.randint(0,10,(5,5))
h,w=cp.array([1,2])
pad_width=((h,h),(w,w))
...
0
votes
0
answers
32
views
How to realize customized cupy parallel
Basically, my inputs are a sparse matrix and a set of vectors. I want to do a sparse matrix-vector in each gpu core. How to realize this in cupy?
0
votes
0
answers
52
views
Can cupy support running user-defined kernel with torch.nn.DataParallel?
I'm using torch.nn.DataParallel() to run my model on multiple GPUs. Besides using multiple GPUs to do parallelize the process, I want to write my own cuda kernel to speed up some operations in a layer....
0
votes
1
answer
847
views
What does it mean by say GPU under ultilization due to low occupancy?
I am using NUMBA and cupy to perform GPU coding. Now I have switched my code from a V100 NVIDIA card to A100, but then, I got the following warnings:
NumbaPerformanceWarning: Grid size (27) < 2 * ...
0
votes
1
answer
88
views
Linear programming with cupy
I am trying to improve codes efficiency with cupy. But I find no ways to carry linear programming within cupy. This problem comes from the following parts:
N = hull_points.shape[0]
c = ones(N)
A_eq = ...
0
votes
0
answers
55
views
Calling thrust functions through pybind
Apologies in advance for the long post, but I don't think there's a way to make it shorter and get all the detail across.
I'm using thrust to perform an inclusive scan on some relatively large ...
0
votes
0
answers
139
views
How do you do a grid search with cuml without a datatype error?
I tried doing a grid search with cuml. (rapids 21.10) I get a cupy conversion error. This doesn't happen if I build the model with the same dataset without a grid search. It also works doing it with ...
-1
votes
1
answer
173
views
Cuda streams synchronization issue with cupy and tensorRT
I am working with TensorRT and cupy. The following code does not wait for the cuda calls too be executed if I set the cp.cuda.Stream(non_blocking=True) while it works perfectly with non_blocking=False....
0
votes
0
answers
85
views
Is there a cupy decorator like numba jit
I have an application that accepts user functions which use numpy and send it over to a machine with a good GPU to run computations. What I want to do is a way for me after I send the code to the ...
0
votes
0
answers
53
views
cuDF rolling UDF not working with cuPY functions
I am trying to write a cuDF-UDF which computes the pearson auto correlation with lag==1 of a cuDF series.
I have defined the following UDF:
import cupy as cp
def cuda_corr(x):
xx=x[:-1]
yy=x[1:...
0
votes
1
answer
39
views
cupy sum method gives strange value
I run following code
import cupy as cp
x = cp.array([2.0, 3.0])
print(cp.sum(x))
Then it says
0.0
as output. Moreover,
x = cp.array([1, 2, 3, 4, 5, 6])
print(cp.sum(x))
gives 72340172838076673 as ...
0
votes
2
answers
289
views
Only GPU to CPU transfer with cupy is incredible slow
If I have an array on the GPU, it is really slow (order of hundreds of seconds) to copy back an array of shape (20, 256, 256).
My code is the following:
import cupy as cp
from cupyx.scipy.ndimage ...
0
votes
0
answers
30
views
Stop CuPy operation when condition is met?
Consider the following code that multiples two matrices filled with only 0s and 1s:
import cupy as cp
import numpy as np
A = cp.array(np.random.randint(2, size=(10000, 10000), dtype='uint8'))
B = cp....
0
votes
0
answers
164
views
How to force CPU usage of CuPy?
This is a bit of a weird question, as CuPy is meant for GPU. However, depending on the input of my program, I actually want to use the CPU as it is faster. I have already tried
if DISABLE_GPU:
...
0
votes
1
answer
83
views
Cupy streams synchronization using with statement
Are the two codes equivalent?
Code 1:
with cp.cuda.Stream(non_blocking=False) as stream:
# do stuff
stream.synchronize()
Code 2:
with cp.cuda.Stream(non_blocking=False) as stream:
# do ...
0
votes
1
answer
79
views
Is there any way to set number of threads , number of blocks and grids for CuPy computation? How?
I am using Cupy with following code,
import cupy as cp
vals, vecs = cp.linalg.eigh(Array)
For above code , I want to set number of threads in the code. How to do it. Let us say for 100 threads ...
0
votes
1
answer
55
views
Large cupy array running out of GPU Ram
This is a total newbie question but I've been searching for a couple days and cannot find the answer.
I am using cupy to allocate a large array of doubles (circa 655k rows x 4k columns ) which is ...
1
vote
0
answers
42
views
Using tensor-flow without trainable model? or should I use cupy-numba instead
I would like to use tensor-flow so I will be able use xla, and the GPU optimization which the framework offers, for my matrix calculations.
This of course a non-classic usage.
Is this a good idea? as ...
4
votes
0
answers
2k
views
CUDA path not detected. Set CUDA_PATH environment variable if CuPy fails to load
C:\Users\jkim4\Anaconda3\lib\site-packages\cupy\_environment.py:213: UserWarning: CUDA path could not be detected. Set CUDA_PATH environment variable if CuPy fails to load.
warnings.warn(
Traceback (...
0
votes
1
answer
487
views
Install cupy on MacOS without GPU support
I've been making the rounds on forums trying out different ways to install cupy on MacOS running on a device without a Nvidia GPU. So far, nothing has worked. I've tried both a Homebrew install of ...
0
votes
2
answers
202
views
Cupy indexing in 2D Cuda Grid Kernels?
I'm trying to start using Cupy for some Cuda Programming.
I need to write my own kernels. However, I'm struggling with 2D kernels. It seems that Cupy does not work the way I expected.
Here is a very ...