Introduction
This feature is not supported on the Wolfram Cloud.

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.

In[1]:=
Click for copyable input

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

In[2]:=
Click for copyable input
Out[2]=

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

In[3]:=
Click for copyable input
Out[3]=

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.

In[4]:=
Click for copyable input
Out[4]=

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.

In[1]:=
Click for copyable input

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

In[2]:=
Click for copyable input
Out[2]=

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

In[3]:=
Click for copyable input

This calls OpenCLFunction.

In[4]:=
Click for copyable input
Out[4]=

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

In[5]:=
Click for copyable input
Out[5]=