Headless render: can't find compute_device in 2.78b
From the 2.78b, it's necessary to recover them via the preferences of the Cycles addon.
You cant get it with

bpy.context.user_preferences.addon['cycles'].preferences.compute_device_type


And for the devices:

for card in bpy.context.user_preferences.addons['cycles'].preferences.devices:
    print(card.name)