成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

基于ZStack構建深度學習云平臺

云計算
本文將介紹基于產品化云平臺——ZStack,來構建對初學者友好、易運維、易使用的深度學習云平臺。

 前言

深度學習是機器學習和人工智能研究的熱門分支,也是當今最流行的科學研究趨勢之一。深度學習方法為計算機視覺、機器學習帶來了革命性的進步,而新的深度學習技術也正在不斷誕生。由于深度學習正快速發展,新的研究者很難對這一技術實時跟進。國內各大公有云廠商都提供了相應的深度學習相關產品,但對于初學者并不那么實用。本文將介紹基于產品化云平臺——ZStack,來構建對初學者友好、易運維、易使用的深度學習云平臺。

由于ZStack的輕量性,我們僅通過一臺普通PC機就能部署云平臺,進而實現深度學習平臺構建。讀者可結合本文輕松擴展出規模更大、功能更為完備的深度學習云平臺。

1 、ZStack簡介

ZStack是下一代開源的云計算IaaS(基礎架構即服務)軟件。它主要面向未來的智能數據中心,通過提靈活完善的APIs來管理包括計算、存儲和網絡在內的數據中心資源。用戶可以利用ZStack快速構建自己的智能云數據中心,也可以在穩定的ZStack之上搭建靈活的云應用場景。

ZStack功能架構

ZStack產品優勢:

ZStack是基于專有云平臺4S(Simple簡單,Strong健壯,Scalable彈性,Smart智能)標準設計的下一代云平臺IaaS軟件。

1. 簡單(Simple)

• 簡單安裝部署:提供安裝文件網絡下載,30分鐘完成從裸機到云平臺的安裝部署。

• 簡單搭建云平臺:支持云主機的批量(生成,刪除等)操作,提供列表展示和滑窗詳情。

• 簡單實用操作:詳細的用戶手冊,足量的幫助信息,良好的社區,標準的API提供。

• 友好UI交互:設計精良的專業操作界面,精簡操作實現強大的功能。

2. 健壯(Strong)

• 穩定且高效的系統架構設計:擁有全異步的后臺架構,進程內微服務架構,無鎖架構,無狀態服務架構,一致性哈希環,保證系統架構的高效穩定。目前已實現:單管理節點管理上萬臺物理主機、數十萬臺云主機;而多個管理節點構建的集群使用一個數據庫、一套消息總線可管理十萬臺物理主機、數百萬臺云主機、并發處理數萬個API。

• 支撐高并發的API請求:單ZStack管理節點可以輕松處理每秒上萬個并發API調用請求。

• 支持HA的嚴格要求:在網絡或節點失效情況下,業務云主機可自動切換到其它健康節點運行;利用管理節點虛擬化實現了單管理節點的高可用,故障時支持管理節點動態遷移。

3. 彈性(Scalable)

• 支撐規模無限制:單管理節點可管理從一臺到上萬臺物理主機,數十萬臺云主機。

• 全API交付:ZStack提供了全套IaaS API,用戶可使用這些APIs完成全新跨地域的可用區域搭建、

網絡配置變更、以及物理服務器的升級。

• 資源可按需調配:云主機和云存儲等重要資源可根據用戶需求進行擴縮容。ZStack不僅支持對云主

機的CPU、內存等資源進行在線更改,還可對云主機的網絡帶寬、磁盤帶寬等資源進行動態調整。

4. 智能(Smart)

• 自動化運維管理:在ZStack環境里,一切由APIs來管理。ZStack利用Ansible庫實現全自動部署和

升級,自動探測和重連,在網絡抖動或物理主機重啟后能自動回連各節點。其中定時任務支持定時

開關云主機以及定時對云主機快照等輪詢操作。

• 在線無縫升級:5分鐘一鍵無縫升級,用戶只需升級管控節點。計算節點、存儲節點、網絡節點在

管控軟件啟動后自動升級。

• 智能化的UI交互界面:實時的資源計算,避免用戶誤操作。

• 實時的全局監控:實時掌握整個云平臺當前系統資源的消耗情況,通過實時監控,智能化調配,從

而節省IT的軟硬件資源。

0x2 構建深度學習平臺

2.1 組件部署介紹

  • TensorFlow

是一個開放源代碼軟件庫,用于進行高性能數值計算。借助其靈活的架構,用戶可以輕松地將計算工作部署到多種平臺(CPU、GPU、TPU)和設備(桌面設備、服務器集群、移動設備、邊緣設備等)。TensorFlow最初是由 Google Brain 團隊中的研究人員和工程師開發的,可為機器學習和深度學習提供強力支持,并且其靈活的數值計算核心廣泛應用于許多其他科學領域。

  • cuDNN

NVIDIA CUDA深層神經網絡庫(cuDNN)是一種用于深層神經網絡的GPU加速庫原始圖形。cuDNN為標準例程提供了高度調優的實現,如前向和后向卷積、池化、歸一化和激活層。cuDNN是NVIDIA深度學習SDK的一部分。

  • TensorBoard

是一個可視化工具,能夠有效地展示Tensorflow在運行過程中的計算圖、各種指標隨著時間的變化趨勢以及訓練中使用到的數據信息。

  • Jupyter

Jupyter是一個交互式的筆記本,可以很方便地創建和共享文學化程序文檔,支持實時代碼,數學方程,可視化和 markdown。一般用與做數據清理和轉換,數值模擬,統計建模,機器學習等等。

2.2 云平臺環境準備

環境介紹

本次使用如下配置構建深度學習平臺:

物理服務器配置  GPU型號 云主機配置 云主機系統 IP地址 主機名
Intel(R) i5-3470 DDR3 24G

NVIDIA QuadroP2000

8vCPU16G CentOS7.4 192.168.66.6 GPU-TF
 

本次使用一臺普通PC機部署ZStack云平臺,使用云平臺中GPU透傳功能將一塊NVIDIA QuadroP2000顯卡透傳給一個CentOS7.4虛擬機,進行平臺的構建。

ZStack云平臺部署步驟詳情參考官方文檔:https://www.zstack.io/help/product_manuals/user_guide/3.html#c3

2.2.1 創建云主機

選擇“云資源池”點擊“云主機”點擊“創建云主機按鈕”打開云主機創建頁面;

創建云主機的步驟:

1、選擇添加方式; 平臺支持創建單個云主機和創建多個云主機,根據需求進行選擇。

2、設置云主機名稱;在設置名稱時建議以業務系統名稱進行命名,方便管理運維。

3、選擇計算規格;根據定義的計算規格結合業務需求選擇適合的計算規格。

4、選擇鏡像模板;根據業務需求選擇相應的鏡像模板。

5、選擇三層網絡;在新版本中平臺三層網絡同時支持IPv4和IPv6,請根據自身業務需求進行選擇;同時也可以在創建云主機過程中設置網卡屬性。

6、確認配置無誤后點擊“確定”開始創建。

2.2.2 透傳GPU操作

點擊云主機名稱點擊配置信息;

找到GPU設備標簽,點擊操作選擇加載,然后選擇相應的GPU設備給云主機直接使用。

0x3 開始部署

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* 

 

  1. 設置python默認版本號為3.x  
  2.   
  3. # mv /usr/bin/python /usr/bin/python.bak   
  4. # ln -s /usr/local/bin/python3 /usr/bin/python  
  5.   
  6. 查看一下2.x版本的文件位置  
  7.   
  8. # ll /usr/bin/python*  

  1. 為使yum命令正常使用,需要將其配置的python依然指向2.x版本 
  2.  
  3. # vim /usr/bin/yum 
  4.  
  5. #vim /usr/libexec/urlgrabber-ext-down 
  6.  
  7. 將上面兩個文件的頭部文件修改為老版本即可  
  8. !/usr/bin/python --> !/usr/bin/python2.7 
  9.  
  10. 安裝python-dev、python-pip 
  11.  
  12. # yum install python-dev python-pip -y 
  13.  
  14. 禁用自帶Nouveau驅動 
  15.  
  16. Nouveau使用 
  17.  
  18. # lsmod | grep nouveau 
  19.  
  20. nouveau 1662531 0 
  21.  
  22. mxm_wmi 13021 1 nouveau 
  23.  
  24. wmi 19086 2 mxm_wmi,nouveau 
  25.  
  26. video 24538 1 nouveau 
  27.  
  28. i2c_algo_bit 13413 1 nouveau 
  29.  
  30. drm_kms_helper 176920 2 qxl,nouveau 
  31.  
  32. ttm 99555 2 qxl,nouveau 
  33.  
  34. drm 397988 5 qxl,ttm,drm_kms_helper,nouveau 
  35.  
  36. i2c_core 63151 5 drm,i2c_piix4,drm_kms_helper,i2c_algo_bit,nouveau 
  37.  
  38. #vim /usr/lib/modprobe.d/dist-blacklist.conf 
  39.  
  40. # nouveau 
  41.  
  42. blacklist nouveau 
  43.  
  44. options nouveau modeset=0 
  45.  
  46. :wq 保存退出 
  47.  
  48. # mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak 備份引導鏡像 
  49.  
  50. # dracut /boot/initramfs-$(uname -r).img $(uname -r) 重建引導鏡像 
  51.  
  52. # reboot 
  53.  
  54. #lsmod | grep nouveau 再次驗證禁用是否生效 

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

cuDNN的全稱為NVIDIA CUDA® Deep Neural Network library,是NVIDIA專門針對深度神經網絡(Deep Neural Networks)中的基礎操作而設計基于GPU的加速庫。cuDNN為深度神經網絡中的標準流程提供了高度優化的實現方式。

  1. 下載安裝包:https://developer.nvidia.com/rdp/cudnn-download   
  2.    
  3. 注:下載前需先注冊 NVIDIA Developer Program,然后才能下載。   

 

  1. 可以根據自身的環境選擇相應版本進行下載,這個有身份驗證只能瀏覽器下載然后再上傳到云主機中。  
  2.   
  3. 安裝:  
  4.   
  5. #rpm -ivh libcudnn7-7.4.2.24-1.cuda10.0.x86_64.rpm libcudnn7-devel-7.4.2.24-1.cuda10.0.x86_64.rpm libcudnn7-doc-7.4.2.24-1.cuda10.0.x86_64.rpm  
  6.   
  7. 準備中... ################################# [100%]  
  8.   
  9. 正在升級/安裝...  
  10.   
  11. 1:libcudnn7-7.4.2.24-1.cuda10.0 ################################# [ 33%]  
  12.   
  13. 2:libcudnn7-devel-7.4.2.24-1.cuda10################################# [ 67%]  
  14.   
  15. 3:libcudnn7-doc-7.4.2.24-1.cuda10.0################################# [100%]  
  16.   
  17. 驗證cuDNN:  
  18.   
  19. # cp -r /usr/src/cudnn_samples_v7/ $HOME  
  20.   
  21. # cd $HOME/cudnn_samples_v7/mnistCUDNN  
  22.   
  23. # make clean && make  
  24.   
  25. rm -rf *o  
  26.   
  27. rm -rf mnistCUDNN  
  28.   
  29. /usr/local/cuda/bin/nvcc -ccbin g++ -I/usr/local/cuda/include -IFreeImage/include -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o fp16_dev.o -c fp16_dev.cu  
  30.   
  31. g++ -I/usr/local/cuda/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp  
  32.   
  33. g++ -I/usr/local/cuda/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp  
  34.   
  35. /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_53,code=compute_53 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -IFreeImage/include -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm  
  36.   
  37. # ./mnistCUDNN  
  38.   
  39. cudnnGetVersion() : 7402 , CUDNN_VERSION from cudnn.h : 7402 (7.4.2)  
  40.   
  41. Host compiler version : GCC 4.8.5  
  42.   
  43. There are 1 CUDA capable devices on your machine :  
  44.   
  45. device 0 : sms 8 Capabilities 6.1, SmClock 1480.5 Mhz, MemSize (Mb) 5059, MemClock 3504.0 Mhz, Ecc=0, boardGroupID=0  
  46.   
  47. Using device 0  
  48.   
  49. Testing single precision  
  50.   
  51. Loading image data/one_28x28.pgm  
  52.   
  53. Performing forward propagation ...  
  54.   
  55. Testing cudnnGetConvolutionForwardAlgorithm ...  
  56.   
  57. Fastest algorithm is Algo 1  
  58.   
  59. Testing cudnnFindConvolutionForwardAlgorithm ...  
  60.   
  61. ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.036864 time requiring 0 memory  
  62.   
  63. ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.044032 time requiring 3464 memory  
  64.   
  65. ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.053248 time requiring 57600 memory  
  66.   
  67. ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.116544 time requiring 207360 memory  
  68.   
  69. ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.181248 time requiring 2057744 memory  
  70.   
  71. Resulting weights from Softmax:  
  72.   
  73. 0.0000000 0.9999399 0.0000000 0.0000000 0.0000561 0.0000000 0.0000012 0.0000017 0.0000010 0.0000000  
  74.   
  75. Loading image data/three_28x28.pgm  
  76.   
  77. Performing forward propagation ...  
  78.   
  79. Resulting weights from Softmax:  
  80.   
  81. 0.0000000 0.0000000 0.0000000 0.9999288 0.0000000 0.0000711 0.0000000 0.0000000 0.0000000 0.0000000  
  82.   
  83. Loading image data/five_28x28.pgm  
  84.   
  85. Performing forward propagation ...  
  86.   
  87. Resulting weights from Softmax:  
  88.   
  89. 0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 0.9999820 0.0000154 0.0000000 0.0000012 0.0000006  
  90.   
  91. Result of classification: 1 3 5  
  92.   
  93. Test passed!  
  94.   
  95. Testing half precision (math in single precision)  
  96.   
  97. Loading image data/one_28x28.pgm  
  98.   
  99. Performing forward propagation ...  
  100.   
  101. Testing cudnnGetConvolutionForwardAlgorithm ...  
  102.   
  103. Fastest algorithm is Algo 1  
  104.   
  105. Testing cudnnFindConvolutionForwardAlgorithm ...  
  106.   
  107. ^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.032896 time requiring 0 memory  
  108.   
  109. ^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.036448 time requiring 3464 memory  
  110.   
  111. ^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.044000 time requiring 28800 memory  
  112.   
  113. ^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.115488 time requiring 207360 memory  
  114.   
  115. ^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.180224 time requiring 2057744 memory  
  116.   
  117. Resulting weights from Softmax:  
  118.   
  119. 0.0000001 1.0000000 0.0000001 0.0000000 0.0000563 0.0000001 0.0000012 0.0000017 0.0000010 0.0000001  
  120.   
  121. Loading image data/three_28x28.pgm  
  122.   
  123. Performing forward propagation ...  
  124.   
  125. Resulting weights from Softmax:  
  126.   
  127. 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000714 0.0000000 0.0000000 0.0000000 0.0000000  
  128.   
  129. Loading image data/five_28x28.pgm  
  130.   
  131. Performing forward propagation ...  
  132.   
  133. Resulting weights from Softmax:  
  134.   
  135. 0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 1.0000000 0.0000154 0.0000000 0.0000012 0.0000006  
  136.   
  137. Result of classification: 1 3 5  
  138.   
  139. Test passed!  
  140.   
  141. Test passed!且測試過程中無報錯,表示測試通過!  

3.4安裝 TensorFlow

  1. # pip3 install --upgrade setuptools==30.1.0 
  2.  
  3. # pip3 install tf-nightly-gpu 
  4.  
  5. 驗證測試: 
  6.  
  7. 在 Python 交互式 shell 中輸入以下幾行簡短的程序代碼: 
  8.  
  9. # python  
  10. import tensorflow as tf  
  11. hello = tf.constant('Hello, TensorFlow!')  
  12. sess = tf.Session()  
  13. print(sess.run(hello)) 
  14.  
  15. 如果系統輸出以下內容,就說明您可以開始編寫 TensorFlow 程序了: 
  16.  
  17. Hello, TensorFlow! 
  18.  
  19. 同時使用nvidia-smi命令可以看到當前顯卡的處理任務。 

3.5 安裝TensorBoard 可視化工具

可以用 TensorBoard 來展現 TensorFlow 圖,繪制圖像生成的定量指標圖以及顯示附加數據(如其中傳遞的圖像)。通過 pip 安裝 TensorFlow 時,也會自動安裝 TensorBoard:

  1. 驗證版本: 
  2.  
  3. # pip3 show tensorboard 
  4.  
  5. Name: tensorboard 
  6.  
  7. Version: 1.12.2 
  8.  
  9. Summary: TensorBoard lets you watch Tensors Flow 
  10.  
  11. Home-page: https://github.com/tensorflow/tensorboard 
  12.  
  13. Author: Google Inc. 
  14.  
  15. Author-email: opensource@google.com 
  16.  
  17. License: Apache 2.0 
  18.  
  19. Location: /usr/lib/python2.7/site-packages 
  20.  
  21. Requires: protobuf, numpy, futures, grpcio, wheel, markdown, werkzeug, six 
  22.  
  23. Required-by
  24.  
  25. 啟動服務: 
  26.  
  27. # tensorboard --logdir /var/log/tensorboard.log 
  28.  
  29. TensorBoard 1.13.0a20190107 at http://GPU-TF:6006 (Press CTRL+C to quit) 
  30.  
  31. 根據提示在瀏覽器上輸入http://服務器IP:6006 

 

3.6 安裝Jupyter

Jupyter是一個交互式的筆記本,可以很方便地創建和共享文學化程序文檔,支持實時代碼,數學方程,可視化和 markdown。一般用與做數據清理和轉換,數值模擬,統計建模,機器學習等等。

  1. 安裝: 
  2.  
  3. # sudo pip3 install jupyter 
  4.  
  5. 生成配置文件: 
  6.  
  7. # jupyter notebook --generate-config 
  8.  
  9. Writing default config to: /root/.jupyter/jupyter_notebook_config.py 
  10.  
  11. 生成Jupyter密碼: 
  12.  
  13. # python 
  14.  
  15. Python 3.6.5 (default, Jan 15 2019, 02:51:51) 
  16.  
  17. [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux 
  18.  
  19. Type "help""copyright""credits" or "license" for more information. 
  20.  
  21. >>> from notebook.auth import passwd; 
  22.  
  23. >>> passwd() 
  24.  
  25. Enter password
  26.  
  27. Verify password
  28.  
  29. 'sha1:6067bcf7350b:8407670bb3f94487c9404ed3c20c1ebf7ddee32e' 
  30.  
  31. >>> 
  32.  
  33. 將生成的hash串寫入Jupyter配置文件: 
  34.  
  35. # vim /root/.jupyter/jupyter_notebook_config.py 

  1. 啟動服務 
  2.  
  3. # jupyter notebook --allow-root --ip='192.168.66.11' 
  4.  
  5. 瀏覽器登陸 

  1. 輸入密碼后登陸:即可正常訪問 
  2.  
  3. 執行測試任務: 
  4.  
  5. 運行TensorFlow Demo示例 
  6.  
  7. Jupyter中新建 HelloWorld 示例,代碼如下: 
  8.  
  9. import tensorflow as tf 
  10.  
  11. # Simple hello world using TensorFlow 
  12.  
  13. Create a Constant op 
  14.  
  15. # The op is added as a node to the default graph. 
  16.  
  17.  
  18. # The value returned by the constructor represents the output 
  19.  
  20. of the Constant op. 
  21.  
  22. hello = tf.constant('Hello, TensorFlow!'
  23.  
  24. # Start tf session 
  25.  
  26. sess = tf.Session() 
  27.  
  28. # Run the op 
  29.  
  30. print(sess.run(hello)) 

 

0x4總結

通過使用ZStack云平臺可以快速構建深度學習平臺,云平臺自身無需太多的復雜配置,在安裝各種驅動及深度學習組件時也與物理機無異。安裝好驅動后進行性能測試發現與同配置物理邏輯性能相當,GPU部分沒有任何性能損失。

當上述軟件環境都準備完成以后,可配置多塊GPU并從模板創建多個云主機一一透傳,結合ZStack本身的多租戶屬性,可使得多人在同一套環境中互不影響進行開發或者運行應用程序,從而成為一個真正的深度學習“云”平臺。

 

責任編輯:張燕妮 來源: ZStack
相關推薦

2019-03-07 16:26:42

FortiGateZStack云平臺

2016-04-08 10:47:27

中國軟件資訊網

2018-05-29 15:34:31

2018-07-16 22:13:54

CPU容器

2018-07-16 22:40:21

CPU容器

2017-09-08 10:16:44

混合云網絡互聯互通

2010-03-24 10:15:52

SCS云計算

2018-12-18 16:16:12

私有云

2012-09-11 14:04:35

私有云公有云IaaS

2010-11-11 17:44:18

云計算IBM

2019-04-17 10:30:05

混合云邊緣ZStack

2021-02-24 09:15:48

kubernetes混合云云端

2018-08-15 15:20:14

阿里云

2013-09-02 15:35:57

云計算

2023-05-22 08:00:00

深度學習機器學習人工智能

2018-08-29 14:00:45

云測評

2015-01-21 10:45:57

災難恢復云應用云災難恢復

2019-04-04 10:39:23

云平臺云架構云計算

2017-09-18 17:00:04

云深度學習機器學習云服務
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 亚洲视频在线观看 | 久久久国产一区二区三区 | 亚洲久久久 | 国产精品一级在线观看 | 99视频在线免费观看 | 亚洲一区二区三区在线播放 | 亚洲精品一区二区三区丝袜 | 男女羞羞免费网站 | 亚洲成人精品 | 亚洲免费视频在线观看 | 丝袜 亚洲 另类 欧美 综合 | 精产嫩模国品一二三区 | 91社区在线观看播放 | caoporn免费 | 精品网站999 | 国产99小视频 | 欧美日韩国产在线观看 | 自拍偷拍在线视频 | 一区二区亚洲 | 韩国av一区二区 | 日韩欧美天堂 | 99re6在线视频精品免费 | 国产高清在线观看 | 亚洲aⅴ精品 | 欧美一区二区三区在线 | 精品一区二区电影 | 欧美一区二区三区在线 | 国产精品欧美一区二区三区不卡 | 日韩成人在线观看 | 日韩欧美在线一区 | 欧美国产日韩一区二区三区 | 中文字幕在线播放第一页 | 不卡的av在线 | 久久精品一区二区三区四区 | 999精品在线观看 | 天天拍天天插 | 亚洲综合99| 波多野结衣一区二区 | 成人在线观看亚洲 | 一级黄色毛片子 | 免费一区二区在线观看 |