Arrayfire bindings for J language
Requires download and install of Arrayfire. For more information about ArrayFire, see:
- Binary versions for download: https://arrayfire.com/download/
- Source repository: https://github.com/arrayfire/arrayfire
- Documentation: https://arrayfire.org/docs/
All J files in project should be in the same folder as this file. Load jfire.ijs in the J language ide.
Arrayfire is a paralel math library (focused mainly on floating point) that uses a single interface to other GPU and CPU math libraries.
- jfire.ijs includes setup utilities.
- arrayf_tests.ijs includes samples and benchmarks.
A memory manager is included as well as a device interface, and enhancements to J to allow easier locale management.
The device interface allows independent device locales each with their own memory manager.
This allows not having to assign results and clear an entire group of pointers with one call, or by codestroy__device ''
The same memory manager approach as my BN library is used. Mixed automatic and manual memory management is available.
The M
suffix on verbs that create pointers create an automanaged result.
The design allows J single line productivity. Unlike my openssl bindings these use J dyads naturally, but the result is always a new pointer.
See arrayf_test.ijs for usage.
Error management is currently set to just crash at point of failure and didsplay what error information is returned from arrayfire (standard error is not used much by them, but the error codes are in arrayfire.ijs file).
A subset of functions are implemented so far, but it should be straightforward to add the others as they have common signatures.
Main commands in every locale and device:
A
creates an array. (scalars are arrays too)Af
,Ad
,As
create "typed" arrays (using C typesfloat
,double
, and (signed 32 bit)int
, respectively). I haven't implemented complex or byte arrays yet.A
is simple monad with any numeric noun (handle chars when I do byte, but there are few functions suited to chars in AF library).R
releases an array.M
suffix (AM AfM...) puts created array in managed memory. addM mulM adds result to managed memory.J
is universal from arrayfire to J command (every type)JR
releases pointer after getting its contents.
See the wiki for performing the same BLAS tests that come with arrayfire in J: https://github.com/Pascal-J/Jfire/wiki.