onnxruntime-tvm/Makefile

138 строки
4.2 KiB
Makefile
Исходник Обычный вид История

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
ROOTDIR = $(CURDIR)
.PHONY: clean all test doc pylint cpplint lint\
cython cython2 cython3 web runtime vta
2016-10-26 21:32:43 +03:00
ifndef DMLC_CORE_PATH
DMLC_CORE_PATH = $(ROOTDIR)/3rdparty/dmlc-core
endif
ifndef DLPACK_PATH
DLPACK_PATH = $(ROOTDIR)/3rdparty/dlpack
endif
INCLUDE_FLAGS = -Iinclude -I$(DLPACK_PATH)/include -I$(DMLC_CORE_PATH)/include
PKG_CFLAGS = -std=c++11 -Wall -O2 $(INCLUDE_FLAGS) -fPIC
PKG_LDFLAGS =
all:
@mkdir -p build && cd build && cmake .. && $(MAKE)
runtime:
@mkdir -p build && cd build && cmake .. && $(MAKE) runtime
vta:
@mkdir -p build && cd build && cmake .. && $(MAKE) vta
cpptest:
@mkdir -p build && cd build && cmake .. && $(MAKE) cpptest
# 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="['addFunction','cwrap','getValue','setValue']"\
-s USE_GLFW=3 -s USE_WEBGL2=1 -lglfw\
$(INCLUDE_FLAGS)
2016-10-15 04:07:37 +03:00
web: build/libtvm_web_runtime.js build/libtvm_web_runtime.bc
2016-10-17 07:33:42 +03:00
build/libtvm_web_runtime.bc: web/web_runtime.cc
@mkdir -p build/web
@mkdir -p $(@D)
emcc $(EMCC_FLAGS) -MM -MT build/libtvm_web_runtime.bc $< >build/web/web_runtime.d
emcc $(EMCC_FLAGS) -o $@ web/web_runtime.cc
build/libtvm_web_runtime.js: build/libtvm_web_runtime.bc
@mkdir -p $(@D)
emcc $(EMCC_FLAGS) -o $@ build/libtvm_web_runtime.bc
2016-10-26 21:32:43 +03:00
# Lint scripts
cpplint:
python3 3rdparty/dmlc-core/scripts/lint.py vta cpp vta/include vta/src
python3 3rdparty/dmlc-core/scripts/lint.py topi cpp topi/include;
python3 3rdparty/dmlc-core/scripts/lint.py nnvm cpp nnvm/include nnvm/src;
python3 3rdparty/dmlc-core/scripts/lint.py tvm cpp include src verilog\
examples/extension/src examples/graph_executor/src
pylint:
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
python3 -m pylint vta/python/vta --rcfile=$(ROOTDIR)/tests/lint/pylintrc
jnilint:
python3 3rdparty/dmlc-core/scripts/lint.py tvm4j-jni cpp jvm/native/src
[WIP][Frontend] Scala/Java package (#176) * JVM package skeleton * [JVM] link libtvm.so and list function names * [JVM] Function & NDArray skeleton * [JVM] TVMFuncCall in JNI * [JVM] handle string arg in TVMFuncCall * [JVM] get module function * [JVM] entry function for Module * [JVM] construct Module from function return value * [JVM] TVMContext, TVMArray attributes * [JVM] NDArray from / to java array * [JVM] load so and compute on cpu * [JVM] move PackedFunc to individual modules * [JVM] assembly package & native library loader * [JVM] unit test & codestyle check settings * [JVM] NDArray from & to different dtypes * [JVM] NDArray from native double array. Add linux-cpu profile. * [JVM] modify Makefile * [JVM] add linux-x86_64-gpu profile * [tvm4j] delay load libtvm_runtime.so * [tvm4j] refactor to pure java * [tvm4j] remove scalastyle-config.xml * [tvm4j] remove link HalideIR, remove Shape, remove scala binary versions * [tvm4j] only allow convert from/to same type array * [tvm4j] make NDArray api more readable * [tvm4j] refactor for c api * [tvm4j] add Jenkins tests * [tvm4j] fix duplicate Dockerfile cmd * [tvm4j] fix ut script filename * [tvm4j] add module load tests * [tvm4j] add javadoc, remove types package * [tvm4j] fix test script * [tvm4j] remove ut temp dir * [tvm4j] fix missing package types * [tvm4j] java code style check * [tvm4j] fix java lint * [tvm4j] downgrade checkstyle plugin for JDK7 * [tvm4j] add stylecheck in jenkins tests * [tvm4j] specify source file encoding * [tvm4j] lazy init function; add Function.call() api; allow manully release Module,NDArray,Function * [tvm4j] fix ModFree * [tvm4j] cache Function in API
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
javadoc:
# build artifact is in jvm/core/target/site/apidocs
cd jvm && mvn javadoc:javadoc
# 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:
rm -rf python/tvm/*/*/*.so python/tvm/*/*/*.dylib python/tvm/*/*/*.cpp
# JVM build rules
ifeq ($(OS),Windows_NT)
2018-07-22 03:21:38 +03:00
JVM_PKG_PROFILE := windows
SHARED_LIBRARY_SUFFIX := dll
else
2018-07-22 03:21:38 +03:00
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)
[WIP][Frontend] Scala/Java package (#176) * JVM package skeleton * [JVM] link libtvm.so and list function names * [JVM] Function & NDArray skeleton * [JVM] TVMFuncCall in JNI * [JVM] handle string arg in TVMFuncCall * [JVM] get module function * [JVM] entry function for Module * [JVM] construct Module from function return value * [JVM] TVMContext, TVMArray attributes * [JVM] NDArray from / to java array * [JVM] load so and compute on cpu * [JVM] move PackedFunc to individual modules * [JVM] assembly package & native library loader * [JVM] unit test & codestyle check settings * [JVM] NDArray from & to different dtypes * [JVM] NDArray from native double array. Add linux-cpu profile. * [JVM] modify Makefile * [JVM] add linux-x86_64-gpu profile * [tvm4j] delay load libtvm_runtime.so * [tvm4j] refactor to pure java * [tvm4j] remove scalastyle-config.xml * [tvm4j] remove link HalideIR, remove Shape, remove scala binary versions * [tvm4j] only allow convert from/to same type array * [tvm4j] make NDArray api more readable * [tvm4j] refactor for c api * [tvm4j] add Jenkins tests * [tvm4j] fix duplicate Dockerfile cmd * [tvm4j] fix ut script filename * [tvm4j] add module load tests * [tvm4j] add javadoc, remove types package * [tvm4j] fix test script * [tvm4j] remove ut temp dir * [tvm4j] fix missing package types * [tvm4j] java code style check * [tvm4j] fix java lint * [tvm4j] downgrade checkstyle plugin for JDK7 * [tvm4j] add stylecheck in jenkins tests * [tvm4j] specify source file encoding * [tvm4j] lazy init function; add Function.call() api; allow manully release Module,NDArray,Function * [tvm4j] fix ModFree * [tvm4j] cache Function in API
2017-07-15 09:04:39 +03:00
jvmpkg:
(cd $(ROOTDIR)/jvm; \
mvn clean package -P$(JVM_PKG_PROFILE) -Dcxx="$(CXX)" \
-Dcflags="$(PKG_CFLAGS)" -Dldflags="$(PKG_LDFLAGS)" \
-Dcurrent_libdir="$(ROOTDIR)/build" $(JVM_TEST_ARGS))
jvminstall:
(cd $(ROOTDIR)/jvm; \
mvn install -P$(JVM_PKG_PROFILE) -Dcxx="$(CXX)" \
-Dcflags="$(PKG_CFLAGS)" -Dldflags="$(PKG_LDFLAGS)" \
-Dcurrent_libdir="$(ROOTDIR)/build" $(JVM_TEST_ARGS))
[WIP][Frontend] Scala/Java package (#176) * JVM package skeleton * [JVM] link libtvm.so and list function names * [JVM] Function & NDArray skeleton * [JVM] TVMFuncCall in JNI * [JVM] handle string arg in TVMFuncCall * [JVM] get module function * [JVM] entry function for Module * [JVM] construct Module from function return value * [JVM] TVMContext, TVMArray attributes * [JVM] NDArray from / to java array * [JVM] load so and compute on cpu * [JVM] move PackedFunc to individual modules * [JVM] assembly package & native library loader * [JVM] unit test & codestyle check settings * [JVM] NDArray from & to different dtypes * [JVM] NDArray from native double array. Add linux-cpu profile. * [JVM] modify Makefile * [JVM] add linux-x86_64-gpu profile * [tvm4j] delay load libtvm_runtime.so * [tvm4j] refactor to pure java * [tvm4j] remove scalastyle-config.xml * [tvm4j] remove link HalideIR, remove Shape, remove scala binary versions * [tvm4j] only allow convert from/to same type array * [tvm4j] make NDArray api more readable * [tvm4j] refactor for c api * [tvm4j] add Jenkins tests * [tvm4j] fix duplicate Dockerfile cmd * [tvm4j] fix ut script filename * [tvm4j] add module load tests * [tvm4j] add javadoc, remove types package * [tvm4j] fix test script * [tvm4j] remove ut temp dir * [tvm4j] fix missing package types * [tvm4j] java code style check * [tvm4j] fix java lint * [tvm4j] downgrade checkstyle plugin for JDK7 * [tvm4j] add stylecheck in jenkins tests * [tvm4j] specify source file encoding * [tvm4j] lazy init function; add Function.call() api; allow manully release Module,NDArray,Function * [tvm4j] fix ModFree * [tvm4j] cache Function in API
2017-07-15 09:04:39 +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