-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add openvino support && fix build failure (#20)
* add oneflow build script * update source.sh * update Dockerfile * add openvino support * update doc * update LD_LIBRARY_PATH * update LD_LIBRARY_PATH * add source * update dockerfile, add cpio * use ordered list * tabs * tabs * update doc * update build-gcc7.sh * remove source * update oneflow-cuda.cmake
- Loading branch information
Showing
7 changed files
with
103 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
build | ||
build-* | ||
build-*/ | ||
checkpoints | ||
model | ||
log | ||
.vscode | ||
.clangd | ||
.cache | ||
|
||
*.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env bash | ||
# copy from https://github.com/Oneflow-Inc/oneflow/blob/master/ci/manylinux/build-gcc7.sh | ||
|
||
set -euxo pipefail | ||
ONEFLOW_CI_BUILD_PARALLEL=${ONEFLOW_CI_BUILD_PARALLEL:-$(nproc)} | ||
gcc --version | ||
ld --version | ||
# clean python dir | ||
cd ${ONEFLOW_CI_SRC_DIR} | ||
${ONEFLOW_CI_PYTHON_EXE} -m pip install -i https://mirrors.aliyun.com/pypi/simple --user -r ci/fixed-dev-requirements.txt | ||
cd python | ||
|
||
function clean_artifacts { | ||
git clean -nXd -e \!dist -e \!dist/** | ||
git clean -fXd -e \!dist -e \!dist/** | ||
} | ||
|
||
clean_artifacts | ||
|
||
# cmake config | ||
mkdir -p ${ONEFLOW_CI_BUILD_DIR} | ||
cd ${ONEFLOW_CI_BUILD_DIR} | ||
find ${ONEFLOW_CI_BUILD_DIR} -name CMakeCache.txt | ||
find ${ONEFLOW_CI_BUILD_DIR} -name CMakeCache.txt -delete | ||
if [ ! -f "$ONEFLOW_CI_CMAKE_INIT_CACHE" ]; then | ||
echo "$ONEFLOW_CI_CMAKE_INIT_CACHE does not exist." | ||
exit 1 | ||
fi | ||
export PATH="${PATH}:$(dirname ${ONEFLOW_CI_PYTHON_EXE})" | ||
export PYTHON_BIN_PATH=${ONEFLOW_CI_PYTHON_EXE} | ||
cmake -S ${ONEFLOW_CI_SRC_DIR} -C ${ONEFLOW_CI_CMAKE_INIT_CACHE} -DPython3_EXECUTABLE=${ONEFLOW_CI_PYTHON_EXE} | ||
|
||
# cmake build | ||
cd ${ONEFLOW_CI_BUILD_DIR} | ||
cmake --build . --parallel ${ONEFLOW_CI_BUILD_PARALLEL} | ||
|
||
# build pip | ||
cd ${ONEFLOW_CI_SRC_DIR} | ||
cd python | ||
${ONEFLOW_CI_PYTHON_EXE} setup.py bdist_wheel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
# Build From Source | ||
|
||
To build from source, you need to build liboneflow first. | ||
|
||
Build liboneflow from source | ||
You can pull the docker images, and follow the instructions below to build in docker container. | ||
|
||
``` | ||
git clone https://github.com/Oneflow-Inc/oneflow --depth=1 | ||
cd oneflow | ||
mkdir build && cd build | ||
cmake -C ../cmake/caches/cn/cuda.cmake -DBUILD_CPP_API=ON -DBUILD_SHARED_LIBS=ON -DWITH_MLIR=ON -G Ninja .. | ||
ninja | ||
docker pull registry.cn-beijing.aliyuncs.com/oneflow/triton-devel | ||
``` | ||
|
||
Build oneflow backend from source | ||
To build from source, you need to build liboneflow first. | ||
|
||
``` | ||
mkdir build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=/path/to/liboneflow_cpp/share -DTRITON_RELATED_REPO_TAG=r21.10 -DTRITON_ENABLE_GPU=ON -G Ninja .. | ||
ninja | ||
``` | ||
1. Build liboneflow from source | ||
|
||
Launch triton server | ||
``` | ||
git clone https://github.com/Oneflow-Inc/oneflow --depth=1 | ||
cd oneflow | ||
mkdir build && cd build | ||
cmake -C ../cmake/caches/cn/cuda.cmake -DBUILD_CPP_API=ON -DBUILD_SHARED_LIBS=ON \ | ||
-DWITH_MLIR=ON -G Ninja .. | ||
ninja | ||
``` | ||
``` | ||
cd ../ # back to root of the serving | ||
docker run --runtime=nvidia --rm --network=host \ | ||
-v$(pwd)/examples:/models \ | ||
-v$(pwd)/build/libtriton_oneflow.so:/backends/oneflow/libtriton_oneflow.so \ | ||
-v$(pwd)/oneflow/build/liboneflow_cpp/lib/:/mylib nvcr.io/nvidia/tritonserver:21.10-py3 \ | ||
bash -c 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mylib/ /opt/tritonserver/bin/tritonserver \ | ||
--model-repository=/models --backend-directory=/backends' | ||
curl -v localhost:8000/v2/health/ready # ready check | ||
``` | ||
2. Build oneflow backend from source | ||
``` | ||
mkdir build && cd build | ||
cmake -DCMAKE_PREFIX_PATH=/path/to/liboneflow_cpp/share -DTRITON_RELATED_REPO_TAG=r21.10 \ | ||
-DTRITON_ENABLE_GPU=ON -G Ninja -DTHIRD_PARTY_MIRROR=aliyun .. | ||
ninja | ||
``` | ||
3. Launch triton server | ||
``` | ||
cd ../ # back to root of the serving | ||
docker run --runtime=nvidia --rm --network=host \ | ||
-v$(pwd)/examples:/models \ | ||
-v$(pwd)/build/libtriton_oneflow.so:/backends/oneflow/libtriton_oneflow.so \ | ||
-v$(pwd)/oneflow/build/liboneflow_cpp/lib/:/mylib nvcr.io/nvidia/tritonserver:21.10-py3 \ | ||
bash -c 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mylib/ /opt/tritonserver/bin/tritonserver \ | ||
--model-repository=/models --backend-directory=/backends' | ||
curl -v localhost:8000/v2/health/ready # ready check | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters