[FFmpeg-user] Failed creating CUDA context for NVENC
Yang Zhang
yzfedora at gmail.com
Thu Jul 19 17:06:37 EEST 2018
sorry, there is no document about it. basically. you need follow the
keylase's guide to patch the driver. it's means patch
nvidia-encode.so. then you can backup this so file. and install other
version driver. then copy the nvidia-encode.so you backup before to
override same files in your system.
On 7/19/18, Yugandhar Veeramachaneni <hello at yugandhar.me> wrote:
>> I patched the Nvidia driver by forcing FFmpeg link to patched nvidia
> library.
>
> May I know how you did this? Is there some documentation that I can follow?
> Or is this the same as the one at https://github.com/keylase/nvidia-patch/ ?
>
> On Thu, Jul 19, 2018 at 8:40 AM Yang Zhang <yzfedora at gmail.com> wrote:
>
>> Also, I noticed a change on Nvidia Matrix website. I remember previous
>> matrix says 1070ti only 1 NVENC chip. but now it says some 1060ti and
>> 1070ti has 2 NVENC chips. and the strangest thing is: the old model of GTX
>> 1070ti used much less GPU RAM than new GTX 1070ti. for example: old 1070ti
>> used about 80 MB for full gpu based SD channels transcoding. but the new
>> model used 130 MB.
>>
>> On Thu, Jul 19, 2018 at 9:36 PM, Yang Zhang <yzfedora at gmail.com> wrote:
>>
>> > Sure,
>> >
>> > I am using the latest 390.24 driver. I build the ffmpeg by myself. I
>> > patched the Nvidia driver by forcing FFmpeg link to patched nvidia
>> library.
>> > so this can let you use any version driver also without limits. the
>> command
>> > is generate by software. for example:
>> >
>> > ffmpeg -hwaccel cuvid -hwaccel_device 0 -fflags +discardcorrupt -c:v
>> > h264_cuvid -gpu 0 -probesize 10M -analyzeduration 10M -thread_queue_size
>> > 128 -i /home/test/Videos/boku_no_hero_academia_16.mp4 -filter_complex
>> > hwdownload,format=pix_fmts=nv12,split=outputs=1[hwupload:0];
>> > [hwupload:0]hwupload=extra_hw_frames=1[map:v:0];
>> > asplit=outputs=1[map:a:0] -map [map:v:0] -c:v h264_nvenc -flags:v
>> > +global_header+cgop -preset:v hp -profile:v main -g 250 -gpu 0 -b:v:0
>> 3000k
>> > -maxrate:v:0 3500k -bufsize:v:0 7000k -map [map:a:0] -c:a libfdk_aac -ac
>> 2
>> > -ar 44100 -b:a:0 128k -f tee [f=hls:hls_time=2:hls_list_
>> > size=5:hls_flags=delete_segments:select=\'v:0,a:0\':
>> > bsfs/v=dump_extra=freq=keyframe]../cache/hls/13/highest.m3u8
>> > -hide_banner
>> > -loglevel info
>> >
>> > To transcoding 60 SD channels the bottleneck is at GPU Memory side.
>> > above
>> > command is using full gpu based hardware acceleration. so the GPU RAM
>> > overhead is about 80MB for 1 channel. actually I expect GTX 1070TI 8GB
>> > to
>> > transcoding 80 SD channels. but also, same problem with yours. GPU
>> > actually used 6900 MB. but can not transcoding more.
>> >
>> > On Thu, Jul 19, 2018 at 9:29 PM, Yugandhar Veeramachaneni <
>> > hello at yugandhar.me> wrote:
>> >
>> >> Hi Zhang,
>> >>
>> >> Are you using the driver published by NVIDIA or did you modify anything
>> in
>> >> it? Also, can you please share your full ffmpeg command string that you
>> >> use
>> >> for transcoding 60 SD channels for the sake of the community?
>> >>
>> >> Regards,
>> >>
>> >> Yugandhar
>> >>
>> >> On Thu, Jul 19, 2018 at 8:19 AM Yang Zhang <yzfedora at gmail.com> wrote:
>> >>
>> >> > I got this error before. the error code 0x2 is indicate no enough gpu
>> >> > memory. perhaps you can see the output of nvidia-smi tool indicate
>> >> > the gpu is still left 1GB or more. perhaps nvidia-smi's output is not
>> >> > exactly. or the nvidia driver limited it. my previous test is GTX
>> >> > 1070ti 8GB can transcoding 60 SD channels.
>> >> >
>> >> > On 7/19/18, Yugandhar Veeramachaneni <hello at yugandhar.me> wrote:
>> >> > > I see unrestricted in the # of concurrent sessions column -
>> >> > >
>> https://screenshots.firefox.com/ZTBoEcMVKO336dh8/developer.nvidia.com
>> >> > which
>> >> > > is why I bought this GPU in the first place.
>> >> > >
>> >> > > Your solution to override the hard-coded limits seems promising at
>> the
>> >> > > first glance. I'll try that soon and report back my findings.
>> >> > >
>> >> > > Thank you for your help.
>> >> > >
>> >> > > - Yugandhar
>> >> > >
>> >> > > On Wed, Jul 18, 2018 at 2:46 PM Dennis Mungai <dmngaie at gmail.com>
>> >> wrote:
>> >> > >
>> >> > >> Also, see this list:
>> >> > >>
>> https://developer.nvidia.com/video-encode-decode-gpu-support-matrix
>> >> > >>
>> >> > >> You have the Quadro P4000, which is artificially crippled to ~2
>> >> > concurrent
>> >> > >> sessions according to the documentation above.
>> >> > >>
>> >> > >> On 18 July 2018 at 22:34, Dennis Mungai <dmngaie at gmail.com> wrote:
>> >> > >>
>> >> > >> > NVENC runs on a discrete silicon IP core (SIP) block in the GPU,
>> >> and
>> >> > not
>> >> > >> > on the GPU's shaders.
>> >> > >> > That SIP block has hard-coded limits (set in firmware) to ensure
>> >> that
>> >> > >> > these who need more than the artificial limit buy Tesla-grade
>> >> > hardware.
>> >> > >> >
>> >> > >> > Marketing shills by NVIDIA.
>> >> > >> >
>> >> > >> > You can override this limit by using Keylase's nvidia patcher
>> here:
>> >> > >> > https://github.com/keylase/nvidia-patch
>> >> > >> >
>> >> > >> > On 18 July 2018 at 22:00, Yugandhar Veeramachaneni <
>> >> > hello at yugandhar.me>
>> >> > >> > wrote:
>> >> > >> >
>> >> > >> >> I'm a little confused here because the GPU resource utilization
>> is
>> >> > well
>> >> > >> >> below the hard limits.
>> >> > >> >>
>> >> > >> >> When I run nvidia-smi, this is what I get -
>> >> > >> >>
>> >> > >> >> yugandharv at eclairs:~$ nvidia-smi
>> >> > >> >> Thu Jul 19 00:29:45 2018
>> >> > >> >> +-----------------------------------------------------------
>> >> > >> >> ------------------+
>> >> > >> >> | NVIDIA-SMI 390.67 Driver Version:
>> >> > >> >> 390.67 |
>> >> > >> >> |-------------------------------+----------------------+----
>> >> > >> >> ------------------+
>> >> > >> >> | GPU Name Persistence-M| Bus-Id Disp.A |
>> Volatile
>> >> > >> Uncorr.
>> >> > >> >> ECC |
>> >> > >> >> | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage |
>> GPU-Util
>> >> > >> Compute
>> >> > >> >> M. |
>> >> > >> >> |===============================+======================+====
>> >> > >> >> ==================|
>> >> > >> >> | 0 Quadro P4000 Off | 00000000:02:00.0 Off |
>> >> > >> >> N/A |
>> >> > >> >> | 52% 55C P0 38W / 105W | 6646MiB / 8117MiB |
>> >> > >> >> 25%
>> >> > >> >> Default |
>> >> > >> >> +-------------------------------+----------------------+----
>> >> > >> >> ------------------+
>> >> > >> >>
>> >> > >> >>
>> >> > >> >> +-----------------------------------------------------------
>> >> > >> >> ------------------+
>> >> > >> >> | Processes:
>> >> > GPU
>> >> > >> >> Memory |
>> >> > >> >> | GPU PID Type Process name
>> >> > >> >> Usage |
>> >> > >> >> |===========================================================
>> >> > >> >> ==================|
>> >> > >> >> | 0 983 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 995 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 1010 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 1012 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 215MiB |
>> >> > >> >> | 0 1017 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 235MiB |
>> >> > >> >> | 0 1986 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 224MiB |
>> >> > >> >> | 0 8484 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 8497 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 8538 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 225MiB |
>> >> > >> >> | 0 11097 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 193MiB |
>> >> > >> >> | 0 11109 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 193MiB |
>> >> > >> >> | 0 11121 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 193MiB |
>> >> > >> >> | 0 11134 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11169 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 225MiB |
>> >> > >> >> | 0 11175 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 193MiB |
>> >> > >> >> | 0 11186 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11195 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11207 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 224MiB |
>> >> > >> >> | 0 11222 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11226 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 225MiB |
>> >> > >> >> | 0 11231 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11234 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 225MiB |
>> >> > >> >> | 0 11235 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11237 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11240 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11252 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 11300 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> | 0 13264 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 193MiB |
>> >> > >> >> | 0 14176 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 193MiB |
>> >> > >> >> | 0 30258 C /home/yugandharv/bin/ffmpeg
>> >> > >> >> 229MiB |
>> >> > >> >> +-----------------------------------------------------------
>> >> > >> >> ------------------+
>> >> > >> >>
>> >> > >> >>
>> >> > >> >> Thanks,
>> >> > >> >>
>> >> > >> >> Yugandhar
>> >> > >> >>
>> >> > >> >> On Wed, Jul 18, 2018 at 11:55 AM Dennis Mungai <
>> dmngaie at gmail.com
>> >> >
>> >> > >> wrote:
>> >> > >> >>
>> >> > >> >> > You mentioned 30 streams. And more cause this to "fail".
>> >> > >> >> >
>> >> > >> >> > Perhaps the Quadro line has a maximum simultaneous encoder
>> >> limit of
>> >> > >> 30,
>> >> > >> >> > similar to the GeForce's limit of 2?
>> >> > >> >> >
>> >> > >> >> > On Wed, Jul 18, 2018, 19:28 Yugandhar Veeramachaneni <
>> >> > >> >> hello at yugandhar.me>
>> >> > >> >> > wrote:
>> >> > >> >> >
>> >> > >> >> > > Hello everyone,
>> >> > >> >> > >
>> >> > >> >> > > I'm currently using an NVIDIA Quadro P4000 GPU to transcode
>> >> > >> multicast
>> >> > >> >> UDP
>> >> > >> >> > > streams to RTMP streams. I have quite about 30 streams
>> >> running in
>> >> > >> >> > parallel
>> >> > >> >> > > on this GPU and I have no problems so far. I tried adding
>> more
>> >> > >> >> > > today
>> >> > >> >> and
>> >> > >> >> > > many of them are failing with this error.
>> >> > >> >> > >
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] Loaded Nvenc version 8.1
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] Nvenc initialized
>> >> > >> >> > > successfully
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] 1 CUDA capable devices found
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] [ GPU #0 - < Quadro P4000 >
>> has
>> >> > >> Compute
>> >> > >> >> SM
>> >> > >> >> > > 6.1 ]
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] Failed creating CUDA context
>> for
>> >> > >> NVENC:
>> >> > >> >> 0x2
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] No NVENC capable devices
>> >> > >> >> > > found
>> >> > >> >> > > [h264_nvenc @ 0x55ef24458040] Nvenc unloaded
>> >> > >> >> > >
>> >> > >> >> > > Full log is pasted at
>> >> > >> >> > >
>> >> > >>
>> https://gist.github.com/yugandhar91/47a1c30482d1e89a47f7b6fb6dd420ca
>> >> > >> >> > >
>> >> > >> >> > > Can you please point me to my mistake?
>> >> > >> >> > >
>> >> > >> >> > > Thanks,
>> >> > >> >> > >
>> >> > >> >> > > Yugandhar
>> >> > >> >> > > _______________________________________________
>> >> > >> >> > > ffmpeg-user mailing list
>> >> > >> >> > > ffmpeg-user at ffmpeg.org
>> >> > >> >> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >> > >> >> > >
>> >> > >> >> > > To unsubscribe, visit link above, or email
>> >> > >> >> > > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >> > >> >> > _______________________________________________
>> >> > >> >> > ffmpeg-user mailing list
>> >> > >> >> > ffmpeg-user at ffmpeg.org
>> >> > >> >> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >> > >> >> >
>> >> > >> >> > To unsubscribe, visit link above, or email
>> >> > >> >> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >> > >> >> _______________________________________________
>> >> > >> >> ffmpeg-user mailing list
>> >> > >> >> ffmpeg-user at ffmpeg.org
>> >> > >> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >> > >> >>
>> >> > >> >> To unsubscribe, visit link above, or email
>> >> > >> >> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >> > >> >>
>> >> > >> >
>> >> > >> >
>> >> > >> _______________________________________________
>> >> > >> ffmpeg-user mailing list
>> >> > >> ffmpeg-user at ffmpeg.org
>> >> > >> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >> > >>
>> >> > >> To unsubscribe, visit link above, or email
>> >> > >> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >> > > _______________________________________________
>> >> > > ffmpeg-user mailing list
>> >> > > ffmpeg-user at ffmpeg.org
>> >> > > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >> > >
>> >> > > To unsubscribe, visit link above, or email
>> >> > > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >> > _______________________________________________
>> >> > ffmpeg-user mailing list
>> >> > ffmpeg-user at ffmpeg.org
>> >> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >> >
>> >> > To unsubscribe, visit link above, or email
>> >> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >> _______________________________________________
>> >> ffmpeg-user mailing list
>> >> ffmpeg-user at ffmpeg.org
>> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> >>
>> >> To unsubscribe, visit link above, or email
>> >> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> >>
>> >
>> >
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list