2023-07-21 12:29:50 +08:00
|
|
|
.PHONY : build clean format install-python test-cpp test-onnx
|
2023-02-12 08:23:49 +08:00
|
|
|
|
2023-08-18 12:17:47 +08:00
|
|
|
TYPE ?= Release
|
2023-04-18 15:10:33 +08:00
|
|
|
CUDA ?= OFF
|
|
|
|
BANG ?= OFF
|
2023-04-17 12:15:23 +08:00
|
|
|
INTELCPU ?= off
|
2023-04-18 15:10:33 +08:00
|
|
|
BACKTRACE ?= ON
|
|
|
|
TEST ?= ON
|
2023-07-21 12:29:50 +08:00
|
|
|
FORMAT_ORIGIN ?=
|
2023-04-18 15:10:33 +08:00
|
|
|
|
|
|
|
CMAKE_OPT = -DCMAKE_BUILD_TYPE=$(TYPE)
|
|
|
|
CMAKE_OPT += -DUSE_CUDA=$(CUDA)
|
|
|
|
CMAKE_OPT += -DUSE_BANG=$(BANG)
|
|
|
|
CMAKE_OPT += -DUSE_BACKTRACE=$(BACKTRACE)
|
|
|
|
CMAKE_OPT += -DBUILD_TEST=$(TEST)
|
2023-02-12 08:23:49 +08:00
|
|
|
|
2023-04-17 12:15:23 +08:00
|
|
|
ifeq ($(INTELCPU), ON)
|
|
|
|
CMAKE_OPT += -DUSE_INTELCPU=ON -DCMAKE_CXX_COMPILER=dpcpp
|
|
|
|
endif
|
|
|
|
|
2023-02-12 08:23:49 +08:00
|
|
|
build:
|
|
|
|
mkdir -p build/$(TYPE)
|
2023-04-18 00:26:36 +08:00
|
|
|
cd build/$(TYPE) && cmake $(CMAKE_OPT) ../.. && make -j8
|
2023-02-12 08:23:49 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf build
|
|
|
|
|
2023-07-21 12:29:50 +08:00
|
|
|
format:
|
|
|
|
@python3 scripts/format.py $(FORMAT_ORIGIN)
|
|
|
|
|
2023-02-12 08:23:49 +08:00
|
|
|
install-python: build
|
|
|
|
cp build/$(TYPE)/backend*.so pyinfinitensor/src/pyinfinitensor
|
2023-08-18 12:17:47 +08:00
|
|
|
pip install -e pyinfinitensor/
|
2023-02-12 08:23:49 +08:00
|
|
|
|
2023-07-06 16:57:10 +08:00
|
|
|
test-cpp:
|
2023-02-12 08:23:49 +08:00
|
|
|
@echo
|
|
|
|
cd build/$(TYPE) && make test
|
|
|
|
|
|
|
|
test-onnx:
|
|
|
|
@echo
|
|
|
|
python3 pyinfinitensor/tests/test_onnx.py
|