Skip to content

Instantly share code, notes, and snippets.

@aszenz
Created October 27, 2018 17:16
Show Gist options
  • Save aszenz/b2e161a0d5fd7da3ad32b3cea394680a to your computer and use it in GitHub Desktop.
Save aszenz/b2e161a0d5fd7da3ad32b3cea394680a to your computer and use it in GitHub Desktop.
# ==================================================================
# module list
# ------------------------------------------------------------------
# torch latest (git)
# ==================================================================
APT_INSTALL="apt-get install -y --no-install-recommends" && \
PIP_INSTALL="python -m pip --no-cache-dir install --upgrade" && \
GIT_CLONE="git clone --depth 10" && \
rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/cuda.list \
/etc/apt/sources.list.d/nvidia-ml.list && \
apt-get update && \
# ==================================================================
# tools
# ------------------------------------------------------------------
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
build-essential \
ca-certificates \
cmake \
wget \
git \
vim \
&& \
# ==================================================================
# torch
# ------------------------------------------------------------------
export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__" && \
$GIT_CLONE https://github.com/torch/distro.git ~/torch --recursive && \
cd ~/torch/exe/luajit-rocks && \
mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_LUAJIT21=ON \
.. && \
make -j"$(nproc)" install && \
DEBIAN_FRONTEND=noninteractive $APT_INSTALL \
libjpeg-dev \
libpng-dev \
libreadline-dev \
&& \
$GIT_CLONE https://github.com/Yonaba/Moses ~/moses && \
cd ~/moses && \
luarocks install rockspec/moses-1.6.1-1.rockspec && \
cd ~/torch && \
sed -i 's/extra\/cudnn/extra\/cudnn \&\& git checkout R7/' install.sh && \
sed -i 's/$PREFIX\/bin\/luarocks/luarocks/' install.sh && \
sed -i '/qt/d' install.sh && \
sed -i '/Installing Lua/,/^cd \.\.$/d' install.sh && \
sed -i '/path_to_nvidiasmi/,/^fi$/d' install.sh && \
sed -i '/Restore anaconda/,/^Not updating$/d' install.sh && \
sed -i '/You might want to/,/^fi$/d' install.sh && \
sed -i 's/\[ -x "$path_to_nvcc" \]/false/' install.sh && \
yes no | ./install.sh && \
# ==================================================================
# config & cleanup
# ------------------------------------------------------------------
ldconfig && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/* ~/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment