1

Currently, I am working with ILGPU library. As I mentioned in the title briefly, I would like to go through the cameraSpacePoints and check whether the value is valid (if not infinity), if valid store the point in the Arrayview, as the code below.

However the kinect APIs (for e.g. new CameraSpacePoint[depthWidth * depthHeight] )can not be used in a kernel. So how can the below code actually work on GPU?

static void gpu_kernel(Index index,int depthWidth,int depthHeight, ArrayView<CameraSpacePoint> dataView)
    {
        CameraSpacePoint[] cameraSpacePoints
        cameraSpacePoints = new CameraSpacePoint[depthWidth * depthHeight];

        for (int i = 0; i < depthWidth*depthHeight; i++)
        {
            if (!(XMath.IsInfinity(cameraSpacePoints[i].X)))
            {

                dataView[i] =  cameraSpacePoints[i];
            }
        } 
    }
Joe
  • 135
  • 7
  • In your example, you're checking the contents of cameraSpacePoints which you just created meaning all values are going to be zero anyway. are you hoping to pass an already populated CameraSpacePoint array to the kernel? if so you'd just have to copy the contents into a normal array type like float[] – LampToast Oct 18 '19 at 13:49

0 Answers0