Installation of CUDA on Linux Mint 19 Xfce

Hello! That is my very first post on any forum so, first things first: I’m brazilian, my english is a little rusty, so feel free to correct me.

I have a Dell Inspiron 14 3443 laptop running with NVIDIA GeForce 820M graphics card and I installed Linux Mint 19 xfce on it. I tried really hard to install the NVIDIA’s driver, since it wasn’t appearing in the driver manager so I could install it. After a lot of work I finally got the 384.98 NVIDIA’s driver to work with the 4.13.0-21 kernel’s version running (if I upgrade the kernel to the 4.15.38-40, the driver no longer works). So now I wanted to install the CUDA Toolkit and there’s when the problem started: everytime that I try to install it, automatically is forcing my driver to update and when it does that the driver no longer works and I got a lot of issues like “the black screen problem”, the “unable to load ‘nvidia-drm’ kernel module” and I tried everything that I found on internet, for being more accurate, I tried several things that I saw here like https://devtalk.nvidia.com/default/topic/1001312/error-unable-to-load-the-nvidia-drm-kernel-module-nvidia-driver-/ and in another websites like https://stackoverflow.com/questions/42777533/unable-to-load-the-nvidia-drm-kernel-module. So I don’t know what to do now, I tried also install an older version of CUDA (the 9.1-85 version) but the problem is always the same: it’s forcing the driver to update. In the case of the CUDA Toolkit 10.0 it’s forcing to update to the 410.66 version, in the case of the 9.1-85 version it’s forcing to update to the 387.26 version. I don’t really know if I try to update the driver first and then I try to install the CUDA Toolkit, or I update the kernel to the 4.15.38-40 version first. I tried all those things and nothing worked. Please someone tell me what to do to get the CUDA Toolkit working, so I can use the gpu for Python’s Theano library.

Thank you for your attention and hope this topic helps more people in the same situation.

Please post the output of
lspci -nn -d 10de:*
first to see if you have a supported GPU.

Based on that, the installation procedure would be

  • Don’t use the .run installers, use --uninstall to uninstall them
  • purge anthing nvidia/cuda
  • add the ubuntu graphics ppa
  • install the driver from that
  • download the cuda .deb
  • add it to your system
  • don’t install cuda
  • instead, run sudo apt install cuda-toolkit-10-0

Okay, I’ll do what you said and see what happens. Sould I install the lastest version of the driver through the ppa? I’m asking that because I tried to install the nvidia-410 package and the driver is not there. One more thing: should I install the lastest kernel version?

By the way, the output of lspci -nn -d 10de:* is that:

08:00.0 3D controller [0302]: NVIDIA Corporation GF117M [GeForce 610M/710M/810M/820M / GT 620M/625M/630M/720M] [10de:1140] (rev a1)

Ok, what I suspected: your GT820 is Fermi based, that’s not supported anymore by the latest drivers and cuda.
You can only install the 390 driver and cuda 9.1 max.
so the install procedure would be:

  • Don’t use the .run installers, use --uninstall to uninstall them
  • purge anthing nvidia/cuda
  • add the ubuntu graphics ppa
  • install the driver from that: sudo apt install nvidia-driver-390 (or nvidia-390)
  • download the cuda 9.1 .deb
  • add it to your system
  • don’t install cuda
  • instead, run sudo apt install cuda-toolkit-9-1
    Edit: your chip is GF117M, the F stands for Fermi

Well, I installed the last version of the kernel and I tried to install the 390 NVIDIA driver via ppa, but when I rebooted it falls into a black screen and I did what this website said to fix it: http://www.upubuntu.com/2016/11/how-to-fix-blank-screen-after.html .

So I purged all nvidia/cuda and I am searching for something in the web to fix this black screen problem, if you have a solution I would like to hear, but your help it’s beeing such amazing, thanks a lot!

Please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.

Okay. I did the following to obtain the file (hope I’ve done the right procedure):

  • After some seconds of the black screen I got for the nvidia driver I enter the tty mode with Ctrl+Alt+F1
  • Then I just run in the terminal ‘sudo sh nvidia-bug-report.sh’ and generate the file
  • With that done I uninstall the nvidia driver and reboot the system so I could send you the file
    nvidia-bug-report.log.gz (104 KB)

The procedure was perfect, unfortunately the xorg logs weren’t included. The logs tell that the kernel modules are loading fine, the xorg config is correct.
Please repeat the procedure, but this time instead of running nvidia-bug-report.sh, please run
sudo journalctl -b0 --no-pager _COMM=gdm-x-session >xorg.log
and attach that to have the missing logs.

Blindly, you could try if creating the files
/usr/share/gdm/greeter/autostart/optimus.desktop
/etc/xdg/autostart/optimus.desktop

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

fixes the issue

I tried creating those files you said, in my case the first directory was the /usr/share/gdm/autostart/optimus.desktop (there was no “greeter” folder), and it didn’t fix the issue. I’m sending to you through this reply the xorg.log attachment.
xorg.log (102 Bytes)

Ok, I’ve confused things a bit, you’re using xfce and probably lightdm, I’ve been telling you things for GDM/Gnome.
So for your lightdm setup, see if purging/reinstalling lightdm fixes the issue, if not, check if the needed setting for PRIME are set:
https://wiki.archlinux.org/index.php/NVIDIA_Optimus#Display_Managers

Wow! That was impresive! I followed the instructions on the website right after installing the NVIDIA driver and it works perfectly! I then installed the cuda-toolkit only, like you said, but I still have an issue, now due to running a python program that uses the GPU. When I run the deviceQuery the reuslt is PASS, so I thought it was everything okay, then I runned a python program and the result was this:

pygpu.gpuarray.GpuArrayException: b’GPU is too old for CUDA version’

Now what should I do?

Thank you very, very much for this help.

Please post the output of deviceQuery.

Here’s the output of deviceQuery:

./deviceQuery Starting…

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

Detected 1 CUDA Capable device(s)

Device 0: “GeForce 820M”
CUDA Driver Version / Runtime Version 9.1 / 9.1
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1985 MBytes (2081816576 bytes)
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
MapSMtoCores for SM 2.1 is undefined. Default to use 64 Cores/SM
( 2) Multiprocessors, ( 64) CUDA Cores/MP: 128 CUDA Cores
GPU Max Clock rate: 1250 MHz (1.25 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 64-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 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: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
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): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 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
Supports Cooperative Kernel Launch: No
Supports MultiDevice Co-op Kernel Launch: No
Device PCI Domain ID / Bus ID / location ID: 0 / 8 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

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

Ok, while the driver supports cuda 9.1, your gpu does not. It has only

CUDA Capability Major/Minor version number: 2.1

which means, maximum supported cuda version is indeed 8.0
So you will have to purge cuda and download/install cuda-toolkit-8.0

I do what you said, but I still got the same message. I tried the GA1 and the GA2 versions of cuda 8.0, which one sholud I install? The output of deviceQuery now looks like this:

./deviceQuery Starting…

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

Detected 1 CUDA Capable device(s)

Device 0: “GeForce 820M”
CUDA Driver Version / Runtime Version 9.1 / 8.0
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 1985 MBytes (2081816576 bytes)
( 2) Multiprocessors, ( 48) CUDA Cores/MP: 96 CUDA Cores
GPU Max Clock rate: 1250 MHz (1.25 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 64-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 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: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
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): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 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 PCI Domain ID / Bus ID / location ID: 0 / 8 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce 820M
Result = PASS

Your setup is perfectly fine now, just the application you’re running has a bug when it comes to detecting the cuda version:
https://github.com/Theano/libgpuarray/issues/573
Edit: to make it work correctly, I think you should replace all occurences of cuDriverGetVersion with cudaRuntimeGetVersion

After I did a lot of work installing the NCCL and the cuDNN for get better performance in my deep learning research I got this error due to the cuDNN cc3.0-only compatibility:

cudnnGetVersion() : 7104 , CUDNN_VERSION from cudnn.h : 7104 (7.1.4)
Host compiler version : GCC 7.3.0
There are 1 CUDA capable devices on your machine :
device 0 : sms 2 Capabilities 2.1, SmClock 1250.0 Mhz, MemSize (Mb) 1985, MemClock 900.0 Mhz, Ecc=0, boardGroupID=0
Using device 0

Testing single precision
CUDNN failure
Error: CUDNN_STATUS_ARCH_MISMATCH
mnistCUDNN.cpp:394
Aborting…

So I can’t use the GPU to get better performance on my deep learning algorithms due to that. Do you have any ideas besides using cuDNN for use my GPU to perform better than a cpu-only processing? Thanks a lot for your help, one more time.

Looks like the forum software ate my previous answer.
I don’t think you’ll get very far in that field with your gpu, you might be able to work around some issue but then will hit the next showstopper.
For Tensorflow&Co you’ll need cc3.5
https://developer.nvidia.com/cuda-gpus
http://www.drdobbs.com/parallel/running-cuda-code-natively-on-x86-proces/231500166