A utility library to select and handle devices (CPU/GPU) seamlessly.
Project description
device-selector
A small Python library to automatically pick the best available PyTorch device.
-
select_best_device()
Automatically returns one of:"cuda"if an NVIDIA GPU is available via CUDA"mps"if you're on Apple Silicon with Metal Performance Shaders available"cpu"otherwise
-
check_or_select_device(requested_device: Optional[str])- If
requested_deviceisNone, it behaves likeselect_best_device(). - Otherwise, checks if the requested device is actually available and raises an error if not.
- If
Installation
pip install https://github.com/darizae/device-selector/releases/download/v0.1.0/device_selector-0.1.0-py3-none-any.whl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
device_selector-0.1.0.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file device_selector-0.1.0.tar.gz.
File metadata
- Download URL: device_selector-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a6b52c68bb28cf271e0dbc3b7ee797519a08eaf6167b5f87d2c46b13e38bed6
|
|
| MD5 |
91d06e62aee332833cc5f0c9e6be9b15
|
|
| BLAKE2b-256 |
6026aa3353b602ec1ca07c8516e1a842948bb8bcf31f9e61063caae126a08694
|
File details
Details for the file device_selector-0.1.0-py3-none-any.whl.
File metadata
- Download URL: device_selector-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9138bd62ee3cc76c67f55e56c4e3aa95191a30c2173fedb4280ee4ec2bfe99b
|
|
| MD5 |
a9230b3df20810d822a2c4b5274d1ae3
|
|
| BLAKE2b-256 |
4696bfd7039113fdf1d361817bca3e9bc4fdeaa89225bab6afffcff4ba29153d
|