Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accelerating MATLAB code using GPUs?

AccelerEyes announced in December 2012 that it works with Mathworks on the GPU code and has discontinued its product Jacket for MATLAB:

http://blog.accelereyes.com/blog/2012/12/12/exciting-updates-from-accelereyes/

Unfortunately they do not sell Jacket licences anymore.

As far as I understand, the Jacket GPU Array solution based on ArrayFire was much faster than the gpuArray solution provided by MATLAB.

I started working with gpuArray, but I see that many functions are implemented poorly. For example a simple

myArray(:) = 0  

is very slow. I have written some custom CUDA-Kernels, but the poorly-implemented standard MATLAB functionality adds a lot of overhead, even if working with gpuArrays consistently throughout the code. I fixed some issues by replacing MATLAB code with hand written CUDA code - but I do not want to reimplement the MATLAB standard functionality.

Another feature I am missing is sparse GPU matrices.

So my questions are:

How do is speed up the badly implemented default GPU implementations provided by MATLAB? In particular, how do I speed up sparse matrix operations in MATLAB using the GPU?

like image 855
Stiefel Avatar asked Jun 05 '13 15:06

Stiefel


People also ask

Can MATLAB use GPU acceleration?

Perform MATLAB computing on NVIDIA CUDA-enabled GPUsMATLAB® enables you to use NVIDIA® GPUs to accelerate AI, deep learning, and other computationally intensive analytics without having to be a CUDA® programmer.

Can you run MATLAB code on GPU?

Run MATLAB Code on GPUHundreds of functions in MATLAB and other toolboxes run automatically on a GPU if you supply a gpuArray argument. This example shows how to use gpuDevice to identify and select which device you want to use. Support for NVIDIA® GPU architectures.

How do I force MATLAB to run on GPU?

Use MATLAB Functions with the GPU Create a row vector that repeats values from -15 to 15. To transfer it to the GPU and create a gpuArray object, use the gpuArray function. To operate with gpuArray objects, use any gpuArray -enabled MATLAB function. MATLAB automatically runs calculations on the GPU.

Is it possible to train models using GPU in MATLAB?

MATLAB® supports training a single deep neural network using multiple GPUs in parallel. By using parallel workers with GPUs, you can train with multiple GPUs on your local machine, on a cluster, or on the cloud. Using multiple GPUs can speed up training significantly.


1 Answers

MATLAB does support CUDA based GPU. You have to access it from the "Parallel Computing Toolbox". Hope these 2 links also help:

Parallel Computing Toolbox Features

Key Features

  • Parallel for-loops (parfor) for running task-parallel algorithms on multiple processors
  • Support for CUDA-enabled NVIDIA GPUs
  • Full use of multicore processors on the desktop via workers that run locally
  • Computer cluster and grid support (with MATLAB Distributed Computing Server)
  • Interactive and batch execution of parallel applications
  • Distributed arrays and single program multiple data (spmd) construct for large dataset handling and data-parallel algorithms

MATLAB GPU Computing Support for NVIDIA CUDA-Enabled GPUs

Using MATLAB for GPU computing lets you accelerate your applications with GPUs more easily than by using C or Fortran. With the familiar MATLAB language you an take advantage of the CUDA GPU computing technology without having to learn the intricacies of GPU architectures or low-level GPU computing libraries.

You can use GPUs with MATLAB through Parallel Computing Toolbox, which supports:

  • CUDA-enabled NVIDIA GPUs with compute capability 2.0 or higher. For releases 14a and earlier, compute capability 1.3 is sufficient.
  • GPU use directly from MATLAB
    • GPU-enabled MATLAB functions such as fft, filter, and several linear algebra operations
    • GPU-enabled functions in toolboxes: Image Processing Toolbox, Communications System Toolbox, Statistics and Machine Learning Toolbox, Neural Network Toolbox, Phased Array Systems Toolbox, and Signal Processing Toolbox (Learn more about GPU support for signal processing algorithms)
    • CUDA kernel integration in MATLAB applications, using only a single line of MATLAB code
  • Multiple GPUs on the desktop and computer clusters using MATLAB workers in Parallel Computing Toolbox and MATLAB Distributed Computing Server
like image 181
Re Captcha Avatar answered Nov 04 '22 01:11

Re Captcha