开发者

Does opencl support boolean variables?

Does开发者_开发百科 openCL support boolean variables? I am currently using JOCL (java) to write my openCL calling code and I don't see anything about booleans.


tl;dr: Yes, but you should avoid it in kernel function signatures.

Yes; but the size of a bool is not defined. Therefore, it does not have an associated API type (as what size the value should be is device dependent).

See section 6.1.1 Built-in Scalar Data Type of the OpenCL 1.1 specification for a list of supported scalar types.

From Section 6.8.k

Arguments to __kernel functions in a program cannot be declared with the built-in scalar types bool, half, size_t, ptrdiff_t, intptr_t, and uintptr_t. The size in bytes of these types except half are implementation-defined and in addition can also be different for the OpenCL device and the host processor making it difficult to allocate buffer objects to be passed as arguments to a kernel declared as pointer to these type

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜