Wstęp do CUDA Wstęp do CUDA cz. I autor: Szymon Zimnowoda Instalacja
Opisdocs.nvidia : cuda-quick-start-guideinstalacji : ask ubuntu| Instalacja CUDA Thomas Krenn Wiki Cuda HELP UBUNTUtutorials.ubuntu : gpu-data-processing-inside-lxd CUDA toolkit 12.2
sudo dpkg --install cuda-repo--..deb sudo apt-key del 7fa2af80 wget https://developer.download.nvidia.com/compute/cuda/repos/$distro/$arch/cuda-keyring_1.0-1_all.deb sudo dpkg -i cuda-keyring_1.0-1_all.deb sudo add-apt-repository contrib sudo apt-get update sudo apt-get -y install cuda sudo reboot export PATH=/usr/local/cuda-12.2/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-12.2/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} git clone [email protected]:NVIDIA/cuda-samples.git
Instalacja Dockerlinuxhandbook : setup-opencl-linux-docker sprzęt Sprawdzamy jaką mamy kartę graficzną: cuda-getting-started-guide-for-linux
lspci | grep -i nvidia
lub za pomocą komendy:
lspci | grep VGA lshw -c video | grep driver ubuntu-drivers devices
lublinuxconfig: how-to-check-cuda-version-on-ubuntu-20-04-focal-fossa-linux
nvidia-smi
i czy jest ona na liście kompatybilnego sprzętu: Lista GPU odpowiednich dla CUDA
https://developer.nvidia.com/cuda-gpus
GeForce GTX 770 : Compute Capability = 3.0
Nvidia GTX 770
The GeForce GTX 770 is a graphics card featuring the next-gen Kepler-based GPU with 1536 CUDA cores, It features an amazing GDDR5 memory at 7GHz. It sports a pair of SLI connectors, 6-pin and 8-pin PCIe power connectors, and an I/O panel consisting of HDMI, DisplayPort and two DVI ports. The GTX 770 packs 4 graphics processing clusters, 8 streaming multiprocessors, 128 TAUs and 32 ROPs.techspot : products nvidia-geforce-gtx-770.91181
Specyfikacja: GTX 770 GPU Engine Specs: 1536CUDA Cores 1046Base Clock (MHz) 1085Boost Clock (MHz) 134Texture Fill Rate (billion/sec) GTX 770 Memory Specs: 7.0 GbpsMemory Speed 2048 MBStandard Memory Config GDDR5Memory Interface 256-bitMemory Interface Width 224.3Memory Bandwidth (GB/sec) GTX 770 Support: GPU Boost 2.0, PhysX, TXAA, SHIELD-Ready, NVIDIA G-SYNC-readyImportant Technologies 3D Vision, CUDA, DirectX 11, Adaptive VSync, FXAA, NVIDIA Surround, SLI-readyOther Supported Technologies 4.3OpenGL PCI Express 3.0Bus Support YesCertified for Windows 7, Windows 8, Windows Vista, or Windows XP Yes3D Vision Ready Yes3D Gaming YesBlu Ray 3D Yes3D Vision Live (Photos and Videos) YesNVIDIA PhysX™ Technology 11Microsoft DirectX 11.2 API Display Support: 4096x2160Maximum Digital Resolution 1 2048x1536Maximum VGA Resolution One Dual Link DVI-I, One Dual Link DVI-D, One HDMI, One DisplayPortStandard Display Connectors 4 displaysMulti Monitor YesHDCP YesHDMI InternalAudio Input for HDMI GTX 770 Graphics Card Dimensions: 4.376 inchesHeight 10.5 inchesLength Dual-slotWidth Thermal and Power Specs: 98 CMaximum GPU Temperature (in C) 230 WGraphics Card Power (W) 600 WMinimum Recommended System Power (W) One 8-pin and one 6-pinSupplementary Power Connectors 1 - 3840x2160 at 30Hz or 4096x2160 at 24Hz supported over HDMI. 4096x2160 (including 3840x2160) at 60Hz supported over Displayport. Support for 4k tiled MST displays requires 326.19 driver or later.
Graphics Featurestechpowerup : gpu-specs geforce-gtx-770.c1856 DirectX 12 (11_0) OpenGL 4.6 OpenCL 3.0 Vulkan 1.2.175 CUDA 3.0 Shader Model 6.5 (5.1)
Render Config Shading Units 1536 TMUs 128 ( texture mapping units) ROPs 32 SMX Count 8 ( The Next Generation Streaming Multiprocessor SMX) L1 Cache 16 KB (per SMX) L2 Cache 512 KB
Graphics Processor GPU Name GK104 GPU Variant GK104-425-A2 Architecture Kepler Foundry TSMC Process Size 28 nm Transistors 3,540 million Density 12.0M / mm² Die Size 294 mm² Chip Package BGA-1745 the SMX now contains 196 cores 8 SMX * 196 cores = 1536 cores to reach 3,250 Gflops
Theoretical Performance Pixel Rate 34.72 GPixel/s Texture Rate 138.9 GTexel/s FP32 (float) 3.333 TFLOPS FP64 (double) 138.9 GFLOPS (1:24)
OS Wybieramy taką wersję OS dla której jest dostępny CUDA ToolkitCUDA Toolkit
Sprawdzamy aktualną wersję i typ OS:
uname -m && cat /etc/*release
otrzymujemy (przykładowy wynik):
x86_64 DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.10 DISTRIB_CODENAME=saucy DISTRIB_DESCRIPTION="Ubuntu 13.10" NAME="Ubuntu" VERSION="13.10, Saucy Salamander" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 13.10" VERSION_ID="13.10" HOME_URL="http://www.ubuntu.com/" SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
Informacje o instalacji dla wersji: Ubuntu 16.04askubuntu question: how-can-i-install-cuda-on-ubuntu-16-04devtalk.nvidia : cuda-8-0-toolkit-install-nvcc-not-found-ubuntu-16-04 Ubuntu 14.10downloads Ubuntu 14.04 Installing and testing CUDA in Ubuntu 14.04 Ubuntu 12.04 Yputube : Ubuntu 12.04 - Installing Nvidia CUDA Developer Driver [OUTDATED]
cuda-drivers
apt search cuda-drivers # This command lists all the available CUDA versions
Sorting... Done Full Text Search... Done cuda-drivers/unknown 535.86.10-1 amd64 CUDA Driver meta-package, branch-agnostic
cuda-drivers-515/unknown 515.105.01-1 amd64 CUDA Driver meta-package, branch-specific
cuda-drivers-520/unknown 520.61.05-1 amd64 CUDA Driver meta-package, branch-specific
cuda-drivers-525/unknown 525.125.06-1 amd64 CUDA Driver meta-package, branch-specific
cuda-drivers-530/unknown 530.30.02-1 amd64 CUDA Driver meta-package, branch-specific
cuda-drivers-535/unknown 535.86.10-1 amd64 CUDA Driver meta-package, branch-specific
cuda-drivers-fabricmanager/unknown 535.86.10-1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-450/jammy-updates,jammy-security 450.248.02-0ubuntu0.22.04.1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-460/jammy-updates,jammy-security 510.85.02-0ubuntu0.22.04.1 amd64 Transitional package for cuda-drivers-fabricmanager-510
cuda-drivers-fabricmanager-470/jammy-updates,jammy-security 470.199.02-0ubuntu0.22.04.1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-510/jammy-updates,jammy-security 515.105.01-0ubuntu0.22.04.1 amd64 Transitional package for cuda-drivers-fabricmanager-515
cuda-drivers-fabricmanager-515/unknown 515.105.01-1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-520/unknown 520.61.05-1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-525/unknown 525.125.06-1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-530/unknown 530.30.02-1 amd64 Meta-package for FM and Driver
cuda-drivers-fabricmanager-535/unknown 535.86.10-1 amd64 Meta-package for FM and Driver
Sterownik karty graficznej
Sterownik Accelerated Linux Driver Set README and Installation Guide
sudo software-properties-gtk
lub:
nvidia-settings
lub
apt list --installed | grep -e nvidia-driver-[0-9][0-9][0-9] -e nvidia-[0-9][0-9][0-9]
Rekomendowany sterownik:
ubuntu-drivers devices
Przykładowy wynik: == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == modalias : pci:v000010DEd00001184sv00001458sd00003603bc03sc00i00 vendor : NVIDIA Corporation model : GK104 [GeForce GTX 770] driver : nvidia-driver-450-server - distro non-free driver : nvidia-driver-390 - distro non-free driver : nvidia-driver-418-server - distro non-free driver : nvidia-driver-470 - distro non-free recommended driver : nvidia-driver-470-server - distro non-free driver : xserver-xorg-video-nouveau - distro free builtin
Aktualny sterownik:
nvidia-smi
gcc
Czy mamy odpowiedniąnvidia cuda-installation-guide-linux - table wersję gcc ?
_______________________________________________________________ | CUDA version | max supported GCC version |
| 12.1, 12.2 | 12.2 | | 12 | 12.1 | | 11.4.1+, 11.5, 11.6, 11.7, 11.8 | 11 | | 11.1, 11.2, 11.3, 11.4.0 | 10 | | 11 | 9 | | 10.1, 10.2 | 8 | | 9.2, 10.0 | 7 | | 9.0, 9.1 | 6 | | 8 | 5.3 | | 7 | 4.9 | | 5.5, 6 | 4.8 | | 4.2, 5 | 4.6 | | 4.1 | 4.5 | | 4.0 | 4.4 | ____________________________________________________________
Sprawdzamy wersję gcc
gcc --version
apt policy gcc
gcc: Installed: 4:11.2.0-1ubuntu1 Candidate: 4:11.2.0-1ubuntu1 Version table: *** 4:11.2.0-1ubuntu1 500 500 http://pl.archive.ubuntu.com/ubuntu jammy/main amd64 Packages 100 /var/lib/dpkg/status
W przeciwnym razie pojawi się błąd w czasie instalacji :
Error: unsupported compiler: 5.4.1. Use --override to override this check.
Rozwiązaniestackoverflow question : cuda-incompatible-with-my-gcc-version : sudo sh cuda_8.0.44_linux.run --override
lina 81:/usr/local/cuda/include/host_config.h
//#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4) #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
Wybieramy odpowiednią wersję gcc za pomocą update-alternatives sudo update-alternatives --config gcc
sudo gedit /var/log/cuda-installer.log
[INFO]: Driver installation detected by command: apt list --installed | grep -e nvidia-driver-[0-9][0-9][0-9] -e nvidia-[0-9][0-9][0-9] [INFO]: Cleaning up window [INFO]: Complete [INFO]: Checking compiler version... [INFO]: gcc location: /usr/bin/gcc
[INFO]: gcc version: gcc version 10.4.0 (Ubuntu 10.4.0-4ubuntu1~22.04)
[INFO]: Initializing menu [INFO]: Setup complete [INFO]: Components to install: [INFO]: Driver [INFO]: 470.42.01 [INFO]: Executing NVIDIA-Linux-x86_64-470.42.01.run --ui=none --no-questions --accept-license --disable-nouveau --no-cc-version-check --install-libglvnd 2>&1 [INFO]: Finished with code: 256 [ERROR]: Install of driver component failed. [ERROR]: Install of 470.42.01 failed, quitting
SDK = NVIDIA CUDA Toolkit Nvidia CUDA toolkitnvidia cuda-toolkit
dpkg -l | grep cuda-toolkit
lub
nvcc --version
Instalacja apt instaler runfile
Instalacja: na pulpicie naciśnij ALT+F1, spowoduje to przejście do ekranu konsoli zaloguj się jako root( tylko root może instalować moduły jądra) sudo systemctl isolate multi-user.target run the nVidia install script reboot
wget https://developer.download.nvidia.com/compute/cuda/11.4.0/local_installers/cuda_11.4.0_470.42.01_linux.run sudo sh cuda_11.4.0_470.42.01_linux.run
sudo /usr/local/cuda-10.1/bin/cuda-uninstaller sudo /usr/local/cuda-X.Y/bin/cuda-uninstaller
sudo apt install nvidia-cuda-toolkit
sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"
Którą wersję SDK wybrać ? The Streaming Multiprocessor (SM) version of your GPU determines which CUDA toolkit still supports it. if your compute capability is 6.1 us sm_61 and compute_61 NVIDIA GPU Compute Capability
apt
sudo apt install cuda-toolkit sudo apt install nvidia-cuda-toolkit
wynik apt-get pakiet „cuda” nie jest częścią oficjalnego repozytorium Ubuntu
sudo apt-get -y install cuda Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:
The following packages have unmet dependencies: libcufile-11-4 : Depends: liburcu6 but it is not installable libnvidia-decode-470 : Depends: libnvidia-compute-470 (= 470.42.01-0ubuntu1) but 470.199.02-0ubuntu0.22.04.1 is to be installed nvidia-driver-470 : Depends: libnvidia-compute-470 (= 470.42.01-0ubuntu1) but 470.199.02-0ubuntu0.22.04.1 is to be installed Recommends: nvidia-prime (>= 0.8) but it is not going to be installed Recommends: libnvidia-compute-470:i386 (= 470.42.01-0ubuntu1) Recommends: libnvidia-decode-470:i386 (= 470.42.01-0ubuntu1) Recommends: libnvidia-encode-470:i386 (= 470.42.01-0ubuntu1) Recommends: libnvidia-ifr1-470:i386 (= 470.42.01-0ubuntu1) Recommends: libnvidia-fbc1-470:i386 (= 470.42.01-0ubuntu1) Recommends: libnvidia-gl-470:i386 (= 470.42.01-0ubuntu1)