In my testing of sum, there's a bug with opencl (either arrayfire or me), but
afcpu (I think boost compute is the backend) works fine.
its not surprising that J is fastest at it, but with my 4 core processor,
C =. P =. ('afcpu';0) conew 'afdevice'
killmanaged__C timespacex 'J__C 0 sumM__C a' [ a =. AM__C"1 ?. 4 800000 $
100000
0.00836225 6912
killmanaged__C timespacex 'J__C 0 sumM__C a' [ a =. AM__C"1 ?. 16 200000 $
100000
0.00890401 7424
both of these lines free all pointers after execution. The 2nd line splits the
data into 16 arrays, while the first goes into 4. sum is being applied on each
array independently, and the speed is about the same.
the result is also the same as a monolithic array operation:
timespacex 'J__C 1 sumM__C a' [ a =. AM__C ?. 4 800000 $ 100000
0.0148899 6784
buts its twice as fast. Splitting the arrays allows the library to apply
thread paralelism. The sum function takes a dyadic argument that is similar to
rank, but that is easier
This approach of working with lists of pointers is similar to working with
lists of boxes in J. You apply a rank 0 function just as the adverb each, and
each element can have different shape/sizes.
cheating a little on the J version, and timing the expense of boxing its items.
timespacex '+/ each <"1 b ' [ b=. 4 800000 $ 100000
0.0317267 4.19474e7
without cheating.
timespacex '+/ each b ' [ b=. <"1 ?. 4 800000 $ 100000
0.00554032 3584
J is faster, but perhaps not on bigger gpus than mine if opencl bug is removed.
updated https://github.com/Pascal-J/Jfire with these functions and tests.
----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: "[email protected]" <[email protected]>
Cc:
Sent: Monday, September 28, 2015 12:29 AM
Subject: Re: [Jprogramming] Arrayfire bindings
updated repo (bug fixes), and included a wiki page describing
advantages/disadvantages of arrayfire. https://github.com/Pascal-J/Jfire
On my low end GPU, I get a 250x speed improvement over J for floating point
matrix multiplication on array size of 1024x1024 (including setup and results
going back to J).
----- Original Message -----
From: Alex Shroyer <[email protected]>
To: [email protected]
Cc:
Sent: Saturday, September 26, 2015 10:07 PM
Subject: Re: [Jprogramming] Arrayfire bindings
Very cool. I did an audio processing thing in J a while back which I think
would have benefited from something like this. Perhaps now I'll re-implement it
using Jfire.
Thanks for sharing!
Alex
-----Original Message-----
From: "'Pascal Jasmin' via Programming" <[email protected]>
Sent: 9/26/2015 7:03 PM
To: "Programming Forum" <[email protected]>
Subject: [Jprogramming] Arrayfire bindings
https://github.com/Pascal-J/Jfire
There are probably some helpful applications for it. Mostly with floating
point. (A lot of work for something I don't use much :P)
Hope you like the interface for it. Its fairly J like.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm