On Freitag 18 Dezember 2009, Dan Piponi wrote:
> go.prepare("s", ...)   # tell PyCuda we're passing in a string buffer
> go.prepared_call(grid, struct.pack("i",12345))    # pack integer into
> string buffer

struct_typestr = "i"
sz = struct.calcsize(struct_typestr)
go.prepare("%ds" % sz, ...)   # tell PyCuda we're passing in a string buffer
go.prepared_call(grid, struct.pack(struct_typestr, 12345))

codepy.cgen.GenerableStruct can help you generate type strings and C source 
code from a single source and will also help you make packed instances.

HTH,
Andreas

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PyCUDA mailing list
PyCUDA@tiker.net
http://tiker.net/mailman/listinfo/pycuda_tiker.net

Reply via email to