Help requested on trying to setup Nvidia GPU for CUDA only

Hi there folks,

I’ve always ran into issues when it comes to Nvidia/intel GPU ever since the beginnig and the solution, at the time, was to use only the intel GPU, which i intend to keep. However i now need to program something in CUDA for classes and i would like to properly set it up.

From the Manjaro Setting Manager i see that i have the following installed video-hybrid-intel-nvidia-430xx-bumblebee, the most recent version of bumblebee, but prime has available video-hybrid-intel-nvidia-455xx-prime but from my understanding prime forces the whole display to use the Nvidia GPU, right?

When trying to install cuda using sudo pacman -S cuda and after picking the providers i thought worked in my machine the following happens:

$ sudo pacman -S cuda
resolving dependencies...
:: There are 8 providers available for opencl-nvidia:
:: Repository extra
   1) opencl-nvidia-340xx  2) opencl-nvidia-390xx  3) opencl-nvidia-418xx  4) opencl-nvidia-430xx  5) opencl-nvidia-435xx  6) opencl-nvidia-440xx  7) opencl-nvidia-450xx  8) opencl-nvidia-455xx

Enter a number (default=1): 4
:: There are 2 providers available for nvidia-utils>=450.51.06:
:: Repository extra
   1) nvidia-450xx-utils  2) nvidia-455xx-utils

Enter a number (default=1): 1
looking for conflicting packages...
:: nvidia-450xx-utils and nvidia-430xx-utils are in conflict (nvidia-libgl). Remove nvidia-430xx-utils? [y/N] n
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: nvidia-450xx-utils and nvidia-430xx-utils are in conflict

Because i intend to keep my system running only on the intel GPU and the nvidia GPU to wake up only when i run something that requires cuda i’m unsure if i can update or not.

Other thing to mention is the 2 files in my /etc/modprobe.d: mhwd-bbswitch.conf and mhwd-nvidia.conf with the following contents:

$ cat mhwd-bbswitch.conf 
##
## Generated by mhwd - Manjaro Hardware Detection
##
 
 
options bbswitch load_state=0 unload_state=0
##
## Generated by mhwd - Manjaro Hardware Detection
##
 
 
blacklist nouveau
blacklist nvidia
blacklist nvidia-modeset
blacklist nvidia-uvm
blacklist ttm
blacklist drm_kms_helper
blacklist drm

The archwiki as me in a loop of articles and manjaro wiki regarding the matter at hand - link - made no mentions to CUDA or the intended behavior that i expect my machine to have, as i’m pretty sure i don’t want anything to do with prime or bumblebee as i’m just expecting my machine to run programs i tell it to.

Hardware:

  • Lenovo Y520
  • Manjaro x64
  • Kernel: 5.4 LTS
  • dGPU: Nvidia 1050ti
  • iGPU: Intel HD Graphics 630
  • DE: i3

Well i am aware that they don’t go well together, but i just want things to work good enough for me to be able to my assignments and future projects good enough, and if sticking to an older kernel or something like that does it then i wouldn’t mind.

Unfortunately this is my laptop and i won’t be changing it any time soon, nor will i be able to use a desktop in the future with AMD GPUs, so just having the Nvidia GPU waking up and shutting off before and after using cuda shouldn’t screw up anything else, right?

Please read the thread - and the linked articles - unless Nvidia do something drastic - CUDA and OpenCL will be very difficult to get working on Linux.

1 Like

Which GPU are you using?
You want to use CUDA for tensorflow/julia?

There’s a dependency chain if you will straight forward installation it will not work as it will pull latest CUDA version from the repository.

I’m programming into CUDA directly, my class is about parallel programming so we’re learning how to write in CUDA using C and just an overall introduction to programming in GPU and parallel computation, so i’m not really going to use anything else but the nvcc compiler and sending a file straight to the GPU with data for processing.

Check the latest version of driver supported by your GPU and install the prime version of the driver using mhwd. Execute nvidia-smi and check the CUDA version supported and install that version of CUDA

But doesn’t the prime version of the driver make the entire system run on dGPU?

The reason i installed bumblebee was to have the possibility to only enable dGPU when i wanted to, but since i don’t game it’s just for cuda now.

You have to run the application you want to run on dGPU using command
prime-run

It seems that with the 455.38 CUDA and OpenCL is back when using Linux 5.9 kernel.

I’m using it for a few days without any issues

After installing video-hybrid-intel-nvidia-455xx-prime through Manjaro Hardware running lspci | grep -E "VGA|3D" now returns:

00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)

Which means that my dGPU is in fact active, and probably running the X sessions, which is not what i wanted as battery life is valuable to me.

I also haven’t deleted the files i’ve showed previously available at /etc/modprobe.d/ which blacklisted some nvidia modules, but mhwd took care of it and now there’s only this file present named mhwd-gpu-conf:

##
## Generated by mhwd - Manjaro Hardware Detection
##
 
blacklist nouveau
blacklist ttm
blacklist drm_kms_helper
blacklist drm
options nvidia "NVreg_DynamicPowerManagement=0x02"

How can i make sure the dGPU is not used to run X and will be disabled unless when i use it for CUDA?

It is in fact running Xorg, output on nvidia-smi:

$ nvidia-smi
Sun Nov  8 12:49:32 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.38       Driver Version: 455.38       CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 105...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   27C    P8    N/A /  N/A |      4MiB /  4042MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       710      G   /usr/lib/Xorg                       4MiB |
+-----------------------------------------------------------------------------+
1 Like

A post was split to a new topic: Setup nvidia for cuda only