Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
/ calx Public archive

not under active development - idiomatic opencl bindings for clojure

Notifications You must be signed in to change notification settings

ztellman/calx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

not under active development - idiomatic opencl bindings for clojure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published