public void AllocateDeviceMemory() { int fftWidth = width / 2 + 1; imgToTrackCplx = new CudaDeviceVariable <float2>(fftWidth * height); imgRefCplx = new CudaDeviceVariable <float2>(fftWidth * height); x = new CudaDeviceVariable <int>(1); y = new CudaDeviceVariable <int>(1); val = new CudaDeviceVariable <float>(1); bufferFFT = new CudaDeviceVariable <byte>(FFTBufferSize); int maxBufferSize = imgToTrackRotated.MaxIndexGetBufferHostSize(); maxBufferSize = Math.Max(maxBufferSize, imgToTrackRotated.MinMaxGetBufferHostSize()); buffer = new CudaDeviceVariable <byte>(maxBufferSize); forward.SetWorkArea(bufferFFT.DevicePointer); backward.SetWorkArea(bufferFFT.DevicePointer); memoryAllocated = true; }