Allocate page locked memory for output array in mex?
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have something like this:
plhs[0] = mxCreateDoubleMatrix(ref_row, ref_col, mxREAL);
I would like to know if it's possible to replace this function with a cudaHostAlloc function instead. Thanks.
0 个评论
采纳的回答
James Lebak
2012-4-19
Justin,
Unfortunately this isn't possible in MATLAB today. The function mxCreateDoubleMatrix returns an mxArray, not a raw pointer, and mxArrays that get returned to MATLAB need to be freed by MATLAB.
3 个评论
James Tursa
2019-2-11
MATLAB still needs to allocate its own memory for mxArray variables. Within a mex routine, that means using API functions or call backs into other MATLAB functions.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 GPU Computing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!