2017-03-12 21:34:04 +03:00
|
|
|
ROOTDIR = $(CURDIR)
|
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
.PHONY: clean all test doc pylint cpplint lint\
|
|
|
|
cython cython2 cython3 web runtime
|
2016-10-26 21:32:43 +03:00
|
|
|
|
2017-06-01 03:20:31 +03:00
|
|
|
ifndef DMLC_CORE_PATH
|
|
|
|
DMLC_CORE_PATH = $(ROOTDIR)/dmlc-core
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef DLPACK_PATH
|
|
|
|
DLPACK_PATH = $(ROOTDIR)/dlpack
|
|
|
|
endif
|
|
|
|
|
2017-08-20 10:30:44 +03:00
|
|
|
INCLUDE_FLAGS = -Iinclude -I$(DLPACK_PATH)/include -I$(DMLC_CORE_PATH)/include -IHalideIR/src -Itopi/include
|
2018-06-11 08:00:33 +03:00
|
|
|
PKG_CFLAGS = -std=c++11 -Wall -O2 $(INCLUDE_FLAGS) -fPIC
|
2018-01-31 21:20:57 +03:00
|
|
|
PKG_LDFLAGS =
|
2017-08-20 03:05:38 +03:00
|
|
|
|
2018-01-21 00:51:34 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
all:
|
|
|
|
@mkdir -p build && cd build && cmake .. && $(MAKE)
|
2017-05-02 20:14:45 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
runtime:
|
2018-04-10 08:24:19 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
@mkdir -p build && cd build && cmake .. && $(MAKE) runtime
|
2017-09-25 04:50:15 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
cpptest:
|
|
|
|
@mkdir -p build && cd build && cmake .. && $(MAKE) cpptest
|
2018-01-28 08:50:04 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
# EMCC; Web related scripts
|
|
|
|
EMCC_FLAGS= -std=c++11 -DDMLC_LOG_STACK_TRACE=0\
|
|
|
|
-Oz -s RESERVED_FUNCTION_POINTERS=2 -s MAIN_MODULE=1 -s NO_EXIT_RUNTIME=1\
|
|
|
|
-s TOTAL_MEMORY=1073741824\
|
|
|
|
-s EXTRA_EXPORTED_RUNTIME_METHODS="['cwrap','getValue','setValue','addFunction']"\
|
|
|
|
-s USE_GLFW=3 -s USE_WEBGL2=1 -lglfw\
|
|
|
|
$(INCLUDE_FLAGS)
|
2016-10-15 04:07:37 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
web: build/libtvm_web_runtime.js build/libtvm_web_runtime.bc
|
2016-10-17 07:33:42 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
build/libtvm_web_runtime.bc: web/web_runtime.cc
|
2017-07-11 04:23:47 +03:00
|
|
|
@mkdir -p build/web
|
|
|
|
@mkdir -p $(@D)
|
2018-06-11 08:00:33 +03:00
|
|
|
emcc $(EMCC_FLAGS) -MM -MT build/libtvm_web_runtime.bc $< >build/web/web_runtime.d
|
2017-07-11 04:23:47 +03:00
|
|
|
emcc $(EMCC_FLAGS) -o $@ web/web_runtime.cc
|
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
build/libtvm_web_runtime.js: build/libtvm_web_runtime.bc
|
2017-07-11 04:23:47 +03:00
|
|
|
@mkdir -p $(@D)
|
2018-06-11 08:00:33 +03:00
|
|
|
emcc $(EMCC_FLAGS) -o $@ build/libtvm_web_runtime.bc
|
2016-10-26 21:32:43 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
# Lint scripts
|
2017-03-12 21:34:04 +03:00
|
|
|
cpplint:
|
2018-06-12 02:36:52 +03:00
|
|
|
python3 dmlc-core/scripts/lint.py topi cpp topi/include;
|
|
|
|
python3 dmlc-core/scripts/lint.py nnvm cpp nnvm/include nnvm/src;
|
|
|
|
python3 dmlc-core/scripts/lint.py tvm cpp include src verilog\
|
2017-06-15 19:45:18 +03:00
|
|
|
examples/extension/src examples/graph_executor/src
|
2017-03-12 21:34:04 +03:00
|
|
|
|
|
|
|
pylint:
|
2018-06-12 02:36:52 +03:00
|
|
|
python3 -m pylint python/tvm --rcfile=$(ROOTDIR)/tests/lint/pylintrc
|
|
|
|
python3 -m pylint topi/python/topi --rcfile=$(ROOTDIR)/tests/lint/pylintrc
|
|
|
|
python3 -m pylint nnvm/python/nnvm --rcfile=$(ROOTDIR)/tests/lint/pylintrc
|
2017-03-12 21:34:04 +03:00
|
|
|
|
2017-07-19 07:40:18 +03:00
|
|
|
jnilint:
|
2018-06-12 02:36:52 +03:00
|
|
|
python3 dmlc-core/scripts/lint.py tvm4j-jni cpp jvm/native/src
|
2017-07-15 09:04:39 +03:00
|
|
|
|
|
|
|
lint: cpplint pylint jnilint
|
2016-10-15 04:07:37 +03:00
|
|
|
|
2016-10-16 05:51:02 +03:00
|
|
|
doc:
|
|
|
|
doxygen docs/Doxyfile
|
|
|
|
|
2017-04-28 01:20:29 +03:00
|
|
|
# Cython build
|
|
|
|
cython:
|
|
|
|
cd python; python setup.py build_ext --inplace
|
|
|
|
|
|
|
|
cython2:
|
|
|
|
cd python; python2 setup.py build_ext --inplace
|
|
|
|
|
|
|
|
cython3:
|
|
|
|
cd python; python3 setup.py build_ext --inplace
|
|
|
|
|
|
|
|
cyclean:
|
2017-07-31 22:23:34 +03:00
|
|
|
rm -rf python/tvm/*/*/*.so python/tvm/*/*/*.dylib python/tvm/*/*/*.cpp
|
2017-04-28 01:20:29 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
# JVM build rules
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
JVM_PKG_PROFILE := windows
|
|
|
|
SHARED_LIBRARY_SUFFIX := dll
|
|
|
|
else
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S), Darwin)
|
|
|
|
JVM_PKG_PROFILE := osx-x86_64
|
|
|
|
SHARED_LIBRARY_SUFFIX := dylib
|
|
|
|
else
|
|
|
|
JVM_PKG_PROFILE := linux-x86_64
|
|
|
|
SHARED_LIBRARY_SUFFIX := so
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
JVM_TEST_ARGS := $(if $(JVM_TEST_ARGS),$(JVM_TEST_ARGS),-DskipTests -Dcheckstyle.skip=true)
|
|
|
|
JVM_PKG_PROFILE := $(JVM_PKG_PROFILE)-gpu
|
|
|
|
|
2017-07-15 09:04:39 +03:00
|
|
|
jvmpkg:
|
|
|
|
(cd $(ROOTDIR)/jvm; \
|
|
|
|
mvn clean package -P$(JVM_PKG_PROFILE) -Dcxx="$(CXX)" \
|
2018-06-11 08:00:33 +03:00
|
|
|
-Dcflags="$(PKG_CFLAGS)" -Dldflags="$(PKG_LDFLAGS)" \
|
|
|
|
-Dcurrent_libdir="$(ROOTDIR)/build" $(JVM_TEST_ARGS))
|
2017-08-25 19:02:21 +03:00
|
|
|
jvminstall:
|
|
|
|
(cd $(ROOTDIR)/jvm; \
|
|
|
|
mvn install -P$(JVM_PKG_PROFILE) -Dcxx="$(CXX)" \
|
2018-06-11 08:00:33 +03:00
|
|
|
-Dcflags="$(PKG_CFLAGS)" -Dldflags="$(PKG_LDFLAGS)" \
|
|
|
|
-Dcurrent_libdir="$(ROOTDIR)/build" $(JVM_TEST_ARGS))
|
2017-07-15 09:04:39 +03:00
|
|
|
|
2018-06-11 08:00:33 +03:00
|
|
|
# clean rule
|
2016-10-15 04:07:37 +03:00
|
|
|
clean:
|
2018-06-14 18:55:19 +03:00
|
|
|
@mkdir -p build && cd build && cmake .. && $(MAKE) clean
|