uncomplicate

2018-08-01T16:25:41.000402Z

What is the best way to program Neanderthal agnostically and concisely, i.e., avoiding writing sub-namespaces to support targeting each compute engine (CPU, OpenCL, CUDA)? New to Neanderthal, I have several observations: First, it’s useful to require the uncomplicate.neanderthal.native namespace, for convenience when targeting the CPU. Second, it’s also convenient to use dge et al., instead of ge c/w a factory, etc. Third, I think with-release (for example) degrades gracefully to become let when code is to be run on the CPU, making this macro, at least, inherently portable across compute engines and, of course, redundant on the CPU.

2018-08-01T16:27:01.000388Z

Can uncomplicate.neanderthal.real be used in programs targeting OpenCL or CUDA, or is it only suitable for programs running on the CPU?

2018-08-01T18:02:28.000385Z

Dragan, your recent blog posting dealt with broadcasting, and you mentioned that you have written a broadcasting implementation (of whatever extent) for Neanderthal. Apart from pre-allocating and reusing ones-vectors, how else might broadcasting be optimized in Neanderthal? (defn xpcv! "Addition of broadcast column vector v and matrix x, where the dimension of v equals the number of rows of x. Matrix x is altered. 1s vector, y, may be pre-allocated and supplied, otherwise it's allocated in this routine. The dimension of y equals the number of columns of x." ([x v] (with-release [y (entry! (raw (row x 0)) 1)] ; with-release is '(let) that ensures GPU computing deallocations' (rk! v y x))) ([x v y] (rk! v y x))) (defn xprv! "Addition of broadcast row vector v and matrix x, where the dimension of v equals the number of columns of x. Matrix x is altered. 1s vector, y, may be pre-allocated and supplied, otherwise it's allocated in this routine. The dimension of y equals the number of rows of x." ([x v] (with-release [y (entry! (raw (col x 0)) 1)] ; with-release is '(let) that ensures GPU computing deallocations' (rk! y v x))) ([x v y] (rk! y v x))) (defn mmpcv! "Matrix multiplication (mm!), followed by addition of a column vector broadcast over result matrix." ([v alpha a b beta c] (mm! alpha a b beta c) (xpcv! c v)) ([v alpha a b c] (mm! alpha a b c) (xpcv! c v)) ([v alpha a b] (mm! alpha a b) (xpcv! b v)) ([v a b] (mm! a b) (xpcv! b v))) (defn mmprv! "Matrix multiplication (mm!), followed by addition of a row vector broadcast over result matrix." ([v alpha a b beta c] (mm! alpha a b beta c) (xprv! c v)) ([v alpha a b c] (mm! alpha a b c) (xprv! c v)) ([v alpha a b] (mm! alpha a b) (xprv! b v)) ([v a b] (mm! a b) (xprv! b v)))

2018-08-01T18:43:37.000491Z

I for one am hoping for a neanderthal xkcd function in the next release.. j/k 🙂