Distributing an Optix enabled version of Blender in Ubuntu

I’m maintaining the Ubuntu Blender PPA and people are asking for an Optix-enabled version. PPA maintainers just inject source packages. My understanding is that Optix headers cannot be redistributed and I, therefore, don’t distribute an Optix-enabled Blender.

I was wondering whether anyone had found a way to circumvent this restriction (if it does exist)?

NB: I already precompile CUDA kernels which I shamelessly include in the source archive, so a very partial precompilation could be feasible.

There is a way to download the OptiX headers directly, which can provide a workaround:

We should probably add a CMake option to do this to the Blender build, but I haven’t gotten around to it yet.


Thanks. Will try this. I’m wondering if Ubuntu compile cluster allows for downloading. Will see :slight_smile:

Well, as I expected, the Ubuntu compilation cluster does not allow for network connection to the internet. I think I’m FOOBAR.

How can official Blender builds deal with this redistribution limitation?

Sorry to intrude on the thread, but I am interested to know for those of us who share out there Blender portable builds with Optix capability (where OptiX kernel is compiled on the Blender user’s computer that uses that portable version)

You can’t redistribute the OptiX SDK or headers. There’s similar restrictions on Visual Studio and Xcode for example, so in that sense it’s not that strange.

Blender builds do not bundle OptiX headers (unless you made some modification to do that). If the user downloads the OptiX SDK, sets the OPTIX_ROOT_DIR environment variable and then does runtime compilation it’s fine too. But that’s hardly convenient, so not sure you are relying on users to do that?

Yes, that is what I do to build Blender. I point to the “include” folder in cmake-gui where I have downloaded the OptiX SDK. Then the first time I run Blender with OptiX, the OptiX kernel is compiled, just like with official Blender builds.
I am not a developer. I just don’t understand why the Ubuntu PPA maintainer couldn’t then build Blender that way as well to be able to offer binaries with OptiX enabled capability in that PPA.

OptiX compilation is in two stages. First we compile to ptx as part of the build, for which OptiX headers are needed. Then on the users’ computer it compiles ptx to machine code, and for that no OptiX headers are needed.

The reason it’s not so easy to do for Linux distributions is that to download the OptiX SDK you need to log in with an NVIDIA developer account, which is problematic to do as part of an automated build system. The CUDA toolkit on the other hand can be downloaded directly. Not sure why NVIDIA decided to do it this way, but they provided the header download workaround for this.

1 Like

No, the idea is really to avoid having the users do that. But the Ubuntu compilation clusters are hiding the internet behind a firewall. SO I cannot download the headers when compilation occurs.

Thanks to both of you, I think I have a solution here. I will distribute the .ptx files. I can try to find the information myself of course, but if you know: is it ok to put these .ptx files in the same location as the precompiled cuda kernels?

The PPA maintainers don’t produce binaries, that’s why. Ubuntu requires that PPA maintainers produce source packages that are later compiled by Ubuntu on their cluster (which has no direct access to internet). I do have a debian package with the last OPTIX enabled version of Blender that I built myself and installed on my machine. But PPA need source packages, thus OPTIX headers and I cannot redistribute them.

1 Like

The nvidia driver will take care of this on the end users machine, nothing extra is needed once you have the ptx.

It’s the cycles_kernel_optix target.

I apparently have successfully produced an OptiX enabled blender Ubuntu package, using precompiled .ptx files. Thanks for your help, all of you!