NPP with Driver API Driver API NPP

I’m still new with the NPP library. I’m trying to find min/max of an array already stored in the device memory.

CUdeviceptr GPUPtr_MinMaxArr;

cutilDrvSafeCall(cuMemAlloc(&GPUPtr_MinMaxArr,ArraySize));

//// Do something to fill the array using an existing kernel

int BufferSize;

nppsMinMaxGetBufferSize_32f(ArraySize,&BufferSize);

Npp8u *pScratch = nppsMalloc_8u(BufferSize);

Npp32f* DataPtr=(float*)GPUPtr_MinMaxArr;

Npp32f Min=0;

Npp32f Max=0;

NppStatus ErrorCode=nppsMinMax_32f(DataPtr,TotalNumberofThreads*2,&Min,&Max,pScratch);

There is no error. So ErrorCode=NPP_SUCCESS . No Change happen to Min and Max (still with their initial values) ! and

cutilDrvSafeCall(cuMemFree(GPUPtr_MinMaxArr));

cuSafeCallNoSync() Driver API error = 0700 “CUDA_ERROR_INVALID_VALUE”

Anyone know what I’m doing wrong?

I’m using CUDA 4.0.

Thanks,