| 98 | self.rpc.get_function("CloseRPCConnection")() |
| 99 | |
| 100 | def load_module(self, ex: relax.VMExecutable): |
| 101 | with tempfile.TemporaryDirectory() as tempdir: |
| 102 | file_name = "vm_library.so" |
| 103 | file_path = os.path.join(tempdir, file_name) |
| 104 | if self.is_remote: |
| 105 | ex.export_library( |
| 106 | file_path, fcompile=ndk.create_shared, options=["-shared", "-fPIC", "-lm"] |
| 107 | ) |
| 108 | else: |
| 109 | ex.export_library(file_path) |
| 110 | |
| 111 | self.rpc.upload(file_path) |
| 112 | rexec = self.rpc.load_module(file_name) |
| 113 | return rexec |
| 114 | |
| 115 | def device(self, device: str): |
| 116 | return self.rpc.device(device) |