negativo17 / cuda

NVIDIA Compute Unified Device Architecture Toolkit
14 stars 1 forks source link

cuda packages do not provide Davinci Resolve Studio H264/H265 encode options (works with official NV repo) #29

Closed GloriousEggroll closed 1 year ago

GloriousEggroll commented 1 year ago

In the paid version of Davinci Resolve (Studio --aka-- DRS), if you use the official nvidia CUDA repository drivers and cuda packages for fedora:

http://developer.download.nvidia.com/compute/cuda/repos/fedora35/

DRS provides proper advertised H264/H265 hardware encode options, however when using the nvidia drivers + cuda (and cuda-devel) packages from Negativo17 repo instead, those options do not show up.

It should additionally be noted that the options also do not show up when using rpmfusion packages, and rpmfusion recommends to use the official nvidia repo for full cuda support.

I figured this is a bug in this repo since per the documentation this repo should also provide fully functional cuda packages: https://negativo17.org/nvidia-driver/#CUDA_support

Complete packaged CUDA stack has been added for all supported distributions, all the packages provide/require/obsolete the relevant packages in the [Nvidia CUDA repository](http://developer.download.nvidia.com/compute/cuda/repos/); so you can enable this repository along with the official Nvidia CUDA one (x86_64 systems only).
scaronni commented 1 year ago

Hi, sorry but I've never used Davinci Resolve studio, so I don't know how the detection works. Usually my experience is that some commercial software hardcodes /usr/local/cuda in their binaries and in some other cases it expects to have a variable CUDA_ROOT or CUDA_PATH pointing to the root of the installation. My packages are using FHS for libraries etc. as I'm not interested in having multiple versions supported without using DNF modules or software collections.

In the first case you can probably solve it with a symlink, in the second case you can probably point CUDA_ROOT or CUDA_PATH to /usr.

Having said that, is there a place where I can download and check the software for free? Thanks.

scaronni commented 1 year ago

Never mind, just figured out I can download it at: https://www.blackmagicdesign.com/support/family/davinci-resolve-and-fusion

I'll test and let you know.

GloriousEggroll commented 1 year ago

Just to save a headache -- unfortunately only the paid version provides the encode options, ill see if i can mess around with symlinking and find whats happening

scaronni commented 1 year ago

Just tried with the free version and it works fine just fine with the driver packages, it does not even need any CUDA package as it includes already all the CUDA libraries it needs:

$ ls -l /opt/resolve/libs/lib{cu,nv}*
-rwxr-xr-x. 1 root root  175953248 Dec  6 07:58 /opt/resolve/libs/libcublasLt.so
-rwxr-xr-x. 1 root root  175953248 Dec  6 07:58 /opt/resolve/libs/libcublasLt.so.11
-rwxr-xr-x. 1 root root  175953248 Dec  6 07:58 /opt/resolve/libs/libcublasLt.so.11.2.0.252
-rwxr-xr-x. 1 root root   96806384 Dec  6 07:58 /opt/resolve/libs/libcublas.so
-rwxr-xr-x. 1 root root   96806384 Dec  6 07:58 /opt/resolve/libs/libcublas.so.11
-rwxr-xr-x. 1 root root   96806384 Dec  6 07:58 /opt/resolve/libs/libcublas.so.11.2.0.252
-rwxr-xr-x. 1 root root     514936 Dec  6 07:58 /opt/resolve/libs/libcudart.so
-rwxr-xr-x. 1 root root     514936 Dec  6 07:58 /opt/resolve/libs/libcudart.so.11.0
-rwxr-xr-x. 1 root root     514936 Dec  6 07:58 /opt/resolve/libs/libcudart.so.11.0.221
-rwxr-xr-x. 1 root root     325992 Dec  6 07:58 /opt/resolve/libs/libcudart.so.6.5
-rwxr-xr-x. 1 root root     383336 Dec  6 07:58 /opt/resolve/libs/libcudart.so.7.5
-rwxr-xr-x. 1 root root     445848 Dec  6 07:58 /opt/resolve/libs/libcudart.so.9.1
-rwxr-xr-x. 1 root root   98957080 Dec  6 07:58 /opt/resolve/libs/libcudnn_adv_infer.so.8
-rwxr-xr-x. 1 root root 1288305728 Dec  6 07:58 /opt/resolve/libs/libcudnn_cnn_infer.so.8
-rwxr-xr-x. 1 root root  251390696 Dec  6 07:58 /opt/resolve/libs/libcudnn_ops_infer.so.8
-rwxr-xr-x. 1 root root     158264 Dec  6 07:58 /opt/resolve/libs/libcudnn.so.8
-rwxr-xr-x. 1 root root     671904 Dec  6 07:58 /opt/resolve/libs/libcurl.so
-rwxr-xr-x. 1 root root    5455272 Dec  6 07:58 /opt/resolve/libs/libnvrtc-builtins.so
-rwxr-xr-x. 1 root root    5455272 Dec  6 07:58 /opt/resolve/libs/libnvrtc-builtins.so.11.0
-rwxr-xr-x. 1 root root    5455272 Dec  6 07:58 /opt/resolve/libs/libnvrtc-builtins.so.11.0.221
-rwxr-xr-x. 1 root root   22408512 Dec  6 07:58 /opt/resolve/libs/libnvrtc-builtins.so.7.5
-rwxr-xr-x. 1 root root    3331184 Dec  6 07:58 /opt/resolve/libs/libnvrtc-builtins.so.9.1
-rwxr-xr-x. 1 root root   22290168 Dec  6 07:58 /opt/resolve/libs/libnvrtc.so
-rwxr-xr-x. 1 root root   22290168 Dec  6 07:58 /opt/resolve/libs/libnvrtc.so.11.0
-rwxr-xr-x. 1 root root   22290168 Dec  6 07:58 /opt/resolve/libs/libnvrtc.so.11.0.221
-rwxr-xr-x. 1 root root   18199288 Dec  6 07:58 /opt/resolve/libs/libnvrtc.so.7.5
-rwxr-xr-x. 1 root root   21705024 Dec  6 07:58 /opt/resolve/libs/libnvrtc.so.9.1

These are the packages you need, basically just the driver:

dkms-nvidia-525.60.11-1.fc37.x86_64
nvidia-driver-525.60.11-1.fc37.x86_64
nvidia-driver-cuda-525.60.11-1.fc37.x86_64
nvidia-driver-cuda-libs-525.60.11-1.fc37.i686
nvidia-driver-cuda-libs-525.60.11-1.fc37.x86_64
nvidia-driver-libs-525.60.11-1.fc37.i686
nvidia-driver-libs-525.60.11-1.fc37.x86_64
nvidia-driver-NVML-525.60.11-1.fc37.x86_64
nvidia-kmod-common-525.60.11-1.fc37.noarch
nvidia-libXNVCtrl-525.60.11-1.fc37.x86_64
nvidia-persistenced-525.60.11-1.fc37.x86_64
nvidia-settings-525.60.11-1.fc37.x86_64

So on a pristine system:

dnf -y install nvidia-driver nvidia-driver-cuda

That's it:

image

GloriousEggroll commented 1 year ago

thats not what im talking about.

In the deliver section if you have an nvidia GPU and cuda installed its supposed to show H264 and H265 encode options on the DR Studio version. With the current negativo17 drivers it does not do so. This issue should be reopened

ryzendew commented 1 year ago

thats not what im talking about.

In the deliver section if you have an nvidia GPU and cuda installed its supposed to show H264 and H265 encode options on the DR Studio version. With the current negativo17 drivers it does not do so. This issue should be reopened

This is correct and this is an issue

GloriousEggroll commented 1 year ago

This is what I'm referring to: DRS These are Hardware encode options that only show up in the Studio version, and only with Nvidia cards that have proper CUDA packages and drivers installed.

ryzendew commented 1 year ago

As said above and i have had this issue ans would to see it fixed

scaronni commented 1 year ago

Anyone that can pass me the installer of the Studio version so I can check?

scaronni commented 1 year ago

Since the software itself is bundling more CUDA version libraries it must be something simple like a missing library in a specific place or similar stuff.

scaronni commented 1 year ago

Found the "Studio" installer can be downloaded for free, now I need a key.

ryzendew commented 1 year ago

Found the "Studio" installer can be downloaded for free, now I need a key.

It cost money just trust GE he has been through hell to fix this issue

scaronni commented 1 year ago

Ehm, I can not contribute without access to the software. What do you expect me to do then?

GloriousEggroll commented 1 year ago

@scaronni I sent you my serial # via email (negativo17@gmail.com).

scaronni commented 1 year ago

Just to be clear, I'll respond privately to @GloriousEggroll for license issues. So far I was not able to activate it.

scaronni commented 1 year ago

Works, trying to figure out.

scaronni commented 1 year ago

@GloriousEggroll @RyzenDew, so I think I found the fix. Ignore the Nvidia repository, make sure your system is clean of all their packages and just install the following:

dnf -y install nvidia-driver nvidia-driver-cuda nvidia-driver-devel

If you prefer DKMS over akmods:

dnf -y install dkms-nvidia nvidia-driver nvidia-driver-cuda nvidia-driver-devel

The detection just works. You don't need any other CUDA package at all as the installer ships everything needed, only the driver is needed.

scaronni commented 1 year ago

The issue is the check for the libraries. I ship only versioned libraries in the main packages, while Nvidia makes a bundle of all of them and instruct people to check for the unversioned ones (libcuda.so being the main example). This is not very standard, so I'm not particularly in favor of it. But hey, things you buy need to work even if you don't agree completely.

There are a few other libraries that are checked by various programs (I think I stepped into Maya as well), in this case I'm adding the necessary symlink if the information can not be derived by the shared object (through ldconfig):

https://github.com/negativo17/nvidia-driver/blob/master/nvidia-driver.spec#L167-L173

Then I'm adding them to the main library subpackages and skip them in the -devel subpackages:

https://github.com/negativo17/nvidia-driver/blob/master/nvidia-driver.spec#L369

In this case, just by installing nvidia-driver-devel, we can see that Da Vinci Resolve (cool product btw) looks for one of these unversioned libraries:

$ rpm -ql nvidia-driver-devel
/usr/lib64/libnvcuvid.so
/usr/lib64/libnvidia-encode.so

The strange thing is why I can't see them with strace, so they must be dlopened from another library. I'm checking how this is happening and then I'll come up with a fix (probably just getting rid of the nvidia-driver-devel subpackage completely).

scaronni commented 1 year ago

Well, bingo:

$ strings '/opt/resolve/bin/DaVinci Remote Monitoring' | grep libnvcuvid.so
libnvcuvid.so

I'll get rid of the nvidia-driver-devel package completely, it's already almost empty by now after all these years.

GloriousEggroll commented 1 year ago

awesome thanks for digging in and getting it resolved! it will be really nice to have these working without needing the entire giant mass of cuda packages from nvidia

scaronni commented 1 year ago

Packages are being built now and will be pushed soon.