diff --git a/Makefile b/Makefile index a14c29452f6e..e9751098e658 100644 --- a/Makefile +++ b/Makefile @@ -617,12 +617,13 @@ 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; \ + mkdir -p $(ROOTDIR)/lib; \ cp $(TVM_PATH)/build/libtvm_runtime.so $(ROOTDIR)/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 endif diff --git a/ci/docker/install/ubuntu_python.sh b/ci/docker/install/ubuntu_python.sh index 2ca0cceec515..b8626d3037d5 100755 --- a/ci/docker/install/ubuntu_python.sh +++ b/ci/docker/install/ubuntu_python.sh @@ -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 diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index 2518f4c7c64f..58fb350c68c5 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -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 \ @@ -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 \ @@ -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 \ @@ -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) @@ -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) @@ -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) @@ -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) @@ -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" \ @@ -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 \ @@ -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 \ @@ -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 \ @@ -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 \ diff --git a/ci/jenkins/Jenkins_steps.groovy b/ci/jenkins/Jenkins_steps.groovy index f653e0c5cb63..df1e015f0522 100644 --- a/ci/jenkins/Jenkins_steps.groovy +++ b/ci/jenkins/Jenkins_steps.groovy @@ -23,19 +23,19 @@ utils = load('ci/Jenkinsfile_utils.groovy') // mxnet libraries -mx_lib = 'lib/libmxnet.so, lib/libmxnet.a, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a' +mx_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a' mx_lib_cython = 'lib/libmxnet.so, lib/libmxnet.a, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so' // Python wheels mx_pip = 'build/*.whl' // mxnet cmake libraries, in cmake builds we do not produce a libnvvm static library by default. -mx_cmake_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so' -mx_cmake_lib_cython = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so' +mx_cmake_lib = 'build/libmxnet.so, build/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so' +mx_cmake_lib_cython = 'build/libmxnet.so, build/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so' // mxnet cmake libraries, in cmake builds we do not produce a libnvvm static library by default. -mx_cmake_lib_debug = 'build/libmxnet.so, build/libmxnet.a, build/libsample_lib.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests' -mx_cmake_mkldnn_lib = 'build/libmxnet.so, build/libmxnet.a, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, build/3rdparty/mkldnn/src/libmkldnn.so.0' -mx_mkldnn_lib = 'lib/libmxnet.so, lib/libmxnet.a, libsample_lib.so, lib/libiomp5.so, lib/libmkldnn.so.0, lib/libmklml_intel.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a' +mx_cmake_lib_debug = 'build/libmxnet.so, build/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, build/libsample_lib.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests' +mx_cmake_mkldnn_lib = 'build/libmxnet.so, build/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, build/3rdparty/dmlc-core/libdmlc.a, build/tests/mxnet_unit_tests, build/3rdparty/openmp/runtime/src/libomp.so, build/3rdparty/mkldnn/src/libmkldnn.so.0' +mx_mkldnn_lib = 'lib/libmxnet.so, lib/libmxnet.a, lib/libtvm_runtime.so, lib/libtvmop.so, libsample_lib.so, lib/libiomp5.so, lib/libmkldnn.so.0, lib/libmklml_intel.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a' mx_tensorrt_lib = 'build/libmxnet.so, lib/libnvonnxparser_runtime.so.0, lib/libnvonnxparser.so.0, lib/libonnx_proto.so, lib/libonnx.so' mx_lib_cpp_examples = 'lib/libmxnet.so, lib/libmxnet.a, libsample_lib.so, 3rdparty/dmlc-core/libdmlc.a, 3rdparty/tvm/nnvm/lib/libnnvm.a, 3rdparty/ps-lite/build/libps.a, deps/lib/libprotobuf-lite.a, deps/lib/libzmq.a, build/cpp-package/example/*, python/mxnet/_cy2/*.so, python/mxnet/_cy3/*.so' mx_lib_cpp_examples_cpu = 'build/libmxnet.so, build/cpp-package/example/*' diff --git a/tests/python/unittest/test_tvm_op.py b/tests/python/unittest/test_tvm_op.py index 3ab2a25bc20e..cb007f416b11 100644 --- a/tests/python/unittest/test_tvm_op.py +++ b/tests/python/unittest/test_tvm_op.py @@ -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