Questions tagged [pycuda]

PyCUDA is the Python module which provides a comprehensive pythonic interface to the NVIDIA CUDA GPU computing environment.

PyCUDA provides a python module to access the NVIDIA CUDA driver API from within Python code.

The module includes interoperability with numpy, and comprehensive metaprogramming facilities for dynamically generating and JIT compiling CUDA code using Python.

417 questions
4
votes
1 answer

Why numba cuda is running slow after recalling it several times?

I am experimenting how to use cuda inside numba. However I have encountered something different from my expectation. Here is my code from numba import cuda @cuda.jit def matmul(A, B, C): """Perform square matrix multiplication of C = A *…
Peter Deng
  • 477
  • 1
  • 4
  • 9
4
votes
2 answers

Running optimization process with GPU using PYTHON 3.5 and Backtrader

I was giving a try to the optimization process of the Backtrader library. I see that the code run pretty well with multi-core CPU. It took around 22.352761494772228 second for the complete optimization process. But could be even faster if worked…
Jaffer Wilson
  • 7,029
  • 10
  • 62
  • 139
4
votes
4 answers

processing an image using CUDA implementation, python (pycuda) or C++?

I am in a project to process an image using CUDA. The project is simply an addition or subtraction of the image. May I ask your professional opinion, which is best and what would be the advantages and disadvantages of those two? I appreciate…
ardiyu07
  • 1,790
  • 2
  • 17
  • 29
4
votes
1 answer

100% GPU usage from CUDA code makes screen lag

I have some pyCUDA code that keeps the GPU at 100% usage and seems to hog the GPU to the point that my screen only updates every second or so. Changing the block and grid sizes doesn't help. Each thread in the grid goes through a loop about 1.3…
Frobot
  • 1,224
  • 3
  • 16
  • 33
4
votes
2 answers

pycuda: nvcc compitalation of kernel.cu failed

I've just installed pyCuda, when i try to compile: import pycuda.autoinit import pycuda.driver as drv import numpy from pycuda.compiler import SourceModule mod = SourceModule(""" __global__ void multiply_them(float *dest, float *a,…
Giuseppe Angora
  • 833
  • 1
  • 10
  • 25
4
votes
1 answer

Explain pitch, width, height, depth in memory for 3D arrays

I am working with CUDA and 3D textures in python (using pycuda). There is a function called Memcpy3D which has the same members as Memcpy2D plus a few extras. In it it calls you to describe things such as width_in_bytes, src_pitch, src_height,…
NineTails
  • 550
  • 4
  • 24
4
votes
3 answers

Storing Kernel in Separate File - PyOpenCL

I'm trying to store the kernel part of the code, with the 3 """ , in a different file. I tried saving it as a text file and a bin file, and reading it in, but I didn't find success with it. It started giving me an error saying """ is missing, or )…
RandN88
  • 101
  • 8
4
votes
0 answers

Identify contiguous segments of a non-contiguous numpy array

In the example below, we have a contiguous array, and a view of the same array that is non-contiguous: shape = (5, 100) A = np.arange(np.product(shape)).reshape(shape) # Everything is contiguous at this point assert A.flags.c_contiguous == True #…
Simon
  • 553
  • 4
  • 14
4
votes
1 answer

Genetic cellular automata with PyCuda, how to efficiently pass a lot of data per cell to CUDA kernel?

I'm developing a genetic cellular automata using PyCuda. Each cell will have a lot of genome data, along with cell parameters. I'm wondering what could be a most efficient way to 1) pass cells data to a CUDA kernel, then 2) to process this data. I…
a5kin
  • 1,335
  • 16
  • 20
4
votes
3 answers

How can i tell PyCUDA which GPU to use?

I have two NVidia cards in my machine, and both are CUDA capable. When I run the example script to get started with PyCUDA seen here: http://documen.tician.de/pycuda/ i get the error nvcc fatal : Value 'sm_30' is not defined for option…
JasonRDalton
  • 715
  • 1
  • 7
  • 12
4
votes
1 answer

cudaBindTextureToArray in PyCuda

Is-there a way to bind an array that is already on the gpu to a texture using PyCuda ? There is already a cuda.bind_array_to_texref(cuda.make_multichannel_2d_array(...), texref) that binds an array on the CPU to a texture, but I couldn't find the…
nbonneel
  • 3,286
  • 4
  • 29
  • 39
4
votes
1 answer

Addition Assignment Operator in Cuda C

I'm experiencing a problem with addition assignment operator in Cuda C. I'm getting the following error: kernel.cu(5): error: expression must have integral or enum type My code is : import pycuda.driver as drv import pycuda.autoinit from…
3
votes
0 answers

Python: PyCUDA ERROR: The context stack was not empty upon module cleanup

I have created a Streamlit App to as a demo of a project on Multilingual Text Classification using mBERT in PyTorch. When I run the app with the command python app.py it works fine but when I try to use Streamlit with the command streamlit run…
Ishan Dutta
  • 897
  • 4
  • 16
  • 36
3
votes
1 answer

Automatic CudaMat conversion in Python

I'm looking into speeding up my python code, which is all matrix math, using some form of CUDA. Currently my code is using Python and Numpy, so it seems like it shouldn't be too difficult to rewrite it using something like either PyCUDA or…
Abe Schneider
  • 977
  • 1
  • 11
  • 23
3
votes
1 answer

Getting Pycuda to work with Mpi4py on 2 gpus

I am trying to run a pycuda program across two gpus. I have read a great post by Talonmies explaining how you do it with the threading library, the post also mentioned this is possible with mpi4py. When I run mpi4py with pycuda, program gives the…
user847078
  • 31
  • 2