https://github.com/davidbrochart/uarray
https://github.com/davidbrochart/uarray
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/davidbrochart/uarray
- Owner: davidbrochart
- Created: 2018-08-21T10:43:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-21T10:43:45.000Z (over 7 years ago)
- Last Synced: 2025-01-12T13:50:40.004Z (about 1 year ago)
- Language: Python
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# uarray
```python
from uarray import *
x1 = uarray([0, 1, 2], 'cpu')
x2 = uarray([3, 4, 5], 'gpu')
out = uarray([0, 0, 0], 'cpu')
with context('gpu'):
add(x1, x2, out)
print(f'out = {out.array}')
```
```
Switching context from cpu to gpu
Moving "x1" from cpu to gpu
Allocating memory for "out" on gpu
Adding arrays in gpu
Moving "out" from gpu to cpu
Switching context from gpu to cpu
out = [3, 5, 7]
```