Error (batch_jpeg_enc): Transformation of CUDA_DEVICE memory on different GPUs is not allowed

Description: I’m encountering a GPU memory transformation error when using the nvds_obj_enc_process function in my DeepStream application:

Error (batch_jpeg_enc): Transformation of CUDA_DEVICE memory on different gpus is not allowed. Please use either UNIFIED or PINNED memory for the transformation or do the transformation on the same gpus.

Code Context:

I use a buffer probe on the pad of nvosd.
Following along the lines of
\opt\nvidia\deepstream\deepstream\sources\apps\sample_apps\deepstream-image-meta-test\deepstream_image_meta_test.c

NvDsObjEncUsrArgs objData = {0};
objData.saveImg = TRUE;
objData.attachUsrMeta = TRUE;
objData.scaleImg = FALSE;
objData.scaledWidth = 0;
objData.scaledHeight = 0;
objData.objNum = 1;
objData.quality = 80;
objData.calcEncodeTime = TRUE;

nvds_obj_enc_process(ctx, &objData, ip_surf, obj_meta, frame_meta);

Environment:

  • Hardware Platform: GPU
  • DeepStream Version: 7.1
  • JetPack Version: Not applicable (using GPU)
  • TensorRT Version: Not specified
  • NVIDIA GPU Driver Version: 560.35.03
  • CUDA Version: 12.6

Issue Type: Bug

How to Reproduce the Issue:

  1. Use the nvds_obj_enc_process function in a DeepStream application.
  2. Configure the NvDsObjEncUsrArgs structure as shown in the code context

Question: How can I configure the nvds_obj_enc_process function or the NvDsObjEncUsrArgs structure to use UNIFIED or PINNED memory instead of CUDA_DEVICE memory? Is there a parameter I’m missing, or do I need to modify the input buffer surface memory type before calling the encoding function?

I only use on GPU with gpu_id=0

Any guidance on resolving this GPU memory transformation issue would be greatly appreciated.

Do you have multiple GPUs on your system? You can try to set CUDA_VISIBLE_DEVICES=gpu_id_which_you_want_to_use ./your_program

This is usually related to other elements in the pipeline. Can you share your pipeline?

1 Like

x.pdf (31.2 KB)
Here is the pipeline. There is only one GPU.

There is no problem with the pipeline. This problem is usually caused by incorrect configuration of gpu-id. Can you share sample code to reproduce the problem? Or can deepstream_image_meta_test reproduce the problem?