# RPC remote compilation?

**URL:** <https://discuss.tvm.apache.org/t/rpc-remote-compilation/15577>\
**Category:** Questions\
**Created:** [August 24, 2023, 4:15pm UTC](https://discuss.tvm.apache.org/t/rpc-remote-compilation/15577 "2023-08-24T16:15:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shimun](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/shimun/32/4802_2.png) [@shimun](https://discuss.tvm.apache.org/u/shimun)\
**Post date:** [August 24, 2023, 4:15pm UTC](https://discuss.tvm.apache.org/t/rpc-remote-compilation/15577/1 "2023-08-24T16:15:17Z")

</div>

Hi,

I’ve got an question regarding the [RPC](https://tvm.apache.org/docs/tutorial/cross_compilation_and_rpc.html#run-cpu-kernel-remotely-by-rpc). If I rename `lib.tar` to `lib.so` TVM will try to compile for my target which fails as I don’t have an suitable cross compiler on my machine. My inital thought was that if I use `tar` TVM will just use the module systems `SaveToBinary`/`LoadFromBinary` infrastructure in order to avoid compilation, however after inspecting the uploaded `lib.tar` on the rpc device I discovered that it contains object files(`devc.o`,`lib0.o`) which makes me wonder how those came to be, were they compiled on the rpc and why? Ist it possible to just rely on `SaveToBinary`/`LoadFromBinary` or does the GraphExecutor require compilation?

---

<div class="post-metadata">

**Author:** ![XFPlus](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/xfplus/32/4805_2.png) [@XFPlus](https://discuss.tvm.apache.org/u/XFPlus)\
**Post date:** [August 25, 2023, 5:56am UTC](https://discuss.tvm.apache.org/t/rpc-remote-compilation/15577/2 "2023-08-25T05:56:59Z")

</div>

Hi, shimun, maybe here is what you are looking for [https://github.com/apache/tvm/blob/main/python/tvm/meta\_schedule/builder/local\_builder.py#L264](https://github.com/apache/tvm/blob/main/python/tvm/meta_schedule/builder/local_builder.py#L264) TVM generate tarball by default and compile them at rpcserver side, you can override this export function to generate library at host side like this:

```python
@register_func("export_target_lib", override=True)
     def export_target_lib(mod) -> str:
         import tvm
         import tempfile
         artifact_path = os.path.join(tempfile.mkdtemp(), "tvm_tmp_mod.so")
         mod.export_library(artifact_path)
         return artifact_path

```
