Run job from command line + GPU on linux

Hello :stuck_out_tongue:

I’m trying to run blender from commande line. It works OK but it’s on my CPU. I have 8x3070 on this machine and a want to run a render scene on from a t least one of my GPU.
I’have tryied a lot of python script. but nothing works.

Here is my command line :
blender -b tree_creature.blend -o //render_####.png -a -noaudio -P setup.py
I have the lasted nvidia drivers on linux.

Can you help me ?

Thanks

It seems to be disabled…not sure

blender -b tree_creature.blend -o //render_####.png -a -noaudio -E CYCLES -t 0 -F PNG -x 1 -f 1 --devices 1,2 is not working …

or via script :
import bpy

Activer le rendu GPU

bpy.context.preferences.addons[‘cycles’].preferences.get_devices()

Activer CUDA

bpy.context.preferences.addons[‘cycles’].preferences.compute_device_type = ‘CUDA’
bpy.context.preferences.addons[‘cycles’].preferences.devices[0].use = True

Lancer le rendu

bpy.ops.render.render(animation=False, write_still=True)

any clue ?

Tanks a lot