Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
enable tvm_op for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhliu committed Aug 20, 2019
1 parent b914d0a commit 8af7685
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,14 @@ lib/libtvm_runtime.so:
cmake -DUSE_LLVM="$(LLVM_PATH)/bin/llvm-config" \
-DUSE_SORT=OFF -DUSE_CUDA=$(TVM_USE_CUDA) -DUSE_CUDNN=OFF ..; \
$(MAKE) VERBOSE=1; \
cp $(TVM_PATH)/build/libtvm_runtime.so $(ROOTDIR)/lib/libtvm_runtime.so; \
cp $(TVM_PATH)/build/libtvm_runtime.so lib/libtvm_runtime.so; \
cd $(ROOTDIR)

lib/libtvmop.so: lib/libtvm_runtime.so $(wildcard contrib/tvmop/*/*.py contrib/tvmop/*.py)
echo "Compile TVM operators"
PYTHONPATH=$(TVM_PATH)/python:$(TVM_PATH)/topi/python:$(ROOTDIR)/contrib:$PYTHONPATH \
PYTHONPATH=$(TVM_PATH)/python:$(TVM_PATH)/topi/python:$(ROOTDIR)/contrib \
LD_LIBRARY_PATH=lib \
python3 $(ROOTDIR)/contrib/tvmop/compile.py -o $(ROOTDIR)/lib/libtvmop.so
python3 $(ROOTDIR)/contrib/tvmop/compile.py -o lib/libtvmop.so
endif

NNVM_INC = $(wildcard $(NNVM_PATH)/include/*/*.h)
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/install/ubuntu_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ python3 get-pip.py
python2 get-pip.py

pip2 install nose cpplint==1.3.0 'numpy>1.16.0,<2.0.0' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3 Cython==0.29.7
pip3 install nose cpplint==1.3.0 pylint==2.3.1 'numpy>1.16.0,<2.0.0' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3 Cython==0.29.7
pip3 install nose cpplint==1.3.0 pylint==2.3.1 'numpy>1.16.0,<2.0.0' nose-timer 'requests<2.19.0,>=2.18.4' h5py==2.8.0rc1 scipy==1.0.1 boto3 Cython==0.29.7 decorator
12 changes: 12 additions & 0 deletions ci/docker/runtime_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ build_ubuntu_cpu_openblas() {
build_ccache_wrappers
make \
DEV=1 \
USE_TVM_OP=1 \
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=openblas \
Expand All @@ -395,6 +396,7 @@ build_ubuntu_cpu_mkl() {
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_BLAS=mkl \
USE_TVM_OP=1 \
USE_MKLDNN=0 \
USE_INTEL_PATH=/opt/intel \
USE_DIST_KVSTORE=1 \
Expand All @@ -412,6 +414,7 @@ build_ubuntu_cpu_cmake_debug() {
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DENABLE_TESTCOVERAGE=ON \
-DUSE_CUDA=OFF \
-DUSE_TVM_OP=ON \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_OPENMP=OFF \
-DUSE_OPENCV=ON \
Expand Down Expand Up @@ -559,6 +562,7 @@ build_ubuntu_cpu_mkldnn() {
DEV=1 \
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_TVM_OP=1 \
USE_BLAS=openblas \
USE_SIGNAL_HANDLER=1 \
-j$(nproc)
Expand All @@ -573,6 +577,7 @@ build_ubuntu_cpu_mkldnn_mkl() {
DEV=1 \
ENABLE_TESTCOVERAGE=1 \
USE_CPP_PACKAGE=1 \
USE_TVM_OP=1 \
USE_BLAS=mkl \
USE_SIGNAL_HANDLER=1 \
-j$(nproc)
Expand Down Expand Up @@ -657,6 +662,7 @@ build_ubuntu_gpu_mkldnn() {
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=1 \
USE_TVM_OP=1 \
CUDA_ARCH="$CI_CUDA_COMPUTE_CAPABILITIES" \
USE_SIGNAL_HANDLER=1 \
-j$(nproc)
Expand All @@ -674,6 +680,7 @@ build_ubuntu_gpu_mkldnn_nocudnn() {
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=0 \
USE_TVM_OP=1 \
CUDA_ARCH="$CI_CUDA_COMPUTE_CAPABILITIES" \
USE_SIGNAL_HANDLER=1 \
-j$(nproc)
Expand All @@ -690,6 +697,7 @@ build_ubuntu_gpu_cuda101_cudnn7() {
USE_CUDA=1 \
USE_CUDA_PATH=/usr/local/cuda \
USE_CUDNN=1 \
USE_TVM_OP=1 \
USE_CPP_PACKAGE=1 \
USE_DIST_KVSTORE=1 \
CUDA_ARCH="$CI_CUDA_COMPUTE_CAPABILITIES" \
Expand Down Expand Up @@ -733,6 +741,7 @@ build_ubuntu_gpu_cmake_mkldnn() {
-DENABLE_TESTCOVERAGE=ON \
-DUSE_CUDA=1 \
-DUSE_CUDNN=1 \
-DUSE_TVM_OP=1 \
-DUSE_MKLML_MKL=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCUDA_ARCH_NAME=Manual \
Expand All @@ -758,6 +767,7 @@ build_ubuntu_gpu_cmake() {
-DENABLE_TESTCOVERAGE=ON \
-DUSE_CUDA=ON \
-DUSE_CUDNN=ON \
-DUSE_TVM_OP=ON \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_MKLML_MKL=OFF \
-DUSE_MKLDNN=OFF \
Expand All @@ -784,6 +794,7 @@ build_ubuntu_cpu_large_tensor() {
-DENABLE_TESTCOVERAGE=ON \
-DUSE_CUDA=OFF \
-DUSE_CUDNN=OFF \
-DUSE_TVM_OP=ON \
-DUSE_MKLDNN=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_INT64_TENSOR_SIZE=ON \
Expand All @@ -805,6 +816,7 @@ build_ubuntu_gpu_large_tensor() {
-DENABLE_TESTCOVERAGE=ON \
-DUSE_CUDA=ON \
-DUSE_CUDNN=ON \
-DUSE_TVM_OP=ON \
-DUSE_MKL_IF_AVAILABLE=OFF \
-DUSE_MKLML_MKL=OFF \
-DUSE_MKLDNN=OFF \
Expand Down
15 changes: 7 additions & 8 deletions tests/python/unittest/test_tvm_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@

@with_seed()
def test_tvm_broadcast_add():
if _features.is_enabled("TVM_OP"):
a_shape = rand_shape_nd(4)
b_shape = (1,) + a_shape[1:2] + (1, 1)
a = mx.nd.normal(shape=a_shape)
b = mx.nd.normal(shape=b_shape)
c = mx.nd.contrib.tvm_vadd(a, b)
c_np = a.asnumpy() + b.asnumpy()
assert same(c.asnumpy(), c_np)
a_shape = rand_shape_nd(4)
b_shape = (1,) + a_shape[1:2] + (1, 1)
a = mx.nd.normal(shape=a_shape)
b = mx.nd.normal(shape=b_shape)
c = mx.nd.contrib.tvm_vadd(a, b)
c_np = a.asnumpy() + b.asnumpy()
assert same(c.asnumpy(), c_np)

if __name__ == '__main__':
import nose
Expand Down

0 comments on commit 8af7685

Please sign in to comment.