addKernel launch failed: no kernel image is available for execution on the device

I loaded a CUDA template from Visual Studio 2022, compiled it (with a warning about conflicting libraries), and ran the “Start without debug.” The console comes up and displays

addKernel launch failed: no kernel image is available for execution on the device
addWithCuda failed!

I see this has been brought up on the forum quite a few times, and the suggestion was to compile with nvcc and run it from that as a solution. So I did.

nvcc -ccbin "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64\cl.exe" -arch=sm_52 -o kernel1000.exe kernel.cu

For some odd reason, cl.exe just refuses to appear in the path depsite be putting it in the system, and account path so I had to force it.

During compile time on the command line it displayed the following:

tmpxft_0000072c_00000000-10_kernel.cudafe1.cpp
   Creating library kernel1000.lib and object kernel1000.exp

Upon execution of the compile binary, i get the same result.

This is on my intel based laptop with a 940MX.

And here is nvidia-smi
Wed Feb 21 12:41:52 2024
±--------------------------------------------------------------------------------------+
| NVIDIA-SMI 546.17 Driver Version: 546.17 CUDA Version: 12.3 |
|-----------------------------------------±---------------------±---------------------+
| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce 940MX WDDM | 00000000:01:00.0 Off | N/A |
| N/A 0C P8 N/A / 200W | 0MiB / 4096MiB | 0% Default |
| | | N/A |
±----------------------------------------±---------------------±---------------------+

±--------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| No running processes found |
±--------------------------------------------------------------------------------------+

Any clues on resolving this?

940MX is a compute capability 5.0 GPU. You need to compile for a architecture that matches your GPU. CUDA 11.x and 12.x compile by default for cc5.2. See here.

1 Like

Thank you for helping me understand this. The installation of the SDK had put “compute_52,sm_52” into Visual Studio and I had assumed that was correct.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.