From c13c71237e7719cab672d06f0483a9fb15f74488 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Wed, 20 Jun 2018 14:53:16 -0400 Subject: [PATCH 01/12] Ensure that installed libs are usable and make sure to install topi. --- CMakeLists.txt | 13 +++++-------- HalideIR | 2 +- dmlc-core | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 23d146a65f2c..b08b9eec3be6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,17 +201,14 @@ endif() # Custom targets add_custom_target(runtime DEPENDS tvm_runtime) -# Installation rulse + +# Installation rules +install(TARGETS tvm DESTINATION lib${LIB_SUFFIX}) +install(TARGETS tvm_topi DESTINATION lib${LIB_SUFFIX}) install(TARGETS tvm_runtime DESTINATION lib${LIB_SUFFIX}) -if(WIN32) - install(TARGETS nnvm_compiler RUNTIME DESTINATION bin) - install(TARGETS nnvm_compiler ARCHIVE DESTINATION lib) -else() - install(TARGETS nnvm_compiler LIBRARY DESTINATION lib) -endif() +install(TARGETS nnvm_compiler DESTINATION lib${LIB_SUFFIX}) if (INSTALL_DEV) - install(TARGETS tvm DESTINATION lib${LIB_SUFFIX}) install( DIRECTORY "include/." DESTINATION "include" FILES_MATCHING diff --git a/HalideIR b/HalideIR index 9204453ae8de..0b7e25275138 160000 --- a/HalideIR +++ b/HalideIR @@ -1 +1 @@ -Subproject commit 9204453ae8de77e7dfc32c4d80f58dd788ad75ff +Subproject commit 0b7e25275138768bb05edb9b9db2c86d0fb09c9a diff --git a/dmlc-core b/dmlc-core index e864aa6757cd..9b3f9753ae81 160000 --- a/dmlc-core +++ b/dmlc-core @@ -1 +1 @@ -Subproject commit e864aa6757cdbe78b1296fe5231fd3050b7802c3 +Subproject commit 9b3f9753ae81d657743c555e0cacc4e43f0bed2d From 650222f5e4acd6a83931d201f115e4f07c8ed0a4 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Thu, 21 Jun 2018 13:07:13 -0400 Subject: [PATCH 02/12] Make the conda packages buildable --- CMakeLists.txt | 5 +++++ nnvm/python/conda/build.sh | 13 +++---------- nnvm/python/conda/meta.yaml | 6 +++--- python/conda/build.sh | 25 ++----------------------- python/conda/meta.yaml | 11 ++++++----- topi/python/conda/build.sh | 18 ++++++++++++++++++ topi/python/conda/meta.yaml | 5 ++--- 7 files changed, 39 insertions(+), 44 deletions(-) create mode 100644 topi/python/conda/build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index b08b9eec3be6..6ff39e748bbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,11 @@ endif() # Custom targets add_custom_target(runtime DEPENDS tvm_runtime) +# Targets for the conda build +add_custom_target(tvm-libs DEPENDS tvm tvm_runtime) +add_custom_target(topi-libs DEPENDS tvm_topi) +add_custom_target(nnvm-libs DEPENDS nnvm_compiler) + # Installation rules install(TARGETS tvm DESTINATION lib${LIB_SUFFIX}) diff --git a/nnvm/python/conda/build.sh b/nnvm/python/conda/build.sh index 484d0626ae03..280dbb2285cc 100644 --- a/nnvm/python/conda/build.sh +++ b/nnvm/python/conda/build.sh @@ -2,10 +2,6 @@ set -e -if [ -z "$PREFIX" ]; then - PREFIX="$CONDA_PREFIX" -fi - if [ "$(uname)" = 'Darwin' ] then # Without this, Apple's default shipped clang will refuse to see any @@ -16,13 +12,10 @@ fi rm -rf build || true mkdir -p build cd build -# Enable static-libstdc++ to make it easier to link this library with -# other C++ compilers -CXXFLAGS=-static-libstdc++ cmake -DCMAKE_PREFIX_PATH=${PREFIX} -DCMAKE_INSTALL_PREFIX=${PREFIX} .. -make -j4 VERBOSE=1 -make install/fast +cmake .. +make -j4 VERBOSE=1 nnvm-libs cd .. -cd python +cd nnvm/python $PYTHON setup.py install cd .. diff --git a/nnvm/python/conda/meta.yaml b/nnvm/python/conda/meta.yaml index 56e052000b40..0ec607052137 100644 --- a/nnvm/python/conda/meta.yaml +++ b/nnvm/python/conda/meta.yaml @@ -1,14 +1,14 @@ -{% set version = "0.1.dev" %} +{% set version = "0.4.dev" %} package: name: nnvm version: {{ version }} source: - path: ../.. + path: ../../.. build: - number: 1 + number: 0 skip: True # [win] requirements: diff --git a/python/conda/build.sh b/python/conda/build.sh index 60582de9523b..98644d7c47e1 100644 --- a/python/conda/build.sh +++ b/python/conda/build.sh @@ -2,14 +2,6 @@ set -e -# See Note [CUDA_TOOLKIT_ROOT_DIR versus CUDA_BIN_PATH] -if [ -z "$CONDA_CUDA_HOME" ]; then - CUDA_ARGS="" -else - # See Note [Bash argument quoting] - CUDA_ARGS="-DCUDA_TOOLKIT_ROOT_DIR=$(printf %q "$CONDA_CUDA_HOME")" -fi - if [ -z "$PREFIX" ]; then PREFIX="$CONDA_PREFIX" fi @@ -24,23 +16,10 @@ fi rm -rf build || true mkdir -p build cd build -# Enable static-libstdc++ to make it easier to link this library with -# other C++ compilers -CXXFLAGS=-static-libstdc++ cmake -DCMAKE_PREFIX_PATH=${PREFIX} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DUSE_CUDA=1 -DUSE_LLVM=1 -DINSTALL_DEV=1 $CUDA_ARGS .. -make -j20 VERBOSE=1 -make install/fast +cmake -DUSE_LLVM=ON .. +make -j4 VERBOSE=1 tvm-libs cd .. -# Also install the headers for libraries that TVM vendored -mkdir -p "$PREFIX/include" -# TODO: arguably dlpack and dmlc-core should get its own packaging and -# install their headers themselves -cp -R dlpack/include/. "$PREFIX/include" -cp -R dmlc-core/include/. "$PREFIX/include" -# TODO: HalideIR's includes could conflict, but TVM currently assumes they -# are installed here, awfully enough -cp -R HalideIR/src/. "$PREFIX/include" - cd python $PYTHON setup.py install cd .. diff --git a/python/conda/meta.yaml b/python/conda/meta.yaml index f4e64dfd6bef..bfcefb6e9476 100644 --- a/python/conda/meta.yaml +++ b/python/conda/meta.yaml @@ -1,4 +1,4 @@ -{% set version = "0.1.dev" %} +{% set version = "0.4.dev" %} package: name: tvm @@ -8,14 +8,15 @@ source: path: ../.. build: - number: 1 + number: 0 skip: True # [win] - script_env: - - CONDA_CUDA_HOME requirements: build: - - llvmdev ==4.0.0 + # The compiler on mac comes bundled with a broken llvm that overwrites + # the llvmdev package + - {{ compiler('cxx') }} # [not osx] + - llvmdev ==6.0.0 - cmake - python >=3 - numpy diff --git a/topi/python/conda/build.sh b/topi/python/conda/build.sh new file mode 100644 index 000000000000..239aec111dd9 --- /dev/null +++ b/topi/python/conda/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [ "$(uname)" = 'Darwin' ] +then + # Without this, Apple's default shipped clang will refuse to see any + # headers like mutex. + export MACOSX_DEPLOYMENT_TARGET=10.9 +fi + +rm -rf build || true +mkdir -p build +cd build +cmake -DUSE_LLVM=ON .. +make -j4 VERBOSE=1 topi-libs +cd .. + +cd topi/python +python setup.py install diff --git a/topi/python/conda/meta.yaml b/topi/python/conda/meta.yaml index 37d3a35da433..67ee3859a297 100644 --- a/topi/python/conda/meta.yaml +++ b/topi/python/conda/meta.yaml @@ -1,15 +1,14 @@ -{% set version = "0.1.dev" %} +{% set version = "0.4.dev" %} package: name: topi version: {{ version }} source: - path: .. + path: ../../.. build: number: 0 - script: $PYTHON setup.py install requirements: build: From b39aa017c5f98e6add2144428d67d08b54e1be21 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Thu, 28 Jun 2018 13:39:34 -0400 Subject: [PATCH 03/12] Fix creation of easy-install.pth --- nnvm/python/conda/build.sh | 2 +- python/conda/build.sh | 2 +- topi/python/conda/build.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nnvm/python/conda/build.sh b/nnvm/python/conda/build.sh index 280dbb2285cc..db80a9ae1c7c 100644 --- a/nnvm/python/conda/build.sh +++ b/nnvm/python/conda/build.sh @@ -17,5 +17,5 @@ make -j4 VERBOSE=1 nnvm-libs cd .. cd nnvm/python -$PYTHON setup.py install +$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt cd .. diff --git a/python/conda/build.sh b/python/conda/build.sh index 98644d7c47e1..f6a3c90a5c6a 100644 --- a/python/conda/build.sh +++ b/python/conda/build.sh @@ -21,5 +21,5 @@ make -j4 VERBOSE=1 tvm-libs cd .. cd python -$PYTHON setup.py install +$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt cd .. diff --git a/topi/python/conda/build.sh b/topi/python/conda/build.sh index 239aec111dd9..2e424abfc12c 100644 --- a/topi/python/conda/build.sh +++ b/topi/python/conda/build.sh @@ -15,4 +15,4 @@ make -j4 VERBOSE=1 topi-libs cd .. cd topi/python -python setup.py install +python setup.py install --single-version-externally-managed --record=/tmp/record.txt From d631fa1b87bdca390225487b84280e5d49176155 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Thu, 28 Jun 2018 15:54:28 -0400 Subject: [PATCH 04/12] fix typo --- python/tvm/_ffi/libinfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/_ffi/libinfo.py b/python/tvm/_ffi/libinfo.py index b449e712c32c..22dc19c165fb 100644 --- a/python/tvm/_ffi/libinfo.py +++ b/python/tvm/_ffi/libinfo.py @@ -44,7 +44,7 @@ def find_lib_path(name=None, search_path=None, optional=False): # Default cmake build directory dll_path.append(os.path.join(source_dir, "build")) dll_path.append(os.path.join(source_dir, "build", "Release")) - # Default mkae build directory + # Default make build directory dll_path.append(os.path.join(source_dir, "lib")) dll_path.append(install_lib_dir) From c4e849ec2d8ace0830ddee0e60c48206340e147c Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Thu, 28 Jun 2018 17:53:42 -0400 Subject: [PATCH 05/12] Unify the conda packages and split the libraries into a separate tvm-libs package. This still needs some fixes for nnvm since it does not search the standard install paths for libraries. --- CMakeLists.txt | 6 --- conda/nnvm/build.sh | 6 +++ {nnvm/python/conda => conda/nnvm}/meta.yaml | 12 ++++-- conda/topi/build.sh | 6 +++ {topi/python/conda => conda/topi}/meta.yaml | 10 ++++- {python/conda => conda/tvm-libs}/build.sh | 9 ++-- conda/tvm-libs/meta.yaml | 24 +++++++++++ conda/tvm/build.sh | 6 +++ {python/conda => conda/tvm}/meta.yaml | 10 ++--- nnvm/python/conda/build.sh | 21 --------- nnvm/python/setup.py | 19 +++++--- python/setup.py | 48 +++++++++++++-------- topi/python/conda/build.sh | 18 -------- topi/python/setup.py | 34 +++++++++------ 14 files changed, 129 insertions(+), 100 deletions(-) create mode 100644 conda/nnvm/build.sh rename {nnvm/python/conda => conda/nnvm}/meta.yaml (68%) create mode 100644 conda/topi/build.sh rename {topi/python/conda => conda/topi}/meta.yaml (67%) rename {python/conda => conda/tvm-libs}/build.sh (66%) create mode 100644 conda/tvm-libs/meta.yaml create mode 100644 conda/tvm/build.sh rename {python/conda => conda/tvm}/meta.yaml (71%) delete mode 100644 nnvm/python/conda/build.sh delete mode 100644 topi/python/conda/build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ff39e748bbf..81630841f525 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,12 +201,6 @@ endif() # Custom targets add_custom_target(runtime DEPENDS tvm_runtime) -# Targets for the conda build -add_custom_target(tvm-libs DEPENDS tvm tvm_runtime) -add_custom_target(topi-libs DEPENDS tvm_topi) -add_custom_target(nnvm-libs DEPENDS nnvm_compiler) - - # Installation rules install(TARGETS tvm DESTINATION lib${LIB_SUFFIX}) install(TARGETS tvm_topi DESTINATION lib${LIB_SUFFIX}) diff --git a/conda/nnvm/build.sh b/conda/nnvm/build.sh new file mode 100644 index 000000000000..9f7889e610e7 --- /dev/null +++ b/conda/nnvm/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e + +cd nnvm/python +$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt diff --git a/nnvm/python/conda/meta.yaml b/conda/nnvm/meta.yaml similarity index 68% rename from nnvm/python/conda/meta.yaml rename to conda/nnvm/meta.yaml index 0ec607052137..fb5877c2af53 100644 --- a/nnvm/python/conda/meta.yaml +++ b/conda/nnvm/meta.yaml @@ -5,7 +5,7 @@ package: version: {{ version }} source: - path: ../../.. + path: ../.. build: number: 0 @@ -13,15 +13,19 @@ build: requirements: build: - - cmake + - {{ compiler('cxx') }} + - tvm-libs =={{ version }} + host: - python >=3 + - cython - numpy - setuptools - nose - decorator run: - - tvm - - topi + - tvm =={{ version }} + - topi =={{ version }} + - tvm-libs =={{ version }} - python >=3 - numpy - decorator diff --git a/conda/topi/build.sh b/conda/topi/build.sh new file mode 100644 index 000000000000..a1f5e491c8eb --- /dev/null +++ b/conda/topi/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e + +cd topi/python +$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt diff --git a/topi/python/conda/meta.yaml b/conda/topi/meta.yaml similarity index 67% rename from topi/python/conda/meta.yaml rename to conda/topi/meta.yaml index 67ee3859a297..573932a0a2ae 100644 --- a/topi/python/conda/meta.yaml +++ b/conda/topi/meta.yaml @@ -5,15 +5,19 @@ package: version: {{ version }} source: - path: ../../.. + path: ../.. build: number: 0 + skip: True # [win] requirements: build: - - cmake + - {{ compiler('cxx') }} + - tvm-libs =={{ version }} + host: - python >=3 + - cython - numpy - setuptools - nose @@ -22,6 +26,8 @@ requirements: - python >=3 - numpy - decorator + - tvm-libs =={{ version }} + - tvm =={{ version }} about: home: https://github.com/dmlc/tvm diff --git a/python/conda/build.sh b/conda/tvm-libs/build.sh similarity index 66% rename from python/conda/build.sh rename to conda/tvm-libs/build.sh index f6a3c90a5c6a..5279fad90f41 100644 --- a/python/conda/build.sh +++ b/conda/tvm-libs/build.sh @@ -16,10 +16,7 @@ fi rm -rf build || true mkdir -p build cd build -cmake -DUSE_LLVM=ON .. -make -j4 VERBOSE=1 tvm-libs -cd .. - -cd python -$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt +cmake -DUSE_LLVM=ON -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" .. +make -j2 VERBOSE=1 +make install cd .. diff --git a/conda/tvm-libs/meta.yaml b/conda/tvm-libs/meta.yaml new file mode 100644 index 000000000000..2dc69e5f028c --- /dev/null +++ b/conda/tvm-libs/meta.yaml @@ -0,0 +1,24 @@ +{% set version = "0.4.dev" %} + +package: + name: tvm-libs + version: {{ version }} + +source: + path: ../.. + +build: + number: 0 + +requirements: + build: + # The compiler on mac comes bundled with a broken llvm that overwrites + # the llvmdev package + - {{ compiler('cxx') }} # [not osx] + - llvmdev ==6.0.0 + - cmake + +about: + home: https://github.com/dmlc/tvm + license: Apache2 + summary: a low level domain specific language for compiling tensor computation pipelines \ No newline at end of file diff --git a/conda/tvm/build.sh b/conda/tvm/build.sh new file mode 100644 index 000000000000..9c958a32e629 --- /dev/null +++ b/conda/tvm/build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +set -e + +cd python +$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt diff --git a/python/conda/meta.yaml b/conda/tvm/meta.yaml similarity index 71% rename from python/conda/meta.yaml rename to conda/tvm/meta.yaml index bfcefb6e9476..99dc4e9a828b 100644 --- a/python/conda/meta.yaml +++ b/conda/tvm/meta.yaml @@ -13,12 +13,11 @@ build: requirements: build: - # The compiler on mac comes bundled with a broken llvm that overwrites - # the llvmdev package - - {{ compiler('cxx') }} # [not osx] - - llvmdev ==6.0.0 - - cmake + - {{ compiler('cxx') }} + - tvm-libs =={{ version }} + host: - python >=3 + - cython - numpy - setuptools - nose @@ -27,6 +26,7 @@ requirements: - python >=3 - numpy - decorator + - tvm-libs =={{ version }} about: home: https://github.com/dmlc/tvm diff --git a/nnvm/python/conda/build.sh b/nnvm/python/conda/build.sh deleted file mode 100644 index db80a9ae1c7c..000000000000 --- a/nnvm/python/conda/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$(uname)" = 'Darwin' ] -then - # Without this, Apple's default shipped clang will refuse to see any - # headers like mutex. - export MACOSX_DEPLOYMENT_TARGET=10.9 -fi - -rm -rf build || true -mkdir -p build -cd build -cmake .. -make -j4 VERBOSE=1 nnvm-libs -cd .. - -cd nnvm/python -$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt -cd .. diff --git a/nnvm/python/setup.py b/nnvm/python/setup.py index 2b2102e319eb..f680690a2e10 100644 --- a/nnvm/python/setup.py +++ b/nnvm/python/setup.py @@ -37,11 +37,18 @@ def config_cython(): libinfo = {'__file__': libinfo_py} exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo) -LIB_PATH = libinfo['find_lib_path']() -_, LIB_NAME = os.path.split(LIB_PATH[0]) __version__ = libinfo['__version__'] -curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) -rpath = os.path.relpath(LIB_PATH[0], curr_path) +if not os.getenv('CONDA_BUILD'): + LIB_PATH = libinfo['find_lib_path']() + _, LIB_NAME = os.path.split(LIB_PATH[0]) + curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) + rpath = os.path.relpath(LIB_PATH[0], curr_path) + setup_kwargs = dict( + include_package_data=True, + data_files=[('nnvm', [rpath])] + ) +else: + setup_kwargs = {} setup(name='nnvm', version=__version__, @@ -52,6 +59,4 @@ def config_cython(): ], packages=find_packages(), url='https://github.com/dmlc/nnvm', - include_package_data=True, - data_files=[('nnvm', [rpath])]) - + **setup_kwargs) diff --git a/python/setup.py b/python/setup.py index 188938d76c3d..5ae7a6d909e4 100644 --- a/python/setup.py +++ b/python/setup.py @@ -27,14 +27,17 @@ def get_lib_path(): libinfo_py = os.path.join(CURRENT_DIR, './tvm/_ffi/libinfo.py') libinfo = {'__file__': libinfo_py} exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo) - lib_path = libinfo['find_lib_path']() version = libinfo['__version__'] - libs = [lib_path[0]] - if libs[0].find("runtime") == -1: - for name in lib_path[1:]: - if name.find("runtime") != -1: - libs.append(name) - break + if not os.getenv('CONDA_BUILD'): + lib_path = libinfo['find_lib_path']() + libs = [lib_path[0]] + if libs[0].find("runtime") == -1: + for name in lib_path[1:]: + if name.find("runtime") != -1: + libs.append(name) + break + else: + libs = None return libs, version LIB_LIST, __version__ = get_lib_path() @@ -89,23 +92,33 @@ def has_ext_modules(self): def is_pure(self): return False +include_libs = False +wheel_include_libs = False +if not os.getenv('CONDA_BUILD'): + if "bdist_wheel" in sys.argv: + wheel_include_libs = True + else: + include_libs = True + +setup_kwargs = {} + # For bdist_wheel only -if "bdist_wheel" in sys.argv: - with open("MANIFEST.in", "w") as fo: - for path in LIB_LIST: - shutil.copy(path, os.path.join(CURRENT_DIR, 'tvm')) - _, libname = os.path.split(path) - fo.write("include tvm/%s\n" % libname) +if wheel_include_libs: + for path in LIB_LIST: + shutil.copy(path, os.path.join(CURRENT_DIR, 'tvm')) + _, libname = os.path.split(path) + fo.write("include tvm/%s\n" % libname) setup_kwargs = { "include_package_data": True } -else: + +if include_libs: curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) for i, path in enumerate(LIB_LIST): LIB_LIST[i] = os.path.relpath(path, curr_path) setup_kwargs = { "include_package_data": True, - "data_files": [('tvm', LIB_LIST)] + "package_data": {'tvm': LIB_LIST} } setup(name='tvm', @@ -122,8 +135,9 @@ def is_pure(self): ext_modules=config_cython(), **setup_kwargs) -# Wheel cleanup -if "bdist_wheel" in sys.argv: + +if wheel_include_libs: + # Wheel cleanup os.remove("MANIFEST.in") for path in LIB_LIST: _, libname = os.path.split(path) diff --git a/topi/python/conda/build.sh b/topi/python/conda/build.sh deleted file mode 100644 index 2e424abfc12c..000000000000 --- a/topi/python/conda/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -if [ "$(uname)" = 'Darwin' ] -then - # Without this, Apple's default shipped clang will refuse to see any - # headers like mutex. - export MACOSX_DEPLOYMENT_TARGET=10.9 -fi - -rm -rf build || true -mkdir -p build -cd build -cmake -DUSE_LLVM=ON .. -make -j4 VERBOSE=1 topi-libs -cd .. - -cd topi/python -python setup.py install --single-version-externally-managed --record=/tmp/record.txt diff --git a/topi/python/setup.py b/topi/python/setup.py index 6967051acbd8..dadb79453857 100644 --- a/topi/python/setup.py +++ b/topi/python/setup.py @@ -29,25 +29,31 @@ def get_lib_path(): libinfo_py = os.path.join(CURRENT_DIR, '../../python/tvm/_ffi/libinfo.py') libinfo = {'__file__': libinfo_py} exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo) - lib_path = libinfo['find_lib_path'](get_lib_names()) version = libinfo['__version__'] - libs = [lib_path[0]] - if libs[0].find("runtime") == -1: - for name in lib_path[1:]: - if name.find("runtime") != -1: - libs.append(name) - break + if not os.getenv('CONDA_BUILD'): + lib_path = libinfo['find_lib_path'](get_lib_names()) + libs = [lib_path[0]] + if libs[0].find("runtime") == -1: + for name in lib_path[1:]: + if name.find("runtime") != -1: + libs.append(name) + break + else: + libs = None return libs, version LIB_LIST, __version__ = get_lib_path() -curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) -for i, path in enumerate(LIB_LIST): - LIB_LIST[i] = os.path.relpath(path, curr_path) -setup_kwargs = { - "include_package_data": True, - "data_files": [('topi', LIB_LIST)] -} +if not os.getenv('CONDA_BUILD'): + curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) + for i, path in enumerate(LIB_LIST): + LIB_LIST[i] = os.path.relpath(path, curr_path) + setup_kwargs = { + "include_package_data": True, + "data_files": [('topi', LIB_LIST)] + } +else: + setup_kwargs = {} setup(name='topi', version=__version__, From 51f63c4d022abd6437054c5742e3161c403d7db9 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Mon, 16 Jul 2018 15:32:52 -0400 Subject: [PATCH 06/12] Finally fixed the issue with llvm on os X --- conda/tvm-libs/meta.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conda/tvm-libs/meta.yaml b/conda/tvm-libs/meta.yaml index 2dc69e5f028c..7875931fc124 100644 --- a/conda/tvm-libs/meta.yaml +++ b/conda/tvm-libs/meta.yaml @@ -11,10 +11,11 @@ build: number: 0 requirements: + host: + # The OS X build will require some manual setup or it will break + # See https://conda.io/docs/user-guide/tasks/build-packages/compiler-tools.html#macos-sdk + - {{ compiler('cxx') }} build: - # The compiler on mac comes bundled with a broken llvm that overwrites - # the llvmdev package - - {{ compiler('cxx') }} # [not osx] - llvmdev ==6.0.0 - cmake From 5f26d0ba75da550021a6c5d46edf62e7aba995eb Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Mon, 16 Jul 2018 15:33:30 -0400 Subject: [PATCH 07/12] Clean up the python recipes --- conda/topi/meta.yaml | 17 ++++++++--------- conda/tvm/meta.yaml | 14 ++++++++------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/conda/topi/meta.yaml b/conda/topi/meta.yaml index 573932a0a2ae..af2fb4fd4228 100644 --- a/conda/topi/meta.yaml +++ b/conda/topi/meta.yaml @@ -9,26 +9,25 @@ source: build: number: 0 - skip: True # [win] requirements: - build: - - {{ compiler('cxx') }} - - tvm-libs =={{ version }} host: - - python >=3 - - cython + - python {{ python }} - numpy - setuptools - - nose - decorator + - tvm-libs =={{ version }} run: - - python >=3 - - numpy + - python + - {{ pin_compatible('numpy') }} - decorator - tvm-libs =={{ version }} - tvm =={{ version }} +test: + imports: + - topi + about: home: https://github.com/dmlc/tvm license: Apache2 diff --git a/conda/tvm/meta.yaml b/conda/tvm/meta.yaml index 99dc4e9a828b..478e095322eb 100644 --- a/conda/tvm/meta.yaml +++ b/conda/tvm/meta.yaml @@ -9,25 +9,27 @@ source: build: number: 0 - skip: True # [win] requirements: build: - {{ compiler('cxx') }} - - tvm-libs =={{ version }} host: - - python >=3 + - python {{ python }} - cython - numpy - setuptools - - nose - decorator + - tvm-libs =={{ version }} run: - - python >=3 - - numpy + - python + - {{ pin_compatible('numpy') }} - decorator - tvm-libs =={{ version }} +test: + imports: + - tvm + about: home: https://github.com/dmlc/tvm license: Apache2 From a97c352b9969b59d3ef0f3fe453443ae2ead8fe6 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Mon, 16 Jul 2018 15:33:51 -0400 Subject: [PATCH 08/12] Make sure to build for multiple python versions --- conda/conda_build_config.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 conda/conda_build_config.yaml diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml new file mode 100644 index 000000000000..7f18f5eea432 --- /dev/null +++ b/conda/conda_build_config.yaml @@ -0,0 +1,4 @@ +python: + - 3.5 + - 3.6 + - 3.7 \ No newline at end of file From b3407fb25eb64dcf019ff86a08543d8d92009930 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Mon, 16 Jul 2018 15:44:55 -0400 Subject: [PATCH 09/12] The deployment target is handled by the conda compiler packages --- conda/tvm-libs/build.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/conda/tvm-libs/build.sh b/conda/tvm-libs/build.sh index 5279fad90f41..d427d922a21e 100644 --- a/conda/tvm-libs/build.sh +++ b/conda/tvm-libs/build.sh @@ -6,13 +6,6 @@ if [ -z "$PREFIX" ]; then PREFIX="$CONDA_PREFIX" fi -if [ "$(uname)" = 'Darwin' ] -then - # Without this, Apple's default shipped clang will refuse to see any - # headers like mutex. - export MACOSX_DEPLOYMENT_TARGET=10.9 -fi - rm -rf build || true mkdir -p build cd build From b350ef7562a3031391e3102314642a99e463b064 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Tue, 17 Jul 2018 12:12:08 -0400 Subject: [PATCH 10/12] Fix nnvm library loading --- conda/nnvm/meta.yaml | 13 ++++++++----- nnvm/python/nnvm/libinfo.py | 19 +++++++++++-------- python/tvm/_ffi/libinfo.py | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/conda/nnvm/meta.yaml b/conda/nnvm/meta.yaml index fb5877c2af53..a8b47d0de118 100644 --- a/conda/nnvm/meta.yaml +++ b/conda/nnvm/meta.yaml @@ -14,22 +14,25 @@ build: requirements: build: - {{ compiler('cxx') }} - - tvm-libs =={{ version }} host: - - python >=3 + - python {{ python }} - cython - numpy - setuptools - - nose - decorator + - tvm-libs =={{ version }} run: - tvm =={{ version }} - topi =={{ version }} - tvm-libs =={{ version }} - - python >=3 - - numpy + - python + - {{ pin_compatible('numpy') }} - decorator +test: + imports: + - nnvm + about: home: https://github.com/dmlc/nnvm license: Apache2 diff --git a/nnvm/python/nnvm/libinfo.py b/nnvm/python/nnvm/libinfo.py index 694bd0f92e7c..5b0dc494692c 100644 --- a/nnvm/python/nnvm/libinfo.py +++ b/nnvm/python/nnvm/libinfo.py @@ -28,10 +28,13 @@ def find_lib_path(): else: lib_name = "nnvm_compiler" if sys.platform.startswith('win32') else "libnnvm_compiler" - api_path = os.path.join(base_path, '../../lib/') - cmake_build_path = os.path.join(base_path, '../../../build/Release/') - cmake_build_path = os.path.join(base_path, '../../../build/') - dll_path = [base_path, api_path, cmake_build_path] + source_dir = os.path.join(base_path, '..', '..', '..') + api_path = os.path.join(base_path, '..', '..', 'lib') + cmake_build_path_win = os.path.join(base_path, '..', '..', '..', 'build', 'Release') + cmake_build_path = os.path.join(base_path, '..', '..', '..', 'build') + install_path = os.path.join(base_path, '..', '..', '..') + dll_path = [base_path, api_path, cmake_build_path_win, cmake_build_path, + install_path] if sys.platform.startswith('linux') and os.environ.get('LD_LIBRARY_PATH', None): dll_path.extend([p.strip() for p in os.environ['LD_LIBRARY_PATH'].split(":")]) @@ -43,11 +46,11 @@ def find_lib_path(): if sys.platform.startswith('win32'): vs_configuration = 'Release' if platform.architecture()[0] == '64bit': - dll_path.append(os.path.join(base_path, '../../../build', vs_configuration)) - dll_path.append(os.path.join(base_path, '../../../windows/x64', vs_configuration)) + dll_path.append(os.path.join(base_path, '..', '..', '..', 'build', vs_configuration)) + dll_path.append(os.path.join(base_path, '..', '..', '..', 'windows', 'x64', vs_configuration)) else: - dll_path.append(os.path.join(base_path, '../../../build', vs_configuration)) - dll_path.append(os.path.join(base_path, '../../../windows', vs_configuration)) + dll_path.append(os.path.join(base_path, '..', '..', '..', 'build', vs_configuration)) + dll_path.append(os.path.join(base_path, '..', '..', '..', 'windows', vs_configuration)) dll_path = [os.path.join(p, '%s.dll' % lib_name) for p in dll_path] elif sys.platform.startswith('darwin'): dll_path = [os.path.join(p, '%s.dylib' % lib_name) for p in dll_path] diff --git a/python/tvm/_ffi/libinfo.py b/python/tvm/_ffi/libinfo.py index 22dc19c165fb..390849f8536d 100644 --- a/python/tvm/_ffi/libinfo.py +++ b/python/tvm/_ffi/libinfo.py @@ -40,7 +40,7 @@ def find_lib_path(name=None, search_path=None, optional=False): dll_path.extend([p.strip() for p in os.environ['DYLD_LIBRARY_PATH'].split(":")]) # Pip lib directory - dll_path.append(os.path.join(ffi_dir, "../")) + dll_path.append(os.path.join(ffi_dir, "..")) # Default cmake build directory dll_path.append(os.path.join(source_dir, "build")) dll_path.append(os.path.join(source_dir, "build", "Release")) From 70d4fa67057ed73b1d68046798ff33115a0a7306 Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Tue, 17 Jul 2018 13:51:29 -0400 Subject: [PATCH 11/12] fix pylint issues --- nnvm/python/nnvm/libinfo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nnvm/python/nnvm/libinfo.py b/nnvm/python/nnvm/libinfo.py index 5b0dc494692c..652433fc3d8c 100644 --- a/nnvm/python/nnvm/libinfo.py +++ b/nnvm/python/nnvm/libinfo.py @@ -28,7 +28,6 @@ def find_lib_path(): else: lib_name = "nnvm_compiler" if sys.platform.startswith('win32') else "libnnvm_compiler" - source_dir = os.path.join(base_path, '..', '..', '..') api_path = os.path.join(base_path, '..', '..', 'lib') cmake_build_path_win = os.path.join(base_path, '..', '..', '..', 'build', 'Release') cmake_build_path = os.path.join(base_path, '..', '..', '..', 'build') @@ -47,7 +46,8 @@ def find_lib_path(): vs_configuration = 'Release' if platform.architecture()[0] == '64bit': dll_path.append(os.path.join(base_path, '..', '..', '..', 'build', vs_configuration)) - dll_path.append(os.path.join(base_path, '..', '..', '..', 'windows', 'x64', vs_configuration)) + dll_path.append(os.path.join(base_path, '..', '..', '..', 'windows', 'x64', + vs_configuration)) else: dll_path.append(os.path.join(base_path, '..', '..', '..', 'build', vs_configuration)) dll_path.append(os.path.join(base_path, '..', '..', '..', 'windows', vs_configuration)) From aebbaf3b0f59f42278e2e559a1928e1cf093224c Mon Sep 17 00:00:00 2001 From: Arnaud Bergeron Date: Tue, 17 Jul 2018 15:57:34 -0400 Subject: [PATCH 12/12] Reset the submodules back the the master state --- HalideIR | 2 +- dmlc-core | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HalideIR b/HalideIR index 0b7e25275138..9204453ae8de 160000 --- a/HalideIR +++ b/HalideIR @@ -1 +1 @@ -Subproject commit 0b7e25275138768bb05edb9b9db2c86d0fb09c9a +Subproject commit 9204453ae8de77e7dfc32c4d80f58dd788ad75ff diff --git a/dmlc-core b/dmlc-core index 9b3f9753ae81..e864aa6757cd 160000 --- a/dmlc-core +++ b/dmlc-core @@ -1 +1 @@ -Subproject commit 9b3f9753ae81d657743c555e0cacc4e43f0bed2d +Subproject commit e864aa6757cdbe78b1296fe5231fd3050b7802c3