You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by roderick via Apache TVM Discuss <no...@discuss.tvm.ai> on 2022/02/15 01:48:25 UTC

[Apache TVM Discuss] [Questions] Is it possible to package python scripts and DSO to a APP


I want an easy deployment, does it possible to create a APP including my python script and all dependent   TVM python scripts and libtvm_runtime.so, libtvm.so ?





---
[Visit Topic](https://discuss.tvm.apache.org/t/is-it-possible-to-package-python-scripts-and-dso-to-a-app/12085/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/2cb64e3a48d3425804381f2a7877862debb02d1236bf2c82a3a5920213001d85).

[Apache TVM Discuss] [Questions] Is it possible to package python scripts and DSO to a APP

Posted by roderick via Apache TVM Discuss <no...@discuss.tvm.ai>.

Thanks @driazati for your more tips for package python scripts to a single app. 

I have successfully package a simple test_py.py + tvm + libtvm_runtime.so into an single app using pyinstaller, and it runs ok.  The only problem is the destination app's size, more than 440MB (in a new created conda env).

I just want a minimum package with TVM's RPC. 
```python
#! /usr/bin/python3.6
# -*- coding:utf-8 -*-

# test_py.py

import tvm
import sys
import tvm.rpc

print('test_py.py will run...')
ip_addr, ip_port = sys.argv[1].split(':')
remote = tvm.rpc.connect(ip_addr, int(ip_port))
add_func = remote.get_function('rpc.test_add')
print(add_func(10, 20))
```

List of files under package directory:
* libtvm_runtime.so
* test_py.py  # --> test_py.spec
* tvm: __init__.py  _ffi  contrib  parser  rpc  runtime  support.py error.py

Content of the test_py.spec:
```sh
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['test_py.py'],
             pathex=['/data/huangxiaofeng/work/vsext_example/py_package'],
             binaries=[('libtvm_runtime.so', '.')],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             hooksconfig={},
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='test_py',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=False,
          disable_windowed_traceback=False,
          target_arch=None,
          codesign_identity=None,
          entitlements_file=None )
```





---
[Visit Topic](https://discuss.tvm.apache.org/t/is-it-possible-to-package-python-scripts-and-dso-to-a-app/12085/3) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/5c18cc94e9798db86630f427c4e0e2883a2e8c4533d6d714d4beb53b0b69c469).