0

It seems to me that a lot of the OpenCL kernel argument setting can be streamlined. The most rudimentary thing one can think of is implementing:

clSetKernelArgs(cl_kernel kernel, unsigned num_args, ...)

and then for each argument can one can read either a triplet of arg_index, arg_size and value, or a pair of arg_size and arg_value, or even just the argument (if one could somehow figure out within the impl what the signature types are).

Isn't this already implemented somewhere as part of the standard?

Note: I'm interested both in C and C++ code.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • 1
    The question is tagged c++ so I assume your code is in C++. Then I strongly suggest you look at the C++ Bindings (and their specification: http://www.khronos.org/registry/cl/). They make things a hell of a lot easier! – Matthias Holzapfel Jul 28 '13 at 11:07
  • @MatthiasHolzapfel: Will look into it; but I'm also interested in C code for this, since I'm not sure I'll be able to only write C++ code. – einpoklum Jul 28 '13 at 13:07
  • As far as I know there's nothing in the C standard. For anyone looking for an implementation similar to what was described, I have a simple utility function that I use for this: http://pastebin.com/Enamp0EF. Use at your own risk. – agrippa Jul 28 '13 at 18:42

0 Answers0