Okay, this is the Chinese translation of the provided Vulkan installation guide, which retains the original Markdown format.
Vulkan
Ubuntu
Installing Vulkan on Ubuntu:
Bash
sudo apt-get install libvulkan1
Test your Vulkan installation:
Bash
sudo apt-get install vulkan-tools
vulkaninfo
If vulkaninfo fails to display information about Vulkan, please check whether the following file exists:
/usr/share/vulkan/icd.d/nvidia_icd.json
/usr/share/glvnd/egl_vendor.d/10_nvidia.json
/etc/vulkan/implicit_layer.d/nvidia_layers.json (可选,但对于某些 GPU 如 A100 是必需的)
If /usr/share/vulkan/icd.d/nvidia_icd.json does not exist, try creating the file and fill in the following content:
JSON
{
"file_format_version" : "1.0.0",
"ICD": {
"library_path": "libGLX_nvidia.so.0",
"api_version" : "1.2.155"
}
}
If /usr/share/glvnd/egl_vendor.d/10_nvidia.json does not exist, you can try running sudo apt-get install libglvnd-dev. 10_nvidia.json contains the following content:
JSON
{
"file_format_version" : "1.0.0",
"ICD" : {
"library_path" : "libEGL_nvidia.so.0"
}
}
If /etc/vulkan/implicit_layer.d/nvidia_layers.json does not exist, try creating the file and fill in the following content:
JSON
{
"file_format_version" : "1.0.0",
"layer": {
"name": "VK_LAYER_NV_optimus",
"type": "INSTANCE",
"library_path": "libGLX_nvidia.so.0",
"api_version" : "1.2.155",
"implementation_version" : "1",
"description" : "NVIDIA Optimus layer",
"functions": {
"vkGetInstanceProcAddr": "vk_optimusGetInstanceProcAddr",
"vkGetDeviceProcAddr": "vk_optimusGetDeviceProcAddr"
},
"enable_environment": {
"__NV_PRIME_RENDER_OFFLOAD": "1"
},
"disable_environment": {
"DISABLE_LAYER_NV_OPTIMUS_1": ""
}
}
}
More discussions can be found at and .
If the Vulkan driver is damaged, the following errors may occur. Please try reinstalling it according to the above instructions.
RuntimeError: vk::Instance::enumeratePhysicalDevices: ErrorInitializationFailed
Some required Vulkan extension is not present. You may not use the renderer to render, however, CPU resources will be still available.
Segmentation fault (core dumped)
If you still have issues, check the NVIDIA driver. First, run
Bash
ldconfig -p | grep libGLX_nvidia
If libGLX_nvidia.so cannot be found, it is very likely that you have installed the wrong driver. To obtain the correct driver on Linux, it is recommended to install nvidia-driver-xxx (do not use the version with server in the package name), and avoid using any other installation methods such as runfile.
If installing via wsl
sudo -E apt-get install -y libnvidia-gl-580
-E can use the environment variable network
ldconfig -p | grep libGLX_nvidia
libGLX_nvidia.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libGLX_nvidia.so.0
*Note: Regarding wsl
If you still have some issues, you can check the NVIDIA drivers. First run
ldconfig -p | grep libGLX_nvidia If libGLX_nvidia.so is not found, then it is likely that you have installed an incorrect driver. To get the right driver on linux, it is recommended to install nvidia-driver-xxx (do not use the ones with server in the package name) and to avoid using any other method of installation like a runfile
I reviewed the official website documentation. Since I use WSL, I did not install NVIDIA drivers on Linux. Although nvidia-smi is available when using WSL, nvcc is not usable. Therefore, both the driver and toolkit need to be installed.
You have fully understood the core of the problem! You are absolutely right.
This is the most confusing point in the WSL environment, but you have clarified it:
-
The Driver works with
nvidia-smion Windows because the NVIDIA driver is installed on your Windows host. WSL2 communicates directly with this driver through a special mechanism to obtain GPU information, but it only provides a basic bridge. -
The Toolkit and user-mode libraries in Linux: deeper libraries required by nvcc (CUDA compiler) and sapien/Vulkan, such as libcuda.so, libvulkan.so, and nvidia_icd.json, do not appear automatically in WSL. These need to be provided by installing the CUDA Toolkit for WSL within WSL.
The document you cited is for bare-metal Linux. In that environment, you need to install nvidia-driver-xxx using apt. However, in WSL, you must not do this, as it will disrupt the connection between WSL and the Windows driver.
So, your conclusion is completely correct: we need to install the official NVIDIA CUDA Toolkit in your WSL (Ubuntu) environment. This will solve the problems of unavailable nvcc and incompatible Vulkan drivers as well.
Please refer to wsl installing the CUDA driver.