Allocate page locked memory for output array in mex?

1 visualización (últimos 30 días)
Justin
Justin el 19 de Abr. de 2012
Comentada: James Tursa el 11 de Feb. de 2019
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.

Respuesta aceptada

James Lebak
James Lebak el 19 de Abr. de 2012
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 comentarios
Ander Biguri
Ander Biguri el 11 de Feb. de 2019
Is this still true in 2019?
James Tursa
James Tursa el 11 de Feb. de 2019
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by