Since I am using cuda on matlab, I want to make the input pointer to be mapped memory.
Dose anybody know how?
For example:
void mexFunction(int nlhs, mxArray *plhs,int nrhs, const mxArray *prhs)
{
int m,n;
float *data1, *data2;
float *data2f;
float *data1f_gpu, *data2f_gpu;
const mwSize *dims;
m = mxGetM(prhs[0]);
n = mxGetN(prhs[0]);
dims = mxGetDimensions(prhs[0]);
plhs[0] = mxCreateNumericArray(2, dims, mxSINGLE_CLASS, mxREAL);
data2=(float *)mxGetData(plhs[0]);
data1=(float *)mxGetData(prhs[0]);
cudaSetDeviceFlags(cudaDeviceMapHost);
}
How can I set the data1 to be mapped memory?