Ejemplo n.º 1
0
void verifyRetrievedPointers(mxGPUArray const *Aval, mxGPUArray const *rowInd, mxGPUArray const *colInd, mxGPUArray const *b){
	// Verify that Aval, rowInd, colInd and b really are double array before extracting the pointer.
    if (mxGPUGetClassID(Aval) != mxDOUBLE_CLASS) {
		cudaDeviceReset();
		const char * errMsg = "Invalid Input argument: Aval is not a double array";
        mexErrMsgIdAndTxt(errId, errMsg); // errMsg
    }
	if (mxGPUGetClassID(rowInd) != mxINT32_CLASS) {
		cudaDeviceReset();
        mexErrMsgIdAndTxt(errId, "Invalid Input argument: rowInd is not a mxINT32_CLASS array, it is %d\n", mxGPUGetClassID(rowInd)); // errMsg
    }
	if (mxGPUGetClassID(colInd) != mxINT32_CLASS) {
		cudaDeviceReset();
		const char * errMsg = "Invalid Input argument: colInd is not a mxINT32_CLASS array";
        mexErrMsgIdAndTxt(errId, errMsg);
    }
	if (mxGPUGetClassID(b) != mxDOUBLE_CLASS) {
		cudaDeviceReset();
		const char * errMsg = "Invalid Input argument: b is not a double array";
        mexErrMsgIdAndTxt(errId, errMsg);
    }
}
///////////////////////////////////////////////////////////////////////////
// Return true if gpuArray data is UINT8 
///////////////////////////////////////////////////////////////////////////
boolean_T isGPUDataUINT8(const mxArray * in)
{

    // Get the underlying data type the gpuArray
    const mxGPUArray * img = mxGPUCreateFromMxArray(in);

    boolean_T isUINT8 = mxGPUGetClassID(img) == mxUINT8_CLASS;

    // Clean up gpuArray header
    mxGPUDestroyGPUArray(img);

    return isUINT8;
}