GPU加速相信大家都不会陌生,用于异构计算领域的不外是OPENCL、CUDA、C++ AMP等,这些都相对比较新颖的技术。废话不多说,下面将开始配置CUDA流程
1、下载CUDA6.0并安装,我的机器是WIN8.1的,当然6.0版本的CUDA是支持WIN7和WIN8的,从官网DOWNLOAD下来的文件有1G多,下载的网址为点击打开链接。从XP到WIN7、WIN8都有,64BITS及32BITS的要与自己的机器相关
2、安装CUDA,此过程默认即可。
3、安装完成后,有两个目录要注意的:
一个是安装目录:我的机器是在C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.0;
另一个是SDK的目录,它提供了许多可执行程序和对我们有用的例子程序,这个目录在C:\ProgramData\NVIDIA Corporation(注意,这里的ProgramData文件夹一般是隐藏的,要设置才能看到)。
下面可以测试一下你的安装是否成功,我们利用SDK提供的例子程序来运行便知。
C:\ProgramData\NVIDIA Corporation\CUDA Samples\v6.0\Bin\win64\Release此目录下是例子程序所有发行版本所在目录,首先我们打开命令提示符,进入到此目录下,执行命令deviceQuery.exe,此时应该可以看到关于我们的GPU的信息了,如下
deviceQuery.exe Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GT 630"
CUDA Driver Version / Runtime Version 6.0 / 6.0
CUDA Capability Major/Minor version number: 2.1
Total amount of global memory: 2048 MBytes (2147483648 bytes)
( 2) Multiprocessors, ( 48) CUDA Cores/MP: 96 CUDA Cores
GPU Clock rate: 1620 MHz (1.62 GHz)
Memory Clock rate: 500 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 131072 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535),
3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
CUDA Device Driver Mode (TCC or WDDM): WDDM (Windows Display Driver Mo
del)
Device supports Unified Addressing (UVA): Yes
Device PCI Bus ID / PCI location ID: 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simu
ltaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.0, CUDA Runtime Versi
on = 6.0, NumDevs = 1, Device0 = GeForce GT 630
Result = PASS
基本上能正确运行此程序,说明你的安装是没有问题的。
OK,安装完成后,便可以取一个工程来进行测试验证了。打开VS,新建工程时会发现多了CUDA的工程选项。