Metadata-Version: 2.4
Name: phyelds-gpu
Version: 10.4.0
Summary: PyTorch backend for phyelds: aggregate programs on batches of devices, on CPU or GPU
License: Apache-2.0
Author: Gianluca Aguzzi
Author-email: gianluca.aguzzi@unibo.it
Requires-Python: >=3.12,<3.15
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: phyelds (>=10.4.0,<11.0.0)
Requires-Dist: torch (>=2.4.0)
Project-URL: Homepage, https://github.com/phyelds/phyelds
Project-URL: Repository, https://github.com/phyelds/phyelds
Description-Content-Type: text/markdown

# phyelds-gpu

PyTorch backend for [phyelds](https://github.com/phyelds/phyelds): the devices of an aggregate
system as tensors, on CPU or GPU.

`BatchSynchronousRuntime` runs an unmodified `@aggregate` program on every device at once, one
synchronous round at a time, with the results of phyelds' own `SynchronousRuntime`;
`BatchWavefrontRuntime` runs it in wavefronts of devices with clocks of their own, over a
channel with delays and losses. See [the documentation](https://phyelds.github.io/phyelds/integration/gpu/).


```python
import torch
from phyelds.calculus import aggregate
from phyelds.libraries.device import sense
from phyelds.libraries.spreading import distance_to
from phyelds.gpu import BatchSynchronousRuntime, radius_topology

@aggregate
def gradient():
    return distance_to(sense("source"))

positions = torch.rand(100_000, 2, dtype=torch.float64) * 200
runtime = BatchSynchronousRuntime(gradient, radius_topology(positions, 1.0))
distances = runtime.run_round({"source": torch.arange(100_000) == 0})  # one per device
```

