>>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

matlab采用GPU运算的更多相关文章

  1. 科学计算 | Matlab 使用 GPU 并行计算

    科学计算 | Matlab 使用 GPU 并行计算 本文转载自:  https://sanwen8.cn/p/14bJc10.html       Matlab下直接使用GPU并行计算(预告)< ...

  2. MATLAB的符号运算基础

    在数学运算中,运算的结果如果是一个数值,可以称这类运算为数值运算:如果运算结果为表达式,在MATLAB中称为符号运算,符号计算是对未赋值的符号对象(可以是常数.变量.表达式)进行运算和处理.MATLA ...

  3. TensorFlow——tensorflow指定CPU与GPU运算

    1.指定GPU运算 如果安装的是GPU版本,在运行的过程中TensorFlow能够自动检测.如果检测到GPU,TensorFlow会尽可能的利用找到的第一个GPU来执行操作. 如果机器上有超过一个可用 ...

  4. TensorFlow.NET机器学习入门【8】采用GPU进行学习

    随着网络越来约复杂,训练难度越来越大,有条件的可以采用GPU进行学习.本文介绍如何在GPU环境下使用TensorFlow.NET. TensorFlow.NET使用GPU非常的简单,代码不用做任何修改 ...

  5. Matlab的集合运算[转]

    今天遇到一个问题:有向量a和向量b,b是a的子向量(元素全部来自a),求向量a去掉向量b后剩下的元素构成的向量. 这么一个简单的问题,搜了半天也没有得到结果,因为找不到合适的关键词来描述这个问题. 在 ...

  6. 【matlab】GPU 显卡版本与计算能力(compute capability)兼容性问题

    MathWorks - Bug Reports 1. 问题说明 当运行 alexnet 等卷积神经网络需要使用 GPU 加速时,matlab 如果提示如下的警告信息: GPUs of compute ...

  7. 利用matlab进行协方差运算

    本文全部参考自: http://www.cnblogs.com/welen/articles/5535042.html#undefined 知识点一: MATLAB中四个取整函数具体使用方法如下:Ma ...

  8. [matlab] 5.字符运算与微积分

    首先介绍一下matlab里的符号计算 符号变量可以看成是数学中含参数 的表达式中的参数 matlab能进行像(a+b)(a-b)=a^2-b^2这样的计算 要进行符号计算首先要定义符号变量 定义符号对 ...

  9. MATLAB矩阵基础运算

    1.矩阵的加减运算X+Y或者X-Y:元素对应相加减.在此要求X与Y必须是同维矩阵,否则会出现错误信息.如果Y为一个数,则表示X中每一元素+Y或者-Y: %当X和Y都为同维矩阵时 X=[1,2,-3;2 ...

随机推荐

  1. BZOJ3038 上帝造题的七分钟

    Time Limit: 3 Sec Memory Limit: 128 MB Description XLk觉得<上帝造题的七分钟>不太过瘾,于是有了第二部. "第一分钟,X说, ...

  2. 前端每日实战:66# 视频演示如何用纯 CSS 创作一台咖啡机

    效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/rKPLMW 可交互视频 此视频是可 ...

  3. uCOS的软件定时器、uCOS时钟节拍和滴答定时器的关系

    uCOS2.81后的版本中有软件定时器的概念,如果要开启定时器任务,需要在OS_CFG.H文件中 #define  OS_TMR_EN                 1 软件定时器其实跟硬件中断是相 ...

  4. 如何使用Keka for Mac提取受密码保护的文件?用Keka提取文件的格式

    如何使用Keka for Mac提取受密码保护的文件?keka Mac是很多人喜欢的压缩解压工具,以小巧,使用简单,界面简洁受到很多Mac用户的喜欢,你还可以使用它提取文件,下面我们就来介绍一下关于用 ...

  5. 【LeetCode 60】第k个排列

    题目链接 [题解] 逆康托展开. 考虑康托展开的过程. K = ∑v[i]*(n-i)! 其中v[i]表示在a[i+1..n]中比a[i]小的数字的个数 (也即未出现的数字中它排名第几(从0开始)) ...

  6. 【HDOJ6579】Operation(线性基)

    题意:给定一个数列a,给定两种操作: 1.询问[l,r]区间内最大的xor和 2.n++,a[n]赋值为x 要求强制在线 n,m<=5e5,a[i]<2^30 思路:同CF1100F 固定 ...

  7. LUOGU P3380 【模板】二逼平衡树(树套树)

    传送门 解题思路 这里写的是常数巨大的线段树套\(splay\),卡了半天常才过.首先线段树每个节点挂一个\(splay\),\(splay\)中的元素即为线段树管辖的区间中的数.对于操作\(1\), ...

  8. 手机上访问angular移动项目

    要实现手机访问本地开发的移动端项目,首先做到两点: 1.本地打开的项目可以使用本地ip访问 2.手机和电脑同时处于一个同一个局域网中(手机和电脑同时连上同一个wifi / 手机开热点给电脑 / 电脑开 ...

  9. SQLmap注入

    一.安装 先安装Python2.7 下载SQLmap:http://sqlmap.org/ 下载文件解压到Python文件目录下 然后设置环境变量:D:\Python27\sqlmap 在cmd查看是 ...

  10. 一双木棋(chess)

    一双木棋(chess) 题目描述 菲菲和牛牛在一块 nn 行 mm 列的棋盘上下棋,菲菲执黑棋先手,牛牛执白棋后手. 棋局开始时,棋盘上没有任何棋子,两人轮流在格子上落子,直到填满棋盘时结束.落子的规 ...