Vulkaninfo GPU index mismatch with lspci

I am just getting started with Vulkan. I tried the simplest thing: vkcube, and got an error message: “Could not find both graphics and present queues

After some investigation, I believe the issue is with GPU indexing in Vulkan vs. my system. I have a dual NVidia GPU desktop running Ubuntu. If I run lspci | grep -i nvidia or nvidia-settings, I see GPU 0 pointing to a different GPU as GPU 0 with vulkaninfo. Ubuntu is using GPU 0 to render its display, which is not the GPU 0 that vulkan recognizes, and that’s why I think I got the error message above.

Is there a way to make vulkaninfo GPU indices match my system’s?

Is that, strictly speaking, necessary? The program trying to initialize Vulkan should pick the right GPU; it shouldn’t just use a GPU index based on what Ubuntu says. It should be able to look at the available VkPhysicalDevices and know which ones have presentation functionality and which ones don’t.

That wouldn’t even make sense. Consider there is device not supporting Vulkan. Then there would have to be gaps in the index numbering.

If you want a specific device, you need to use specific identifier, not the random way things are ordered in an array.

On Linux an updated Loader sorts Dedicated devices first then by PCI slot second (not standardized behavior). I.e. the first device should typically be the one you want.

Thanks for both of your responses.

I’ve had success with vkcube on single-GPU machines. What do you think the solution is for the error message that I got on my dual-GPU machine?

I found a workaround thanks to this thread:

I installed vkdevicechooser, and I am able to run vkcube successfully with


where <idx> is the GPU index in vulkaninfo.

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