ubuntu14.04+cuda6.5+opencv2.4.9+cuda
第一次这么正式的写技术博客,一是锻炼下写总结的能力,二来也算是由于自己看技术贴多却从来没有贡献过自己的感到羞愧. 1.准备 一.首先,运行环境为ubuntu14.04 ,因此本文都假设大家已经装好了ubuntu14.04,另外,cuda时nvidia公司为自己的gpu设计的编程架构,因此
第一次这么正式的写技术博客,一是锻炼下写总结的能力,二来也算是由于自己看技术贴多却从来没有贡献过自己的感到羞愧.
1.准备
一.首先,运行环境为ubuntu14.04,因此本文都假设大家已经装好了ubuntu14.04,另外,cuda时nvidia公司为自己的gpu设计的编程架构,因此要使用cuda首先要保证自己的电脑具有nvidia的显卡特别时要有cuda支持的显卡.关于自己的显卡怎么看:
~$ lspci|grep VGA
我的显卡是NVIDIA GT540M系列得到的结果为:
01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 540M] (rev a1)
这一点看起来时小问题,我一个哥们当时就是没有注意到这个问题结果呼次呼吃装了半天发现压根装不了,最后才发现自己的电脑的显卡时AMD公司的
二.确定了了自己的电脑时NVIDIA的显卡就可以进行下面的工作了.
1.先到NVIDIA官网上下载最新版的cuda-6.5,由于现在新版的cuda已经将cuda-toolkit和cudaSDK整合到一起了,所以只需要下载一个就行了
下面是我下载时的下载链接:
http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.14_linux_64.run
2.然后当然还要下载nvidia的显卡驱动,不过我比较不清楚的是为何还要再装一遍驱动,而且装的时候时先要将原来的驱动先卸载,完全清除了再安装新的驱动,可能时我想多了,linux本身没有nvidia的显卡驱动,但为什么又要再卸载后再安装,反正很矛盾.
下面时nvidia_3.40的显卡驱动链接,我是再一篇帖子上看到cuda6.5好像能支持到的驱动就直到3.40,所以不要下太高的版本
http://cn.download.nvidia.com/XFree86/Linux-x86_64/340.24/NVIDIA-Linux-x86_64-340.24.run
准备工作做好了,需要先安装显卡驱动,然后再安装cuda:
2.安装显卡驱动,下面是我看到的比较简单的方法:
1.下载显卡驱动,这步已经再准备工作阶段做好了.
2.编辑blacklist.conf。
sudo gedit /etc/modprobe.d/blacklist.conf
添加以下部分并保存:
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
(这里有一行空格)
3. 删除之前所安装的nVidia驱动。
sudo apt-get remove --purge nvidia-*(需要清除干净)
sudo apt-get remove --purge xserver-xorg-video-nouveau
4. 重启电脑。
5. 按Ctrl + Alt +F1到第一控制台(+F7是回到xservers)。
6. 输入用户名和密码后,登录后执行(数字不能用小键盘输入):
sudo /etc/init.d/gdm stop或者
sudo /etc/init.d/lightdm stop
7. 进入驱动所在的文件夹,安装驱动(这里有个小技巧,只需要输入NVIDIA加tab键就行了,文件名可以全部补全,不要说我太low,以前我还真不知道,当然也可先把驱动名字改为简单的,自己能认识的)。
sudo sh NVIDIA-Linux-x86_64-340.24.run
报错the distribution-provided pre-install script failed!不必理会,继续安装;
8.启动GDM :
sudo /etc/init.d/gdm restart或者
sudo /etc/init.d/lightdm restart
9.重启电脑。
sudo reboot
10.可能在详细信息里面显卡选项显示未知,可用以下手法:
sudo apt-get install mesa-utils
本人在按照上面的方法安装的时候,sudo /etc/init.d/gdm stop或者sudo /etc/init.d/gdm restart都没有找到文件,可能时系统的问题吧,不必管,这里第6步和第8步使用sudo /etc/init.d/lightdm stop和sudo /etc/init.d/lightdm restart就行了.
3.安装cuda,这也是我看到的比较简单的安装方法
1.安装cuda-6.5
进入刚刚下载的cuda-6.5所在的文件夹执行
sh cuda_6.5.14_linux_64.run
然后就是耐心的等待安装的完成
2.配置环境变量
ubuntu的环境变量配置文件再 ~/home/用户名/.bashrc或者/etc/bash.bashr或者/etc/profile三个文件中,具体的区别好像就是全局啊,什么的,反正就是权限和作用范围不一样了,可能还有别的区别,因此只需要使用gedit打开编辑其中一个就行了,这里为了保险还是使用大家都用的的.
具体执行以下命令:
:~$ sudo gedit .bashrc
在文件末尾加上,:
$ export PATH=/usr/local/cuda-6.5/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH
我的系统是64位的所以是用的lib64,当然再下载,对了忘记说了,对于不同的系统再下载驱动时也要注意,不然白下了,
然后;
~$ source .bashrc
使得环境变量配置生效
3.编译sdk的sample
下面不是我的是别人的,我的也是这样的,但是不好截图,就没有贴了
完成后编译Sample文件, 整个过程大概10分钟左右
cd /usr/local/cuda-<span>6.5</span>/<span>samples </span><span>sudo</span> <span>make</span>
全部编译完成后, 进入 samples/bin/x86_64/linux/release, sudo下运行deviceQuery
<span>sudo</span> ./deviceQuery
如果出现下列显卡信息, 则驱动及显卡安装成功:
./<span>deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected </span><span>1</span><span> CUDA Capable device(s) Device </span><span>0</span>: <span>"</span><span>GeForce GTX 670</span><span>"</span><span> CUDA Driver Version </span>/ Runtime Version <span>6.5</span> / <span>6.5</span><span> CUDA Capability Major</span>/Minor version number: <span>3.0</span><span> Total amount of global memory: </span><span>4095</span> MBytes (<span>4294246400</span><span> bytes) ( </span><span>7</span>) Multiprocessors, (<span>192</span>) CUDA Cores/MP: <span>1344</span><span> CUDA Cores GPU Clock rate: </span><span>1098</span> MHz (<span>1.10</span><span> GHz) Memory Clock rate: </span><span>3105</span><span> Mhz Memory Bus Width: </span><span>256</span>-<span>bit L2 Cache Size: </span><span>524288</span><span> bytes Maximum Texture Dimension Size (x,y,z) 1D</span>=(<span>65536</span>), 2D=(<span>65536</span>, <span>65536</span>), 3D=(<span>4096</span>, <span>4096</span>, <span>4096</span><span>) Maximum Layered 1D Texture Size, (num) layers 1D</span>=(<span>16384</span>), <span>2048</span><span> layers Maximum Layered 2D Texture Size, (num) layers 2D</span>=(<span>16384</span>, <span>16384</span>), <span>2048</span><span> layers Total amount of constant memory: </span><span>65536</span><span> bytes Total amount of shared memory per block: </span><span>49152</span><span> bytes Total number of registers available per block: </span><span>65536</span><span> Warp size: </span><span>32</span><span> Maximum number of threads per multiprocessor: </span><span>2048</span><span> Maximum number of threads per block: </span><span>1024</span><span> Max dimension size of a thread block (x,y,z): (</span><span>1024</span>, <span>1024</span>, <span>64</span><span>) Max dimension size of a grid size (x,y,z): (</span><span>2147483647</span>, <span>65535</span>, <span>65535</span><span>) Maximum memory pitch: </span><span>2147483647</span><span> bytes Texture alignment: </span><span>512</span><span> bytes Concurrent copy and kernel execution: Yes with </span><span>1</span><span> copy engine(s) Run </span><span>time</span><span> limit on kernels: Yes Integrated GPU sharing Host Memory: No Support host page</span>-<span>locked memory mapping: Yes Alignment requirement </span><span>for</span><span> Surfaces: Yes Device has ECC support: Disabled Device supports Unified Addressing (UVA): Yes Device PCI Bus ID </span>/ PCI location ID: <span>1</span> / <span>0</span><span> Compute Mode: </span><span> deviceQuery, CUDA Driver </span>= CUDART, CUDA Driver Version = <span>6.5</span>, CUDA Runtime Version = <span>6.5</span>, NumDevs = <span>1</span>, Device0 = GeForce GTX <span>670</span><span> Result </span>= PASS
至此cuda6.5安装就完成了.
<span>有时间再把安装opencv和cuda-convnet2的配置的技术总结下!</span>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Full table scanning may be faster in MySQL than using indexes. Specific cases include: 1) the data volume is small; 2) when the query returns a large amount of data; 3) when the index column is not highly selective; 4) when the complex query. By analyzing query plans, optimizing indexes, avoiding over-index and regularly maintaining tables, you can make the best choices in practical applications.

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

Yes, MySQL can be installed on Windows 7, and although Microsoft has stopped supporting Windows 7, MySQL is still compatible with it. However, the following points should be noted during the installation process: Download the MySQL installer for Windows. Select the appropriate version of MySQL (community or enterprise). Select the appropriate installation directory and character set during the installation process. Set the root user password and keep it properly. Connect to the database for testing. Note the compatibility and security issues on Windows 7, and it is recommended to upgrade to a supported operating system.

The difference between clustered index and non-clustered index is: 1. Clustered index stores data rows in the index structure, which is suitable for querying by primary key and range. 2. The non-clustered index stores index key values and pointers to data rows, and is suitable for non-primary key column queries.

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

In MySQL database, the relationship between the user and the database is defined by permissions and tables. The user has a username and password to access the database. Permissions are granted through the GRANT command, while the table is created by the CREATE TABLE command. To establish a relationship between a user and a database, you need to create a database, create a user, and then grant permissions.

MySQL and MariaDB can coexist, but need to be configured with caution. The key is to allocate different port numbers and data directories to each database, and adjust parameters such as memory allocation and cache size. Connection pooling, application configuration, and version differences also need to be considered and need to be carefully tested and planned to avoid pitfalls. Running two databases simultaneously can cause performance problems in situations where resources are limited.

MySQL supports four index types: B-Tree, Hash, Full-text, and Spatial. 1.B-Tree index is suitable for equal value search, range query and sorting. 2. Hash index is suitable for equal value searches, but does not support range query and sorting. 3. Full-text index is used for full-text search and is suitable for processing large amounts of text data. 4. Spatial index is used for geospatial data query and is suitable for GIS applications.
