Module qute.device
Simplify multi-platform device support.
Functions
def cuda_does_gpu_support_16bit_mixed_precision() ‑> bool-
Check if the CUDA GPU supports 16-bit mixed precision.
Returns
result:bool- True if the CUDA GPU supports 16-bit mixed precision, False otherwise.
def cuda_free_memory() ‑> None-
Free unused CUDA memory.
If CUDA is available, attempt to release any unused CUDA memory back to the device.
def cuda_get_gpu_memory_info() ‑> tuple[int, int]-
Return the maximum and currently available GPU memory for CUDA devices.
Returns
total_memory:int- Total GPU memory (0 if CUDA is not available).
free_memory:int- Current free memory (0 if CUDA is not available).
def get_accelerator() ‑> str-
Return available PyTorch Lightning accelerator depending on platform.
Returns
accelerator:str- Accelerator that can be used for training.
def get_device() ‑> torch.device-
Return available PyTorch device depending on platform.
Returns
device:torch.device- Device that can be used for training.