The official download page only have package for 16.04 and 14.04, but actually Ubuntu 17.04 can install CUDA via apt directly. https://launchpad.net/ubuntu/zesty/+source/nvidia-cuda-toolkit
Install
Assume you already have NVIDIA graphic driver installed and just need CUDA. Only the following command is needed.
sudo apt-get install nvidia-cuda-dev nvidia-cuda-toolkit nvidia-nsight
NOTE: Ubuntu 17.04 use GCC6, which is not supported by nvcc
, the package will install clang-3.8 (the default clang version for 17.04 is clang 4.0, they can co-exist).
Compile
Compile cuda code using nvcc -ccbin clang-3.8 hello-world.cu
, remember to use cu
as suffix instead of c
other wise you will have error like the following
nvcc warning : The ‘compute_20’, ‘sm_20’, and ‘sm_21’ architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
square.c:6:1: error: unknown type name ‘__global__’
__global__ void cube(float * d_out, float * d_in){
You can use the following code to test if you have correct installation