cuda-samples
cuda-samples copied to clipboard
simpleVulkan - Several problems
I wanted to run the simpleVulcan sample and encountered some problems. My specs:
- Laptop with NVIDIA GeForce GTX 1050 (CC 6.1)
- Driver Version: 470.129.06
- CUDA: 11.4
- Vulkan: 1.3.211
Comments would be well appreciated. It could very well be that I missunderstand some things. I am very new to Vulkan. I had the following problems:
1) GLSL vs SPIR-V
In the beginning, I could not start up at all. The problem was that the shader code was directly read from the GLSL, which was not supported on my device. This probably worked previously out of the box? I dont know what I would have to do to use GLSL directly and JIT compile it, but it does not work for the versions that I used. So I had to compile the shaders with glslc and use the compiled SPIR-V files. It would be helpful to incorporate that into the build process, if many people have this problem.
2) VulkanBaseApp "physicalDevice" != cuda device
After the shader problem, I got another exception: "No Vulkan-CUDA Interop capable GPU found.". That was because I have several vkEnumeratePhysicalDevices
, but the isSuitableDevice
check seems to return true not only for my NVIDIA GPU, but also for the onboard IntelHD Graphics. Since just the first instance of a "suitable device" is taken (in VulkanBaseApp::createDevice
), there is a missmatch. I guess there is a better way to check if it is suitable. In the end, I additionally checked if props.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
(vkGetPhysicalDeviceProperties(it, &props)
).
3) Window closing problems
Because I could not use Timeline Semaphores, I ran into a problem in the destructor of the VulkanCudaSineWave
on shutdown, because m_vkPresentationSemaphore
and m_vkTimelineSemaphore
were not initialized. I fixed this by adding these lines to the VulkanBaseApp
constructor:
m_vkPresentationSemaphore(VK_NULL_HANDLE),
m_vkTimelineSemaphore(VK_NULL_HANDLE),
The example comes shipped with spv files which are spirv. So there shouldn't be any need to compile glsl, i can't even see the glsl source files. Maybe they updated it?
I get the error Makefile:386: recipe for target 'VulkanBaseApp.o' failed
Is this related?
More insight VulkanBaseApp.cpp:1731:3: error: ‘timelineInfo’ was not declared in this scope timelineInfo.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO; ^~~~~~~~~~~~ VulkanBaseApp.cpp:1731:24: error: ‘VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO’ was not declared in this scope timelineInfo.sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Makefile:386: recipe for target 'VulkanBaseApp.o' failed make[1]: *** [VulkanBaseApp.o] Error 255 make[1]: Leaving directory '/home/rnd/cpp_coding/cuda-samples/Samples/5_Domain_Specific/simpleVulkan' Makefile:45: recipe for target 'Samples/5_Domain_Specific/simpleVulkan/Makefile.ph_build' failed make: *** [Samples/5_Domain_Specific/simpleVulkan/Makefile.ph_build] Error 2