Chapter 7. Events, profiling, and synchronization

 

This chapter covers

  • Configuring events and event-handling
  • Using profiling to measure processing time
  • Synchronizing work-item execution

Preceding chapters have dealt with the what and how of OpenCL operations; this chapter deals with when. We’re not going to look at new types of operations, but instead you’ll learn how to monitor operations we’ve already encountered.

The concept of an event is central to this discussion. In OpenCL, an event is a data structure that corresponds to an occurrence. One event might monitor the completion of a data transfer operation and another might monitor the execution of a kernel. You can use events in three main ways:

  • Host notification— An event can notify the host that a command has completed its execution on a device
  • Command synchronization— An event can force commands to delay their execution until another event’s occurrence has taken place
  • Profiling— An event can monitor how much time a command takes to execute

The third use is particularly interesting. Profiling is a vital tool in high-performance application development because it allows you to evaluate the performance of computing hardware and coding methods. With profiling, you can compare devices, kernels, and data partitioning strategies. This chapter will not only explain profiling; it will also show how profiling can be used to test different aspects of OpenCL’s operation.

7.1. Host notification events

7.2. Command synchronization events

7.3. Profiling events

7.4. Work-item synchronization

7.5. Summary

sitemap