11.07.2015 Views

CUPTI User's Guide

CUPTI User's Guide

CUPTI User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CUptiResult cuptiMetricGetValue (CUdevice device,CUpti_MetricID metric, size_t eventIdArraySizeBytes,CUpti_EventID ∗ eventIdArray, size_t eventValueArraySizeBytes,uint64_t ∗ eventValueArray, uint64_t timeDuration,CUpti_MetricValue ∗ metricValue)Use the events collected for a metric to calculate the metric value. Metric value calculationassumes that event values are normalized to represent all domain instances on a device.For the most accurate metric collection, the events required for the metric should becollected for all profiled domain instances. For example, to collect all instances of an event,set the <strong>CUPTI</strong>_EVENT_GROUP_ATTR_PROFILE_ALL_DOMAIN_INSTANCESattribute on the group containing the event to 1. The normalized value for the event isthen: (sum_event_values ∗ totalInstanceCount) / instanceCount, wheresum_event_values is the summation of the event values across all profiled domaininstances, totalInstanceCount is obtained from querying<strong>CUPTI</strong>_EVENT_DOMAIN_ATTR_TOTAL_INSTANCE_COUNT andinstanceCount is obtained from querying<strong>CUPTI</strong>_EVENT_GROUP_ATTR_INSTANCE_COUNT (or<strong>CUPTI</strong>_EVENT_DOMAIN_ATTR_INSTANCE_COUNT).Parameters:device The CUDA device that the metric is being calculated formetric The metric IDeventIdArraySizeBytes The size of eventIdArray in byteseventIdArray The event IDs required to calculate metriceventValueArraySizeBytes The size of eventValueArray in byteseventValueArray The normalized event values required to calculate metric. Thevalues must be order to match the order of events in eventIdArraytimeDuration The duration over which the events were collected, in nsmetricValue Returns the value for the metricReturn values:<strong>CUPTI</strong>_SUCCESS<strong>CUPTI</strong>_ERROR_NOT_INITIALIZED<strong>CUPTI</strong>_ERROR_INVALID_METRIC_ID<strong>CUPTI</strong>_ERROR_INVALID_OPERATION<strong>CUPTI</strong>_ERROR_PARAMETER_SIZE_NOT_SUFFICIENT if the eventIdArraydoes not contain all the events needed for metric<strong>CUPTI</strong>_ERROR_INVALID_EVENT_VALUE if any of the event values requiredfor the metric is <strong>CUPTI</strong>_EVENT_OVERFLOWCUDA Tools SDK <strong>CUPTI</strong> User’s <strong>Guide</strong> DA-05679-001_v01 | 107

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

Saved successfully!

Ooh no, something went wrong!