Commit Graph

6 Commits

Author SHA1 Message Date
Félix Baylac Jacqué 891dd0bf95
Cache cold build: prevent race condition
We had a race condition on cold cache builds. When several nix-gl-host
instances were called, they were trying to concurrently build the
cache.

This lead to some weird errors and busted caches.

We introduce a file lock preventing any concurrent access to the
cache.

We take advantage of this bug to rethink the way we build the cache
and do it in a more robust way. Instead of building it in place, we're
now building it first in a temporary directory (while making sure to
patchelf the DSOs according their final destination). We then move
this directory to the actual cache destination iff the cache has been
built successfully.
2023-01-17 16:14:16 +01:00
Félix Baylac Jacqué 4f51b37c29
nvidia_main: refactor out metadata generation in separate function
This nvidia_main function got out of control. Let's chop the metadata
generation out of it.
2023-01-17 12:41:07 +01:00
Félix Baylac Jacqué 37d4a1b248
Bugfix: do not try to copy and patch unexisting DSOs
It seems like some drivers installations are missing some NVidia
subsystems. We stumbled upon the case of somebody missing the Cuda
libraries.

It did end up making fail the patchelf call.

Preventing the copying/patch routine to run when we do not have any
DSO to copy/patch.
2022-12-22 19:01:31 +01:00
Félix Baylac Jacqué eb782d3fd5 Bug: use mtime instead of atime as timestamp
atime == last time a file has been accessed.
mtime == last time a file has been modified.

Facepalm on that one…
2022-12-19 20:53:14 +01:00
Félix Baylac Jacqué c7c5f08cbc Cold cache: optimize cache generation
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.
2022-12-14 19:20:31 +01:00
Félix Baylac Jacqué 97e35d20fa Rename nixglhost_wrapper -> nixglhost 2022-12-14 19:20:31 +01:00
Renamed from src/nixglhost_wrapper.py (Browse further)