-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevices.py
More file actions
26 lines (21 loc) · 982 Bytes
/
devices.py
File metadata and controls
26 lines (21 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import tvm
valid_devices = ["pi3", "pi4","pi5"]
def get_device(input:str):
index = valid_devices.index(input)
if not (input in valid_devices):
raise ValueError(input + " is not a valid device name! Supported devices names:" + str(valid_devices))
if valid_devices[index] == "pi3":
target=str(tvm.target.arm_cpu('rasp3b')) + " -mfloat-abi=hard"
device_key='pi-cluster-node-pi3b-unity'
device_type = "cpu"
elif valid_devices[index] == "pi4":
target=tvm.target.arm_cpu('rasp4b64')
device_key='pi-cluster-node-pi4b-unity'
device_type = "cpu"
elif valid_devices[index] == "pi5":
target="llvm -device=arm_cpu -model=bcm2712 -mtriple=aarch64-linux-gnu -mattr=+neon -mcpu=cortex-a76"
device_key='pi-cluster-node-pi5-unity'
device_type = "cpu"
else: # should never happen!
raise ValueError("No information for device: " + input)
return target, device_key, device_type