Errors regarding run-time GPU encoder

2 vues (au cours des 30 derniers jours)
moh mor
moh mor le 20 Juin 2024
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

Réponse acceptée

Garmit Pant
Garmit Pant le 20 Juin 2024
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!

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with GPU Coder dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by