max function in gpu error
3 次查看(过去 30 天)
显示 更早的评论
hello,
I want to use max function in arrayfun function.
I'm not familiar with using matlab in gpu.
My function is
[ maxv , dtree ]= arrayfun(@ GetRandomDecisionTree, rand_vec , rand_label , ClaNum , RandFnum , RandTnum , MinSampleNum , MaxDepth ) ;
and in GetRandomDecisionTree function
function [ DTreeMaxVec DTrees ] = GetRandomDecisionTree( Vec , ClaLabel , ClaNum , RandFnum , RandTnum , MinSampleNum , MaxDepth )
DTreeMaxVec = max(Vec);
end
Vec is matrix 50 * 500 size
but this code has error "Too few arguments supplied to: 'max'. (One supplied, two required.) "
I just want to get DTreeMaxVec 1*500 size, I don't want to use max(a,b).
help me please!
0 个评论
回答(2 个)
Edric Ellis
2015-9-1
On the GPU, arrayfun supports only the elementwise version of min and max - i.e. the two input argument case. In this case, I think you'll need to call max outside your arrayfun invocation.
0 个评论
Walter Roberson
2015-8-30
Which MATLAB release are you using? Before R2011b there were more limitations on gpu functions
2 个评论
Walter Roberson
2015-8-31
gpu arrays must be numeric or logical, not structures. However a structure (not on the GPU) may contain a gpu array object.
I do not seem to find any documentation about max on GPU.
另请参阅
类别
在 Help Center 和 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!