MCPcopy
hub / github.com/tinygrad/tinygrad / open

Method open

extra/usbgpu/debug.py:28–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

26 self.close()
27
28 def open(self):
29 self.ftdi = Ftdi()
30 self.ftdi.open_from_url(self.device_url)
31 self.ftdi.set_baudrate(921600)
32 self.ftdi.set_line_property(8, 1, 'N')
33
34 self.eeprom = FtdiEeprom()
35 self.eeprom.connect(self.ftdi)
36
37 self.provisioned = (self.eeprom.cbus_func_1 == "GPIO" and self.eeprom.cbus_func_2 == "GPIO")
38
39 if not self.provisioned:
40 print("Warning: Device not provisioned for usbgpu debugging. Use --provision to provision it.")
41 return
42
43 # setup gpio for reset control
44 self.ftdi.set_cbus_direction(self.CBUS_RESET | self.CBUS_BOOTLOADER, self.CBUS_RESET | self.CBUS_BOOTLOADER)
45 self.ftdi.set_cbus_gpio(0x00)
46
47 def close(self):
48 self.ftdi.close()

Callers 15

__enter__Method · 0.95
gen_statsFunction · 0.45
decode.pyFile · 0.45
test_kfd_2.pyFile · 0.45
mainFunction · 0.45
_open_am_deviceMethod · 0.45
example.pyFile · 0.45
imagenet_extractFunction · 0.45
fetch_mnistFunction · 0.45
fetch_cifarFunction · 0.45
extract_dimsFunction · 0.45

Calls 1

connectMethod · 0.45

Tested by 1

imagenet_dataloaderFunction · 0.36