Elasped time of CUDA Operations on egl image slowly increasing

Hi,

I used the function void HandleEGLImage(void *pEGLImage) in NvCudaProc.cpp to do CUDA operations on frames captured by CSI cameras, and found that the overhead time of this function is increasing slowly. It is about 1.5 ms at the beginning, then increases to 4.5 ms after 15 minutes, and 12ms after 40 minutes. After an hour test, it is so long that the camera start to drop frames. Is this what you expected? How to fix it? is it ok to move registering and unresgitering out of the loop? Thanks.

Before starting the test, I have run sudo /usr/bin/jetson_clocks to have maximum performance. Below is the modified function. I commented out the function for CUDA operations to measure the overhead time.

/**

  • Performs CUDA Operations on egl image.

  • @param image : EGL image
    */
    static void
    Handle_EGLImage(EGLImageKHR image)
    {
    CUresult status;
    CUeglFrame eglFrame;
    CUgraphicsResource pResource = NULL;

    cudaFree(0);
    status = cuGraphicsEGLRegisterImage(&pResource, image,
    CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
    if (status != CUDA_SUCCESS)
    {
    printf(“cuGraphicsEGLRegisterImage failed: %d, cuda process stop\n”,
    status);
    return;
    }

    status = cuGraphicsResourceGetMappedEglFrame(&eglFrame, pResource, 0, 0);
    if (status != CUDA_SUCCESS)
    {
    printf(“cuGraphicsSubResourceGetMappedArray failed\n”);
    }

    status = cuCtxSynchronize();
    if (status != CUDA_SUCCESS)
    {
    printf(“cuCtxSynchronize failed\n”);
    }

    if (eglFrame.frameType == CU_EGL_FRAME_TYPE_PITCH)
    {
    //Rect label in plan Y, you can replace this with any cuda algorithms.
    }

    status = cuCtxSynchronize();
    if (status != CUDA_SUCCESS)
    {
    printf(“cuCtxSynchronize failed after memcpy\n”);
    }

    status = cuGraphicsUnregisterResource(pResource);
    if (status != CUDA_SUCCESS)
    {
    printf(“cuGraphicsEGLUnRegisterResource failed: %d\n”, status);
    }
    }

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

I’m closing this topic due to there is no update from you for a period, assuming this issue was resolved.
If still need the support, please open a new topic. Thanks

Hi,

If you still need help with this, could you share a compilable source so we can reproduce it?
Thanks.