User Guide

Intel® VTune™ Profiler User Guide

ID 766319
Date 12/16/2022

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Error Message: Not All OpenCL™ API Profiling Callbacks Are Received


Intel® VTune™ Profiler uses OpenCL™ API to collect profiling information about OpenCL kernels. According to the OpenCL Specification, completion callbacks must be thread-safe and can be called in different threads. It is possible that the completion callback is received while the collection is being stopped.


Use OpenCL API to set callbacks for events for clEnqueue* functions and wait for them to be received. For example:

#include <atomic>
#include <thread>
#include <CL/cl2.hpp>

std::atomic_uint32_t number_of_uncompleted_callbacks = 0;

void CL_CALLBACK completion_callback(cl_event, cl_int , void*)
int main()
    cl::Program prog(context, 
    auto kernelFunc = cl::KernelFunctor<cl::Buffer, cl_int>(prog, "sin_cos"); 
    cl::Event event = kernelFunc(cl::EnqueueArgs(cl::NDRange(dataBuf.size())), clDataBuf, 0);

    ++ number_of_uncompleted_callbacks;
    event.setCallback(CL_COMPLETE, completion_callback);
    while (number_of_uncompleted_callbacks.load())
    return EXIT_SUCCESS;