pip install torchcompat
Features
Provide a super set implementation of pytorch device interface to enable code to run seamlessly between different accelerators.
Identify uniquely devices
import torchcompat.core as accelerator
# on cuda accelerator == torch.cuda
# on rocm accelerator == torch.cuda
# on xpu accelerator == torch.xpu
# on gaudi accelerator == ...
assert accelerator.is_available() == true
assert accelerator.device_name in ('xpu', 'cuda', "hpu") # rocm is seen as cuda by pytorch
assert accelerator.device_string(0) == "cuda:0" or "xpu:0" or "hpu:0"
assert accelerator.fetch_device(0) == torch.device("cuda:0")
accelerator.set_enable_tf32(true) # toggle the right flags for each backend
Example
example here
Metadata
Release files for torchcompat 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| torchcompat-1.1.4.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torchcompat-1.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / torchcompat-1.1.4.tar.gz
| Download URL | torchcompat-1.1.4.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fabd54bea79624f2e7058842f38536b3d80b2a586c1ac88303d42b8e06ae8c84
|
|
BLAKE2b-256 checksum How to use checksums |
2cdeac95694f30034e716e83427a1e9e84ea368735b566300f696178e9e910be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.19
|
Release files / torchcompat-1.1.4-py3-none-any.whl
| Download URL | torchcompat-1.1.4-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e3b3c56717590450588a4d431be387355d16864fdd74edb22fb189b9feca47b
|
|
BLAKE2b-256 checksum How to use checksums |
94b29b5d6f9aa9ffc7d35a42ff8a0e2fcf2e9458be5f0bb6077ad98925f8c043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.19
|