On Sat, 26 Jun 2010 12:30:17 -0600, Cyrus Omar <[email protected]> wrote: > I think it makes more sense to force both global and local size to be > keyword arguments, as folks are used to the order of positional > arguments in a call being the same as those in a definition and it's > not clear on first glance why e.g. a.shape is being passed instead. > Similarly with queue, these are sort of meta-arguments and should > probably be distinguished as such. This seems more clear: > > sum(a, b, dest, queue=queue, global_size=a.shape, local_size=(256,)) > > Perhaps shorter names could be used (gsize, lsize, q) to minimize > typing? Or I wrote some extensions that implicitly pass a default > queue around and allow kernels to specify how to calculate sizes in > their definitions to mostly eliminate the issue as well.
I'm -1 on your proposal, since it's a lot of typing. Here's a counterproposal, partially based on how the C++ wrapper does things: bound_sum = sum.bind(queue, None, (256,)) bound_sum(a, b, dest, global_size=a.shape) I.e. create an instance of a 'BoundKernel' type, which represents a binding of a kernel to a queue, and which may also hold defaults for local and global size, all of which *can* be overriden by kwargs at invocation time. This provides the clear separation of meta- and actual arguments that you're after. Opinions? (Just to be clear--whatever gets decided here will be backward-compatible, although it might deprecate current behavior.) Andreas PS: It'd be good if we had a consensus on this by Tuesday, because that's when I'll teach the pyopencl tutorial at SciPy'10. :)
pgpk3BFidTEeo.pgp
Description: PGP signature
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
