NVIDIA Jetson TK1学习与开发(六):如何安装CUDA

本文介绍如何安装CUDA,以CUDA6.0为例介绍。

1、Installing the CUDA Toolkit onto your device for native CUDA development

Download the .deb file for the CUDA Toolkit for L4T either using a web browser on the device, or download on your PC then copy the file to your device using a USB flash stick or across the network. (Make sure you download the Toolkit for L4T and not the Toolkit for Ubuntu since that is for cross-compilation instead of native compilation).

On the device, install the .deb file and the CUDA Toolkit. eg:

[cpp]  view plain  copy
 print ?
  1. cd ~/Downloads  
  2. # Install the CUDA repo metadata that you downloaded manually for L4T  
  3. sudo dpkg -i cuda-repo-l4t-r19.2_6.0-42_armhf.deb  
  4. # Download & install the actual CUDA Toolkit including the OpenGL toolkit from NVIDIA. (It only downloads around 15MB)  
  5. sudo apt-get update  
  6. # Install "cuda-toolkit-6-0" if you downloaded CUDA 6.0, or "cuda-toolkit-6-5" if you downloaded CUDA 6.5, etc.  
  7. sudo apt-get install cuda-toolkit-6-0  
  8. # Add yourself to the "video" group to allow access to the GPU  
  9. sudo usermod -a -G video $USER  
Add the 32-bit CUDA paths to your .bashrc login script, and start using it in your current console:

[cpp]  view plain  copy
 print ?
  1. echo "# Add CUDA bin & library paths:" >> ~/.bashrc  
  2. echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bashrc  
  3. echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH" >> ~/.bashrc  
  4. source ~/.bashrc  
Verify that the CUDA Toolkit is installed on your device:

[cpp]  view plain  copy
 print ?
  1. nvcc -V  

2、Installing & running the CUDA samples (optional)

If you think you will write your own CUDA code or you want to see what CUDA can do, then follow this section to build & run all of the CUDA samples.
Install writeable copies of the CUDA samples to your device's home directory (it will create a "NVIDIA_CUDA-6.0_Samples" folder):

[cpp]  view plain  copy
 print ?
  1. cuda-install-samples-6.0.sh /home/ubuntu  
Build the CUDA samples (takes around 15 minutes on Jetson TK1):

[cpp]  view plain  copy
 print ?
  1. cd ~/NVIDIA_CUDA-6.0_Samples  
  2. make  
Run some CUDA samples:

[cpp]  view plain  copy
 print ?
  1. 1_Utilities/deviceQuery/deviceQuery  
  2. 1_Utilities/bandwidthTest/bandwidthTest  
  3. cd 0_Simple/matrixMul  
  4. ./matrixMulCUBLAS  
  5. cd ../..  
  6. cd 0_Simple/simpleTexture  
  7. ./simpleTexture  
  8. cd ../..  
  9. cd 3_Imaging/convolutionSeparable  
  10. ./convolutionSeparable  
  11. cd ../..  
  12. cd 3_Imaging/convolutionTexture  
  13. ./convolutionTexture  
  14. cd ../..  

3、注意事项(some notes)

Note: Many of the CUDA samples use OpenGL GLX and open graphical windows. If you are running these programs through an SSH remote terminal, you can remotely display the windows on your desktop by typing "export DISPLAY=:0" and then executing the program. (This will only work if you are using a Linux/Unix machine or you run an X server such as the free "Xming" for Windows). eg:

[cpp]  view plain  copy
 print ?
  1. export DISPLAY=:0  
  2. cd ~/NVIDIA_CUDA-6.0_Samples/2_Graphics/simpleGL  
  3. ./simpleGL  
  4. cd ~/NVIDIA_CUDA-6.0_Samples/3_Imaging/bicubicTexture  
  5. ./bicubicTexture  
  6. cd ~/NVIDIA_CUDA-6.0_Samples/3_Imaging/bilateralFilter  
  7. ./bilateralFilter  
Note: the Optical Flow sample (HSOpticalFlow) and 3D stereo sample (stereoDisparity) take rougly 1 minute each to execute since they compare results with CPU code.
Some of the CUDA samples use other libraries such as OpenMP or MPI or OpenGL.
If you want to compile those samples then you'll need to install these toolkits like this:

[cpp]  view plain  copy
 print ?
  1. (to be added)  
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值