Recently, I use pip to install the pyCUDA for my python3.4.3. But I found when I test the sample code(https://documen.tician.de/pycuda/tutorial.html#getting-started), it can't print the result without any error message,the program can end. I can't understand what's wrong with this code or my python,thank you all for answer.This is my code:
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
import numpy
import random
a =[random.randint(0,20) for i in range(20)]
a = a.astype(numpy.float32)
a_gpu = cuda.mem_alloc(a.nbytes)
cuda.memcpy_htod(a_gpu, a)
mod = SourceModule("""
__global__ void doublify(float *a)
{
int idx = threadIdx.x + threadIdx.y*4;
a[idx] *= 2;
}
""")
func = mod.get_function("doublify")
func(a_gpu, block=(4,4,1))
a_doubled = numpy.empty_like(a)
cuda.memcpy_dtoh(a_doubled, a_gpu)
print(a_doubled)
print(a)