You are right, that it is a shallow copy, not a deep copy of the node. But
this is intended (as you see the assert). But i'm not sure why anymore! But
I don't like this as you. We already have an opt that query device
information when it move it to the GPU. This isn't ideal, as if the user
make this op himself, it won't have the information at compile time. So we
need an opt that change the vaues from None to the value used or to provide
default value that work.

I made a PR that change the example Mark used:
https://github.com/Theano/Theano/pull/1767 . @MarkCote when/if it get merge
by @abergeron, can you do the equivalent change to your PR?




On Wed, Mar 12, 2014 at 10:55 AM, abergeron <notifications@github.com>wrote:

> In theano/sandbox/cuda/extra_ops.py:
>
> > +            cuda = theano.sandbox.cuda
> > +            device_id = cuda.use.device_number
> > +            if device_id is None:
> > +                cuda.use("gpu",
> > +                         force=False,
> > +                         default_to_move_computation_to_gpu=False,
> > +                         move_shared_float32_to_gpu=False,
> > +                         enable_cuda=False,
> > +                         test_driver=True)
> > +                device_id = cuda.use.device_number
> > +            cuda_ndarray = theano.sandbox.cuda.cuda_ndarray.cuda_ndarray
> > +            prop = cuda_ndarray.device_properties(device_id)
> > +            node_.op.max_threads_dim0 = prop['maxThreadsDim0']
> > +            node_.op.max_grid_size1 = prop['maxGridSize1']
> > +        return super(GpuCumsum, node_.op).make_thunk(node_, storage_map,
> > +                                                     compute_map, no_recycling)
>
> No, we don't create a new Op. We create a new node with the same Op
> instance and then tweak it. There is even an assert to make sure of that.
>
> Also Marc indicated that it doesn't work in DebugMode.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/Theano/Theano/pull/1760/files#r10520699>
> .
>