diff --git a/.travis.yml b/.travis.yml index fa5359c..bc0a703 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,16 +14,36 @@ dist: bionic before_install: - sudo apt-get install clang-tools-9 - - wget -O /tmp/libtorch-cxx11-abi-shared-with-deps-1.5.1+cpu.zip https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-1.5.1%2Bcpu.zip - - unzip /tmp/libtorch-cxx11-abi-shared-with-deps-1.5.1+cpu.zip -d /opt - - export LIBTORCH=/opt/libtorch - - export LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH - - printenv - - ls - - rm libtch/dummy_cuda_dependency.cpp - - mv libtch/fake_cuda_dependency.cpp.cpu libtch/fake_cuda_dependency.cpp - - rm libtch/lib.go - - mv libtch/lib.go.cpu libtch/lib.go + + - GOTCH_VERSION="${GOTCH_VER:-v0.1.7}" + - LIBTORCH_VERSION="${LIBTORCH_VER:-1.5.1}" + - GOTCH="$GOPATH/pkg/mod/github.com/sugarme/gotch@$GOTCH_VERSION" + - LIBTORCH="$GOPATH/pkg/mod/github.com/sugarme/gotch@$GOTCH_VERSION/libtch/libtorch" + - LIBRARY_PATH="$LIBTORCH/lib" + - CPATH="$LIBTORCH/lib:$LIBTORCH/include:$LIBTORCH/include/torch/csrc:$LIBTORCH/include/torch/csrc/api/include" + - LD_LIBRARY_PATH="$LIBTORCH/lib" + + # Precompiled libtorch + - sudo rm -rf $LIBTORCH + - sudo mkdir -p $LIBTORCH + - wget -O /tmp/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}%2Bcpu.zip + - sudo unzip /tmp/libtorch-cxx11-abi-shared-with-deps-${LIBTORCH_VERSION}+cpu.zip -d $GOTCH/libtch + + # Update .bashrc + - FILE="$HOME/.bashrc" + - LN_LIBTORCH="export LIBTORCH=$GOPATH/pkg/mod/github.com/sugarme/gotch@$GOTCH_VERSION/libtch/libtorch" + - LN_LIBRARY_PATH="export LIBRARY_PATH=$LIBTORCH/lib" + - LN_CPATH="export CPATH=$LIBTORCH/lib:$LIBTORCH/include:$LIBTORCH/include/torch/csrc:$LIBTORCH/include/torch/csrc/api/include" + - LN_LD_LIBRARY_PATH="export LD_LIBRARY_PATH=$LIBTORCH/lib:$LD_LIBRARY_PATH" + - sudo grep -xqF -- "$LN_LIBTORCH" "$FILE" || sudo echo "$LN_LIBTORCH" >> "$FILE" + - sudo grep -xqF -- "$LN_LIBRARY_PATH" "$FILE" || sudo echo "$LN_LIBRARY_PATH" >> "$FILE" + - sudo grep -xqF -- "$LN_CPATH" "$FILE" || sudo echo "$LN_CPATH" >> "$FILE" + - sudo grep -xqF -- "$LN_LD_LIBRARY_PATH" "$FILE" || sudo echo "$LN_LD_LIBRARY_PATH" >> "$FILE" + - sudo rm $GOTCH/libtch/lib.go + - sudo cp $GOTCH/libtch/lib.go.cpu $GOTCH/libtch/lib.go + - sudo mv $GOTCH/libtch/dummy_cuda_dependency.cpp $GOTCH/libtch/dummy_cuda_dependency.cpp.gpu + - sudo mv $GOTCH/libtch/fake_cuda_dependency.cpp.cpu $GOTCH/libtch/fake_cuda_dependency.cpp + - source "$FILE" script: - go test -v github.com/sugarme/gotch/tensor - go test -v github.com/sugarme/gotch/nn diff --git a/README.md b/README.md index 7884218..42bb9ae 100644 --- a/README.md +++ b/README.md @@ -15,21 +15,21 @@ - **CPU** - Default values: `LIBTORCH_VER=1.5.1` and `GOTCH_VER=v0.1.5` + Default values: `LIBTORCH_VER=1.5.1` and `GOTCH_VER=v0.1.7` ```bash - go get -u github.com/sugarme/gotch@v0.1.5 - bash ${GOPATH}/pkg/mod/github.com/sugarme/gotch@v0.1.5/setup-cpu.sh + go get -u github.com/sugarme/gotch@v0.1.7 + bash ${GOPATH}/pkg/mod/github.com/sugarme/gotch@v0.1.7/setup-cpu.sh ``` - **GPU** - Default values: `LIBTORCH_VER=1.5.1`, `CUDA_VER=10.1` and `GOTCH_VER=v0.1.5` + Default values: `LIBTORCH_VER=1.5.1`, `CUDA_VER=10.1` and `GOTCH_VER=v0.1.7` ```bash - go get -u github.com/sugarme/gotch@v0.1.5 - bash ${GOPATH}/pkg/mod/github.com/sugarme/gotch@v0.1.5/setup-gpu.sh + go get -u github.com/sugarme/gotch@v0.1.7 + bash ${GOPATH}/pkg/mod/github.com/sugarme/gotch@v0.1.7/setup-gpu.sh ```