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:

cd ~/Downloads
# Install the CUDA repo metadata that you downloaded manually for L4T
sudo dpkg -i cuda-repo-l4t-r19.2_6.0-42_armhf.deb
# Download & install the actual CUDA Toolkit including the OpenGL toolkit from NVIDIA. (It only downloads around 15MB)
sudo apt-get update
# Install "cuda-toolkit-6-0" if you downloaded CUDA 6.0, or "cuda-toolkit-6-5" if you downloaded CUDA 6.5, etc.
sudo apt-get install cuda-toolkit-6-0
# Add yourself to the "video" group to allow access to the GPU
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:

echo "# Add CUDA bin & library paths:" >> ~/.bashrc
echo "export PATH=/usr/local/cuda/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc

Verify that the CUDA Toolkit is installed on your device:

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):

cuda-install-samples-6.0.sh /home/ubuntu

Build the CUDA samples (takes around 15 minutes on Jetson TK1):

cd ~/NVIDIA_CUDA-6.0_Samples
make

Run some CUDA samples:

1_Utilities/deviceQuery/deviceQuery
1_Utilities/bandwidthTest/bandwidthTest
cd 0_Simple/matrixMul
./matrixMulCUBLAS
cd ../..
cd 0_Simple/simpleTexture
./simpleTexture
cd ../..
cd 3_Imaging/convolutionSeparable
./convolutionSeparable
cd ../..
cd 3_Imaging/convolutionTexture
./convolutionTexture
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:

export DISPLAY=:0
cd ~/NVIDIA_CUDA-6.0_Samples/2_Graphics/simpleGL
./simpleGL
cd ~/NVIDIA_CUDA-6.0_Samples/3_Imaging/bicubicTexture
./bicubicTexture
cd ~/NVIDIA_CUDA-6.0_Samples/3_Imaging/bilateralFilter
./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:

(to be added)
时间: 2024-10-02 15:36:03

NVIDIA Jetson TK1学习与开发(六):如何安装CUDA的相关文章

NVIDIA Jetson TK1学习与开发(三):图文详解Jetson TK1平台搭建

图文详解Jetson TK1平台搭建 在<NVIDIA Jetson TK1学习与开发(一)>和<NVIDIA Jetson TK1学习与开发(二)>中已经对TK1的基本资源进行了简单介绍,并且推荐了一些很有用的网址供大家学习.本文将图文详解Jetson TK1平台的搭建. 1.开箱第一步 开箱后进入唯一的目录下, 会看到installer.sh,在当前路径执行以下命令: sudo ./installer (注意:此命令只能执行一次) 重启, sudo reboot 重启后进入开机

NVIDIA Jetson TK1学习与开发(一):NVIDIA Jetson TK1介绍

经同学推荐,向NVIDIA申请了一套NVIDIA Jetson TK1,首先感谢NVIDIA的慷慨,申请地址为:https://registration.nvidia.com/ahr.aspx.考虑到我的TK1将于本月底邮寄到我手中,为了好好利用该资源做研究,故提前熟悉下. 从今天开始,将记录个人学习开发TK1的点点滴滴,首先呢,就是对TK1做个简单介绍了. 下图是官网上的介绍: 下表是TEGRA K1 处理器规格参数:

NVIDIA Jetson TK1学习与开发(四):一些细节问题

本文把自己在学习或开发Jetson TK1过程中遇到的一些细节性的问题罗列出来,并提供解决方案. 首先就是wiki上提供的一些注意事项,网址:http://elinux.org/Jetson_TK1 1.An important step before connecting the Jetson to Internet It is really important to tell "apt" not to overwrite the file "libglx.so"

NVIDIA Jetson TK1学习与开发(八):图文详解OpenGL在Jetson TK1上的安装和使用

图文详解OpenGL在Jetson TK1上的安装和使用 1.入门介绍与资源推介 OpenGL(全写Open Graphics Library)是个定义了一个跨编程语言.跨平台的编程接口规格的专业的图形程序接口.它用于三维图像(二维的亦可),是一个功能强大,调用方便的底层图形库. OpenGL ES (OpenGL for Embedded Systems) 是 OpenGL 三维图形 API 的子集,针对手机.PDA和游戏主机等嵌入式设备而设计.该API由Khronos集团定义推广,Khron

NVIDIA Jetson TK1学习与开发(二):入门指导

  对于第一次使用TK1的童鞋们,可以仔细阅读以下网址提供的资料:http://elinux.org/Jetson_TK1 TK1开发板的一些资料下载网址:https://developer.nvidia.com/jetson-tk1 入门视频教学:http://www.iqiyi.com/a_19rrhc0aql.html 需要注意的是: 1.由于Jetson TK1只提供一个USB接口,因此若想连接鼠标.键盘.优盘等外设,可以自己购买一个USB扩展接口来使用. 2.Jetson TK1提供的

NVIDIA Jetson TK1学习与开发:如何解决输入和输出音频问题

若Jetson TK1的音频不能用,可以在终端输入以下命令,再次测试,就可以使用了.(注意:在Jetson TK1硬件上音频处,上面的是话筒,下面的是听筒). amixer cset name="Stereo ADC MIXL ADC2 Switch" 0 amixer cset name="Stereo ADC MIXR ADC2 Switch" 0 amixer cset name="Int Mic Switch" 0 amixer cset

NVIDIA Jetson TK1学习与开发(十):人脸检测(Face Detection)

本文介绍如何使用OpenCV检测人脸,并且给出示例,本平台仍然采用的是 Jetson TK1. 1.测试摄像头 为了能够从摄像头中实时检测出人脸,首先要做的就是判断你的摄像头是否可以工作,其基本方法如下: sudo apt-get install luvcview luvcview 如果摄像头可以正常工作,则出现如下界面: 2.安装OpenCV 参考网址:图文详解OpenCV在Jetson TK1上的安装和使用 3.新建工作文件夹并拷贝源码编译 mkdir ~/faceActivatedGPIO

NVIDIA Jetson TK1学习与开发(五):helloworld的C版本与C++版本

从本篇博文开始,将一一探索Jetson TK1的开发过程,那就从最简单的hello world开始吧. 本次将介绍hello world的两种写法. 1.C版本hello world 新建helloworld.c: 输入代码: 编译链接运行: 2.C++版本hello world 新建helloworld.cpp: 输入代码: 编译链接运行: 对,就是这么简单!大家都会的...

NVIDIA Jetson TK1学习与开发(九):基于GPU加速的OpenCV人体检测(Full Body Detection)

基于GPU加速的OpenCV人体检测(Full Body Detection) 1.CUDA和OpenCV的安装 首先,确定一下自己的平台是否安装好了CUDA和OpenCV. CUDA的安装可以参考:http://blog.csdn.net/frd2009041510/article/details/42042807和http://blog.csdn.net/frd2009041510/article/details/42925205 OpenCV的安装可以参考:http://blog.csdn