kunzmi / managedCuda

ManagedCUDA aims an easy integration of NVidia's CUDA in .net applications written in C#, Visual Basic or any other .net language.
Other
440 stars 79 forks source link

What's the proper way to use NPPImage_*.Sum()? #72

Closed hillin closed 5 years ago

hillin commented 5 years ago

NPPImage_*.Sum() expects a CudaDeviceVariable as parameter. However the following code does not work:

var nppImage = SomeCodeLoadsAnImage();
var deviceSum = new CudaDeviceVariable<long>(1);
nppImage.Sum(deviceSum);

var sumData = new long[1];
deviceSum.CopyToHost(sumData);

var sum = sumData[0];

An exception will be thrown in the Sum() call:

ManagedCuda.NPP.NPPException: 'CudaKernelExecutionError: '

CUDA version 10.0.130 managedCuda version 10.0.31 (from NUGET)

hillin commented 5 years ago

Nevermind it seems there is something wrong with the image.