Cudatoolkit 9.1.85 & GCC 6.3.0
Cudatoolkit dipende dai driver nvidia e i driver dipendono dalla scheda video che si possiede. nel mio caso ho una scheda GTX 570 e una GTX 1060. Nel momento in cui scrivo, l’ultimo driver a supportare la scheda video GTX 570 è il 390.87. L’ultima versione di cudatoolkit che supporta questo driver è il 9.1.85 (si veda qui per la matrice delle versioni). La versione GCC con cui compilare i progetti cudatoolkit è 6.2 (si veda qui per la matrice delle versioni).
Per compilarlo ho dovuto creare la versione gcc6 (non multilib anche se la mia linuxbox ha il multilib di alien) perchè cudatoolkit 9.1.85 non è compatibile con GCC 8 presente sulla current (se si cerca di compilare i “samples” si hanno molti errori).
Quindi ho recuperato gli slackbuilds per il GCC 6.3.0 da questo mirror slackware, ho applicato un certo numero di patch (ad esempio questa) per rendere la compilazione compatibile con la version GCC 8.x , ma soprattutto con la version glibc 2.28 della current, ho dovuto infine hackerare in maniera cattiva /usr/include/floatn.h come spiegato qui.
Per far usare a cuda il compilatore gcc-6 basta creare i link simbolici nella sua cartella bin
cd /usr/share/cuda/bin ln -sf /usr/bin/g++-6 g++ ln -sf /usr/bin/gcc-6 gcc
A questo punto se tutto funziona, compilati gli esempi, si può verificare le schede GPU
bash-4.4$ cd ~/tmp/samples bash-4.4$ make bash-4.4$ bin/x86_64/linux/release/deviceQuery bin/x86_64/linux/release/deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected 2 CUDA Capable device(s) Device 0: "GeForce GTX 1060 6GB" CUDA Driver Version / Runtime Version 9.1 / 9.1 CUDA Capability Major/Minor version number: 6.1 Total amount of global memory: 6078 MBytes (6373572608 bytes) (10) Multiprocessors, (128) CUDA Cores/MP: 1280 CUDA Cores GPU Max Clock rate: 1709 MHz (1.71 GHz) Memory Clock rate: 4004 Mhz Memory Bus Width: 192-bit L2 Cache Size: 1572864 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: No 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: Yes Supports MultiDevice Co-op Kernel Launch: Yes Device PCI Domain ID / Bus ID / location ID: 0 / 2 / 0 Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > Device 1: "GeForce GTX 570" CUDA Driver Version / Runtime Version 9.1 / 9.1 CUDA Capability Major/Minor version number: 2.0 Total amount of global memory: 1218 MBytes (1276968960 bytes) MapSMtoCores for SM 2.0 is undefined. Default to use 64 Cores/SM MapSMtoCores for SM 2.0 is undefined. Default to use 64 Cores/SM (15) Multiprocessors, ( 64) CUDA Cores/MP: 960 CUDA Cores GPU Max Clock rate: 1464 MHz (1.46 GHz) Memory Clock rate: 1900 Mhz Memory Bus Width: 320-bit L2 Cache Size: 655360 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 / 1 / 0 Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > > Peer access from GeForce GTX 1060 6GB (GPU0) -> GeForce GTX 570 (GPU1) : No > Peer access from GeForce GTX 570 (GPU1) -> GeForce GTX 1060 6GB (GPU0) : No deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.1, NumDevs = 2 Result = PASS
Gli script qui