Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2020-10-02 01:48:01 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2020-10-02 20:26:35 +0300
commitcfa101c22871c3d115f854e23f8b656b1c58a304 (patch)
tree33051b28379c0e23d0948c61ee63d9a95dd45266 /intern/cycles/blender/addon/engine.py
parent90a27d5aa91a1b6a25ea14e11c889d47f77f4cf7 (diff)
Cycles: Add command line option for overriding the compute device
The current way of setting the compute device makes sense for local use, but for headless rendering it it a massive pain to get Cycles to use the correct device, usually involving entire Python scripts. Therefore, this patch adds a simple command-line option to Blender for specifying the type of device that should be used. If the option is present, the settings in the user preferences and the scene are ignored, and instead all devices matching the specified type are used. Differential Revision: https://developer.blender.org/D9086
Diffstat (limited to 'intern/cycles/blender/addon/engine.py')
-rw-r--r--intern/cycles/blender/addon/engine.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index 54221d3f1e0..807dcaf7f43 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -70,6 +70,11 @@ def _configure_argument_parser():
parser.add_argument("--cycles-print-stats",
help="Print rendering statistics to stderr",
action='store_true')
+ parser.add_argument("--cycles-device",
+ help="Set the device to use for Cycles, overriding user preferences and the scene setting."
+ "Valid options are 'CPU', 'CUDA', 'OPTIX' or 'OPENCL'."
+ "Additionally, you can append '+CPU' to any GPU type for hybrid rendering.",
+ default=None)
return parser
@@ -102,6 +107,10 @@ def _parse_command_line():
import _cycles
_cycles.enable_print_stats()
+ if args.cycles_device:
+ import _cycles
+ _cycles.set_device_override(args.cycles_device)
+
def init():
import bpy