Does GPU coder have only one output?
이전 댓글 표시
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));
len=(1:n)';
pos_mat=PosMap(node(len),:);
coder.gpu.kernel;
for i=1:n-1
for j=i+1:n
dist=sqrt((pos_mat(i,1)-pos_mat(j,1))^2+(pos_mat(i,2)-pos_mat(j,2))^2+(pos_mat(i,3)-pos_mat(j,3))^2);
B = collisionCheck_SP5(PosMap(node(i),:), PosMap(node(j),:));
D(i,j,1) = dist;
N(i,j) = B;
end
end
댓글 수: 6
Pravin Jagtap
2019년 11월 25일
Hello Lim,
It would be helpful if you provide the test file? You can consider the sample data set for 'node', 'PosMap'.
lim daehee
2019년 11월 25일
Pravin Jagtap
2019년 11월 25일
Hello Lim,
I am not able to reproduce the error because the 'collisionCheck_SP5' variable which you used in the 'fcn_PRM' function is not recognized.
Also, provide the caller MATALB file which you used for generating the MEX which will help in debugging the issue.
~Pravin
lim daehee
2019년 11월 25일
편집: lim daehee
2019년 11월 25일
Pravin Jagtap
2019년 11월 25일
Hello Lim,
Refer to following documentation to understand GPU coder workflow:
For code generation, we need to define 'primary' function which is 'fcn_PRM' in your case and 'entry-point function' which is used for the defining the input variables.
Still earlier issue persists since you are loading the data from ''dlite_small.mat'' which is not accessible to me. Also, please verify the code and provide all the necessary inputs for reproducing the error by executing the code.
lim daehee
2019년 11월 25일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File 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!