File: Dockerfile

package info (click to toggle)
pytorch 1.13.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 139,252 kB
  • sloc: cpp: 1,100,274; python: 706,454; ansic: 83,052; asm: 7,618; java: 3,273; sh: 2,841; javascript: 612; makefile: 323; xml: 269; ruby: 185; yacc: 144; objc: 68; lex: 44
file content (126 lines) | stat: -rw-r--r-- 3,798 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
FROM ubuntu:trusty-20190515
MAINTAINER caffe-dev <caffe-dev@googlegroups.com>

# A docker container with CUDA and caffe2 installed.
# Note: this should install everything but cudnn, which requires you to have a
# manual registration and download from the NVidia website. After creating this
# docker image, the Caffe2 repository is located at /opt/caffe2. You can install
# cudnn manually and re-compile caffe2.

################################################################################
# Step 1: set up cuda on the ubuntu box.
################################################################################

RUN apt-get update && apt-get install -q -y \
  build-essential \
  wget

RUN cd /tmp && \
  wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run && \
  chmod +x cuda_*_linux.run && ./cuda_*_linux.run -extract=`pwd` && \
  ./NVIDIA-Linux-x86_64-*.run -s --no-kernel-module && \
  ./cuda-linux64-rel-*.run -noprompt && \
  rm -rf *

# Ensure the CUDA libs and binaries are in the correct environment variables
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
ENV PATH=$PATH:/usr/local/cuda/bin

# Run nvcc to make sure things are set correctly.
RUN nvcc --version

################################################################################
# Step 2: set up caffe2 pre-requisites
################################################################################

RUN apt-get update && apt-get install -q -y \
  git \
  libeigen3-dev \
  libgoogle-glog-dev \
  libleveldb-dev \
  liblmdb-dev \
  libopencv-dev \
  libprotobuf-dev \
  libsnappy-dev \
  zlib1g-dev \
  libbz2-dev \
  protobuf-compiler \
  python-dev \
  python-pip

RUN cd /tmp && \
  git clone https://github.com/facebook/rocksdb.git && \
  cd /tmp/rocksdb && \
  make && make install && \
  cd / && \
  rm -rf /tmp/rocksdb

# Caffe2 works best with openmpi 1.8.5 or above (which has cuda support).
# If you do not need openmpi, skip this step.
RUN cd /tmp && \
  wget http://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.0.tar.gz && \
  tar xzvf openmpi-1.10.0.tar.gz && \
  cd /tmp/openmpi-1.10.0 && \
  ./configure --with-cuda --with-threads && \
  make && make install && \
  cd / && \
  rm -rf /tmp/openmpi-1.10.0 && \
  rm /tmp/openmpi-1.10.0.tar.gz

# Caffe2 requires zeromq 4.0 or above, manually install.
# If you do not need zeromq, skip this step.
RUN apt-get install -q -y autoconf libtool
RUN mkdir /tmp/zeromq-build && \
  cd /tmp/zeromq-build && \
  wget https://github.com/zeromq/zeromq4-1/archive/v4.1.3.tar.gz && \
  tar xzvf v4.1.3.tar.gz --strip 1 && \
  ./autogen.sh && \
  ./configure --without-libsodium && \
  make && make install && \
  cd / && \
  rm -rf /tmp/zeromq-build

# pip self upgrade
RUN pip install --upgrade pip

# Python dependencies
RUN pip install \
  matplotlib \
  numpy \
  protobuf

################################################################################
# Step 3: install optional dependencies ("good to have" features)
################################################################################

RUN apt-get install -q -y \
  gfortran \
  graphviz \
  libatlas-base-dev \
  vim

RUN pip install \
  flask \
  ipython \
  notebook \
  pydot \
  python-nvd3 \
  scipy \
  tornado

# This is intentional. scikit-image has to be after scipy.
RUN pip install \
  scikit-image

################################################################################
# Step 4: set up caffe2
################################################################################

# Get the repository, and build.
RUN cd /opt && \
  git clone https://github.com/Yangqing/caffe2.git && \
  cd /opt/caffe2 && \
  make

# Now, we know that some of the caffe tests will fail. How do we deal with
# those?