Allocate page locked memory for output array in mex?

조회 수: 1 (최근 30일)
Justin
Justin 2012년 4월 19일
댓글: James Tursa 2019년 2월 11일
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.

채택된 답변

James Lebak
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
Ander Biguri
Ander Biguri 2019년 2월 11일
Is this still true in 2019?
James Tursa
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 CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by