mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Summary: Add flags for LMDB and LevelDB, default `OFF`. These can be enabled with ``` USE_LMDB=1 USE_LEVELDB=1 python setup.py build_deps ``` Also add a flag to build Caffe2 ops, which is default `ON`. Disable with ``` NO_CAFFE2_OPS=1 python setup.py build_deps ``` cc Yangqing soumith pjh5 mingzhe09088 Pull Request resolved: https://github.com/pytorch/pytorch/pull/11462 Reviewed By: soumith Differential Revision: D9758156 Pulled By: orionr fbshipit-source-id: 95fd206d72fdf44df54fc5d0aeab598bff900c63
39 lines
983 B
Bash
Executable File
39 lines
983 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
# realpath might not be available on MacOS
|
|
script_path=$(python -c "import os; import sys; print(os.path.realpath(sys.argv[1]))" "${BASH_SOURCE[0]}")
|
|
top_dir=$(dirname $(dirname $(dirname "$script_path")))
|
|
tp2_dir="$top_dir/third_party"
|
|
BUILD_DIR="$top_dir/build"
|
|
mkdir -p "$BUILD_DIR"
|
|
|
|
_pip_install() {
|
|
if [[ -n "$CI" ]]; then
|
|
if [[ -z "${SCCACHE_BUCKET}" ]]; then
|
|
ccache -z
|
|
fi
|
|
fi
|
|
if [[ -n "$CI" ]]; then
|
|
time pip install "$@"
|
|
else
|
|
pip install "$@"
|
|
fi
|
|
if [[ -n "$CI" ]]; then
|
|
if [[ -n "${SCCACHE_BUCKET}" ]]; then
|
|
sccache --show-stats
|
|
else
|
|
ccache -s
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Install onnx
|
|
_pip_install -b "$BUILD_DIR/onnx" "file://$tp2_dir/onnx#egg=onnx"
|
|
|
|
# Install caffe2 and pytorch
|
|
pip install -r "$top_dir/caffe2/requirements.txt"
|
|
pip install -r "$top_dir/requirements.txt"
|
|
USE_LEVELDB=1 USE_LMDB=1 USE_OPENCV=1 BUILD_BINARY=1 python setup.py install
|