ztellman / calx Goto Github PK
View Code? Open in Web Editor NEWnot under active development - idiomatic opencl bindings for clojure
not under active development - idiomatic opencl bindings for clojure
Hello.
Your example in the readme states:
(enqueue-kernel :square 3 a b)
where the 3 refers to the global size of the problem, as in the gid in:
int gid = get_global_id(0)
I would like to write a kernel with 2 (or 3) dimensions, say with
int col = get_global_id(0);
int row = get_global_id(1);
Problem is, I do not see how to state the sizes of each of these(col, row), as you did for gid.
I guess the function enqueue-kernel would need to extend or have a Ndimentional version of it?
Also, the function enqueue-kernel does not seem to be in the doc file you point to in the read me.
How would you approach a 2 problem with calx?
I'm thinking of a 1D data buffer, which, via it's layout, encodes a 2D data, then I'd apply mod(gid,rowWidth) for work on rows and floor(gid/colHight) for columns?
Many thanks!
Ludo
Hello.
I note that the file calx/src/calx/core.clj contains the 'local' function defined as:
(defn local [size]
(CLKernel$LocalSize. size))
I'm designing a kernel for which I will want to set the local work size myself, however, I do not see how I can set this veritable. I attempted to set this within the 'let' as per the example below, however this has no effect. Placing the 'local' function call anywhere else fails with 'Unable to resolve symbol: sourceOpenCL2'.
How could I put this option into effect? A side question, is there a public repo that uses calx that I could use a learning material?
I know the local size is not changing (stays as 256) because of a kernel with something like this:
int lid = get_local_id(0); ....
outvector[gid] = lid ; //The output values loop round 255
Kind regards.
Ludo
(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)
b (mimic a)]
(local 64) ;;This seem to have no effect
(enqueue-kernel :square 3 a b)
(enqueue-read b))))
Hey Zach,
I'm trying to update your calx code to work with 1.3. The binding vars stuff is pretty easy to fix but the import-fn stuff is giving me problems.
Its giving me:
;user=> (clojure.repl/pst)
NullPointerException
java.util.concurrent.ConcurrentHashMap.get (ConcurrentHashMap.java:768)
clojure.lang.Namespace.find (Namespace.java:188)
clojure.core/find-ns (core.clj:3657)
clojure.core/the-ns (core.clj:3689)
clojure.core/intern (core.clj:5561)
potemkin.namespace/import-fn (namespace.clj:16)
clojure.lang.Var.invoke (Var.java:409)
clojure.lang.Var.applyTo (Var.java:518)
clojure.lang.Compiler.macroexpand1 (Compiler.java:6320)
clojure.lang.Compiler.macroexpand (Compiler.java:6381)
clojure.lang.Compiler.macroexpand (Compiler.java:6383)
clojure.lang.Compiler.eval (Compiler.java:6449)
I tried using the most recent version of potemkin but I'm still getting the same error. You know what's going on here?
Best,
Brent
java.lang.IllegalArgumentException: No implementation of method: :sizeof of protocol: #'gloss.core.protocols/Writer found for class: clojure.lang.Keyword (cl.clj:0)
when running the example from README.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.