xpra icon
Bug tracker and wiki

Opened 5 years ago

Closed 4 years ago

#828 closed task (fixed)

NVENC support for Ubuntu and Debian

Reported by: Antoine Martin Owned by: twotwenty
Priority: major Milestone: 0.15
Component: packaging Version: trunk
Keywords: Cc:

Description

Would be nice to have, and I thought it would be easy enough to add since there is now a repository on the cuda downloads page.

But I have to record this to show just how absolutely ridiculous nvidia packaging can be:

0 upgraded, 515 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,167 MB of archives.
After this operation, 2,386 MB of additional disk space will be used.

515 packages, 2.3GB of diskspace, and that's in a chroot which is used to build a lot of things and already has gcc and most development libraries and headers. I reckon that from a clean install, you would be looking at 4GB of diskspace.
What on earth are they thinking?
Shambolic.

Attachments (1)

CUDA-Trusty-Install.log (17.9 KB) - added by Antoine Martin 5 years ago.
the full install log for cuda

Download all attachments as: .zip

Change History (18)

Changed 5 years ago by Antoine Martin

Attachment: CUDA-Trusty-Install.log added

the full install log for cuda

comment:1 Changed 5 years ago by Antoine Martin

Status: newassigned

For trusty, enabling the multiverse repo is marginally better (but still awful).
You can then install:

  • nvidia-cuda-toolkit
  • python-pycuda
    0 upgraded, 503 newly installed, 0 to remove and 0 not upgraded.
    Need to get 319 MB/452 MB of archives.
    After this operation, 1,568 MB of additional disk space will be used.
    

For wheezy:

  • from "non-free": python-pycuda (2012.1-1 which is well out of date..)
    0 upgraded, 93 newly installed, 0 to remove and 0 not upgraded.
    Need to get 276 MB of archives.
    After this operation, 958 MB of additional disk space will be used.
    

Then we still have a number of problems:

found CUDA compiler: /usr/bin/nvcc  version 5.5.0
(..)
nvcc fatal   : Unsupported gpu architecture 'compute_50'

On trusty, 5.5 is way too old.

Last edited 5 years ago by Antoine Martin (previous) (diff)

comment:2 Changed 5 years ago by Antoine Martin

Owner: changed from Antoine Martin to alas
Status: assignednew

We don't need to support wheezy anyway, it isn't supported at all in xpra 0.15.
And I didn't bother building nvenc5 support since all it does at present is remove the ability to run on consumer cards... (#825)

For utopic, you need the "restricted" repo to build.
It does come with CUDA 6:

For vivid, same thing, and we get:

Jessie is OK (well.. xpra is already well out of date there, and it ships with a kernel that is not LTS... they do like to take on work that shouldn't be needed, especially when the release takes so long, and maybe that's why - why, oh why - but that's another discussion, |end of rant|):

@afarr: can you test the beta packages on one of those distributions (with the required nvidia graphics card) and make sure things work.
You will need to install python-pycuda to make use of the nvenc module (we don't list it as a dependency), nvidia-cuda-dev is not needed at runtime (though pycuda already does bring a stupid amount of dependencies, including nvidia-cuda-toolkit)

comment:3 Changed 4 years ago by alas

Tested the trusty beta package against a fedora 20 server as client, as well as locally against itself as both server and client. Works as expected.

Note, also had to install the python-rencode package from the beta directory separately (I presume you realize it's not bundled in the rpm).

comment:4 Changed 4 years ago by Antoine Martin

Works as expected.


I assume you have verified that NVENC was being used?

Note, also had to install the python-rencode package from the beta directory separately (I presume you realize it's not bundled in the rpm).


RPM? Those are DEB packages.
And rencode is in both the stable and beta repositories already. (ie: http://xpra.org/dists/trusty/main/binary-amd64/)

It should just be a matter of installing xpra via the repository and everything required should get installed, including rencode. (see debian repository for install instructions)

comment:5 Changed 4 years ago by twotwenty

Debian Jessie
installed the nvidia-driver metapackage
also had to install libnvidia-encode1

launched using:

#!/bin/sh
XPRA_CUDA_DEVICE=0 \
XPRA_NVENC_CLIENT_KEY="#######-####-####-####-############" \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/x86_64-linux-gnu/nvidia/current:/usr/lib64/nvidia \
xpra \
--no-daemon \
--bind-tcp=0.0.0.0:11000 --video-encoders=nvenc --start-child="xterm -fg white -bg black" start :97

output:

$ ./xpra.sh 

X.Org X Server 1.16.4
Release Date: 2014-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 3.16.0-4-amd64 x86_64 Debian
Current Operating System: Linux herb 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u2 (2015-07-17) x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-4-amd64 root=UUID=f7fef742-edb0-4a57-878a-91347b13fc85 ro quiet
Build Date: 11 February 2015  12:32:02AM
xorg-server 2:1.16.4-1 (http://www.debian.org/support) 
Current version of pixman: 0.32.6
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(++) Log file: "/home/maint/.xpra/Xorg.:97.log", Time: Tue Jul 28 14:03:58 2015
(++) Using config file: "/etc/xpra/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
xauth:  timeout in locking authority file /home/two/.Xauthority
Error running "xauth add :97 MIT-MAGIC-COOKIE-1 eb494ca875524169978966337b6dd630": non-zero exit code: 1
2015-07-28 14:04:18,754 server uuid is b45ec83def8c493e89b27e969e352df0
2015-07-28 14:04:19,023 Failed to launch ldconfig -p
2015-07-28 14:04:19,038 pulseaudio server started with pid 4037
2015-07-28 14:04:19,060 using notification forwarder: DBUSNotificationsForwarder(org.freedesktop.Notifications)
2015-07-28 14:04:19,072 Failed to launch ldconfig -p
2015-07-28 14:04:19,088 started child 'xterm -fg white -bg black' with pid 4049
2015-07-28 14:04:19,089 xpra server version 0.15.4 (r10082)
2015-07-28 14:04:19,089 running with pid 4021
2015-07-28 14:04:19,370 Nvidia kernel module version 340.65
2015-07-28 14:04:19,371 CUDA initialization (this may take a few seconds)
2015-07-28 14:04:19,374 CUDA 6.0.0 / PyCUDA 2014.1, found 1 device(s):
2015-07-28 14:04:19,462   + GeForce GTX 750 Ti @ 0000:01:00.0 (memory: 89% free, compute: 5.0)
2015-07-28 14:04:19,679 failed to load CUDA bin file /usr/share/xpra/cuda/BGRA_to_NV12.fatbin
2015-07-28 14:04:19,715 Warning: nvenc video encoder failed: failed to load BGRA_to_NV12 for device 0
2015-07-28 14:04:19,716 init_video_encoders_options() cannot add nvenc4 encoder
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 256, in init_video_encoders_options
    self.init_video_encoder_option(mod)
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 278, in init_video_encoder_option
    raise e
AssertionError: failed to load BGRA_to_NV12 for device 0
2015-07-28 14:04:19,717 nvenc3 warning: unsupported driver version 340.65, disabling YUV444 support
2015-07-28 14:04:19,899 failed to load CUDA bin file /usr/share/xpra/cuda/BGRA_to_NV12.fatbin
2015-07-28 14:04:19,932 Warning: nvenc video encoder failed: failed to load BGRA_to_NV12 for device 0
2015-07-28 14:04:19,932 init_video_encoders_options() cannot add nvenc3 encoder
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 256, in init_video_encoders_options
    self.init_video_encoder_option(mod)
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 278, in init_video_encoder_option
    raise e
AssertionError: failed to load BGRA_to_NV12 for device 0
2015-07-28 14:04:19,932 video encoder 'nvenc5' could not be loaded:
2015-07-28 14:04:19,933  No module named nvenc5
2015-07-28 14:04:19,939 xpra is ready.
Last edited 4 years ago by twotwenty (previous) (diff)

comment:6 Changed 4 years ago by twotwenty

Ubuntu1404 trusty(Fresh Install)

installed xpra v0.15.4

ran using the script from the previous comment

$ ./xpra.sh 
2015-07-28 16:38:44,210 Error starting Xvfb: [Errno 2] No such file or directory

2015-07-28 16:38:44,210 closing tcp socket 0.0.0.0:11000

comment:7 Changed 4 years ago by twotwenty

after installing xvfb:

$ ./xpra.sh 
2015-07-28 16:40:44,771 failed to load the mdns avahi publisher: No module named avahi
2015-07-28 16:40:44,772 either fix your installation or use the '--no-mdns' flag
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension SECURITY
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension Present
Initializing built-in extension DRI3
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension SELinux
Initializing built-in extension GLX
[dix] Could not init font path element /usr/share/fonts/X11/cyrillic, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/100dpi/:unscaled, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/75dpi/:unscaled, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/100dpi, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/75dpi, removing from list!
Xlib:  extension "RANDR" missing on display ":97".
Xlib:  extension "RANDR" missing on display ":97".
2015-07-28 16:40:45,094 server uuid is 7075760b6fec46a39163a941523b4d27
Illegal instruction (core dumped)

comment:8 Changed 4 years ago by twotwenty

again with Ubuntu1504
had to install xvfb

ran the same script as before

$ ./xpra.sh 
2015-07-28 17:33:59,737 failed to load the mdns avahi publisher: No module named avahi
2015-07-28 17:33:59,737 either fix your installation or use the '--no-mdns' flag
Xlib:  extension "RANDR" missing on display ":97".
Xlib:  extension "RANDR" missing on display ":97".
2015-07-28 17:34:00,082 server uuid is 10a783bee2aa486d931f3a4db48bd3a3
2015-07-28 17:34:00,515 Printer forwarding cannot be enabled, the PPD file '/usr/share/cups/model/CUPS-PDF.ppd' is missing
2015-07-28 17:34:00,602 pulseaudio server started with pid 1333
2015-07-28 17:34:00,639 using notification forwarder: DBUSNotificationsForwarder(org.freedesktop.Notifications)
2015-07-28 17:34:00,658 started child 'xterm -fg white -bg black' with pid 1345
2015-07-28 17:34:00,659 xpra server version 0.15.4 (r10082)
2015-07-28 17:34:00,659 running with pid 1320
2015-07-28 17:34:00,753 Nvidia kernel module version 346.59
2015-07-28 17:34:00,764 CUDA initialization (this may take a few seconds)
2015-07-28 17:34:00,765 xpra is ready.
2015-07-28 17:34:00,781 Warning: nvenc video encoder failed: cuInit failed: unknown
2015-07-28 17:34:00,781 init_video_encoders_options() cannot add nvenc4 encoder
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 256, in init_video_encoders_options
    self.init_video_encoder_option(mod)
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 278, in init_video_encoder_option
    raise e
Error: cuInit failed: unknown
2015-07-28 17:34:00,791 nvenc3 warning: unsupported driver version 346.59, disabling YUV444 support
2015-07-28 17:34:00,791 CUDA initialization (this may take a few seconds)
2015-07-28 17:34:00,794 Warning: nvenc video encoder failed: cuInit failed: unknown
2015-07-28 17:34:00,794 init_video_encoders_options() cannot add nvenc3 encoder
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 256, in init_video_encoders_options
    self.init_video_encoder_option(mod)
  File "/usr/lib/python2.7/dist-packages/xpra/codecs/video_helper.py", line 278, in init_video_encoder_option
    raise e
Error: cuInit failed: unknown
2015-07-28 17:34:00,794 video encoder 'nvenc5' could not be loaded:
2015-07-28 17:34:00,794  No module named nvenc5

comment:9 Changed 4 years ago by Antoine Martin

Owner: changed from alas to twotwenty

These errors from comment:5 (AssertionError: failed to load BGRA_to_NV12 for device 0) are just a simple blooper: I forgot to bundle the CUDA bin files in the package, this is fixed in r10133 (which I will backport once I figure out a way to fix the build on the platforms that don't have CUDA available and therefore don't have those files). Newer beta packages are available for Jessie, Trusty and Stretch. (64-bit only)

The Illegal instruction (core dumped) from comment:7 is quite strange, I've never seen this - how did you solve it? The correct dependencies (xvfb or whatever) should have been installed with the package, were they not?

The Error: cuInit failed: unknown from comment:8 is just as weird, I have no idea why you get a different error then.
Can you please run with -d video,nvenc,cuda? (these flags are generally useful for debugging all nvenc issues)

(I'll do some more testing once Debian has finished downloading the hundreds of megabytes of dependencies of pycuda... not today for sure)

comment:10 Changed 4 years ago by twotwenty

xvfb was not pulled in as a dependency for xpra on either 14.04 or 15.04 and both OSes were fresh installs, my current jessie install is long standing I will get a fresh install soon and use that for testing.

The core dump in comment:7 has not been resolved, I'll look a little further into this today.

comment:11 Changed 4 years ago by twotwenty

Ubuntu14.04
When running without nvenc

$ xpra --no-daemon --bind-tcp=0.0.0.0:11000 --no-mdns --start-child=xterm start :101
Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension SECURITY
Initializing built-in extension XINERAMA
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension Present
Initializing built-in extension DRI3
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension SELinux
Initializing built-in extension GLX
[dix] Could not init font path element /usr/share/fonts/X11/cyrillic, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/100dpi/:unscaled, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/75dpi/:unscaled, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/100dpi, removing from list!
[dix] Could not init font path element /usr/share/fonts/X11/75dpi, removing from list!
Xlib:  extension "RANDR" missing on display ":101".
Xlib:  extension "RANDR" missing on display ":101".
xpra main error:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/xpra/scripts/main.py", line 120, in main
    return run_mode(script_file, err, options, args, mode, defaults)
  File "/usr/lib/python2.7/dist-packages/xpra/scripts/main.py", line 862, in run_mode
    return run_server(error_cb, options, mode, script_file, args)
  File "/usr/lib/python2.7/dist-packages/xpra/scripts/server.py", line 944, in run_server
    save_xvfb_pid(xvfb_pid)
  File "/usr/lib/python2.7/dist-packages/xpra/scripts/server.py", line 68, in save_xvfb_pid
    from xpra.x11.gtk_x11.prop import prop_set
  File "/usr/lib/python2.7/dist-packages/xpra/x11/gtk_x11/prop.py", line 38, in <module>
    from xpra.x11.bindings.window_bindings import (
ImportError: /usr/lib/python2.7/dist-packages/xpra/x11/bindings/window_bindings.so: undefined symbol: XShapeQueryExtents

2015-07-29 16:37:56,844 closing tcp socket 0.0.0.0:11000
2015-07-29 16:37:56,844 removing socket /home/maint/.xpra/two-ubuntu1404-101

comment:12 Changed 4 years ago by Antoine Martin

ImportError: /usr/lib/python2.7/dist-packages/xpra/x11/bindings/window_bindings.so: undefined symbol: XShapeQueryExtents

That's already fixed in r10127. Maybe this is a 32-bit system? (no new packages have been made yet) or just an older build?

comment:13 Changed 4 years ago by Antoine Martin

FWIW: I have tested it on a Debian Stretch system without problems.

Only nvenc4 was being built up until now, but I have added nvenc5 support to the buildbot so the latest and all future builds will have both nvenc4 and nvenc5 (nvenc4 is still preferred because it allows us to supply a license key and avoid the context limits)

I will try to test on Ubuntu if I can get it installed on this system (was not playing nice with the GTX 970 last time I tried)

comment:14 Changed 4 years ago by Antoine Martin

You're right about Xvfb: the /etc/xpra/xpra.conf file we generate is correct (uses Xvfb on Ubuntu because of their broken Xorg setup) but the control file was not using the correct dependencies. This is fixed in r10140 - will backport.

comment:15 Changed 4 years ago by Antoine Martin

re: XShapeQueryExtents, you were testing on 15.04 and I had not made new beta builds for this distro (as per comment:9). I have done so now and the error is gone.

I also installed the proprietary drivers and python-pycuda on this 15.04 system, and apart from some new unrelated problems (#934), both nvenc4 and nvenc5 showed up in the codec loader:

$ ./xpra/codecs/loader.py 
2015-07-30 13:42:05,716 libvpx ABI version 5 is too old: disabling VP9 YUV444P support
2015-07-30 13:42:05,894 libavcodec version (56, 1, 0) is too old: disabling VP9
2015-07-30 13:42:05,897 libav: No accelerated colorspace conversion found from yuv422p to rgb24.
2015-07-30 13:42:05,897 libav: No accelerated colorspace conversion found from yuv422p to bgr24.
2015-07-30 13:42:05,897 libav: No accelerated colorspace conversion found from yuv422p to bgra.
2015-07-30 13:42:05,905 libav: too many threads/slices 5, reducing to 1
2015-07-30 13:42:05,911 libav: too many threads/slices 5, reducing to 1
2015-07-30 13:42:05,916 libav: too many threads/slices 5, reducing to 1
codecs and csc modules found:
* csc_cython           : /usr/lib/python2.7/dist-packages/xpra/codecs/csc_cython/colorspace_converter.so
* csc_opencl           : 
* csc_swscale          : /usr/lib/python2.7/dist-packages/xpra/codecs/csc_swscale/colorspace_converter.so
* dec_avcodec2         : /usr/lib/python2.7/dist-packages/xpra/codecs/dec_avcodec2/decoder.so
* dec_pillow           : /usr/lib/python2.7/dist-packages/xpra/codecs/pillow/decode.pyc
* dec_vpx              : /usr/lib/python2.7/dist-packages/xpra/codecs/vpx/decoder.so
* dec_webp             : 
* enc_pillow           : /usr/lib/python2.7/dist-packages/xpra/codecs/pillow/encode.pyc
* enc_vpx              : /usr/lib/python2.7/dist-packages/xpra/codecs/vpx/encoder.so
* enc_webp             : 
* enc_x264             : /usr/lib/python2.7/dist-packages/xpra/codecs/enc_x264/encoder.so
* enc_x265             : 
* nvenc4               : /usr/lib/python2.7/dist-packages/xpra/codecs/nvenc4/encoder.so
* nvenc5               : /usr/lib/python2.7/dist-packages/xpra/codecs/nvenc5/encoder.so

codecs versions:
* PIL                  : 2.7.0
* avcodec2             : 56.1.0
* buffer_api           : 1
* cython               : 0.3.0.21.1
* dec_pillow           : 2.7.0
* enc_pillow           : 2.7.0
* numpy                : 1.8.2
* nvenc4               : 4.0.0
* nvenc5               : 5.0.0
* swscale              : 3.0.0
* vpx                  : 1.3.0
* x264                 : 142

Works for me! (I will also re-test with 0.14.x and 0.15.x)

comment:16 Changed 4 years ago by Antoine Martin

I can reproduce the "cuInit failed: unknown" error on a "fresh" install of Ubuntu 15.04, but not on Debian Stretch..
It isn't our bug: you can easily reproduce it from the command line like so:

python -c "from pycuda import driver;driver.init()"

After just a little bit of googling I found the solution:

apt-get install nvidia-modprobe

Not much we can do about this - Ubuntu should ensure things work properly out of the box (Debian does). See: PyCUDA error: cuInit failed and this upstream ticket: nvidia-graphics-drivers-331 and newer should recommend nvidia-modprobe

@twotwenty: does that work for you? (updated 0.15 beta packages are available)

comment:17 Changed 4 years ago by Antoine Martin

Resolution: fixed
Status: newclosed

Not heard back and tested OK again, closing.

Note: See TracTickets for help on using tickets.