My short question is has anyone already started a project binding Arrayfire 
library to J... even if it is only partially complete?

Arrayfire is an open source C++ library with c ffi, with multiplatform binaries 
for easy start, that supports acceleration of functions on GPU and CPU 
(multithreading).  It includes openBLAS (linear algebra) and boost.  Intel 
Nvidia and AMD GPUs are all transparently supported (as low as HD4000 intel).  
Recent AMD and (less recent) intel CPUs also have opencl backends (older amd 
APUs still have GPU acceleration), but afaiu, boost and blas backends are 
fallbacks that may help.

Its interface is also almost entirely array processing, with many 1:1 mappings 
to J primitives.  There's no locks/manual thread management/semaphudges...

On my system, there is a 5-9x speedup of (their) opencl benchmarks compared to 
4 core paralel CPU threads for FFT.  Up to 18Gflops.

This seems like a viable write once, run anywhere parallelization platform for 
J. 

Development process (similar to the openssl BN library I made, that I'm pleased 
with):

write/take a J function,
reimplement using ArrayFire calls, or a mix of J and AF calls to avoid calling 
overhead.
Optimize the new function with J reference function for testing

Also from BN experience, J is very good at transforming arrays of pointers, and 
can be used tacitly, and so even if AF is not the ideal array language, it will 
be very familiar to J, and suitable to J manipulation and ease of calling.

Boost has a ton of utilities.  I'm not positive that AF exposes all of these 
directly, but it can be built form source. (Timers that would work in console, 
JHS and iOS come to mind)

http://www.arrayfire.com/docs/group__func__categories.htm

even has iota :P

http://www.arrayfire.com/docs/group__data__func__iota.htm

shape is limited to 4 dimensions apparently, but there is reshape (perhaps all 
arrays in AF are 4d with trailing 1 dimensions, but that is still easy to 
convert)

http://www.arrayfire.com/docs/group__manip__func__tile.htm

In terms of key functions for J interface,

I'd guess that if af_write_array and af_get_data_ptr can work with J, then the 
whole library should be accessible and useful.

http://www.arrayfire.com/docs/group__method__mat.htm


Long term, because its open source, adding native J datatypes or JDo commands 
that process the arrays without copying them over to the calling J instance, 
could be easy enough to add?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to