Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

4.7. Summary

Programming an OpenCL kernel is a lot like programming a regular C function, but there are a few important differences. First, each kernel must be identified with __kernel and the function must return void. Second, OpenCL doesn’t support all of the old data types, but it does provide new ones. Finally, OpenCL models devices in such a way that you can constrain which address space is used to store kernel data.

OpenCL’s scalar data types present only a couple of complications. You can still code with chars, shorts, ints, floats, and longs, but you can only declare doubles and halfs if they’re supported on the device. When it comes to floating-point processing, OpenCL supports many aspects of the IEEE-754 standard, but not all of them. If you intend to port code to OpenCL, you should know which capabilities are available and which aren’t.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial