第一次这么正式的写技术博客,一是锻炼下写总结的能力,二来也算是由于自己看技术贴多却从来没有贡献过自己的感到羞愧. 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>

MySQL uses a GPL license. 1) The GPL license allows the free use, modification and distribution of MySQL, but the modified distribution must comply with GPL. 2) Commercial licenses can avoid public modifications and are suitable for commercial applications that require confidentiality.

The situations when choosing InnoDB instead of MyISAM include: 1) transaction support, 2) high concurrency environment, 3) high data consistency; conversely, the situation when choosing MyISAM includes: 1) mainly read operations, 2) no transaction support is required. InnoDB is suitable for applications that require high data consistency and transaction processing, such as e-commerce platforms, while MyISAM is suitable for read-intensive and transaction-free applications such as blog systems.

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

There are four main index types in MySQL: B-Tree index, hash index, full-text index and spatial index. 1.B-Tree index is suitable for range query, sorting and grouping, and is suitable for creation on the name column of the employees table. 2. Hash index is suitable for equivalent queries and is suitable for creation on the id column of the hash_table table of the MEMORY storage engine. 3. Full text index is used for text search, suitable for creation on the content column of the articles table. 4. Spatial index is used for geospatial query, suitable for creation on geom columns of locations table.

TocreateanindexinMySQL,usetheCREATEINDEXstatement.1)Forasinglecolumn,use"CREATEINDEXidx_lastnameONemployees(lastname);"2)Foracompositeindex,use"CREATEINDEXidx_nameONemployees(lastname,firstname);"3)Forauniqueindex,use"CREATEU

The main difference between MySQL and SQLite is the design concept and usage scenarios: 1. MySQL is suitable for large applications and enterprise-level solutions, supporting high performance and high concurrency; 2. SQLite is suitable for mobile applications and desktop software, lightweight and easy to embed.

Indexes in MySQL are an ordered structure of one or more columns in a database table, used to speed up data retrieval. 1) Indexes improve query speed by reducing the amount of scanned data. 2) B-Tree index uses a balanced tree structure, which is suitable for range query and sorting. 3) Use CREATEINDEX statements to create indexes, such as CREATEINDEXidx_customer_idONorders(customer_id). 4) Composite indexes can optimize multi-column queries, such as CREATEINDEXidx_customer_orderONorders(customer_id,order_date). 5) Use EXPLAIN to analyze query plans and avoid

Using transactions in MySQL ensures data consistency. 1) Start the transaction through STARTTRANSACTION, and then execute SQL operations and submit it with COMMIT or ROLLBACK. 2) Use SAVEPOINT to set a save point to allow partial rollback. 3) Performance optimization suggestions include shortening transaction time, avoiding large-scale queries and using isolation levels reasonably.


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download
The most popular open source editor
