NVIDIA / CUDALibrarySamples

CUDA Library Samples
Other
1.5k stars 311 forks source link

NVJPEG2000 Failure: '#6' #193

Closed ylikla closed 2 months ago

ylikla commented 2 months ago

I'm using Ubuntu 20.04, cuda 11.2. I installed nvJPEG2000 0.8.0. After following the README instruction, ./nvjpeg2k_encode -i ../images/ -b 1 -t 1024 -w 4 -o . shows '#6' error on line 749 in nvjpeg2k_encode.cpp I'm not sure what is wrong on line CHECK_NVJPEG2K(nvjpeg2kEncodeStateCreate(params.enc_handle, &params.enc_state));

zohebk-nv commented 2 months ago

Can you also share the driver version and installation method for nvjpeg2000? nvJPEG2000 by default points to the cuda 12 version

ylikla commented 2 months ago

I downloaded nvjpeg2000 from https://developer.nvidia.com/nvjpeg2000-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu, with x86_64, Ubuntu, 20.04.

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Sun_Feb_14_21:12:58_PST_2021 Cuda compilation tools, release 11.2, V11.2.152 Build cuda_11.2.r11.2/compiler.29618528_0

zohebk-nv commented 2 months ago

Can you also share the output of nvida-smi?

ylikla commented 2 months ago

+-----------------------------------------------------------------------------+ | NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: 11.6 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |===============================+======================+======================| | 0 Tesla V100-SXM2... On | 00000000:00:1E.0 Off | 0 | | N/A 35C P0 24W / 300W | 0MiB / 16384MiB | 0% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+

zohebk-nv commented 2 months ago

The apt install nvjpeg2k command install both cuda 11 and cuda 12 versions of the nvjpeg2k binaries. Since your driver corresponds to r510/cuda 11.6 you can switch to the cuda 11 version using the update-alternatives command and select the one with priority 11 as shown below. You may need to add sudo depending on your environment

root@9a5c9ffd16a1:/# update-alternatives  --config libnvjpeg2k_static.a
There are 2 choices for the alternative libnvjpeg2k_static.a (providing /usr/lib/x86_64-linux-gnu/libnvjpeg2k_static.a).

  Selection    Path                                                           Priority   Status
------------------------------------------------------------
* 0            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k_static.a   12        auto mode
  1            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/11/libnvjpeg2k_static.a   11        manual mode
  2            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k_static.a   12        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/lib/x86_64-linux-gnu/libnvjpeg2k/11/libnvjpeg2k_static.a to provide /usr/lib/x86_64-linux-gnu/libnvjpeg2k_static.a (libnvjpeg2k_static.a) in manual mode
root@9a5c9ffd16a1:/# update-alternatives  --config libnvjpeg2k.so
There are 2 choices for the alternative libnvjpeg2k.so (providing /usr/lib/x86_64-linux-gnu/libnvjpeg2k.so).

  Selection    Path                                                     Priority   Status
------------------------------------------------------------
* 0            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k.so   12        auto mode
  1            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/11/libnvjpeg2k.so   11        manual mode
  2            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k.so   12        manual mode

If you prefer, you can only install the cuda-11 version of the binaries using this command - apt install nvjpeg2k-cuda-11

ylikla commented 2 months ago

I have updated the driver, but the error persists.

yicheli@ca1awsintn24-04:~/CUDALibrarySamples/nvJPEG2000/nvJPEG2000-Decoder/build$ sudo update-alternatives --config libnvjpeg2k.so
There are 2 choices for the alternative libnvjpeg2k.so (providing /usr/lib/x86_64-linux-gnu/libnvjpeg2k.so).

 Selection    Path                                                     Priority   Status
------------------------------------------------------------
  0            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k.so   12        auto mode
* 1            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/11/libnvjpeg2k.so   11        manual mode
  2            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k.so   12        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
yicheli@ca1awsintn24-04:~/CUDALibrarySamples/nvJPEG2000/nvJPEG2000-Decoder/build$ sudo update-alternatives --config libnvjpeg2k_static.a
There are 2 choices for the alternative libnvjpeg2k_static.a (providing /usr/lib/x86_64-linux-gnu/libnvjpeg2k_static.a).

 Selection    Path                                                           Priority   Status
------------------------------------------------------------
  0            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k_static.a   12        auto mode
* 1            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/11/libnvjpeg2k_static.a   11        manual mode
  2            /usr/lib/x86_64-linux-gnu/libnvjpeg2k/12/libnvjpeg2k_static.a   12        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1
yicheli@ca1awsintn24-04:~/CUDALibrarySamples/nvJPEG2000/nvJPEG2000-Decoder/build$ ./nvjpeg2000_decode_sample -i ../images/2k_image_lossless/2k_lossless.jp2 -o .
Decoding images in directory: ../images/2k_image_lossless/2k_lossless.jp2, total 1, batchsize 1
NVJPEG failure: '#6' at /home/yicheli/CUDALibrarySamples/nvJPEG2000/nvJPEG2000-Decoder/nvjpeg2000DecodeSample.cpp:242
zohebk-nv commented 2 months ago

can you repeat the process to move to the cuda11 version for these 2 options as well? I tried it on a similar setup and it worked for me

update-alternatives  --config libnvjpeg2k.so.0.8.0.38
update-alternatives  --config libnvjpeg2k.so.0
ylikla commented 2 months ago

It works now. I guess I was missing update-alternatives --config libnvjpeg2k.so.0.8.0.38