At first, I didn't know how to fetch such information from the device, so I just copied this from another Theano's GPU op. I'll moved this into c_code.