NVIDIA CUDA under Fedora 21
As of May 2015, NVIDIA CUDA is not officially supported under Fedora 21. According to their website they plan to release CUDA 7 for FC21, but until then you can still install CUDA 6.5 using the official packages. If you are trying to install under Fedora 20 then follow this tutorial.
Install cuda-repo-fedora20-6.5-14.x86_64.rpm from the NVIDIA site. This will add a new “cuda” repo from where you can install the cuda packages:
sudo yum install xorg-x11-drv-nvidia-cuda
Compilation
The cuda codebase will not compile under GCC 5 (the default for Fedora 21) but you can just remove the warning and everything works fine (thanks to plebean_student on reddit for the tip).
Edit
/usr/local/cuda-6.5/targets/x86_64-linux/include/host_config.h
and comment out the following line:
#error -- unsupported GNU version! gcc 4.9 and up are not supported!
Build the examples
Setup your environment to point to the installed CUDA libraries and binaries:
export CUDA_HOME=/usr/local/cuda-6.5 export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 PATH=${CUDA_HOME}/bin:${PATH} export PATH
Create a new directory for the examples and build them:
cuda-install-samples-6.5.sh ~ cd ~/NVIDIA_CUDA-6.5_Samples make -j10
Run some examples to check they work ok:
./1_Utilities/deviceQuery/deviceQuery ./2_Graphics/Mandelbrot/Mandelbrot