Does opencl support boolean variables?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 03:21:11

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/4441280/does-opencl-support-boolean-variables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!