Does GPU coder have only one output?

6 次查看(过去 30 天)
I'm changing a function into mex file with GPU coder, and I have a problem while I using the GPU coder.
I want to get two matrices; D, N as the output of fcn_DH.
When I executed GPU coder with a code below, Running test file with MEX is not terminated, thus I cannot make MEX file.
However, When I changed the first line of the function into 'D = fcn_PRM(node,PosMap)', which has only one output, the GPU coder worked fine.
I'm wondering if I can apply the GPU coder to a function and only get one variable as a result.
Otherwise, if GPU coder can multiple outputs, I want to know which part of my code is wrong.
function [D,N] = fcn_PRM(node,PosMap)
n = length(node);
D = coder.nullcopy(zeros(n,n,2));
N = coder.nullcopy(zeros(n,n));
for i=1:n-1
for j=i+1:n
B = collisionCheck_SP5(PosMap(node(i),:), PosMap(node(j),:));
D(i,j,1) = dist;
N(i,j) = B;
  6 个评论
lim daehee
lim daehee 2019-11-25
Hello Parvin,
Thank you for your continuous help.
In my case, the entry-point function is the main code, which starts with loading the dlite_small.mat file. I followed all procedures of GPU coder app on documentation you send to me. However, GPU coder app does not complete at a certain stage on attached figure.
Also, I don't understand why are you cannot accessible to "dlite_small.mat"file. I just confirmed that all files and codes are work well on my computer now. So I attach dlite_small.mat and all codes.
Thanks for your help.



Pravin Jagtap
Pravin Jagtap 2019-11-25
Hello Lim,
After analyzing the code, It is clear that you are not able to generate ‘MEX’ because the ‘%#codegendirective is missing in the function definition at beginning. To generate the ‘MEX’ please add the ‘%#codegen’ directive as shown below at the starting of the Entry-Point function:
function [D,N] = fcn_PRM(node_PRM,PosMap) %#codegen
Also, make sure that the same function is getting called in the ‘Define Input Type’ stage.
Kind Regards
  3 个评论
lim daehee
lim daehee 2019-11-27
编辑:lim daehee 2019-11-27
Hello Parvin,
I always thanks to you for your help and I have a question about your reply.
Is the matrix size can cause the increase of calculation time?
The map data which I gave you is smaller one.. actual map size is 1701*1701*11 double and size of 'node' is 1900.
If my problem is caused by the size of the map data matrix, I want to know the maximum size of matrix that GPU coder can work properly.
Also, I know that GPU coder don't create kernel for indexing of matrix, is that right?
Plus, I realized that my problem is caused by data size of array N. The data size of N is 576kb. I wonder why the size of array cause the increase of calculation time.
Also, I wonder both maximum size of array and maximum data size of array that GPU coder can work properly.


更多回答(0 个)


Help CenterFile Exchange 中查找有关 Get Started with GPU Coder 的更多信息




Community Treasure Hunt

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

Start Hunting!

Translated by