Path: news.mathworks.com!not-for-mail
From: "Christian " <proechri@umich.edu>
Newsgroups: comp.soft-sys.matlab
Subject: Re: histc for gpu
Date: Fri, 7 Mar 2014 14:44:12 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 46
Message-ID: <lfclvs$cei$1@newscl01ah.mathworks.com>
References: <lc1a97$6tt$1@newscl01ah.mathworks.com> <ytweh2y9q0d.fsf@uk-eellis-deb7-64.dhcp.mathworks.com>
Reply-To: "Christian " <proechri@umich.edu>
NNTP-Posting-Host: rubyext-03-ls.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1394203452 12754 172.20.102.179 (7 Mar 2014 14:44:12 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 7 Mar 2014 14:44:12 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3858030
Xref: news.mathworks.com comp.soft-sys.matlab:810436

Hi Edric,

I'm using Matlab 2013b, so not sure why it doesn't work. I just discovered another part of my algorithm that could benefit from histc. So having a gpu version of it would be great. 
Christian

Edric M Ellis <eellis@mathworks.com> wrote in message <ytweh2y9q0d.fsf@uk-eellis-deb7-64.dhcp.mathworks.com>...
> "Christian " <proechri@umich.edu> writes:
> 
> >> [...]
> >
> > Thanks, Edric. I have some trouble getting your code running. I've set up a function file:
> >
> >    function b = bindata(x,edges)
> >        nEdges = 100;
> >        b = 0;
> >        if x == edges(end)
> >            b = nEdges;
> >        else
> >            for idx = 1:(nEdges-1)
> >                if x >= edges(idx) && x < edges(idx + 1)
> >                    b = idx;
> >                    break;
> >                end
> >            end
> >        end
> >    end
> >
> > I changed nEdges=numel(edges) to just the size of edges because the
> > arrayfun command didn't like numel. But still when running the code
> > from my main file using
> >
> > indx = arrayfun(@bindata, xpgpu, x_gridgpu);
> >
> > I receive the message
> > Error using gpuArray/arrayfun
> > Indexing is not supported.
> > for lines 4 and 8. 
> 
> Which version of MATLAB/PCT are you using? You need at least R2013a to
> use indexing within ARRAYFUN. See
> 
> http://www.mathworks.co.uk/help/distcomp/release-notes.html
> 
> Cheers,
> 
> Edric.