import bpy
import json

# Force CPU rendering
bpy.context.preferences.addons["cycles"].preferences.compute_device_type = "NONE"
bpy.context.scene.cycles.device = "CPU"

# Ensure Cycles is available
bpy.context.preferences.addons['cycles'].preferences.get_devices()

# Collect the devices information
devices_info = []
for device in bpy.context.preferences.addons['cycles'].preferences.devices:
    devices_info.append({
        "name": device.name,
        "type": device.type,
        "use": device.use
    })

# Print the devices information in JSON format
print("GPU DATA:" + json.dumps(devices_info))
