博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
matlab采用GPU运算
阅读量:7289 次
发布时间:2019-06-30

本文共 2227 字,大约阅读时间需要 7 分钟。

>>help gpu

There are several options available for using your computer's graphics
processing unit (gpu) for matrix operations.
- Transfer data between the MATLAB workspace and the gpu
- Evaluate individual MATLAB functions that have been
overloaded for execution on the gpu
- Execute MATLAB code containing multiple functions using ARRAYFUN.
(Not all MATLAB functions are supported.)
- Create kernels from CU files for execution on the gpu
The gpu Computing section of the Parallel Computing Toolbox User's Guide
provides more information on these use cases and lists supported devices
and device drivers.
Data Transfer Operations
gpuArray - Transfer an array from the MATLAB workspace to the gpu
gather - Transfer an array from the gpu to the MATLAB workspace
MATLAB Overloads
MATLAB functions that have been made available for
execution on the gpu can be viewed using the command
methods('gpuArray')
Certain other MATLAB functions that support gpuArray inputs are
listed in the Parallel Computing Toolbox documentation.
Examples:
% FFT
A = gpuArray( rand( 2^16, 100 ) );
F = fft(A)
% MLDIVIDE
A = gpuArray( rand(1024) ); B = gpuArray( rand(1024,1) );
X = A\B
% MTIMES
A = gpuArray( rand(1024) ); B = gpuArray( rand(1024) );
C = A*B
Execute MATLAB code on the gpu
gpuArray/arrayfun - Apply a function to each element of an array on
the gpu
The function to evaluate on the gpu must exist on the path. Only a
subset of the MATLAB language is supported by ARRAYFUN on the gpu.
The restrictions are listed in the User's Guide.
Example:
% The file xycrull.m is one example of an existing MATLAB file
% that can be automatically executed on the gpu.
%
% Execute 'type xycrull' at the MATLAB prompt to view the contents
% of the file.
%
gt = gpuArray(rand(400));
[o1, o2] = arrayfun(@xycrull, gt)
CUDA Kernel Operations
parallel.gpu.CUDAKernel - Create a kernel object that corresponds
to a particular kernel in a CU file
parallel.gpu.CUDAKernel/feval - Evaluate a kernel on the gpu
Device Information
gpuDeviceCount - Return the number of gpu devices available
gpuDevice - Query or select a gpu device
Timing gpu Operations
gputimeit - Measure time required to run function on gpu

转载于:https://www.cnblogs.com/hyl2018/p/10229168.html

你可能感兴趣的文章
iOS开发UI篇—Quartz2D使用(图形上下文栈)
查看>>
Oracle迁移MySQL笔记
查看>>
Building a Pub/Sub Message Bus with Wcf,Msmq,IIS
查看>>
Mybatis实现批量删除
查看>>
【leetcode】995. Minimum Number of K Consecutive Bit Flips
查看>>
【洛谷 P4886】 快递员 (点分治)
查看>>
在Ajax中将数组转换成字符串(0517-am)
查看>>
hive字符串函数
查看>>
【erlang ~ 4 days】 Day # 1.2 Sequential Programming
查看>>
HDFS Erasure Coding介绍
查看>>
abstract vs interface
查看>>
egret 游戏优化文档
查看>>
蚂蚁金服研发面经
查看>>
xmanagr 注册机执行ubuntu 桌面程序,ubuntu无需安装 桌面环境
查看>>
开源存储
查看>>
sqlplus乱码
查看>>
CodeForces 213C Relay Race :从左上角到右下角再返回,每个价值计算一次,问最多收集价值 :dp...
查看>>
EFCore中SQLSERVER 2008 的分页问题
查看>>
Python中变量的绑定,或者说引用
查看>>
第一天。
查看>>