render_devices: 'auto' or backends listed in `torchruntime.utils.SUPPORTED_BACKENDS` active_devices: [backends listed in `torchruntime.utils.SUPPORTED_BACKENDS`]
(render_devices, active_devices)
| 30 | |
| 31 | |
| 32 | def get_device_delta(render_devices, active_devices): |
| 33 | """ |
| 34 | render_devices: 'auto' or backends listed in `torchruntime.utils.SUPPORTED_BACKENDS` |
| 35 | active_devices: [backends listed in `torchruntime.utils.SUPPORTED_BACKENDS`] |
| 36 | """ |
| 37 | |
| 38 | render_devices = render_devices or "auto" |
| 39 | render_devices = [render_devices] if isinstance(render_devices, str) else render_devices |
| 40 | |
| 41 | # check for backend support |
| 42 | validate_render_devices(render_devices) |
| 43 | |
| 44 | if "auto" in render_devices: |
| 45 | render_devices = auto_pick_devices(active_devices) |
| 46 | if "cpu" in render_devices: |
| 47 | log.warn("WARNING: Could not find a compatible GPU. Using the CPU, but this will be very slow!") |
| 48 | |
| 49 | active_devices = set(active_devices) |
| 50 | render_devices = set(render_devices) |
| 51 | |
| 52 | devices_to_start = render_devices - active_devices |
| 53 | devices_to_stop = active_devices - render_devices |
| 54 | |
| 55 | return devices_to_start, devices_to_stop |
| 56 | |
| 57 | |
| 58 | def validate_render_devices(render_devices): |
nothing calls this directly
no test coverage detected