Open aurelienpierre opened 9 months ago
https://askubuntu.com/questions/1009888/how-does-an-appimage-persist-settings-between-launches states that starting /some/path/to/my.AppImage --appimage-portable-config
creates a persistent config director across restarts. The equivalent for cache is not implemented.
As a workaround, in src/common/file_location.c:198
, make the use of g_get_user_cache_dir()
optional and create an user-defined config key to force a cache dir.
The weird thing is AppImage is able to use the default, generic system-wise config directory, which is persistent (no issue on that side).
I think the reason is each time AppImage extract itself to different dirs, and the map between .cl
path and cache is invalid because extract path is changed?
Something like that, yes.
The first solution comes up in my head is to release those .cl
files into some user folder like .local/share/ansel/kernels
, and try to load from there first, then fallback to /usr/share/ansel/kernels
. However, the problem is either release files on every startup, or you have to create a method to update .local/share/ansel/kernels
when you have new version, or only enable this function when building AppImage with a build option.
I then have a better idea, instead of using paths to map to cache, what about write some version files in the kernels
dir, like write git commit hash or generate a random string by CMake on building into version.txt
, and use it to create map to cache. So the same build will always use the same cache.
I am not sure which one is better and easier to implement, but I just write suggestion I could come up for you 😸️
I then have a better idea, instead of using paths to map to cache, what about write some version files in the kernels dir, like write git commit hash or generate a random string by CMake on building into version.txt, and use it to create map to cache. So the same build will always use the same cache.
Won't work. If you start the same AppImage twice, you get 2 differents temporary dir pathes with random names. The only hope here is to store the cache somewhere immutable, which might need to make it user-configurable. Config dir works, it's just that cache dir doesn't seem to be fully implemented with AppImage stack.
Won't work. If you start the same AppImage twice, you get 2 differents temporary dir pathes with random names.
Did you mean OpenCL cache is not controlled by ourselves so it must use path as key to map to caches?
AppImage stores pre-built OpenCL kernels in
KERNEL DIRECTORY: /tmp/.mount_Ansel-JKZOKO/usr/share/ansel/kernels
. This is not persistent across restarts, so the kernels have to be rebuilt everytime. This introduces a significant lag in loading time.Find a way to store kernels in
.cache/ansel/kernels
as with the vanilla variant.