Install NVIDIA CUDA Toolkit 10.0 on Fedora 28/27 - Comment Page: 1

This is guide, howto install nVidia CUDA Toolkit 10.0 on Fedora 28/27. I assume here that you have installed nVidia drivers successfully using my earlier Fedora nVidia Drivers Install Guide. You will need nVidia 384.00 or later version. This is initial version of this guide and as always remember backup important files before doing anything! Table of Contents 1. Install NVIDIA CUDA Toolkit 10.0 on Fedora 28/27 2. Uninstall NVIDIA CUDA Toolkit 10.0 on Fedora 28/27 1. Install NVIDIA CUDA Toolkit 10.0 on Fedora 28/27 [inttf_post_ad1] 1.1 Download NVIDIA CUDA Toolkit 10.0 and Patch 1 Download NVIDIA CUDA Toolkit 10.0 runfile (local) from official CUDA Toolkit download page....

4 comments on “Install NVIDIA CUDA Toolkit 10.0 on Fedora 28/27 - Comment Page: 1

    1. 1.1 Download NVIDIA CUDA Toolkit 10.0 and Patch 1

      Download NVIDIA CUDA Toolkit 10.0 runfile (local) from official CUDA Toolkit download page. Only Fedora 27 version available, but works on Fedora 28 too.

      File is currently cuda_10.0.130_410.48_linux.run and when you use browser files are normally downloaded /home//Downloads/cuda_10.0.xxx_linux.run location.
      1.2 Make CUDA installers executable

      chmod +x /path/to/cuda_10.0*.run

      1.3 Change root user

      su –
      ## OR ##
      sudo -i

      1.4 Make sure that you system is up-to-date and you are running latest kernel

      dnf update

      After update reboot your system and boot using latest kernel:

      reboot

      [[email protected] Nvidia]$ chmod +x cuda_10.0.130_410.48_linux.run
      [[email protected] Nvidia]$
      [[email protected] Nvidia]$ sudo dnf update
      [sudo] password for ross:
      Last metadata expiration check: 0:56:28 ago on Sat 13 Oct 2018 08:24:44 PM PDT.
      Dependencies resolved.
      Nothing to do.
      Complete!
      [[email protected] Nvidia]$

      1.5 Install needed dependencies

      dnf install gcc-c++ mesa-libGLU-devel libX11-devel libXi-devel libXmu-devel

      Installed:
      libXi-devel.x86_64 1.7.9-6.fc28 libXmu-devel.x86_64 1.1.2-8.fc28 mesa-libGLU-devel.x86_64 9.0.0-14.fc28
      gl-manpages.noarch 1.1-15.20161227.fc28 libICE-devel.x86_64 1.0.9-12.fc28 libSM-devel.x86_64 1.2.2-8.fc28
      libXdamage-devel.x86_64 1.1.4-12.fc28 libXfixes-devel.x86_64 5.0.3-5.fc28 libXt-devel.x86_64 1.1.5-7.fc28
      libXxf86vm-devel.x86_64 1.1.4-7.fc28 libdrm-devel.x86_64 2.4.93-1.fc28 mesa-libGL-devel.x86_64 18.0.5-4.fc28

      1.6 Run NVIDIA CUDA Binary

      You will need nVidia Drivers > 410.xx (BETA) here, installer still says 384.00, but I can’t get CUDA working with 390.xx or 396.xx, so install nVidia 410.xx BETA Drivers first.

      You have to use –override parameter, so you can run installer with newer GCC.

      ./cuda_10.0.130_410.48_linux.run –override

      ## OR full path / full file name ##

      /path/to/cuda_10.0.130_410.48_linux.run –override

      /home//Downdloads/cuda_10.0.130_410.48_linux.run –override

      Output:

      Logging to /tmp/cuda_install_23154.log
      Using more to view the EULA.
      End User License Agreement
      ————————–

      Preface
      ——-



      ############ Read/Move forward pressing space ############



      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN TH
      E SOFTWARE.

      —————–
      Do you accept the previously read EULA?
      accept/decline/quit: accept

      You are attempting to install on an unsupported configuration. Do you wish to continue?
      (y)es/(n)o [ default is no ]: y

      Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
      (y)es/(n)o/(q)uit: n

      Install the CUDA 10.0 Toolkit?
      (y)es/(n)o/(q)uit: y

      Enter Toolkit Location
      [ default is /usr/local/cuda-10.0 ]:

      Do you want to install a symbolic link at /usr/local/cuda?
      (y)es/(n)o/(q)uit: y

      Install the CUDA 10.0 Samples?
      (y)es/(n)o/(q)uit: y

      Enter CUDA Samples Location
      [ default is /root ]:

      Installing the CUDA Toolkit in /usr/local/cuda-10.0 …
      Installing the CUDA Samples in /root …
      Copying samples to /root/NVIDIA_CUDA-10.0_Samples now…
      Finished copying samples.

      ===========
      = Summary =
      ===========

      Driver: Not Selected
      Toolkit: Installed in /usr/local/cuda-10.0
      Samples: Installed in /root

      Please make sure that
      – PATH includes /usr/local/cuda-10.0/bin
      – LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.0/lib64 to /etc/ld.so.conf and run ldconfig as root

      To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-10.0/bin

      Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.0/doc/pdf for detailed information on setting up CUDA.

      ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 10.0 functionality to work.
      To install the driver using this installer, run the following command, replacing with the name of this run file:
      sudo .run -silent -driver

      Logfile is /tmp/cuda_install_23154.log

      1.7 Post Installation Tasks

      Make sure that PATH includes /usr/local/cuda-10.0/bin and LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64. You can of course do this per user or use some other method, but here is one method to do this. Run following command (copy & paste all lines to console) to create /etc/profile.d/cuda.sh file:

      cat <
      pathmunge /usr/local/cuda-10.0/bin before

      if [ -z “${LD_LIBRARY_PATH}” ]; then
      LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64
      else
      LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
      fi

      export PATH LD_LIBRARY_PATH
      EOF

      Then logout/login (simply close terminal and open it again). Now as normal user and root you should see something like (depends on your system):

      [[email protected] ~]$ echo $PATH
      /usr/local/cuda-10.0/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/user/.local/bin:/home/user/bin
      [[email protected] ~]$ echo $LD_LIBRARY_PATH
      /usr/local/cuda-10.0/lib64
      [[email protected] ~]$

      1.8 Test Your Installation, Compile and Run deviceQuery

      As a root user:

      cd /root/NVIDIA_CUDA-10.0_Samples/1_Utilities/deviceQuery/

      make
      “/usr/local/cuda-10.0″/bin/nvcc -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -o deviceQuery.o -c deviceQuery.cpp
      “/usr/local/cuda-10.0″/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -o deviceQuery deviceQuery.o
      mkdir -p ../../bin/x86_64/linux/release
      cp deviceQuery ../../bin/x86_64/linux/release

      ./deviceQuery
      ./deviceQuery Starting…

      CUDA Device Query (Runtime API) version (CUDART static linking)

      Detected 1 CUDA Capable device(s)

      Device 0: “GeForce GT 1030”
      CUDA Driver Version / Runtime Version 10.0 / 10.0
      CUDA Capability Major/Minor version number: 6.1
      Total amount of global memory: 2001 MBytes (2098135040 bytes)
      ( 3) Multiprocessors, (128) CUDA Cores/MP: 384 CUDA Cores
      GPU Max Clock rate: 1519 MHz (1.52 GHz)
      Memory Clock rate: 3004 Mhz
      Memory Bus Width: 64-bit
      L2 Cache Size: 524288 bytes
      Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
      Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
      Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
      Total amount of constant memory: 65536 bytes
      Total amount of shared memory per block: 49152 bytes
      Total number of registers available per block: 65536
      Warp size: 32
      Maximum number of threads per multiprocessor: 2048
      Maximum number of threads per block: 1024
      Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
      Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
      Maximum memory pitch: 2147483647 bytes
      Texture alignment: 512 bytes
      Concurrent copy and kernel execution: Yes with 2 copy engine(s)
      Run time limit on kernels: Yes
      Integrated GPU sharing Host Memory: No
      Support host page-locked memory mapping: Yes
      Alignment requirement for Surfaces: Yes
      Device has ECC support: Disabled
      Device supports Unified Addressing (UVA): Yes
      Device supports Compute Preemption: Yes
      Supports Cooperative Kernel Launch: Yes
      Supports MultiDevice Co-op Kernel Launch: Yes
      Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
      Compute Mode:

      deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.0, CUDA Runtime Version = 10.0, NumDevs = 1
      Result = PASS

      Thats all, but you might see problems with other examples, because you have too fresh GCC.

      ====> Yes!

      First I want to compile the sample programs included in the CUDA Toolkit. To do that I used the edits suggested by Carter Turn:

      /*************

      https://carterturn.com/h/Guides/NVIDIA%20CUDA%209.1%20with%20GCC%207.2

      which are:

      Modify host_config.h
      As usual, we need to comment out the section of NVIDIA’s host_config.h that prevents us from using newer GCC versions. In a slight twist from last time, we need to modify /usr/local/cuda/include/crt/host_config.h (Note that the /usr/local/cuda part depends on where you chose to install during the installation). Comment out the line

      #error — unsupported GNU version! gcc versions later than 6 are not supported!

      For me, that was line 121.

      Modify floatn.h
      For some reason, nvcc does not like 128 bit floats, so we need to modify /usr/include/bits/floatn.h. The easiest way to do this (e.g. the way that involves opening as few files as possible) is to add

      #ifdef __CUDACC__
      #define __HAVE_FLOAT128 0
      #endif

      just after the section of floatn.h that defines __HAVE_FLOAT128. In my copy, this was line 37.

      So far, the only error I am getting is related to having an outdated driver, so I think

      *****/

      I can’t figure outwhere I got the next edit but it is to add:

      CCFLAGS := -ansi

      to all Makefiles. This and removing some c++ style comments (// …) allows me to compile all of the examples except c++11_cuda. Unfortunately, that won’t compile because the C++ compiler I have is:

      gcc version 8.2.1 20181011 (Red Hat 8.2.1-4) (GCC)

      which when set to -ansi removes the C++11 ability. This in turn means I can’t install OpenCV with CUDA support since that requires at least C++11.

      So I’m at a dead end for now. Do you have any suggestions? How long do you think it will be before the CUDA Toolkit catches up to Fedora 28 and gcc 8.

      Reply
      • Hi Ross,

        Unfortunately I don’t have any idea when CUDA toolkit catch up to Fedora 28 and gcc 8. I guess that nVidia CUDA is more targeted to RHEL and CentOS than Fedora, because Fedora use always latest packages.

        Reply
    2. Why the step 1.7 (updating the PATH and LD_LIBRARY_PATH) with the cude.sh in /etc/profile.d/ does not work?
      I tried logout and system restart both doesn’t update the PATH. I can update through ~/.bashrc.

      Reply
      • Hi Yoki,

        Sorry, there was one critical piece missing on step 1.7. You could try it again, it should work now.

        Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close