Run function on GPU, Matlab 2011a

조회 수: 7 (최근 30일)
Michael
Michael 2011년 7월 5일
Hi,
I saw that one can run matlab function on the GPU in Matlab 2011a. In the introductory video they run the function phaseangle(gx,gy), where gx and gy are matrices on the GPU, then these can be speed up by using arrayfun(@phaseangle, gx, gy). which implies that the function phaseangle is run for each element in gx and gy
Now, I not only have a function(x,y) with two input arguments, but I have a function with arguments function(x,y, parameter). Can I somehow run this on the GPU as I can build matrices for my arguments x,y but parameter is supposed to be the same for all x,y.... Thanks a lot.

채택된 답변

John Melonakos
John Melonakos 2011년 7월 24일
Jacket's GCOMPILE/ARRAYFUN functions will get you what you want. Check it out here: http://wiki.accelereyes.com/wiki/index.php/GCOMPILE_Usage

추가 답변 (1개)

Edric Ellis
Edric Ellis 2011년 7월 6일
Yes, you can do that. The GPU variant of arrayfun has been slightly expanded from the standard MATLAB version to allow scalar expansion. This is mentioned in the doc:
  댓글 수: 2
Michael
Michael 2011년 7월 6일
Thanks for the answer. I guess maybe I wasn't quite clear. In fact I need to pass over another large matrix to the GPU which needs to be used for evaluating the function at each x and y. The doc seems to say that if I pass a matrices X,Y,over to the GPU, then the code run X(i,j), Y(i,j). But I have an additional matrix Z that I need to pass to the GPU and in the for each i, j the entire matrix Z needs to be used, not just element Z(i,j). Is that possible somehow? Thanks.
Edric Ellis
Edric Ellis 2011년 7월 7일
Unfortunately, I think not - arrayfun deals only with scalar elements.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by