Skip to content

Instantly share code, notes, and snippets.

@rnbguy
Created December 22, 2020 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnbguy/a2df19e786b408e182186415d5745ce7 to your computer and use it in GitHub Desktop.
Save rnbguy/a2df19e786b408e182186415d5745ce7 to your computer and use it in GitHub Desktop.
ERAN on Alpine (ETH Robustness Analyzer for Neural Networks)
#!/bin/ash
# set -e
git clone --depth 1 https://github.com/eth-sri/ERAN.git
cd ERAN
has_cuda=0
while : ; do
case "$1" in
"")
break;;
-use-cuda|--use-cuda)
has_cuda=1;;
*)
echo "unknown option $1, try -help"
exit 2;;
esac
shift
done
git clone https://github.com/cddlib/cddlib.git
cd cddlib
./bootstrap
libtoolize
./bootstrap
./configure
make
make install
cd ..
wget https://packages.gurobi.com/9.0/gurobi9.0.3_linux64.tar.gz
tar -xf gurobi9.0.3_linux64.tar.gz
cd gurobi903/linux64/src/build
sed -ie 's/^C++FLAGS =.*$/& -fPIC/' Makefile
make
cp libgurobi_c++.a ../../lib/
cp ../../lib/libgurobi90.so /usr/lib
cd ../..
python3 setup.py install
cd ../..
rm gurobi9.0.3_linux64.tar.gz
export GUROBI_HOME="$(pwd)/gurobi903/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export CPATH="${CPATH}:${GUROBI_HOME}/include"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:${GUROBI_HOME}/lib
git clone https://github.com/eth-sri/ELINA.git
cd ELINA
if test "$has_cuda" -eq 1
then
./configure -use-cuda -use-deeppoly -use-gurobi -use-fconv
else
./configure -use-deeppoly -use-gurobi -use-fconv
fi
make
make install
cd ..
git clone https://github.com/eth-sri/deepg.git
cd deepg/code
mkdir build
make shared_object
cp ./build/libgeometric.so /usr/lib
cd ../..
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib
wget https://files.sri.inf.ethz.ch/eran/nets/tensorflow/mnist/mnist_relu_3_50.tf
ldconfig
FROM alpine
RUN apk update --no-cache
RUN apk add --no-cache git wget build-base automake autoconf libtool mpfr-dev gmp-dev m4 python3 texlive texlive-dvi
WORKDIR /root
ADD ./alpine-install.sh ./alpine-install.sh
RUN ash ./alpine-install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment