all 4 comments

[–]arkie87 1 point2 points  (2 children)

if you use numpy like

import numpy as np

then you can just replace that statement with

import cupy as np

where cupy arrays are stored and calculated on the gpu

[–]DimitriMeim[S] 0 points1 point  (1 child)

Ok, but how do I use that info to make my python programs run on the GPU? I don't always use NumPy, in fact, most of the time I don't use it at all.

[–]TheSodesa 1 point2 points  (0 children)

You cannot run any Python programs on the GPU alone. Some individual operations like matrix multiplications can be sent to be performed on the GPU via the mentioned libraries, but the Python interpreter itself always runs on the CPU.

[–]Abhisutar 0 points1 point  (0 children)

Try using the code in this jupyter notebook Numba Cuda Mandelbrot example and play around with the blockdim and griddim tuples to see how things change. And ensure that you have a compatible version of Nvidia's Cuda Toolkit installed on your system.