Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,27 @@ import tempfile
|
|
6 |
import molecularnodes as mn
|
7 |
import os
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
window = bpy.context.window
|
11 |
screen = window.screen
|
|
|
6 |
import molecularnodes as mn
|
7 |
import os
|
8 |
|
9 |
+
def enable_GPUS():
|
10 |
+
bpy.data.scenes[0].render.engine = "CYCLES" #"CYCLES"
|
11 |
+
# Set the device_type
|
12 |
+
bpy.context.preferences.addons[
|
13 |
+
"cycles"
|
14 |
+
].preferences.compute_device_type = "CUDA" # or "OPENCL"
|
15 |
+
|
16 |
+
# Set the device and feature set
|
17 |
+
bpy.context.scene.cycles.device = "GPU"
|
18 |
+
|
19 |
+
for scene in bpy.data.scenes:
|
20 |
+
scene.cycles.device = "GPU"
|
21 |
+
|
22 |
+
bpy.context.preferences.addons["cycles"].preferences.get_devices()
|
23 |
+
print(bpy.context.preferences.addons["cycles"].preferences.compute_device_type)
|
24 |
+
for d in bpy.context.preferences.addons["cycles"].preferences.devices:
|
25 |
+
d["use"] = True # Using all devices, include GPU and CPU
|
26 |
+
print(d["name"])
|
27 |
+
|
28 |
+
|
29 |
+
enable_GPUS()
|
30 |
|
31 |
window = bpy.context.window
|
32 |
screen = window.screen
|