Convert yuv420p to bgr24 with 2560x1440 camera, CUDA error 700

cuda_tools.cu.txt (3.8 KB)
it works well with 1920x1080 cameras,but it got cuda error with 2560x1440 cameras.

error message:

what should i do next?

Hi,

Error 700 indicates cudaErrorIllegalAddress:
https://docs.nvidia.com/cuda/archive/10.2/cuda-runtime-api/group__CUDART__TYPES.html#group__CUDART__TYPES_1g3f51e3575c2178246db0a94a430e0038

cudaErrorIllegalAddress = 700
The device encountered a load or store instruction on an invalid memory address. 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.

thank you for your time and attention in this matter. however, it makes me confused when it works well with 1920x1080 cameras. and I want to know ‘Why’

Hi,

It is an invalid memory address error which is related to the data resolution/size.
So you might check if the buffer size is set with 2560x1440 correctly.

Thanks.

oh ,thank you for your sugestion, I test it in a simple way:

int width = 1920;
int height = 1080;
cv::Mat img = cv::Mat::zeros(height, width, CV_8UC3);
size_t size = height * width * sizeof(uchar) * 3;
uchar *yuv_buffer = (uchar *)malloc(size);
memset(yuv_buffer, 0, size);
uchar *d_yuv;
CUDA_CHECK(cudaMalloc((void **)&d_yuv, size));
CUDA_CHECK(cudaMemset(d_yuv, 0, size));
uchar *d_src;
CUDA_CHECK(cudaMalloc((void **)&d_src, size));
CUDA_CHECK(cudaMemset(d_src, 0, size));
CUDA_CHECK(cudaMemcpy(d_yuv, yuv_buffer, size, cudaMemcpyHostToDevice)); // CUDA error 700
gpuConvertYUV420ptoBGR24(d_yuv, d_src, width, height);
CUDA_CHECK(cudaMemcpy(img.data, d_src, size, cudaMemcpyDeviceToHost));
char out_tag_pic[1024];
std::string time_str = get_time_str();
sprintf(out_tag_pic, "%s.jpg", time_str.c_str());
cv::imwrite(out_tag_pic, img);

free(yuv_buffer);
CUDA_CHECK(cudaFree(d_yuv));
CUDA_CHECK(cudaFree(d_src));

if I set width=1920 and height = 1080, a green image comes out , it’s ok.
but if I set width=2560 and height = 1440, it got ‘CUDA error 700’ at the line ‘cudaMemcpy(d_yuv, yuv_buffer, size, cudaMemcpyHostToDevice)’.

Hi,

Could you do a test if this issue comes from the yuv_buffer?
For example, allocate another host buffer with 2560x1440 and apply memcpy to see if any error.

Thanks.

“memcpy” is ok.

I find another issue ,when I try to use “cuda-memcheck ./algorihtm |more” to help me figue the bug out.
it always comes out:

========= CUDA-MEMCHECK
CUDA error 46========= Program hit cudaErrorDevicesUnavailable (error 46) due to “all CUDA-capable devices are busy or unavailable” on CUDA API call to cudaM
alloc.
========= Saved host backtrace up to driver entry point at error
========= Host Frame:/usr/lib/aarch64-linux-gnu/tegra/libcuda.so.1 [0x32081c]
========= Host Frame:/usr/local/cuda-10.2/lib64/libcudart.so.10.2 (cudaMalloc + 0x144) [0x3b7bc]
========= Host Frame:./algorihtm [0x2dd0]
========= Host Frame:/lib/aarch64-linux-gnu/libc.so.6 (__libc_start_main + 0xe0) [0x207a0]
========= Host Frame:./algorihtm [0x373c]

is that a problem? or “cuda-memcheck” can’t be used at jetson nx.

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Hi,

Since profiler need to be executed with root authority, do you run it with sudo?
Thanks.

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