Performance of Arrayfire with matlab

176 views
Skip to first unread message

Ali

unread,
Apr 21, 2016, 11:55:59 AM4/21/16
to ArrayFire Users
Hi,

How fast a code can run with arrayfire+matlab combination? Can we compare it with C++ with arrayfire ? Kindly comment with CPU, GPU, OPENCL usage??

Regards
Ali

Eric

unread,
Apr 21, 2016, 1:01:41 PM4/21/16
to ArrayFire Users
I've written quite a few MEX-file wrappers around ArrayFire code.  Sometimes the MEX file does quite a bit of work.  Sometimes I write a MEX file that simply wraps a single call to an ArrayFire function.  Your speed improvement will depend on exactly what you're doing.  I only have experience with ArrayFire and the CUDA backend, by the way.

For instance, I re-wrote the accelerated Lucy-Richardson deconvolution used by Matlab's deconvlucy() in the Image Processing toolbox as a MEX file using ArrayFire.  On my machine a particular deconvolution took 4.9 seconds with deconvlucy.m.  This function is not optimized for speed and includes some options I don't really need (I just wanted to use the image, the PSF, and the number of iterations while leaving all other parameters as their default values).  I wrote my own simplified M-file function and got the time down to 2.3 seconds.  I also wrote my code so it would work with gpuArray objects (something deconvlucy.m does not support).  That got the time down to 0.19 seconds.  I then coded it up in ArrayFire and got the time down to 0.14 seconds.  So in the end I got a speedup of 35X.  For these runs the GPU was a Quadro K2200 in TCC mode (I'm running Windows).

For another, lengthier algorithm, I had the following results.  The CPU was the same but the video board was an old Quadro 4000.  I include results for using the board in both WDDM and TCC driver mode.
Matlab CPU: 8.0 seconds
Matlab gpuArrays with WDDM: 5.1 seconds
ArrayFire with WDDM: 1.6 seconds
Matlab gpuArrays with TCC: 1.9 seconds
ArrayFire with TCC: 0.8 seconds

So the net speedup was 10X.  This testing indicates ArrayFire provides significant benefit over Matlab's gpuArrays, especially if you have to configure the board in WDDM mode in Windows (i.e., you only have one video card, which is driving the display as well).

I hope this helps.

-Eric
Reply all
Reply to author
Forward
0 new messages