Félix Baylac Jacqué
c7c5f08cbc
We manage to improve the cold cache generation from 98s to ~30s on my desktop. Two things have been done to improve that performance: 1. This one was stupid. I forgot a debug tracing routine that should have been removed in the code… This tracing routine was forcing us to cache the libraries… …twice. Massive facepalm. Addressing this reduced the cold runtime by 50%. 2. Instead of spinning up a patchelf subprocess for each library, we batch these operations as much as possible in a single subprocess. This trick shaves about 30% of the remaining runtime. |
||
---|---|---|
overlays | ||
src | ||
tests/fixtures/json_permut | ||
.envrc | ||
INTERALS.md | ||
README.md | ||
default.nix | ||
flake.lock | ||
flake.nix | ||
shell.nix |
README.md
NixGLHost
Running OpenGL/Cuda/OpenCL Nix-built binaries on a foreign Linux distro is quite often a challenge. These programs are relying on some host-specific graphics drivers at runtime. These drivers are host-specific, it is obviously impossible to distribute the drivers for each and every hosts setup through a pre-defined generic nix closure.
NixGLHost solves this issue by re-using your host system graphics drivers. It copies them to an isolated environment and inject the said environment to the Nix runtime closure.
Current status: experimental.
How to Use
All you have to do is to wrap your nix-built OpenGL/Cuda program with nixglhost
:
For instance, let's say you want to run my-gl-program
, a nix-built
program on your favorite distribution. All you'll have to do is:
nixglhost my-gl-program
Example
Let's nix-build glxgears, living in the glxinfo Nixpkgs derivation then execute it with nixglhost.
cd $thisRepoCheckout
PATH=$(nix build --print-out-paths)/bin:$PATH
nixglhost $(nix build --print-out-paths .#glxinfo)/bin/glxgears
Internals
You can read the INTERNALS.md file to learn how exactly NixGLHost
works.
Support
- [-] Proprietary Nvidia
- GLX
- EGL
- Cuda
- OpenCL
- Mesa
- GLX
- EGL
- OpenCL
Alternative Approaches
- NixGL: tries to auto detect the host vendor driver type/version, then download/install it from its Nixpkgs derivation.