11.07.2015 Views

CUPTI User's Guide

CUPTI User's Guide

CUPTI User's Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Resource CallbacksUsing the callback API with the <strong>CUPTI</strong>_CB_DOMAIN_RESOURCE domain, you can associate acallback function with some CUDA resource creation and destruction events. For example,when a CUDA context is created, your callback function will be invoked with a callback IDequal to <strong>CUPTI</strong>_CBID_RESOURCE_CONTEXT_CREATED. For this domain, the cbdata argumentto your callback function will be of the type CUpti_ResourceData.The activity_trace sample described on page 25 shows how to use the resource callback.Synchronization CallbacksUsing the callback API with the <strong>CUPTI</strong>_CB_DOMAIN_SYNCHRONIZE domain, you canassociate a callback function with CUDA context and stream synchronizations. Forexample, when a CUDA context is synchronized, your callback function will be invokedwith a callback ID equal to <strong>CUPTI</strong>_CBID_SYNCHRONIZE_CONTEXT_SYNCHRONIZED. For thisdomain, the cbdata argument to your callback function will be of the typeCUpti_SynchronizeData.The activity_trace sample described on page 25 shows how to use the synchronizationcallback.<strong>CUPTI</strong> Event APIThe <strong>CUPTI</strong> Event API allows you to query, configure, start, stop, and read the eventcounters on a CUDA-enabled device. The following terminology is used by the event API.Event: An event is a countable activity, action, or occurrence on a device.Event ID: Each event is assigned a unique identifier. A named event will represent thesame activity, action, or occurence on all device types. But the named event mayhave different IDs on different device families. Use cuptiEventGetIdFromName to getthe ID for a named event on a particular device.Event Category: Each event is placed in one of the categories defined byCUpti_EventCategory. The category indicates the general type of activity, action, oroccurrence measured by the event.Event Domain: A device exposes one or more event domains. Each event domainrepresents a group of related events available on that device. A device may havemultiple instances of a domain, indicating that the device can simultaneously recordmultiple instances of each event within that domain.Event Group: An event group is a collection of events that are managed together. Thenumber and type of events that can be added to an event group are subject toCUDA Tools SDK <strong>CUPTI</strong> User’s <strong>Guide</strong> DA-05679-001_v01 | 8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!