forked from onnx/onnx-caffe2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·36 lines (29 loc) · 1.05 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
scripts_dir=$(dirname $(readlink -e "${BASH_SOURCE[0]}"))
source "$scripts_dir/common";
[[ -n "$CAFFE2_VERSION" ]] || die "CAFFE2_VERSION not set"
onnx_c2_dir="$PWD"
pip install $onnx_c2_dir
# setup caffe2
c2_dir="$workdir/caffe2"
c2_install_dir="$build_cache_dir/caffe2/$CAFFE2_VERSION"
# install
export PYTHONPATH=$c2_install_dir
export LD_LIBRARY_PATH=$c2_install_dir/lib
pip install numpy future enum
if ! python -c 'import caffe2'; then
rm -rf $c2_install_dir
git clone https://github.com/caffe2/caffe2.git $c2_dir && cd $c2_dir
git checkout "$CAFFE2_VERSION" && git submodule update --init
ccache -z
mkdir build && cd build && cmake -DPYTHON_LIBRARY=$(python-config --prefix)/lib/libpython2.7.so -DCMAKE_INSTALL_PREFIX:PATH=$c2_install_dir .. && make -j16 && make install
ccache -s
fi
# install onnx
onnx_dir="$workdir/onnx"
git clone "https://github.com/onnx/onnx.git" "$onnx_dir" --recursive
pip install "$onnx_dir"
pip install pytest-cov
# run caffe2 tests
cd "$workdir"
pytest "$onnx_c2_dir/tests/caffe2_ref_test.py"