- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To use barrier and mem_fence you need to understand parallel execution and synchronization. barrier() function ensures correct ordering of local/global memory operations (depending on what flag you pass to it - CLK_LOCAL_MEM_FENCE or CLK_GLOBAL_MEM_FENCE). Basically barriers synchronize threads in the same workgroup, butnot across workgroups.
According to the OpenCL spec,a mem_fence() ensures ordering between memory operations of a work-item. Meaning loads and stores operations before the mem_fence will be committed to memory before any loads
and stores following the mem_fence.
These routines won't make your program run faster, but help in ensuring correct behavior of parallel execution. There are a lot of caveats using synchronization functions. I suggest you grab an OpenCL book or look at the spec to understand what to do and what to avoid.
The work_item functions let you query the number of dimensions, the local and global ids of a work-item, number of local and global work-items etc.
Unfortunately our SDK doesn't have any samples demonstrating these functions. But there are a lot of examples out there, if you search online.
If you still need code samples, feel free to post and I'll point you to some resources. In the future we'll try to add more examples to the SDK where and when possible.
Thanks,
Raghu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Raghu,
I looked around and I can get a ton of good example of barrier. However for mem_fence, I can't really get a good example.
Regards,
Qually
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page