本帖最后由 蓝云风翼 于 2013-12-18 17:28 编辑
注:
利用gpu加速有一下工具
1.JACKET 可从帖子中寻找
2.MATLAB a.并行计算工具箱 gpuArray,查看支持gpuArray的函数methods('gpuArray')
b.已经支持GPU的一些工具箱
c.使用mex方式 http://www.matlabsky.com/thread-33511-1-1.html
d.使用产生ptx方法编写cuda kernel
这些都可以通过help gpuArray查看,建议使用最新版本2013a
查看GPU是否支持gpuDevice命令
3.GPUMAT帖子中找
4. nvmex方式即cudawhitepaper可从帖子中直接下载
http://www.matlabsky.com/thread-20597-1-1.html
http://www.matlabsky.com/thread-25951-1-1.html
SIMULINK :http://www.matlabsky.com/forum.php?mod=viewthread&tid=27230
目前,GPU在通用数值计算领域的应用已经越来越广泛,MATLAB通过以下几种方式支持GPU。
一、MATLAB内嵌GPU函数fft, filter,及linear algebra operations等。
二、内嵌工具箱支持GPU的函数: Communications System Toolbox, Neural Network Toolbox, Phased Array Systems Toolbox, and Signal Processing Toolbox (GPU support for signal processing algorithms)
三、在MATLAB中接入CUDA kernel,通过PTX方式或者MEX方式。
Multiple GPUs在单机和计算集群上的使用通过MATLAB 的并行计算工具箱(PCT)及MATLAB分布式计算工具箱(MDCS)(matlab worker)
一、PCT GPUArray
Parallel Computing Toolbox 提供 GPUArray,这是一个具有多个关联函数的特殊数组类型,可让您直接从 MATLAB 在启用 CUDA 的 NVIDIA GPU 上执行计算。这些函数包括 fft、元素级运算和几种线性代数运算,如 lu 和 mldivide(也称作反斜杠运算符 (\))。该工具箱还提供一种机制,可让您直接从 MATLAB 使用现有的基于 CUDA 的 GPU 内核。
使用 MATLAB 进行 GPU 计算。使用 GPUArrays 和 启用 GPU 的 MATLAB 函数,有助于加速 MATLAB 运算,而无需进行低级的 CUDA 编程。
PCT工具箱支持NVIDIA CUDA GPUs(计算能力大于1.3,K20C 计算能力为3.5)
FunctionsCreate array on GPU
Transfer distributed array data or gpuArray to local workspace
Determine if gpuArray or CUDAKernel is available on GPU
Query or select GPU device
Number of GPU devices present
Time required to run function on GPU
Reset GPU device and clear its memory
Wait for job to change state or for GPU calculation to complete
Apply function to each element of array on GPU
Binary singleton expansion function for gpuArray
Apply function to each page of array on GPU
Create GPU CUDA kernel object from PTX and CU code
Evaluate kernel on GPU
Set some constant memory on GPU
ClassesArray of data stored on GPU
Graphics processing unit (GPU)
Kernel executable on GPU
1.使用GPU
首先在命令行窗口输入 gpuDevice 查看当前计算机上是否已经正确安装了GPU设备(硬件+驱动)。
查看所有支持的GPU:
for ii = 1:gpuDeviceCount
g = gpuDevice(ii);
fprintf(1, 'Device %i has ComputeCapability %s \n', ...
g.Index, g.ComputeCapability)
end复制代码
查看gpuArray支持的函数methods('gpuArray')
>> help gpuArray
gpuArray create data on the GPU
G = gpuArray( X ) copies the numeric data X to the GPU. This data can be
operated on by passing it to the FEVAL method of parallel.gpu.CUDAKernel
objects, or by using one of the methods defined for gpuArray objects. See
the Parallel Computing Toolbox documentation for a
list of methods supported by gpuArray.
The MATLAB data X must be numeric (for example: single, double, int8 etc.)
or logical, and the GPU device must have sufficient free memory to store the
data. X must be full.
Examp