Getting Started

From Jacket Wiki

Jump to: navigation, search

This page serves as a quick-start guide to using Jacket for MATLAB®. It assumes you've already downloaded and installed Jacket and are now ready to play ball.

Contents

Jacket Basics

Take the tour to get a high-level overview of Jacket or read through a more detailed version.

Read the basics to get an overview of the data-types and entry functions that form Jacket's core.

Step through examples to see snippets of code from the included demos.

Core Jacket Concepts:

Jacketization

Armed with knowledge of the above concepts, you are now ready to go ahead and dive into your project!

Skim through the included examples to see best practices for GPU development:

Avoid writing separate CPU code and GPU code. Instead, write one copy of your algorithm and use CLASS, CAST, ISA, etc. to create or cast variables to the CPU or GPU based on the type of inputs. For example:

function out = savenonzeros(in)
  out = zeros(size(in), class(in));
  nz = find(in);
  out(nz) = in(nz);
end

Measuring performance

Since the GPU is a device somewhere on your computer's PCI bus, its performance is subject to various operating system bottlenecks, and so timing your code requires some care. To make things easier, we've included TIMEIT which allows for quick timing of both CPU and GPU code.

A = rand(1024, gsingle);
seconds = timeit(@() A * A)
 
seconds =
      0.0073

GFOR

Faster than a sequential for-loop, a GFOR-loop can simultaneously launch all its iterations in parallel on the GPU. Not every loop can be expressed using GFOR, so be sure to skim through GFOR Usage to understand when it works and when it doesn't.

More Help

  • Our FAQ provides solutions to some of the most common issues.
  • Our Forums are an active community of programmers quick to offer help.
  • Contact our engineers by email or phone 1-800-570-1941 x2.
Personal tools