NVIDIA / cuda-samples

Samples for CUDA Developers which demonstrates features in CUDA Toolkit
Other
6.55k stars 1.85k forks source link

nvJPEG_encode failed with image on size 8500*5667 on cuda10.2 #41

Open xvjinkun opened 4 years ago

xvjinkun commented 4 years ago

I build cuda samples install by cuda installer,then I build nvJPEG_encode success on my platform: Driver 440.82 CUDA Version:10.2,I run success by call: ./nvJPEG_encoder -i src/ -o out/ -q 100 -s 420 -fmt rgbi I had test several image success,then I test a image with size[8500*5667],call: ./nvJPEG_encoder -i src/ -o out/ -q 100 -s 420 -fmt rgbi then abort, then I modify code print mem alloc/free msg:

`int dev_malloc(void **p, size_t s) {

int ret = (int)cudaMalloc(p, s); printf("cudaMalloc %d ret=%d\n",s,ret); return ret; } int dev_free(void *p) { int ret = (int)cudaFree(p); printf("cudaFree %p ret=%d\n",p,ret); return ret; }`

then I build program then run with this message:

` [root@localhost nvJPEG_encoder]# ./nvJPEG_encoder -i scale/ -o out/ -q 100 -s 420 -fmt rgbi GPU Device 0: "Pascal" with compute capability 6.1

Using GPU 0 (GeForce GTX 1080, 20 SMs, 2048 th/SM max, CC 6.1, ECC off) cudaMalloc 16777216 ret=0 cudaMalloc 16384 ret=0 cudaMalloc 1024 ret=0 cudaMalloc 1024 ret=0 Processing file: scale/yl1-scale.jpg Image is 3 channels. Channel #0 size: 8501 x 5668 Channel #1 size: 8501 x 5668 Channel #2 size: 8501 x 5668 YUV 4:4:4 chroma subsampling cudaMalloc 435338240 ret=0 cudaMalloc 145044480 ret=0 cudaMalloc 73431040 ret=0 cudaMalloc 885701632 ret=0 cudaFree 0x7ff55e800000 ret=0 cudaMalloc 24094720 ret=0 CUDA error at nvJPEG_encoder.cpp:258 code=6(NVJPEG_STATUS_EXECUTION_FAILED) "nvjpegEncodeRetrieveBitstream( nvjpeg_handle, encoder_state, obuffer.data(), &length, NULL)" [root@localhost nvJPEG_encoder]# ./nvJPEG_encoder -i scale/ -o out/ -q 100 -s 420 GPU Device 0: "Pascal" with compute capability 6.1

Using GPU 0 (GeForce GTX 1080, 20 SMs, 2048 th/SM max, CC 6.1, ECC off) cudaMalloc 16777216 ret=0 cudaMalloc 16384 ret=0 cudaMalloc 1024 ret=0 cudaMalloc 1024 ret=0 Processing file: scale/yl1-scale.jpg Image is 3 channels. Channel #0 size: 8501 x 5668 Channel #1 size: 8501 x 5668 Channel #2 size: 8501 x 5668 YUV 4:4:4 chroma subsampling cudaMalloc 435338240 ret=0 cudaMalloc 145044480 ret=0 cudaMalloc 73431040 ret=0 cudaMalloc 885701632 ret=0 cudaFree 0x7fca96800000 ret=716 CUDA error at nvJPEG_encoder.cpp:230 code=5(NVJPEG_STATUS_ALLOCATOR_FAILURE) "nvjpegEncodeYUV(nvjpeg_handle, encoder_state, encode_params, &imgdesc, subsampling, widths[0], heights[0], NULL)" [root@localhost nvJPEG_encoder]# `

I can see that when encode yuv cudaFree return 716 which means cudaErrorMisalignedAddress,but when encode rgbi it abort at nvjpegEncodeRetrieveBitstream. how can I resolve this probrem? please help me

niaoyu commented 3 years ago

Hi, did you fix the problem?