Get Started

ClojureCL uses native OpenCL drivers, so it is very important that you do not skip any part of this guide.

How to Get Started

Usage

First use or require uncomplicate.clojurecl.core and/or uncomplicate.clojurecl.info in your namespace, and you’ll be able to call appropriate functions from the ClojureCL library.

(ns example
  (:require [uncomplicate.clojurecl.core :refer :all])
  (:require [uncomplicate.commons.core :refer [info]]))

Now you can work with OpenCL platforms, devices, contexts, queues etc.

Here we get info on all available platforms and devices

(map info (platforms))
(map info (devices (first (platforms))))

Overview and Features

ClojureCL is a Clojure library for High Performance Computing with OpenCL, which supports:

  • GPUs from AMD, nVidia, Intel;
  • CPUs from Intel, AMD, ARM etc;
  • Computing accelerators and embedded devices (Intel Xeon Phi, Parallella, etc.).

If you need higher-level high performance functionality, such as matrix computations, try Neanderthal.

On the TODO List

  • Images
  • OpenGL interoperability

Installation

Install OpenCL SDK and Drivers

To use ClojureCL, you must have appropriate hardware (a recent Intel CPU will do, while a recent AMD’s Radeon graphic cards usually give best speedups per dollar), and install the drivers for your platform:

  • AMD fully supports OpenCL 2.0. You need a recent proprietary GPU driver from AMD.
  • Intel OpenCL SDK fully supports OpenCL 2.0.
  • Apple OSX has a built-in support for OpenCL 1.2 - no additional drivers are necessary.
  • nVidia latest drivers should support OpenCL 1.2. nVidia seems to intentionaly give much poorer support for OpenCL computing than AMD or Intel, to push its proprietary CUDA platform.

Add ClojureCL jar

The most straightforward way to include ClojureCL in your project is with Leiningen. Add the following dependency to your project.clj:

ClojureCL currently works out of the box on Linux, Windows, and OS X. For other plaforms, contact us.

Where to go next

Hopefully this guide got you started and now you’d like to learn more. OpenCL programming requires a lot of knowledge about the OpenCL model, devices and specifics of parallel computations. The best beginner’s guide, in my opinion, is the OpenCL in Action book. I expect to build a comprehensive base of articles and references for exploring this topic, so please check the All Guides page from time to time. Of course, you should also check the ClojureCL API for specific details, and feel free to take a glance at the source while you are there.

Tell Us What You Think!

Please take some time to tell us about your experience with the library and this site. Let us know what we should be explaining or is not clear enough. If you are willing to contribute improvements, even better!