This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ziyuan.Lin
Recipients Ziyuan.Lin
Date 2013-12-08.21:58:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386539931.9.0.365735317259.issue19932@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2013-12-08 21:58:51Ziyuan.Linsetrecipients: + Ziyuan.Lin
2013-12-08 21:58:51Ziyuan.Linsetmessageid: <1386539931.9.0.365735317259.issue19932@psf.upfronthosting.co.za>
2013-12-08 21:58:51Ziyuan.Linlinkissue19932 messages
2013-12-08 21:58:51Ziyuan.Lincreate