Errors regarding run-time GPU encoder

조회 수: 2 (최근 30일)
moh mor
moh mor 2024년 6월 20일
답변: Garmit Pant 2024년 6월 20일
Hello, I am trying to convert my function from "MATLAB" form to "cuda" form. So, I used GPU coder in the MATLAB. This is my first time trying to perform this task. Therefore, I faced with the following errors during the "run-time check":
None of above errors get appeared during a normal run. I've uploaded the orinigal function and test file in the attachment.
Any help would be appreciated.
Thank you

채택된 답변

Garmit Pant
Garmit Pant 2024년 6월 20일
Hello moh mor
To address the errors and to modify your MATLAB code for compatibility with GPU Coder for code generation, you need to ensure that all operations are supported for GPU execution and that the data types and allocations are GPU compatible. Here are some adjustments and considerations:
  • Preallocate Arrays: Arrays need to have memory pre-allocated to them and can undergo manipulation and not change of size. For example, in the following code snippet, ‘expT’ has been initialised as an empty array but is being assigned a matrix of size [15 x 16 x 2916].
expT = cat(2,expT,expT2(:,:,:,i));
Determine the size of array and pre-allocate the memory.
  • Use GPU-Compatible Functions: Verify that all functions used are compatible with GPU Coder. The “save” function is not supported by GPU Coder.
  • Change the function definition: Since the function is not returning any value, you can change the definition as follows.
function BPmimo2C(Efield) %#codegen
Kindly modify your code by following the above guidelines and run the conversion to resolve the issue.
I hope you find the above explanation and suggestions useful!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with GPU Coder에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by