2023-02-12 08:23:49 +08:00
|
|
|
.PHONY : build clean install-python test-cpp test-onnx
|
|
|
|
|
|
|
|
TYPE ?= release
|
2023-02-24 14:14:52 +08:00
|
|
|
CUDA ?= off
|
|
|
|
|
|
|
|
CMAKE_OPT = -DCMAKE_BUILD_TYPE=$(TYPE)
|
|
|
|
|
2023-02-24 14:28:34 +08:00
|
|
|
ifeq ($(CUDA), ON)
|
2023-02-24 14:14:52 +08:00
|
|
|
CMAKE_OPT += -DUSE_CUDA=ON
|
|
|
|
endif
|
2023-02-12 08:23:49 +08:00
|
|
|
|
|
|
|
build:
|
|
|
|
mkdir -p build/$(TYPE)
|
2023-02-24 14:14:52 +08:00
|
|
|
cd build/$(TYPE) && cmake $(CMAKE_OPT) ../.. && make -j8
|
2023-02-12 08:23:49 +08:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf build
|
|
|
|
|
|
|
|
install-python: build
|
|
|
|
cp build/$(TYPE)/backend*.so pyinfinitensor/src/pyinfinitensor
|
|
|
|
pip install pyinfinitensor/
|
|
|
|
|
|
|
|
test-cpp: build
|
|
|
|
@echo
|
|
|
|
cd build/$(TYPE) && make test
|
|
|
|
|
|
|
|
test-onnx:
|
|
|
|
@echo
|
|
|
|
python3 pyinfinitensor/tests/test_onnx.py
|