I have to preface this by saying that I have never worked with the Matlab mex interface before, however....
What is clearly happening is that there is a mismatch in size between what mxGPUGetDimensions
is returning, and what you code is using for mwSize
. The result you get [5, 0, 6, 0] is actually [5,6] if the return values were 64 bit integers (size_t on a 64 bit platform for example), rather than 32 bit. The Matlab documentation for mwSize
says the following:
By default, mwSize is equivalent to int in C. When using the mex -largeArrayDims switch, mwSize is equivalent to size_t in C.
Because I know absolutely nothing about Matlab, I can't tell you how to fix this beyond (a) making sure that your compiler/toolchain is building 64 bit code, and (b) try using that largeArrayDims
option.
If none of that works, I would suggest contacting Mathworks support. Something is clearly broken in either your build environment or Matlab itself.