Skip to content

Commit bf65b8b

Browse files
committed
Merged in SIM-3140 (pull request apache#8)
[SIM-3140]: Add topi package * Adding packaging for topi * Add version file in topi * Update topi version * Add topi package upload * Add python dep * Update based off of feedbacvk Approved-by: Spenser Gilliland <[email protected]> Approved-by: Carlos Davila <[email protected]> Approved-by: Lam Nguyen <[email protected]>
1 parent 7888f51 commit bf65b8b

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

Jenkinsfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,30 @@ def main() {
3434
image["image"].inside("-m 32g -c 8") {
3535
utils.cmakeBuild("build", "-DCMAKE_CXX_COMPILER_LAUNCHER=ccache", {}, { src_dir ->
3636
stage("Python Bindings") {
37-
dir("../python") {
37+
dir("${env.WORKSPACE}/python") {
3838
utils.setPythonBuildEnv([], {
3939
sh """#!/bin/bash -ex
4040
rm -rf dist build
4141
python3 setup.py bdist_wheel
4242
"""
4343
}, 'sima')
4444
}
45+
dir("${env.WORKSPACE}/topi/python") {
46+
utils.setPythonBuildEnv([]) {
47+
sh """#!/bin/bash -ex
48+
python3 setup.py bdist_wheel
49+
"""
50+
}
51+
}
4552
}
4653
}, "../sima-regres.cmake", "clean all")
4754
stage("Package") {
48-
archiveArtifacts('python/dist/*.whl')
49-
utils.uploadPythonPackages('jenkins_user', 'sima-pypi', 'python/dist/*.whl', 3)
55+
tvm_pkg_dir = "python/dist/*whl"
56+
archiveArtifacts(tvm_pkg_dir)
57+
utils.uploadPythonPackages('jenkins_user', 'sima-pypi', tvm_pkg_dir, 3)
58+
topi_pkg_dir = "topi/python/dist/*.whl"
59+
archiveArtifacts(topi_pkg_dir)
60+
utils.uploadPythonPackages('jenkins_user', 'sima-pypi', topi_pkg_dir, 3)
5061
}
5162
}
5263
}

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN apt-get update && \
2626
libopenblas-dev \
2727
cython && \
2828
rm -rf /var/lib/apt/lists/* && \
29-
pip3 install twine && \
29+
pip3 install twine pyyaml && \
3030
pip3 install --upgrade keyrings.alt
3131

3232

python/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,10 @@ def get_package(env, pkg_name, pkg_version):
183183
else:
184184
return "%s==%s" % (pkg_name, pkg_version)
185185

186+
tvm_version = get_version('tvm', 'sima')
186187

187188
setup(name='sima-tvm',
188-
version=get_version('tvm', 'sima'),
189+
version=tvm_version,
189190
description="TVM: An End to End Tensor IR/DSL Stack for Deep Learning Systems",
190191
zip_safe=False,
191192
install_requires=[
@@ -194,6 +195,7 @@ def get_package(env, pkg_name, pkg_version):
194195
'decorator',
195196
'attrs',
196197
'psutil',
198+
'sima-topi==' + tvm_version,
197199
'sima-mlc'
198200
],
199201
extras_require={'test': ['pillow<7',

topi/python/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include VERSION.in

topi/python/VERSION.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../python/VERSION.in

topi/python/setup.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import os
2222
import shutil
2323
import sys
24+
import yaml
25+
import subprocess
2426

2527
from setuptools import find_packages
2628
from setuptools.dist import Distribution
@@ -67,6 +69,30 @@ def get_lib_path():
6769

6870
LIB_LIST, __version__ = get_lib_path()
6971

72+
def get_version(pkg_dir, main_branch = "master"):
73+
with open("VERSION.in") as fh:
74+
vinfo = yaml.load(fh.read(), Loader=yaml.BaseLoader)
75+
version = '.'.join([vinfo["major"], vinfo["minor"], vinfo["patch"]])
76+
77+
if 'GIT_HASH' in os.environ:
78+
# In tox the .git directory is not available so do this instead
79+
vinfo['git_hash'] = os.environ['GIT_HASH']
80+
else:
81+
proc = subprocess.Popen(['git','log','-1','--format=%h'], stdout=subprocess.PIPE)
82+
proc.wait()
83+
if proc.returncode != 0:
84+
raise RuntimeError("ERROR: unable to execute git log")
85+
vinfo['git_hash'] = proc.stdout.read().decode('utf-8').rstrip()
86+
87+
with open(pkg_dir + "/VERSION","w") as fh:
88+
fh.write(yaml.dump(vinfo))
89+
90+
# This comes from Jenkins for upstream/downstream builds
91+
if 'DEV_VERSION' in os.environ:
92+
version = version + ".dev0+" + os.environ['DEV_VERSION']
93+
94+
return version
95+
7096
if not os.getenv('CONDA_BUILD'):
7197
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
7298
for i, path in enumerate(LIB_LIST):
@@ -107,8 +133,8 @@ def get_lib_path():
107133
"data_files": [('topi', LIB_LIST)]
108134
}
109135

110-
setup(name='topi',
111-
version=__version__,
136+
setup(name='sima-topi',
137+
version=get_version('topi', 'sima'),
112138
description="TOPI: TVM operator index",
113139
install_requires=[
114140
"numpy",

0 commit comments

Comments
 (0)