$ docker run -it -v /home:/home --rm latelee/cuda:tar-9.0 bash root@98dfc8d4f016:/# ls bin cuda_9.0.176.2_linux.run cuda_9.0.176_384.81_linux.run home media proc sbin tmp boot cuda_9.0.176.3_linux.run dev lib mnt root srv usr cuda_9.0.176.1_linux.run cuda_9.0.176.4_linux.run etc lib64 opt run sys var
然后将.run文件拷贝到宿主机目录中。
安装
在安装前,先查看内核:
1 2
uname -a Linux localhost 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Do you accept the previously read EULA? accept/decline/quit: accept # 输入accept表示同意协议
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? (y)es/(n)o/(q)uit: n # 输入n不安装nvidia驱动,因为已经安装过了。
Install the CUDA 9.0 Toolkit? (y)es/(n)o/(q)uit: y # 输入y安装cuda工具包
Enter Toolkit Location [ default is /usr/local/cuda-9.0 ]: # 直接回车即可,使用默认目录
Do you want to install a symbolic link at /usr/local/cuda? (y)es/(n)o/(q)uit: y # 输入y,安装链接目录
Install the CUDA 9.0 Samples? (y)es/(n)o/(q)uit: y # 输入y安装示例
Enter CUDA Samples Location [ default is /home/latelee ]: # 使用默认目录,直接回车
Installing the CUDA Toolkit in /usr/local/cuda-9.0 ... Missing recommended library: libGLU.so Missing recommended library: libX11.so Missing recommended library: libXi.so Missing recommended library: libXmu.so
Installing the CUDA Samples in /home/latelee ... Copying samples to /home/latelee/NVIDIA_CUDA-9.0_Samples now... Finished copying samples.
=========== = Summary = ===========
Driver: Not Selected # 由于没选择驱动,会这样打印信息出来 Toolkit: Installed in /usr/local/cuda-9.0 Samples: Installed in /home/latelee, but missing recommended libraries
# 设置PATH和库目录 Please make sure that - PATH includes /usr/local/cuda-9.0/bin - LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.0/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.0 functionality to work. To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file: sudo <CudaInstaller>.run -silent -driver
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GTX 1070" CUDA Driver Version / Runtime Version 9.0 / 9.0 CUDA Capability Major/Minor version number: 6.1 Total amount of global memory: 8113 MBytes (8506769408 bytes) (15) Multiprocessors, (128) CUDA Cores/MP: 1920 CUDA Cores GPU Max Clock rate: 1709 MHz (1.71 GHz) Memory Clock rate: 4004 Mhz Memory Bus Width: 256-bit L2 Cache Size: 2097152 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 / 1 / 0 Compute Mode: < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.0, CUDA Runtime Version = 9.0, NumDevs = 1 Result = PASS