Created
March 26, 2021 17:48
-
-
Save robieta/4b8057cbdf077a80c5ab02fc9a298b12 to your computer and use it in GitHub Desktop.
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
make_commit_env(){( set -e | |
ROOT=$(git rev-parse --show-toplevel) | |
COMMIT="$1" | |
PY_VERSION="${2:-3.7}" | |
COMMIT_ESCAPED=$(echo "${COMMIT}" | sed 's#/#_#g') | |
TREE_PATH="${ROOT}/../pytorch_worktrees/tree-${COMMIT_ESCAPED}-repo" | |
git worktree prune | |
git worktree add $TREE_PATH | |
cd $TREE_PATH | |
git checkout $COMMIT | |
ENV_PATH="$PWD-env" | |
git submodule status --recursive | cut -c2- | cut -d ' ' -f 2 | while read submodule; do | |
echo $submodule; | |
git submodule update --init --reference "${ROOT}/${submodule}" $submodule | |
done | |
git submodule update --init --recursive | |
conda create \ | |
--no-default-packages \ | |
-y \ | |
-p $ENV_PATH \ | |
python=$PY_VERSION \ | |
source activate $ENV_PATH | |
conda install -y numpy ninja pyyaml mkl mkl-include setuptools cmake cffi hypothesis typing_extensions dataclasses | |
conda install -y valgrind -c conda-forge | |
time USE_CUDA=0 \ | |
BUILD_CAFFE2_OPS=0 \ | |
BUILD_TEST=0 \ | |
REL_WITH_DEB_INFO=ON \ | |
python setup.py install | |
)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment