How to associate the buffer (NvBuffer) to GPU space (CUDA)

Hello All:
After reading the 3.2.14.1.2. Importing memory objects : https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide/Graphics/nvsci_nvscibuf.html#wwconnect_header

The  the thing is : attached the NvBuffer region directly to the cuda Space. 
If the VIC has already convert the image format from YUV422 to RGB888 in the NvBuffer region,can we use cuda access the region without any copy functions?
Here is my code:

int main()
{
    NvBufferCreateEx(&dma_fd, &input_params);
    cudaExternalMemoryHandleDesc desc = {};
    desc.type = cudaExternalMemoryHandleTypeOpaqueFd;
    desc.handle.fd = dma_fd; //from the NvBuffer returned fd
    desc.size = 1920*1080*2; //make the space length
    desc.flags |= cudaExternalMemoryDedicated;

    cudaImportExternalMemory(&extMem, &desc);
    
    return 0;
}

The code is failed at runtime on XAVIER AGX. Could NvBuffer for cuda process?

thanks
edward

Hi,

The document is for the DRIVE platform.
For Jetson, you can find some examples in the MMAPI folder:

/usr/src/jetson_multimedia_api/samples/12_camera_v4l2_cuda/

Thanks.

Hello AastaLLL:
The sample seems in : /v4l2cuda/main.cpp func is : cudaStreamAttachMemAsync(NULL,ptr,0,cudaMemAttachGlobal);

ps : I have a pegasus agx,and running QNX+DriveOS. The thing is : functions and APIs containing IPC,Stream… can not be found inside the PDK docs. and it is really difficult to use DriveOS running on QNX.
How ask the questins from DriveOS?

thanks
edward

Hi,

Please file a new topic to the DRIVE board directly.

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.