You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/getting-started.md
+25-15Lines changed: 25 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,19 +14,16 @@ pip install dyson
14
14
15
15
16
16
```python
17
-
from dyson importrouter
17
+
importdyson
18
18
import torch
19
+
import time
20
+
from dyson import router
21
+
22
+
# Define a function
23
+
defmat(a, b):
24
+
return torch.matmul(a,b)
19
25
20
-
classComplexOperations:
21
-
defadd(self):
22
-
a, b =1, 3
23
-
return a + b
24
26
25
-
deffunc(self):
26
-
x = torch.tensor([1, 2])
27
-
y = torch.tensor([3, 4])
28
-
z = torch.add(x, y)
29
-
return z
30
27
```
31
28
32
29
### Routing Your Workload
@@ -37,12 +34,10 @@ Add the `key.cgl` path in your code like so,
37
34
key_path ="path/to/your/key.cgl"
38
35
```
39
36
40
-
Add your function with [`paramter`](https://crossgl.github.io/crossgl-docs/dyson/#advanced-routing-parameters) values.
37
+
Add your function with [`parameter`](https://crossgl.github.io/crossgl-docs/dyson/#advanced-routing-parameters) values.
41
38
42
39
```python
43
-
physics_function = ComplexOperations()
44
-
45
-
result = router.route_hardware(
40
+
hardware = router.route_hardware(
46
41
key_path,
47
42
physics_function,
48
43
mode="energy-efficient",
@@ -52,4 +47,19 @@ result = router.route_hardware(
52
47
precision="normal",
53
48
multi_device=True
54
49
)
55
-
```
50
+
```
51
+
52
+
We now have the hardware name required for routing. This can be passed as a parameter to the dyson.run() function, enabling it to route to the specified hardware.
0 commit comments