Errror: Driveworks exception thrown: Cannot allocate cuda pitch memory

We are trying to integrate drivenet api from nvidia in autoware 1.14.0. The autoware build is working but shows the below error Driveworks exception thrown: Cannot allocate cuda pitch memory, bytes 2280618562400

terminate called after throwing an instance of ‘std::runtime_error’ what():DW Error DW_FAILURE executing DW function: dwImageStreamer_initialize(&m_streamerCPU2CUDA, &opencv_prop, DW_IMAGE_CUDA, m_sdk)

Environment setup:
Software Version = DRIVE OS Linux 5.1.6 and DriveWorks 2.2
Target Operating System = Linux
Hardware Platform = NVIDIA DRIVE™ AGX Xavier DevKit (E3550)
SDK Manager Version = 1.6.0.8170
Host Machine Version = Ubuntu 18.04
DRIVE_Software_10.0_Linux_OS_DRIVE_AGX_XAVIER

autoware version= v1.14.0
cuda version = 10.2

please help me!

Dear @kagitala.varalakshmi1,
Please post your DRIVE AGX Xavier related queries to DRIVE AGX Xavier General - NVIDIA Developer Forums to get attention.

I am moving to right forum now.

1 Like

Dear @kagitala.varalakshmi1,

exception thrown: Cannot allocate cuda pitch memory, bytes 2280618562400

The memory buffer size seems to be very high.

Hello @SivaRamaKrishnaNV sir

Yes Memory buffer is not enough ,how to avoid this error.

nvidia@capgemini:~$ cat /proc/meminfo
MemTotal: 32649200 kB
MemFree: 9328740 kB
MemAvailable: 18871804 kB
Buffers: 2658824 kB
Cached: 4846240 kB
SwapCached: 4828 kB
Active: 15404108 kB
Inactive: 3946616 kB
Active(anon): 10564788 kB
Inactive(anon): 1671676 kB
Active(file): 4839320 kB
Inactive(file): 2274940 kB
Unevictable: 32580 kB
Mlocked: 48 kB
SwapTotal: 2097148 kB
SwapFree: 2059772 kB
Dirty: 172 kB
Writeback: 0 kB
AnonPages: 11874144 kB
Mapped: 1136328 kB
Shmem: 398540 kB
KReclaimable: 2898212 kB
Slab: 3349312 kB
SReclaimable: 2898212 kB
SUnreclaim: 451100 kB
KernelStack: 46544 kB
PageTables: 142692 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 18421748 kB
Committed_AS: 30379624 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 116640 kB
VmallocChunk: 0 kB
Percpu: 19648 kB
HardwareCorrupted: 0 kB
AnonHugePages: 6144 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
FileHugePages: 0 kB
FilePmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 3751664 kB
DirectMap2M: 29569024 kB
DirectMap1G: 0 kB

Dear @kagitala.varalakshmi1,
You can not allocate more memory than the available. May I know the image buffer size you want to allocate?

We are trying to run a rosbag or mp4 file, iam trying to convert into from cpu image to cuda image using drivenet function dwImageStreamer_initialize(&m_streamerCPU2CUDA, &opencv_prop, DW_IMAGE_CUDA, m_sdk);
we get this error
exception thrown: Cannot allocate cuda pitch memory, bytes 2280618562400

Dear @kagitala.varalakshmi1,
May I know the resolution/size of of cpu image?

Hello @SivaRamaKrishnaNV

we tried with video file of resolution 3840x2160

Dear @kagitala.varalakshmi1,
Could you share the used opencv_prop struct values? You need to send frame by frame to CUDA for processing. Could you refer to steps in “Simple image streamer” sample to know how to create a CPU image buffer with specific size and send to CUDA using dwImageStreamer.

Hi @SivaRamaKrishnaNV

dwImageProperties opencv_prop;
opencv_prop.format = DW_IMAGE_FORMAT_RGB_UINT8_PLANAR;
opencv_prop.width = m_imageWidth;
opencv_prop.height = m_imageHeight;
opencv_prop.type = DW_IMAGE_CPU;
opencv_prop.memoryLayout = DW_IMAGE_MEMORY_TYPE_PITCH;

Dear @kagitala.varalakshmi1,
So the buffer you are trying to transfer via Image streamer is of size 3840 * 2160 * 3* 8 bits? Could you confirm that as it is not matching to the buffer size in error.

Hello @SivaRamaKrishnaNV

Yes. It is not matching with buffer size in error,

Dear @kagitala.varalakshmi1,
It could probably a bug in Driveworks 2.2. How about testing just with DW code with latest DW release for verification of dwImagestreamer pipeline in your use case.