Why can't I use gpuArray in Simulink?

5 ビュー (過去 30 日間)
Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja 2018 年 4 月 10 日
コメント済み: Joss Knight 2018 年 4 月 15 日
Hello!
I am trying to use gpuArrays in a MATLAB function block inside my Simulink Model. It is throwing the following error,
Undefined function or variable 'gpuArray'.
Function 'Signal Generation/IQ Signal Generation (Simulation)/GenerateTxSignals/Build Transmitter Signals/MATLAB Function' (#1183.3137.3156), line 86, column 26:
"gpuArray(SigSource)"
I was trying to convert an existing Array into a GPU Array,
SigSource = gpuArray(SigSource);
Is it not possible to use gpuArray inside a MATLAB function block?
Other Details,
  • MATLAB Version: 2017a
  • Driver Version: '23.21.13.9133 (391.33)'
  • Parallel Computing Toolbox Version 6.10 (R2017a)

採用された回答

Bhavanithya Thiraviaraja
Bhavanithya Thiraviaraja 2018 年 4 月 13 日
Declaring coder.extrinsic('gpuArray') before calling the function solves the issue. However, it should be noted that there is no code Generation for this function as it is declared extrinsic.
  2 件のコメント
Joss Knight
Joss Knight 2018 年 4 月 15 日
This certainly should be possible and sounds like a bug. Can you provide an example model that reproduces this issue?
Joss Knight
Joss Knight 2018 年 4 月 15 日
Oh, I think I understand - this is an Embedded MATLAB function block, presumably. Since gpuArray is not supported for code generation (unless you have GPU Coder), this error is expected. gpuArray will work inside an ordinary MATLAB function block.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by