nvImageCodec icon indicating copy to clipboard operation
nvImageCodec copied to clipboard

Fail to run build/test/nvimgcodec_tests, build/example/nvimtrans, build/example/nvimproc

Open regall00 opened this issue 1 year ago • 3 comments

Version

0.3.0

Describe the bug.

We successfully rebuild nvImageCodec in docker container (base image: nvcr.io/nvidia/deepstream:7.0-triton-multiarch, tested on x86_64 and AGX Orin), unfortunately running demo applications is not success:

  • build/test/nvimgcodec_tests LD_LIBRARY_PATH=$PWD/../lib64 ./nvimgcodec_tests Expected equality of these values: NVIMGCODEC_STATUS_SUCCESS Which is: 0 nvimgcodecCodeStreamCreateFromFile(instance, &stream_handle, filename.c_str()) Which is: 8
  • build/example/nvimtrans/nvimtrans -i ... -o ... [ERROR] [nvimgcodec] Could not create decoder Error: Something went wrong during decoding - processing status: 11
  • build/example/nvimproc -i ... -o ... [ERROR] [nvimgcodec] Could not create decoder Error: Something went wrong during decoding - processing status: 11

It would be nice if you can support to fix these issues. Thank you

Minimum reproducible example

No response

Environment details

No response

Relevant log output

No response

Other/Misc.

No response

Check for duplicates

  • [x] I have searched the open bugs/issues and have found no duplicates for this bug report

regall00 avatar Oct 04 '24 11:10 regall00

@regall00 Thank you for reporting this issue. Could you please help us understand the case better and add option -v 5 when executing ./nvimtrans? This options increases verbosity so I would appreciate if you can copy printed logs when running example with this option.

I would also suggest to check if nvImageCodec sees extensions folder properly and if nvjpeg and nvjpeg2000 libraries can be loaded as this is can be common problem.

By default nvImageCodec tries to look for extensions folder relatively to libnvimgcodec.so with following logic: "go level up dir (or two levels when there is yet lib64) and add "extensions" to the path" fore example /opt/nvidia/nvimgcodec_cuda<major_cuda_ver>/lib64/libnvimgcodec.so -> /opt/nvidia/nvimgcodec_cuda<major_cuda_ver>/extensions Or when loaded from python ~/.local/lib/python3.8/site-packages/nvidia/nvimgcodec/libnvimgcodec.so -> ~/.local/lib/python3.8/site-packages/nvidia/nvimgcodec/extensions. If it cannot be found with relative path it also checks default installation directory /opt/nvidia/nvimgcodec_cuda <major_cuda_ver>/extensions. Also, there is possibility to specify extensions path using environment variable NVIMGCODEC_EXTENSIONS_PATH or using C API extension_modules_path nvimgcodecInstanceCreateInfo_t struct field when calling nvimgcodecInstanceCreate.

You can also try after build, install everything in some localization so the struct of folders should be as expected e.g.:

cmake --install . --config Release --prefix /opt/nvidia/nvimgcodec_cuda12

You can find more information about installation of nvJpeg and nvJpeg2000 libraries in nvImageCodec installation documentation

smatysik-nv avatar Oct 07 '24 15:10 smatysik-nv

@smatysik-nv Thank you for your reply, I tried with your suggestion as detailed below on x86_64 and still failed. Further suggestion is appreciated. Cheers


docker run -it -v ./nvImageCodec:/nvImageCodec --runtime nvidia nvcr.io/nvidia/deepstream:7.0-triton-multiarch bash

apt-get update apt install python3-clang apt-get install -y --no-install-recommends python3-pytest

export CMAKE_VERSION=3.24.3 wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh -q -O /tmp/cmake-install.sh chmod u+x /tmp/cmake-install.sh mkdir /opt/cmake-${CMAKE_VERSION} /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VERSION} rm -f /tmp/cmake-install.sh rm -f /usr/local/bin/cmake rm -f /usr/local/bin/cpack rm -f /usr/local/bin/ctest ln -s /opt/cmake-${CMAKE_VERSION}/bin/* /usr/local/bin

cd /var/cache/apt/archives wget https://github.com/CVCUDA/CV-CUDA/releases/download/v0.12.0-beta/cvcuda-lib-0.12.0_beta-cuda12-x86_64-linux.deb wget https://github.com/CVCUDA/CV-CUDA/releases/download/v0.12.0-beta/cvcuda-dev-0.12.0_beta-cuda12-x86_64-linux.deb apt install -y ./cvcuda-lib-0.12.0_beta-cuda12-x86_64-linux.deb ./cvcuda-dev-0.12.0_beta-cuda12-x86_64-linux.deb

pip install nvidia-nvimgcodec-cu12 pip install nvidia-nvjpeg-cu12 pip install nvidia-nvjpeg2k-cu12

cd /nvImageCodec/external/libtiff/build/ cmake .. make make install

vi /nvImageCodec/external/build_deps.sh # commented out libtiff

cd /nvImageCodec ./external/build_deps.sh

cd /nvImageCodec mkdir build; cd build cmake .. -DCMAKE_BUILD_TYPE=Release make cmake --install . --config Release --prefix /opt/nvidia/nvimgcodec_cuda12

ls /opt/nvidia/nvimgcodec_cuda12 Acknowledgements.txt LICENSE.txt bin cmake etc extensions include lib64 resources samples test

ls /opt/nvidia/nvimgcodec_cuda12/extensions/ libjpeg_turbo_ext.so.0.3.0.0 libnvbmp_ext.so.0.3.0.0 libnvjpeg2k_ext.so.0.3.0.0 libnvjpeg_ext.so.0.3.0.0 libnvpnm_ext.so.0.3.0.0 libopencv_ext.so.0.3.0.0 libtiff_ext.so.0.3.0.0

cd /nvImageCodec/build ./example/nvimtrans/nvimtrans -i /nvImageCodec/example/assets/images/tabby_tiger_cat.jpg -o ./test.jpg -v 5

nvImageCodec version: 0.3.0

  • extension API version: 0.2.0
  • CUDA Runtime version: 12.2 Using GPU: NVIDIA GeForce RTX 2080 Ti with Compute Capability 7.5 [INFO] [nvimgcodec] Registering extension nvimgcodec_builtin_parsers version:0.3.0 [INFO] [nvimgcodec] Framework is registering parser (id:bmp_parser codec:bmp) [INFO] [nvimgcodec] Codec bmp not yet registered, registering for first time [INFO] [nvimgcodec] Framework is registering parser (id:jpeg_parser codec:jpeg) [INFO] [nvimgcodec] Codec jpeg not yet registered, registering for first time [INFO] [nvimgcodec] Framework is registering parser (id:jpeg2k_parser codec:jpeg2k) [INFO] [nvimgcodec] Codec jpeg2k not yet registered, registering for first time [INFO] [nvimgcodec] Framework is registering parser (id:png_parser codec:png) [INFO] [nvimgcodec] Codec png not yet registered, registering for first time [INFO] [nvimgcodec] Framework is registering parser (id:pnm_parser codec:pnm) [INFO] [nvimgcodec] Codec pnm not yet registered, registering for first time [INFO] [nvimgcodec] Framework is registering parser (id:tiff_parser codec:tiff) [INFO] [nvimgcodec] Codec tiff not yet registered, registering for first time [INFO] [nvimgcodec] Framework is registering parser (id:webp_parser codec:webp) [INFO] [nvimgcodec] Codec webp not yet registered, registering for first time Loading /nvImageCodec/example/assets/images/tabby_tiger_cat.jpg file Input image info:
    • width:720
    • height:720
    • components:3
    • codec:jpeg
    • jpeg encoding: 0xc0 [ERROR] [nvimgcodec] Could not create decoder Error: Something went wrong during decoding - processing status: 11 Saving to /nvImageCodec/build/./example/nvimtrans/./test.jpg file [ERROR] [nvimgcodec] Could not create encoder Error: Something went wrong during encoding Total time spent on transcoding: 0.000478341
  • time spent on parsing: 1.1252e-05
  • time spent on decoding: 0.000107187
  • time spent on encoding (including writting): 0.000359902 [INFO] [nvimgcodec] Unregistering extension nvimgcodec_builtin_parsers version:0.3.0 [INFO] [nvimgcodec] Framework is unregistering parser (id:bmp_parser codec:bmp) [INFO] [nvimgcodec] Framework is unregistering parser (id:jpeg_parser codec:jpeg) [INFO] [nvimgcodec] Framework is unregistering parser (id:jpeg2k_parser codec:jpeg2k) [INFO] [nvimgcodec] Framework is unregistering parser (id:png_parser codec:png) [INFO] [nvimgcodec] Framework is unregistering parser (id:pnm_parser codec:pnm) [INFO] [nvimgcodec] Framework is unregistering parser (id:tiff_parser codec:tiff) [INFO] [nvimgcodec] Framework is unregistering parser (id:webp_parser codec:webp)

regall00 avatar Oct 10 '24 09:10 regall00

@regall00 Thank you for logs. It looks it still has problem with discovering and loading extensions. In working scenario apart of logs for registering parsers, there should be also logs for registering extensions e.g.

[INFO] [nvimgcodec] Loading extension module: /opt/nvidia/nvimgcodec_cuda12/extensions/libjpeg_turbo_ext.so.0.3.0
[INFO] [nvimgcodec] Registering extension libjpeg_turbo_extension version:0.3.0
[INFO] [nvimgcodec] Framework is registering decoder (id:libjpeg_turbo_decoder codec:jpeg)

One issues is that nvImageCodec needs to log more during extension discovery - added this to backlog.

For now, I would check if there is extensions folder one and/or two levels up from libnvimgcodec.so as for some reason it does not take /opt/nvidia/nvimgcodec_cuda12/extensions/

Also, please point directly to extensions folder using environment variable export NVIMGCODEC_EXTENSIONS_PATH=/opt/nvidia/nvimgcodec_cuda12/extensions/ maybe also worth to check variant when they are in other localization.

You can try run LD_DEBUG=libs ./example/nvimtrans/nvimtrans -i /nvImageCodec/example/assets/images/tabby_tiger_cat.jpg -o ./test.jpg -v 5 so maybe it would be possible to see what localizations were tried for loading extensions - please copy these logs here if above suggestions did not help.

smatysik-nv avatar Oct 10 '24 10:10 smatysik-nv

it works, either by specifying where extensions are (export NVIMGCODEC_EXTENSIONS_PATH=...) or the correct location of libnvimgcodec.so (export LD_LIBRARY_PATH=...) and relative location of extensions/. Thank you very much

regall00 avatar Oct 14 '24 09:10 regall00

Good to hear it helped. Thank you for confirming!

smatysik-nv avatar Oct 14 '24 09:10 smatysik-nv