GFOR question

[Old posts from the commercial version of ArrayFire] Discussion of ArrayFire using CUDA or OpenCL.

Moderator: pavanky

GFOR question

Postby melonakos » Fri Jul 23, 2010 2:18 pm

One Jacket programmer just emailed the following to us:

I have a small test program I wrote to test the speedup of using the GPU and Jacket functions, and when making a program like this:

Code: Select all
N=4000;
Nepoch=180;
tic
A=gzeros(N,Nepoch);
gfor k=1:N
    A(k,:)=k;
gend

gfor k=1:Nepoch
    A(:,k)=A(:,k)+k;
gend
B=fft(A);
timegpu1=toc


Is the
Code: Select all
B=fft(A);
statement still done on the GPU since there isn't a MATLAB function before it to cast it back to the CPU or does the GEND statement cast everything after it back to the CPU?


Thanks for the question. GEND does not do any casting at all. The only purpose of GEND is to mark the end of the GFOR loop. So, yes, the
Code: Select all
B=fft(A);
statement is done on the GPU.

Best,

John
John Melonakos (john@arrayfire.com)
User avatar
melonakos
 
Posts: 503
Joined: Tue Jun 10, 2008 9:49 am

Return to [archive-commercial] Programming & Development with ArrayFire

cron