blender: add CUDA discovery test

This commit is contained in:
Someone Serge
2024-06-26 00:35:42 +00:00
parent 340b41815d
commit b9299696ab
2 changed files with 18 additions and 0 deletions
@@ -372,6 +372,16 @@ stdenv.mkDerivation (finalAttrs: {
--render-frame 1
done
'';
cudaAvailable = runCommand
"blender-cuda-available"
{
nativeBuildInputs = [ finalAttrs.finalPackage ];
requiredSystemFeatures = [ "cuda" ];
}
''
blender --background -noaudio --python-exit-code 1 --python ${./test-cuda.py} && touch $out
'';
};
};
@@ -0,0 +1,8 @@
import bpy
preferences = bpy.context.preferences.addons["cycles"].preferences
devices = preferences.get_devices_for_type("CUDA")
ids = [d.id for d in devices]
assert any("CUDA" in i for i in ids), f"CUDA not present in {ids}"
print("CUDA is available")