加入收藏 | 设为首页 | 会员中心 | 我要投稿 核心网 (https://www.hxwgxz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 移动互联 > 正文

基于ZStack构建深度学习云平台

发布时间:2019-02-14 22:35:12 所属栏目:移动互联 来源:朱天顺
导读:前言 深度学习是机器学习和人工智能研究的热门分支,也是当今最流行的科学研究趋势之一。深度学习方法为计算机视觉、机器学习带来了革命性的进步,而新的深度学习技术也正在不断诞生。由于深度学习正快速发展,新的研究者很难对这一技术实时跟进。国内各大

3.1 运行环境准备

  1. 安装pip 
  2.  
  3. # curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py 
  4.  
  5. # python get-pip.py 
  6.  
  7. # pip --version 
  8.  
  9. pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) 
  10.  
  11. # python --version 
  12.  
  13. Python 2.7.5 
  14.  
  15. 安装GCC G++ 
  16.  
  17. # yum install gcc gcc-c++ 
  18.  
  19. # gcc --version 
  20.  
  21. gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36) 
  22.  
  23. 安装一些需要的包 
  24.  
  25. #yum -y install zlib* 
  26.  
  27. #yum install openssl-devel -y 
  28.  
  29. #yum install sqlite* -y 
  30.  
  31. 升级CentOS默认Python2.7.5版本到3.6.5 
  32.  
  33. 下载Python源码包 
  34.  
  35. # wget -c https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz 
  36.  
  37. 解压源码包 
  38.  
  39. # tar -zvxf Python-3.6.5.tgz 
  40.  
  41. 进入源码目录 
  42.  
  43. # cd Python-3.6.5/ 
  44.  
  45. # ./configure --with-ssl 
  46.  
  47. 编译并安装 
  48.  
  49. # make && make install 
  50.  
  51. 查看一下新安装的python3的文件位置 
  52.  
  53. # ll /usr/local/bin/python* 

基于ZStack构建深度学习云平台

基于ZStack构建深度学习云平台

3.2 安装CUDA

  1. 升级内核:  
  2.   
  3. # rpm -import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org  
  4.   
  5. # rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm  
  6.   
  7. # yum -y --enablerepo=elrepo-kernel install kernel-ml.x86_64 kernel-ml-devel.x86_64  
  8.   
  9. 查看内核版本默认启动顺序:  
  10.   
  11. awk -F' '$1=="menuentry " {print $2}' /etc/grub2.cfg  
  12.   
  13. CentOS Linux (4.20.0-1.el7.elrepo.x86_64) 7 (Core)  
  14.   
  15. CentOS Linux (3.10.0-862.el7.x86_64) 7 (Core)  
  16.   
  17. CentOS Linux (0-rescue-c4581dac5b734c11a1881c8eb10d6b09) 7 (Core)  
  18.   
  19. #vim /etc/default/grub  
  20.   
  21. GRUB_DEFAULT=saved 改为GRUB_0=saved  
  22.   
  23. 运行grub2-mkconfig命令来重新创建内核配置  
  24.   
  25. # grub2-mkconfig -o /boot/grub2/grub.cfg  
  26.   
  27. #reboot  
  28.   
  29. # uname -r 重启后验证一下内核版本  
  30.   
  31. 4.20.0-1.el7.elrepo.x86_64  
  32.   
  33. CUDA Toolkit安装有两种方式:  
  34.   
  35. Package安装 (RPM and Deb packages)  
  36. Runfile安装  
  37. 这里选择使用Runfile模式进行安装  
  38.   
  39. 安装包下载:https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux  
  40.  
  41. 根据自身操作系统进行安装包筛选,并下载。复制下载链接直接用wget -c命令进行下载  
  42.   
  43. # wget -c https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_410.48_linux  
  44.   
  45. #chmod +x cuda_10.0.130_410.48_linux  
  46.   
  47. #./cuda_10.0.130_410.48_linux  
  48.   
  49. Do you accept the previously read EULA?  
  50.   
  51. accept/decline/quit: accept  
  52.   
  53. Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?  
  54.   
  55. (y)es/(n)o/(q)uit: y  
  56.   
  57. Install the CUDA 10.0 Toolkit?  
  58.   
  59. (y)es/(n)o/(q)uit: y  
  60.   
  61. Enter Toolkit Location  
  62.   
  63. [ default is /usr/local/cuda-10.0 ]:  
  64.   
  65. Do you want to install a symbolic link at /usr/local/cuda?  
  66.   
  67. (y)es/(n)o/(q)uit: y  
  68.   
  69. Install the CUDA 10.0 Samples?  
  70.   
  71. (y)es/(n)o/(q)uit: y  
  72.   
  73. Enter CUDA Samples Location  
  74.   
  75. [ default is /root ]:  
  76.   
  77. 配置CUDA运行环境变量:  
  78.   
  79. # vim /etc/profile  
  80.   
  81. # CUDA  
  82.   
  83. export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}  
  84.   
  85. export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}  
  86.   
  87. # source /etc/profile  
  88.   
  89. 检查版本  
  90.   
  91. # nvcc --version  
  92.   
  93. nvcc: NVIDIA (R) Cuda compiler driver  
  94.   
  95. Copyright (c) 2005-2018 NVIDIA Corporation  
  96.   
  97. Built on Sat_Aug_25_21:08:01_CDT_2018  
  98.   
  99. Cuda compilation tools, release 10.0, V10.0.130  
  100.   
  101. 使用实例验证测试CUDA是否正常:  
  102.   
  103. #cd /root/NVIDIA_CUDA-10.0_Samples/1_Utilities/deviceQuery  
  104.   
  105. # make  
  106.   
  107. "/usr/local/cuda-10.0"/bin/nvcc -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o deviceQuery.o -c deviceQuery.cpp  
  108.   
  109. "/usr/local/cuda-10.0"/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o deviceQuery deviceQuery.o  
  110.   
  111. mkdir -p ../../bin/x86_64/linux/release  
  112.   
  113. cp deviceQuery ../../bin/x86_64/linux/release  
  114.   
  115. # cd ../../bin/x86_64/linux/release/  
  116.   
  117. # ./deviceQuery  
  118.   
  119. #./deviceQuery Starting...  
  120.   
  121. CUDA Device Query (Runtime API) version (CUDART static linking)  
  122.   
  123. Detected 1 CUDA Capable device(s)  
  124.   
  125. Device 0: "Quadro P2000"  
  126.   
  127. CUDA Driver Version / Runtime Version 10.0 / 10.0  
  128.   
  129. CUDA Capability Major/Minor version number: 6.1  
  130.   
  131. Total amount of global memory: 5059 MBytes (5304745984 bytes)  
  132.   
  133. ( 8) Multiprocessors, (128) CUDA Cores/MP: 1024 CUDA Cores  
  134.   
  135. GPU Max Clock rate: 1481 MHz (1.48 GHz)  
  136.   
  137. Memory Clock rate: 3504 Mhz  
  138.   
  139. Memory Bus Width: 160-bit  
  140.   
  141. L2 Cache Size: 1310720 bytes  
  142.   
  143. Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)  
  144.   
  145. Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers  
  146.   
  147. Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers  
  148.   
  149. Total amount of constant memory: 65536 bytes  
  150.   
  151. Total amount of shared memory per block: 49152 bytes  
  152.   
  153. Total number of registers available per block: 65536  
  154.   
  155. Warp size: 32  
  156.   
  157. Maximum number of threads per multiprocessor: 2048  
  158.   
  159. Maximum number of threads per block: 1024  
  160.   
  161. Max dimension size of a thread block (x,y,z): (1024, 1024, 64)  
  162.   
  163. Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)  
  164.   
  165. Maximum memory pitch: 2147483647 bytes  
  166.   
  167. Texture alignment: 512 bytes  
  168.   
  169. Concurrent copy and kernel execution: Yes with 2 copy engine(s)  
  170.   
  171. Run time limit on kernels: No  
  172.   
  173. Integrated GPU sharing Host Memory: No  
  174.   
  175. Support host page-locked memory mapping: Yes  
  176.   
  177. Alignment requirement for Surfaces: Yes  
  178.   
  179. Device has ECC support: Disabled  
  180.   
  181. Device supports Unified Addressing (UVA): Yes  
  182.   
  183. Device supports Compute Preemption: Yes  
  184.   
  185. Supports Cooperative Kernel Launch: Yes  
  186.   
  187. Supports MultiDevice Co-op Kernel Launch: Yes  
  188.   
  189. Device PCI Domain ID / Bus ID / location ID: 0 / 0 / 11  
  190.   
  191. Compute Mode:  
  192.   
  193. < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >  
  194.   
  195. deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.0, CUDA Runtime Version = 10.0, NumDevs = 1  
  196.   
  197. Result = PASS  
  198.   
  199. Result = PASS且测试过程中无报错,表示测试通过!  

3.3安装 cuDNN

(编辑:核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读