Update device selection
GPU is selected based on the ratio of available memory. For example, if we have two devices with following parameters:
Device 1: 6GB RAM, 50% available
Device 2: 2GB RAM, 100% available
... Then Device 2 is preferred as the ratio of available memory to total memory is greater compared to Device 1. Nonetheless, we can see that the total amount of available memory (0.5x6 = 3GB) on Device 2 is actually greater compared to Device 1 (1.0x2 = 2GB) and thus Device 2 should be preferred.