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!