Coder Social home page Coder Social logo

Comments (21)

caio-vinicius avatar caio-vinicius commented on June 3, 2024 35

For people with problem with NVCC, try to check if CUDA is installed properly. Also, seems like nvcc is not in path, but if you look at /usr/local/cuda/bin you can find the binaries related to the Nvidia CUDA Compiler (nvcc).

So, in my Ubuntu 20.04: export PATH=$PATH:/usr/local/cuda/bin solved the problem.

from cuda-samples.

mike1808 avatar mike1808 commented on June 3, 2024 31

for those who are lurking, you can just add --nvccflags="-gencode arch=compute_75,code=sm_75 -O2" to configure command of ffmpeg and you don't need to change anything in the source code.

from cuda-samples.

katsar0v avatar katsar0v commented on June 3, 2024 6

I think you are not correct @mdoijade. Although cuda is installed:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Oct_12_20:09:46_PDT_2020
Cuda compilation tools, release 11.1, V11.1.105
Build cuda_11.1.TC455_06.29190527_0

I get an error when want to build ffmpeg with nvenc:

PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure   --prefix="$HOME/ffmpeg_build"   --extra-cflags="-I$HOME/ffmpeg_build/include"   --extra-ldflags="-L$HOME/ffmpeg_build/lib"   --bindir="$HOME/bin"   --enable-cuda-sdk   --enable-cuvid   --enable-libnpp   --extra-cflags="-I/usr/local/cuda/include/"   --extra-ldflags=-L/usr/local/cuda/lib64/   --enable-gpl   --enable-libass   --enable-libfdk-aac   --enable-vaapi   --enable-libfreetype   --enable-libmp3lame   --enable-libopus   --enable-libtheora   --enable-libvorbis   --enable-libvpx   --enable-libx264   --enable-nonfree   --enable-nvenc
ERROR: failed checking for nvcc.

from cuda-samples.

swissbeats93 avatar swissbeats93 commented on June 3, 2024 6

This is what I did.

cd ~/ffmpeg_sources && \ git -C nv-codec-headers pull 2> /dev/null || git clone --depth 1 https://git.videolan.org/git/ffmpeg/nv-codec-headers.git && \ cd nv-codec-headers && \ sudo make PREFIX="$HOME/ffmpeg_build" BINDDIR="$HOME/bin" && \ sudo make install PREFIX="$HOME/ffmpeg_build" BINDDIR="$HOME/bin"

  • I proceeded to install ffmpeg like so:
    cd ~/ffmpeg_sources && \ wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \ tar xjvf ffmpeg-snapshot.tar.bz2 && \ cd ffmpeg && \ PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \ --prefix="$HOME/ffmpeg_build" \ --pkg-config-flags="--static" \ --extra-cflags="-I$HOME/ffmpeg_build/include -I/usr/local/cuda/include" \ --extra-ldflags="-L$HOME/ffmpeg_build/lib -L/usr/local/cuda/lib64" \ --extra-libs="-lpthread -lm" \ --bindir="$HOME/bin" \ --enable-gpl \ --enable-gnutls \ --enable-libaom \ --enable-libass \ --enable-libfdk-aac \ --enable-libfreetype \ --enable-libmp3lame \ --enable-libopus \ --enable-libsvtav1 \ --enable-libvorbis \ --enable-libvpx \ --enable-libx264 \ --enable-libx265 \ --enable-cuda-nvcc \ --enable-nvenc \ --enable-cuda \ --enable-cuvid \ --enable-libnpp \ --enable-nonfree && \ PATH="$HOME/bin:$PATH" make -j8 && \ make install && \ hash -r
    There was a needed to edit the configure file to change the nvccflags_default="-gencode arch=compute_35,code=sm_35 -O2 to nvccflags_default="-gencode arch=compute_75,code=sm_75 -O2 since I'm on a Turing architecture GPU.

After that I restarted, I find that ffmpeg is installed to /usr/local (the cuda stuff) and $HOME/bin for the remainder

from cuda-samples.

Tony763 avatar Tony763 commented on June 3, 2024 3

vccflags_default="-gencode arch=compute_35,code=sm_35 -O2 according to cuda-compiler-driver-nvcc

from cuda-samples.

swissbeats93 avatar swissbeats93 commented on June 3, 2024 2

ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i 1.mp4 -c:v h264_nvenc -preset slow 2.mp4

@Tony763 It's working for me. Did you restart the system?

from cuda-samples.

the-uniq-sam avatar the-uniq-sam commented on June 3, 2024 2

https://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/

This website may help to find which nvccflags_default to use.

from cuda-samples.

jeff-j-chen avatar jeff-j-chen commented on June 3, 2024 2

NVCC may actually be installed correctly, you just need to make sure that your GCC version is < 10. If you check in the error logs, it says that versions gcc greater than 10 are not supported, but the console logged error message is that nvcc is not installed!

To fix this:
Install gcc-9, if not yet installed.
sudo apt install libgcc-9-dev
Update alternatives to be able to select gcc 9.
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60
Select gcc 9 as the used alternative.
sudo update-alternatives --config gcc
Now compile, and it should work.

Note that this is a common trend where applications report an unrelated error while the underlying error is the wrong gcc version. If you encounter mysterious errors in the future, one of the first things you should do is switch to a higher gcc version!
(For example, this causes a massive headache with being unable to build nvidia-dkms drivers with lower gcc versions, and the error is only reported in the logs)

from cuda-samples.

mdoijade avatar mdoijade commented on June 3, 2024

I am not sure what is the issue but if you are unable to find nvcc then possibly you are missing cuda toolkit installation. you can follow this cuda installlation guide - https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html

from cuda-samples.

Tony763 avatar Tony763 commented on June 3, 2024

Hi, the same goes for me on two machines. One Ubuntu 18.04, second Ubuntu 20.10. Cuda toolkit 11.1 drivers 455.45.

nvcc fatal : Unsupported gpu architecture 'compute_30'

from cuda-samples.

Tony763 avatar Tony763 commented on June 3, 2024

After altering nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2
i got
WARNING: Option --enable-cuda-sdk is deprecated. Use --enable-cuda-nvcc instead.

from cuda-samples.

swissbeats93 avatar swissbeats93 commented on June 3, 2024

@Tony763 where do you alter the nvccflags_default ?

from cuda-samples.

Tony763 avatar Tony763 commented on June 3, 2024

Hi @swissbeats93: https://github.com/FFmpeg/FFmpeg/blob/master/configure#L4344
FFmpeg now compile but in ffmpeg -hwaccels: no cuvid is pressent

Hardware acceleration methods:
cuda
drm
opencl

from cuda-samples.

swissbeats93 avatar swissbeats93 commented on June 3, 2024

I don't see what you altered it to @Tony763, also doesn't the presence of cuda say that you have cuvid present?

from cuda-samples.

swissbeats93 avatar swissbeats93 commented on June 3, 2024

vccflags_default="-gencode arch=compute_35,code=sm_35 -O2 according to cuda-compiler-driver-nvcc

I saw it now. This is the page: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html . I went with 75 because I'm on Turing architecture

from cuda-samples.

Tony763 avatar Tony763 commented on June 3, 2024

@swissbeats93 is it wotking for You?
For me not. I struct at :
ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i 1.mp4 -c:v h264_nvenc -preset slow 2.mp4

cu->cuInit(0) failed -> CUDA_ERROR_UNKNOWN: unknown error
Device creation failed: -1313558101.
[h264 @ 0x564db43004c0] No device available for decoder: device type cuda needed for codec h264.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
Device setup failed for decoder on input stream #0:0 : Unknown error occurred

Nvidia verification is OK - url
nvidia-smi is also OK

from cuda-samples.

GowthamKudupudi avatar GowthamKudupudi commented on June 3, 2024

Weird! inside docker ffmpeg configured without adding nvccflags but on the host i have to add _75. docker container got cuda-10 while host is of cuda-11. same issue with container with cuda-10.

from cuda-samples.

hitanshsingla avatar hitanshsingla commented on June 3, 2024

Not running ./configure with sudo worked for me

from cuda-samples.

juflunaca avatar juflunaca commented on June 3, 2024

Still had this issue in Ubuntu-based Pop!_OS 22.04, had done everything else and finally adding the directory to path as @caio-vinicius got it working.

from cuda-samples.

VasLem avatar VasLem commented on June 3, 2024

For the sake of posterity, using lmod, I solved it by getting GCC to be compatible with the loaded CUDA:

module load system/CUDA/11.8.0
module load compiler/GCC/11.3.0

from cuda-samples.

gahadzre avatar gahadzre commented on June 3, 2024

for those who are lurking, you can just add --nvccflags="-gencode arch=compute_75,code=sm_75 -O2" to configure command of ffmpeg and you don't need to change anything in the source code.

Hi. My error was due to an incompatible version of gcc. To solve I add to add -ccbin clang-14 to the nvccflags: --nvccflags="-ccbin clang-14 -gencode arch=compute_75,code=sm_75 -O2"

from cuda-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.