Link a module in the remote and download it. Parameters ---------- path : str The relative location to remote temp folder. Returns ------- blob : bytearray The result blob from the file. Note ---- This
(self, path)
| 180 | return _ffi_api.LoadRemoteModule(self._sess, path) |
| 181 | |
| 182 | def download_linked_module(self, path): |
| 183 | """Link a module in the remote and download it. |
| 184 | |
| 185 | Parameters |
| 186 | ---------- |
| 187 | path : str |
| 188 | The relative location to remote temp folder. |
| 189 | |
| 190 | Returns |
| 191 | ------- |
| 192 | blob : bytearray |
| 193 | The result blob from the file. |
| 194 | |
| 195 | Note |
| 196 | ---- |
| 197 | This function can be helpful when a linker |
| 198 | is not available on the local client. |
| 199 | |
| 200 | Examples |
| 201 | -------- |
| 202 | .. code-block:: python |
| 203 | |
| 204 | mod = build_module_with_cross_compilation() |
| 205 | # export the module as tar because a local linker is not available |
| 206 | mod.export_library("lib.tar") |
| 207 | remote.upload("lib.tar") |
| 208 | # invoke the linker on the remote to link the module as a library |
| 209 | # note that the library can only run on the same env as the remote |
| 210 | with open("lib.so", "wb") as file: |
| 211 | file.write(remote.download_linked_module("lib.tar")) |
| 212 | """ |
| 213 | if "download_linked_module" not in self._remote_funcs: |
| 214 | self._remote_funcs["download_linked_module"] = self.get_function( |
| 215 | "tvm.rpc.server.download_linked_module" |
| 216 | ) |
| 217 | return self._remote_funcs["download_linked_module"](path) |
| 218 | |
| 219 | def cpu(self, dev_id=0): |
| 220 | """Construct CPU device.""" |