I don't know about the CUDA stuff, but you have a basic mismatch of types in your C code. E.g.,
v = ones(100,1);
The above creates a double matrix at the MATLAB level.
_global_ void incrementa(int *x) {
for(int i=1; i<100; i++)
x[i] = x[i]++;
}
The above increment routine expects a pointer to int.
x = (int*)mxGetData(prhs[0]);
The above line get a pointer to the input data as an int*, even though the input data is actually double.
plhs[0] = mxCreateNumericArray(2, outDims, mxDOUBLE_CLASS, mxREAL);
Y = (int*)mxGetData( plhs[0] );
The above lines specifically create a double matrix, but you use an int* to get at the data.
So anything you do with this code will be hosed up as you are mixing int* with double data.
