Installing CUDA on older computer

I attempted yesterday to do my first ever installation of CUDA.

The only machine I have available with Nvidia Graphics has been standing in a closet for quite some time. I dusted of the worst cobwebs and was somewhat surprised to see it start at all. Some drives are dead, and the fans on the GFX needed quite a bit of love to start spinning - but you run with what you got.

Server is running Ubuntu 16.04 x86_64, which upgraded to “current” without problem.

I started installing cuda using the instructions here: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=debnetwork

It was all good until I rebooted after the ‘apt install cuda’ step. After that reboot the GFX was no longer starting as it should.

Looking through dmesg I saw alot of lines stating that the nvidia-440 driver is unable to start the NVIDIA Corporation GF104 [GeForce GTX 460] card. The error message also states that nvidia-390 is the way to go.

I nuked some 440-packages and installed 390-packages instead, which made the machine boot with working graphics, but broke the cuda install.

./deviceQuery Starting...

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

cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

Looks to me like the cuda meta package has a bit narrow minded dependency chain:

# for package in cuda cuda-10-2 cuda-runtime-10-2 cuda-drivers; do apt-cache depends $package; done
cuda
  Depends: cuda-10-2
cuda-10-2
  Depends: cuda-toolkit-10-2
  Depends: cuda-runtime-10-2
  Depends: cuda-demo-suite-10-2
cuda-runtime-10-2
  Depends: cuda-drivers
  Depends: cuda-libraries-10-2
  Depends: cuda-license-10-2
cuda-drivers
  Depends: nvidia-440
  Depends: nvidia-440-dev
  Depends: libcuda1-440
  Depends: nvidia-opencl-icd-440
  Depends: <libopencl1>
    ocl-icd-libopencl1
    nvidia-libopencl1-304
    nvidia-libopencl1-340
    nvidia-libopencl1-384
    nvidia-libopencl1-387
    nvidia-libopencl1-390
    nvidia-libopencl1-396
    nvidia-libopencl1-410
    nvidia-libopencl1-418
    nvidia-libopencl1-440
  Depends: nvidia-modprobe
  Depends: nvidia-settings
  Conflicts: cuda-drivers-diagnostic
  Replaces: cuda-drivers-diagnostic

Much like nvidia-libopencl1 is accepted in every shape and color, should it not be possible to satisfy the driver dependencies with 390-packages?

How else am I supposed to do the installation to get CUDA runtime that works with 390 driver?

https://www.geforce.com/hardware/technology/cuda/supported-gpus?field_gpu_type_value=All&page=3 lists GTX 460 as supported.

current software does not support that GF104 Fermi card. It is too old.

The last GPU driver version that supported that card was 390.xx and the last CUDA version that supported it was CUDA 8.0

Go back to the setup where you had the R390 driver installed. Then install CUDA 8 using the runfile install method, while deselecting the driver install.

You can get CUDA 8 runfile installer from http://www.nvidia.com/getcuda by following the legacy releases button

Ah, ok, thanks Robert!

I’ll try the runfile, but my previous remark on the apt dependency chain still feels valid. CUDA8 is in the repo, so is the older driver, but apt is actively prevented from doing a working install:

# for package in cuda-8-0 cuda-runtime-8-0 cuda-drivers; do apt-cache depends $package; done
cuda-8-0
  Depends: cuda-toolkit-8-0
  Depends: cuda-runtime-8-0
  Depends: cuda-demo-suite-8-0
cuda-runtime-8-0
  Depends: cuda-nvrtc-8-0
  Depends: cuda-nvgraph-8-0
  Depends: cuda-cusolver-8-0
  Depends: cuda-cublas-8-0
  Depends: cuda-cufft-8-0
  Depends: cuda-curand-8-0
  Depends: cuda-cusparse-8-0
  Depends: cuda-npp-8-0
  Depends: cuda-cudart-8-0
  Depends: cuda-drivers
  Depends: cuda-license-8-0
cuda-drivers
  Depends: nvidia-440
  Depends: nvidia-440-dev
  Depends: libcuda1-440
  Depends: nvidia-opencl-icd-440
  Depends: <libopencl1>
    ocl-icd-libopencl1
    nvidia-libopencl1-304
    nvidia-libopencl1-340
    nvidia-libopencl1-384
    nvidia-libopencl1-387
    nvidia-libopencl1-390
    nvidia-libopencl1-396
    nvidia-libopencl1-410
    nvidia-libopencl1-418
    nvidia-libopencl1-440
  Depends: nvidia-modprobe
  Depends: nvidia-settings
  Conflicts: cuda-drivers-diagnostic
  Replaces: cuda-drivers-diagnostic

Once you have your 390 driver install done and working, the apt command that I would use to install CUDA at that point is

sudo apt-get install cuda-toolkit-8-0

You may still run into dependency issues. You can push through those if you want. There are plenty of questions on this forum discussing various dependency issues and how to work through them. The runfile installer may offer a quicker path to get things set up. Given that the last and probably only CUDA version you would use on this GPU is 8.0, the runfile install method seems to offer few downsides from my perspective.

Installing using the script worked fine!

I ran

# sh cuda_8.0.61_375.26_linux-run 
# sh cuda_8.0.61.2_linux-run

and created:

# cat /etc/ld.so.conf.d/cuda-8-0.conf
/usr/local/cuda-8.0/lib64

And after building a new deviceQuery it seem to work fine:

$ ./deviceQuery
./deviceQuery Starting...

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

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 460"
  CUDA Driver Version / Runtime Version          9.1 / 8.0
  CUDA Capability Major/Minor version number:    2.1
  Total amount of global memory:                 960 MBytes (1006108672 bytes)
  ( 7) Multiprocessors, ( 48) CUDA Cores/MP:     336 CUDA Cores
  GPU Max Clock rate:                            1430 MHz (1.43 GHz)
  Memory Clock rate:                             1800 Mhz
  Memory Bus Width:                              256-bit
  L2 Cache Size:                                 524288 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 / 1 / 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 GTX 460
Result = PASS

Still using the 390 driver:

$ nvidia-smi 
Sun Feb  2 11:42:00 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.116                Driver Version: 390.116                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 460     Off  | 00000000:01:00.0 N/A |                  N/A |
| 40%   33C   P12    N/A /  N/A |    479MiB /   959MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
+-----------------------------------------------------------------------------+

Thanks again Robert!