# GPU rendering via CLI not working in 2.81

Blender 2.81 seems to have broken CLI headless rendering with CUDA GPU.

Here's the Py script people often use: Rendering on command-line with GPU?

• blender -b *.blend -a -E CYCLES -P script.py
• Blend file has CUDA enabled on another machine
• Shows line that says Activating GTX 1080 Ti
• nvidia-smi shows 0% usage, CPUs are 100%

Any ideas on a fix?

• The order of your CLI arguments appears to be wrong. The -a should be the last one, otherwise you're starting to render before setting the render engine and enabling the GPUs. Writing this from my phone, will have to verify later. – Robert Gützkow Mar 7 '20 at 8:36
• That solved it, strange but works! – IsleOfManIsAwesome Mar 7 '20 at 21:53
• Great, I will add it as an answer within the next days. It's not strange though, the importance of argument order is also documented in Blender's manual. – Robert Gützkow Mar 7 '20 at 21:56

Blender's command line interface executes the argument in the order they are given, as documented in the manual. Therefore your command renders the animation (-a, --render-anim) before executing the Python script (-P, --python). Hence the GPU is enabled after the rendering is already done.
If you put the -a argument last, it should properly render the animation on the GPU.