Results 1 to 2 of 2

Thread: bool array in opencl?

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    5

    bool array in opencl?

    Hi All,

    I'm completely new to openCL and I'm trying to see if I can use it for a project. I don't really need a GPU to solve it, but I've been wanting to learn.

    I'm trying to implement a bitmap and I'm wondering if I create an array of say 1024 bool values if it will create a 1024 byte array or if it will somehow use only 1024 bits. I'm pretty sure it will be the former, but it would be pretty convenient if it did all the bitmasking and whatnot out of the box

    Thanks!

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Posts
    271

    Re: bool array in opencl?

    From the spec, 6.8 section k, you cannot use bool types to kernel arguments, so it pretty much kills that idea. The reason it gives is pretty much the same one: who knows what the format a boolean array would be in.

    You probably don't want to do this bit packing anyway (if you need to write to it): there's no (efficient) way to atomically update bits. Using 32-bit ints will probably be the best if you can afford the space.

    If you really need it for the compression it provides, just use a uint (32 bit) and ensure only full 32-bits are written at any time. e.g. using local workgroups or whatever else.

    Obviously this depends on what you're trying to do ...


    Quote Originally Posted by zje
    Hi All,

    I'm completely new to openCL and I'm trying to see if I can use it for a project. I don't really need a GPU to solve it, but I've been wanting to learn.

    I'm trying to implement a bitmap and I'm wondering if I create an array of say 1024 bool values if it will create a 1024 byte array or if it will somehow use only 1024 bits. I'm pretty sure it will be the former, but it would be pretty convenient if it did all the bitmasking and whatnot out of the box

    Thanks!

Similar Threads

  1. Replies: 7
    Last Post: 09-26-2012, 01:34 PM
  2. Replies: 1
    Last Post: 09-17-2009, 07:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •