GPUArray ANDs and ORs
이전 댓글 표시
First off, I am very satisfied with matlab's ability to leverage the GPU for parellel computing. It makes so many functions and calculations faster (usually about 3-5x faster). With the pre-release and release of MATLAB 2011a, they have added even more functionality for use with GPUArrays. One troubling thing is there seems to be no support for the "and" and "or" operators on GPUArrays.
To get around this, one could gather their GPUArray each time they would like to run a logical AND or OR. This represents a slow down in performance over using non-distrubuted arrays, and requires a re-write (albeit small) of many the existing functions that I have to handle GPUArrays. There is also a clever way to perform the "AND" and "OR" operators using concatanation and the "all" or "any" functions. I have written two short functions to do so
function obj = and(A,B)
nD = ndims(A)+1;
obj = all(cat(nD,A,B),nD);
return
function obj = or2(A,B)
nD = ndims(A)+1;
obj = any(cat(nD,A,B),nD);
return
Is there away to define the method "AND" and "OR" for an existing class type of parallel.gpu.GPUArray?
Any help or insight would me much appreciated.
채택된 답변
추가 답변 (1개)
Jill Reese
2011년 7월 29일
0 개 추천
Hi Jonathan, if your MATLAB license is up to date you might like to have a look at the pre-release of R2011b which is now available. This includes a number of updates to the GPU features. It can be downloaded by logging in to the main www.mathworks.com page.
카테고리
도움말 센터 및 File Exchange에서 GPU Computing in MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!