gpu arrayfun don't support linspace or NaN array

4 ビュー (過去 30 日間)
liu jibao
liu jibao 2022 年 11 月 4 日
コメント済み: liu jibao 2022 年 11 月 9 日
example code is:
gn = rand(1000,"gpuArray")/100 + 0.995;
offs = rand(1000,"gpuArray")/50 - 0.01;
meas = ones(1000)*3; % 1000-by-1000 matrix
corrected = arrayfun(@MC_OceanLidar_sub,meas,gn,offs);
results = gather(corrected);
function c = test(rawdata, gain, offset)
layer=1:0.2:100;
c = (rawdata .* gain) + offset + max(layer);
end
the error message is:
Function passed as first input argument contains unsupported or unknown function 'test'.
or
function c = test(rawdata, gain, offset)
layer=NaN(10000,1,'single');
c = (rawdata .* gain) + offset + max(layer);
end
the error message is :
Size inputs are not supported when using 'NaN'. Input to 'NaN' must be a valid class specification such as 'single' or 'double', or the
word 'like' followed by a prototype argument.

回答 (1 件)

Joss Knight
Joss Knight 2022 年 11 月 5 日
You cannot create an array inside a call to GPU arrayfun, only scalars.
  1 件のコメント
liu jibao
liu jibao 2022 年 11 月 9 日
Thanks, I got it!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGPU Computing in MATLAB についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by