OpenCL

From Encog Machine Learning Framework
Jump to: navigation, search
OpenCL logo.

As version 2.4 Encog has added OpenCL support, version 2.5 has further enhanced this support. This allows Encog to off load some training tasks to the graphics card to accelerate the neural network training process using your computer's GPU. This can often add significant performance improvements to situations where multiple neural networks must be trained simultaneously. This is particularly true if you have a higher-end GPU or multiple GPU's. Encog 2.5 made use of the JOCL OpenCL binding. Encog 3.0 is currently experimenting with JavaCL.

Contents

Wrappers

To access OpenCL from high level languages you must use a wrapper. The following wrappers have been used by Encog.

Using OpenCL with Encog

OpenCL can allow Encog to greatly speed up neural network training. OpenCL allows Encog to make use of the GPU while it trains. Your graphics card, or GPU, is a computing device designed to perform high-performance mathematical operations to provide the 3D graphics needed by demanding video game applications. However, video games are not the only things that your GPU's computing power can be used for. OpenCL is a heterogeneous computer language that allows GPU's and CPU's to be used together to support highly parallel applications.

Making use of OpenCL will likely require some installation/configuration on your computer. We try to make the process of using Encog with OpenCL as seamless as possible. However, there will typically be some installation required depending on what your system is. This applies to both the Encog Workbench, as well as using the Encog core in your own applications. The Encog Workbench will make use of CL if you choose that option in the Workbench configuration. However, Encog will give an error if it cannot find the appropriate OpenCL drivers installed. Choose one of the links below to get instructions for which edition of Encog you are using.

Encog OpenCL for C#

Before you can install the correct OpenCL drivers for your computer you must determine the video card chipset you are dealing with. This is not necessarily the vendor of your video card, as there are numerous vendors that all use common chipsets. As far as OpenCL is concerned, there are three major chipset manufacturers.

  • Intel
  • nVidia
  • AMD/ATI

If you have a graphics processor (GPU) with one of the Intel chipsets, you are out of luck. At least for now. Intel has not yet released OpenCL drivers for any of their devices. This will likely change in the future. You can find the other two vendors drivers here.

Drivers

Before you can do anything, you will need drivers for your video hardware. Usually the drives you already have installed will not include OpenCL.

Once the drivers are installed you should be ready to make use of OpenCL in Encog. Encog for .Net makes use of the CLOO binding. This DLL is included with the Encog download, and must be in the path for Encog to function properly.

Encog OpenCL for Java

Before you can install the correct OpenCL drivers for your computer you must determine the video card chipset you are dealing with. This is not necessarily the vendor of your video card, as there are numerous vendos that all use common chipsets. As far as OpenCL is concerned, there are three major chipset manufacturers.

  • Intel
  • nVidia
  • AMD/ATI

If you have a graphics processor (GPU) with one of the Intel chipsets, you are out of luck. At least for now. Intel has not yet released OpenCL drivers for any of their devices. This will likely change in the future. You can find the other two vendors drivers here.

Drivers

Before you can do anything, you will need drivers for your video hardware. Usually the drives you already have installed will not include OpenCL.

You will also need bindings. Bindings allow Encog for Java to connect to the lower level OpenCL drivers. Encog for Java makes use of JOCL. You will need to visit the JOCL website and download the appropriate driver for your system. The driver will usually be some sort of a DLL for the specific platform. This DLL must be located in Enocg's path. Also make sure you download the correct "bit version" for your system, i.e. 32 or 64 bit.

Installing OpenCL Drivers on a Macintosh

Apple added OpenCL support to the Macintosh, as of the Snow Leopard (10.6) version of OS-X. If you are running this version, or later, then your OpenCL drivers are already loaded. If you are running an earlier version of OS-X, then you will need to upgrade your operating system before you are able to use OpenCL with Encog.

You can read more about Apple support of OpenCL at the following link.

Apple OpenCL

OpenCL Programming

OpenCL is one of the best ways to write programs that execute on GPUs. On this page I have a collection of learning resources about using OpenCL. You do not need any of these to make use of OpenCL with Encog, as Encog is already programmed to make use of OpenCL. These are some of the resources that I found helpful, as I programmed OpenCL for Encog. If you wish to create your own OpenCL application, or contribute OpenCL code to Encog, you will probably find them helpful as well.

Troubleshooting