@kkar thank you so much, this was finally the solution.
The lines I needed were actually the following two, but it was found in the same thread you linked to.
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[0].use = True
For future reference:
- Check to see if Cycles can see devices by running the following from command line and seeing if it lists your devices
blender -b --python-console #launches the blender python console
import _cycles
_cycles.available_devices()
It should give an output like
(('AMD FX(tm)-6350 Six-Core Processor', 'CPU', 'CPU'), ('GeForce GTX 970', 'CUDA', 'CUDA_GeForce GTX 970_0000:01:00'))
-
If your devices are not listed then install / reinstall NVidia / CUDA drivers. If your device is listed proceed to step 3
-
In order to set your devices, run the following from the blender python console (where X is your desired CUDA device number)
bpy.context.user_preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'
bpy.context.user_preferences.addons['cycles'].preferences.devices[X].use = True
This will probably be completely outdated in a couple months when 2.8 releases and I am going to have to figure this out all over again, but in the mean time I hope this helps somebody
and again, thank you @kkar for being patient and helping me through this