This repository has been archived by the owner. It is now read-only.
not under active development - idiomatic opencl bindings for clojure
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This project is not under active development.

Calx is an idiomatic wrapper for OpenCL, which is an abstraction layer for parallel computation. Using a C-variant language, a programmer can target CPUs, GPUs, and more exotic hardware (the Cell processor used in the PS3, for instance).

The OpenCL API is not known for its terseness; consider this ‘Hello World’ example example demonstrating the necessary steps to square a list of floating point numbers. Using Calx, the same result can be achieved like so:

(use 'calx)

(def source
  "__kernel void square (
       __global const float *a,
       __global float *b) {
    int gid = get_global_id(0);
    b[gid] = a[gid] * a[gid];

  (with-program (compile-program source)
    (let [a (wrap [1 2 3] :float32-le)
          b (mimic a)]
      (enqueue-kernel :square 3 a b)
      (enqueue-read b))))

This is very much a work in progress, but still can be immediately useful for some purposes. Anyone using it is encouraged to give feedback.

The complete documentation can be found here.