Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conda package builds #1445

Merged
merged 12 commits into from
Jul 17, 2018
12 changes: 4 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,13 @@ 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
Expand Down
4 changes: 4 additions & 0 deletions conda/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
python:
- 3.5
- 3.6
- 3.7
6 changes: 6 additions & 0 deletions conda/nnvm/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

cd nnvm/python
$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt
39 changes: 39 additions & 0 deletions conda/nnvm/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% set version = "0.4.dev" %}

package:
name: nnvm
version: {{ version }}

source:
path: ../..

build:
number: 0
skip: True # [win]

requirements:
build:
- {{ compiler('cxx') }}
host:
- python {{ python }}
- cython
- numpy
- setuptools
- decorator
- tvm-libs =={{ version }}
run:
- tvm =={{ version }}
- topi =={{ version }}
- tvm-libs =={{ version }}
- python
- {{ pin_compatible('numpy') }}
- decorator

test:
imports:
- nnvm

about:
home: https://github.com/dmlc/nnvm
license: Apache2
summary: Bring deep learning to bare metal
6 changes: 6 additions & 0 deletions conda/topi/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

cd topi/python
$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt
22 changes: 13 additions & 9 deletions topi/python/conda/meta.yaml → conda/topi/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
{% 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:
- cmake
- python >=3
host:
- 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
Expand Down
15 changes: 15 additions & 0 deletions conda/tvm-libs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

if [ -z "$PREFIX" ]; then
PREFIX="$CONDA_PREFIX"
fi

rm -rf build || true
mkdir -p build
cd build
cmake -DUSE_LLVM=ON -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
make -j2 VERBOSE=1
make install
cd ..
25 changes: 25 additions & 0 deletions conda/tvm-libs/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% set version = "0.4.dev" %}

package:
name: tvm-libs
version: {{ version }}

source:
path: ../..

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:
- 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
6 changes: 6 additions & 0 deletions conda/tvm/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

cd python
$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt
25 changes: 14 additions & 11 deletions python/conda/meta.yaml → conda/tvm/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "0.1.dev" %}
{% set version = "0.4.dev" %}

package:
name: tvm
Expand All @@ -8,24 +8,27 @@ source:
path: ../..

build:
number: 1
skip: True # [win]
script_env:
- CONDA_CUDA_HOME
number: 0

requirements:
build:
- llvmdev ==4.0.0
- cmake
- python >=3
- {{ compiler('cxx') }}
host:
- 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
Expand Down
28 changes: 0 additions & 28 deletions nnvm/python/conda/build.sh

This file was deleted.

32 changes: 0 additions & 32 deletions nnvm/python/conda/meta.yaml

This file was deleted.

19 changes: 11 additions & 8 deletions nnvm/python/nnvm/libinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ 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]
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(":")])
Expand All @@ -43,11 +45,12 @@ 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]
Expand Down
19 changes: 12 additions & 7 deletions nnvm/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__,
Expand All @@ -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)
46 changes: 0 additions & 46 deletions python/conda/build.sh

This file was deleted.

Loading