Message205610
To see the errors, one can install PyCUDA and Theano, and run code at http://deeplearning.net/software/theano/tutorial/using_gpu.html#id1 :
import numpy, theano
import theano.misc.pycuda_init
from pycuda.compiler import SourceModule
import theano.sandbox.cuda as cuda
class PyCUDADoubleOp(theano.Op):
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
def make_node(self, inp):
inp = cuda.basic_ops.gpu_contiguous(
cuda.basic_ops.as_cuda_ndarray_variable(inp))
assert inp.dtype == "float32"
return theano.Apply(self, [inp], [inp.type()])
def make_thunk(self, node, storage_map, _, _2):
mod = SourceModule("""
__global__ void my_fct(float * i0, float * o0, int size) {
int i = blockIdx.x*blockDim.x + threadIdx.x;
if(i<size){
o0[i] = i0[i]*2;
}
}""")
pycuda_fct = mod.get_function("my_fct")
inputs = [ storage_map[v] for v in node.inputs]
outputs = [ storage_map[v] for v in node.outputs]
def thunk():
z = outputs[0]
if z[0] is None or z[0].shape!=inputs[0][0].shape:
z[0] = cuda.CudaNdarray.zeros(inputs[0][0].shape)
grid = (int(numpy.ceil(inputs[0][0].size / 512.)),1)
pycuda_fct(inputs[0][0], z[0], numpy.intc(inputs[0][0].size),
block=(512,1,1), grid=grid)
return thunk
The interpreter will complain errors like "c:\python33\include\import.h(97): error: explicit type is missing ("int" assumed)" (at least in my case) |
|
Date |
User |
Action |
Args |
2013-12-08 21:58:51 | Ziyuan.Lin | set | recipients:
+ Ziyuan.Lin |
2013-12-08 21:58:51 | Ziyuan.Lin | set | messageid: <1386539931.9.0.365735317259.issue19932@psf.upfronthosting.co.za> |
2013-12-08 21:58:51 | Ziyuan.Lin | link | issue19932 messages |
2013-12-08 21:58:51 | Ziyuan.Lin | create | |
|