Linux X11 with CUDA

Hi all.

I am working on code that read image from camera - add layer over it and dispaly it on the screen.

The System is jetson nano, using the x11-server

I use X11 lib for rendrenig image on screen.

I am using c cuda library and nvcc as the compiler

Here is my compiling string:

“nvcc -g -o SBPipe …sources… -lX11 -lxcb -lXau -lXdmcp -lpthread -ljpeg -lasound -ldl -lpng”

I recive Error code 719,

Or app crash.

Here is the scemtic code:

  • I receive camera frame into byte array.
  • I have the layer as CUDA manged array (cudaMallocManaged)
  • I cudaMemcpy the frame to another cudaManaged array.
  • I run Add layer function – Device function .
  • Wait with cudaDeviceSynchronize();
  • cudaMemcpy the results back to camera frame byte array
  • Use
    XLockDisplay(videoOut.dis);

videoOut.ximage = ximage;

XunlockDisplay(videoOut.dis);
To render frame on screen.

Here is Code Example:

*uint8_t tempBuffer = NULL;

//Create cuda Managed tempBuffer

cudaMallocManaged(&tempBuffer, videoIn.width * videoIn.height * 4);// Frame diamention – 4 //bytes per pixel.

//Copy frame data to tempBuffer.

cudaError_t t = cudaMemcpy(tempBuffer, ximage->data, videoIn.width * videoIn.height * 4, cudaMemcpyHostToDevice);

printf(“cudaMemcpy 1 error code: %d \n”, t);

//Run Add layer function

int blockSize = 256;

int numBlocks = (tmp.Size + blockSize - 1) / blockSize;

AddLayerCuda<<<1, blockSize>>>(tempBuffer, tmp.layer, tmp.Width, tmp.Height,

tmp.Size, ximage->width, ximage->height, 10,

10);

// Wait for GPU to finish before accessing on host

t = cudaDeviceSynchronize();

printf(“cudaDeviceSynchronize error code: %d \n”, t);

//Copy back tempBuffer to frame byte array

t = cudaMemcpy(ximage->data, tempBuffer, videoIn.width * videoIn.height * 4, cudaMemcpyDeviceToHost);

All of cuda error above are

cudaDeviceSynchronize error code: 719

cudaMemcpy error code: 719

//Render on screen

XLockDisplay(videoOut.dis);

videoOut.ximage = ximage;

XunlockDisplay(videoOut.dis);

Could you please advise me what is the problem? Thank you!

Hello @elyasaf and welcome to the NVIDIA developer forums!

If you don’t mind, I will refer you to the Jetson experts who can surely help you solve your issue.

Alternatively you might also check out our CUDA specific forum categories.

Best of success with your project!

1 Like

Hi,

Here is the information for error code 719.

https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g3f51e3575c2178246db0a94a430e0038

cudaErrorLaunchFailure = 719

An exception occurred on the device while executing a kernel. Common causes include dereferencing an invalid device pointer and accessing out of bounds shared memory. Less common cases can be system specific - more information about these cases can be found in the system specific user guide. This leaves the process in an inconsistent state and any further CUDA work will return the same error. To continue using CUDA, the process must be terminated and relaunched.

Thanks.

1 Like

Yes, Please.

Thanks.

Thanks
I checked this function without CUDA , and no out of bounds shared memory. happens.
I will check bound again.
Thanks

Thanks All!

I Find the bug.
It was a memory out of bounds
(in my AddLayerCuda function…)
Thanks

Thanks for the feedback.
Good to know you find the cause.

1 Like

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