Introduction

OpenCLLink allows you to use the Wolfram Language to query OpenCL system information and execute OpenCL programs using the Wolfram Language. In this section, an overview is provided of OpenCLLink's capabilities.

What Is OpenCL?

The OpenCLLink package lets you harness the capabilities of OpenCL through the Wolfram Language. It requires the user to have installed both OpenCL-capable device drivers and hardware. Currently, OpenCL is supported on many types of NVIDIA's, AMD/ATI's, and VIA's hardware. It is also natively supported on Apple's Mac OS X Snow Leopard 10.6.

CPU vs. OpenCL

Unlike regular CPU programs, OpenCL allows you to write code that runs on either the CPU or the Graphics Processing Unit (GPU) on the video card. Done correctly, this can provide huge performance increases.

CUDA vs. OpenCL

Unlike CUDALink, OpenCLLink allows you to run programs on both the GPU and CPU (if the CPU supports it).

System Information

To use the OpenCLLink package, it must be first loaded.

Now you can check if system support is detected by OpenCLLink. This is done using OpenCLQ.

To find more information about the hardware supported, use SystemInformation or OpenCLInformation. Here SystemInformation is used.

Users can also use OpenCLInformation to get access to the underlying SystemInformation data. The results from OpenCLInformation are queriable. Here the device names of the first platform are shown.

OpenCL Programming

A key feature of OpenCLLink is how it makes it easy to develop new GPU programs and integrate them into your Wolfram Language work.

To use any of the OpenCLLink functionality, you first need to include the OpenCLLink application as shown below.

A simple OpenCL function is loaded. It takes an input vector and doubles each element.

Here is an input vector that will be used to call the function.

This calls OpenCLFunction.

You can get information on your function with OpenCLFunctionInformation, as shown in the following.