2016-09-02

How to get going with Vulkan & NVIDIA on Ubuntu 14.04 and 16.04

First, I found that there really was no support for Vulkan in Ubuntu 14.04 LTS, or at least without a lot of custom configurations that I would like to avoid. So I decided to upgrade my system to Ubuntu 16.04.
Getting started with Vulkan in Ubuntu with nVidia.


Next I tried to find my way by following a lot of different tutorials and advice. Nothing seemed to work for me, and getting Vulkan on my laptop was looking impossible until I decided to follow this simple advice. I decided to shamelessly steal his advice and add my own extra observations. So here are the steps:
  1. Open this page on your tablet/phone
  2. Hit <CTRL> + <F1> to go to a text-only terminal
  3. Log inn using your normal username and password
  4. Get rid of the old nvida drivers, libraries, configurations and other gunk (this step is optional, but if you tried some stuff before getting here it can be well worth it starting fresh): # sudo apt-get remove --purge nvidia*
  5. Add official ppa repository for vulkan: # sudo apt-add-repository ppa:canonical-x/vulkan
  6. Install nvidia driver that supports vulkan (NOTE: version 367 was recommended at the time I wrote this): # sudo apt-get install nvidia-367
  7. Install Vulkan libs: # sudo apt-get install libvulkan1 mesa-vulkan-dev mesa-vulkan-drivers
At this point you may reboot and try the vulkaninfo command from terminal to see what vulkan stuff is found in your system.

TIP: If you have a dual gpu setup which is common nowadays, your secondary inferior (usually Intel) GPU might get in the way of your Vulkan setup and this page shows you how to disable it.

Now it's time to look at and run some code. The official "wrangler lib" and SDK for Vulkan is called "LunarG" and it is not in the Ubuntu repos. It contains libraries, tools and example code for you to play with. You have to download it and unpack/build/install it the old fashioned way:

  1. Download the sdk from here: https://lunarg.com/vulkan-sdk/
  2. Once downloaded #chmod +x the file to be able to run it.
  3. Run the file, copy the extracted folder to some location and add the following path variables:
#export LD_LIBRARY_PATH=$HOME/VulkanSDK/1.0.21.1/x86_64/lib
#export VK_LAYER_PATH=$HOME/VulkanSDK/1.0.21.1/x86_64/etc/explicit_layer.d

You can put these in some script that is run on login or boot like ~/.bash_profile

NOTE: You may need to adjust the paths to match the location where you put the SDK. ~/.local/, /opt/ and /usr/local/ are good candidates.









No comments:

Post a Comment