CUPTI compatibility issue

Hi, I’m running CUDA-5.5 on Ubuntu 16.04 x86_64 with GeForce GTX 1060, driver version 384.90. I had correctly configured them, demo building & running success. Now I’m trying to evaluate my program with the following code:

char *m_deviceName = (char*)malloc(1024);
DRIVER_API_CALL(cuDeviceGetName(m_deviceName, 1023, m_device));
printf("Using device: %s\n", m_deviceName);

DRIVER_API_CALL(cuCtxCreate(&m_context, 0, m_device));
CUPTI_CALL(cuptiSubscribe(&m_subscriber,(CUpti_CallbackFunc)detail::get_value_callback, &m_kernel_data));
CUPTI_CALL(cuptiEnableCallback(1, m_subscriber,CUPTI_CB_DOMAIN_RUNTIME_API, CUPTI_RUNTIME_TRACE_CBID_cudaLaunch_v3020));

uint32_t avame=0;
CUPTI_CALL(cuptiDeviceGetNumMetrics(m_device, &avame));
std::cout<<"Available metrics: "<<avame<<std::endl;

It prints:

Using device: GeForce GTX 1060 6GB
../include/cupti_profiler.h:367: error: function cuptiDeviceGetNumMetrics(m_device, &avame) failed with error CUPTI_ERROR_INVALID_DEVICE.

Line number 367 is refereed to line 11.

I’m wondering why I can detect my device but can’t get metric numbers.
CUPTI compatibility issues?

I would be grateful for any advice!

CUDA 5.5 predates your hardware, the GTX 1060, by many years. You would want to install the currently shipping version of CUDA (version 9), or at minimum CUDA 8.0.

I solved the problem by switching CUDA to version 9.0. Thanks again.

But it will not run on computers with NVidia drivers released before CUDA 9.0. What is the best practice to support the widest possible range of drivers? I only know two ways: compiling with old CUDA (like 6.0) or package app in multiple builds - compiled with different CUDA versions, but this looks very inconvenient.

P.S. The problem is not imaginary, because at least users with notebooks don’t always have the possibility to update driver to the last one.

P.P.S. Approximate table of correspondence between CUDA SDK and minimum driver required you can see here.

A general purpose CUDA app shouldn’t require CUPTI. Your strategy is reasonable for general purpose apps. And furthermore nothing was debugged or root caused here. The suggestion was to get the user going with a minimum of effort.

And, unfortunately, there have been some issues along the way which will prevent some general purpose apps from running on newer hardware. For example apps built using pre-cuda 8.0 CURAND. So, the best strategy is not to rely on the stated intent of CUDA compatibility, but to actually QA test your production programs, which is good practice for any software development effort. It may be necessary to issue new/updated versions of your software as the years go by.

I think I was wrong when I asked my question in this topic, my case doesn’t use CUPTI or CURAND, this discussion triggered my question and it will be better if I will create another topic. :)