Skip to content
This repository

not under active development - idiomatic opencl bindings for clojure

branch: master
README.textile

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-cl
  (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.

Something went wrong with that request. Please try again.