Skip to content

Commit 07df6eb

Browse files
authored
Merge pull request #131 from ilyak93/running-on-docker
Instructions for running it on Docker
2 parents 185b0e2 + 5ff4f05 commit 07df6eb

128 files changed

Lines changed: 25205 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Docker/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM nvidia/cuda:8.0-cudnn7-devel-ubuntu16.04
2+
3+
RUN apt-get update && apt-get install -y \
4+
rsync \
5+
htop \
6+
git \
7+
openssh-server \
8+
nano \
9+
cmake \
10+
python-opencv \
11+
python2.7 \
12+
unzip \
13+
time
14+
15+
16+
RUN apt-get -qq -y install curl bzip2 && \
17+
curl -sSL https://repo.continuum.io/miniconda/Miniconda2-4.6.14-Linux-x86_64.sh -o /tmp/miniconda.sh && \
18+
bash /tmp/miniconda.sh -bfp /usr/local && \
19+
rm -rf /tmp/miniconda.sh && \
20+
conda install -y python=2 && \
21+
conda update conda && \
22+
apt-get -qq -y autoremove && \
23+
apt-get autoclean && \
24+
rm -rf /var/lib/apt/lists/* /var/log/dpkg.log && \
25+
conda clean --all --yes
26+
27+
28+
# install external packages
29+
ADD torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
30+
RUN pip install torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
31+
RUN pip install torchvision==0.2.1 visdom==0.1.8.8 dominate==2.3.5 opencv-python==4.1.0.25 cffi==1.12.2
32+
33+
ADD external_packages external_packages
34+
35+
ENV NVIDIA_VISIBLE_DEVICES all
36+
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
37+

Docker/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Running PWC-Net on Docker and working with a remote interpreter in PyCharm on Linux:
2+
3+
### Worked for me on the following system:
4+
5+
Ubuntu 20.04.4 LTS
6+
7+
docker 20.10.17, build 100c701
8+
9+
nvidia-docker 2.11.0-1
10+
11+
GPU: GeForce RTX 2080 Ti
12+
13+
14+
### Full installation and and settings configuration instructions:
15+
16+
Step 1: Look at [NVIDIA official guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) for installing `nvdia-docker2` (which include instructions for installing docker)
17+
18+
make sure [step 3](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#step-3-testing-the-installation) of it runs as expected.
19+
20+
Step 2: [Download](https://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl) the appropriate torch version for this project.
21+
22+
Step 3: Put the `torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl`, the Dockerfile and the external packages folder in the same folder anywhere you like.
23+
24+
Step 4: got to the folder where your Dockerfile located through the terminal and run `docker build -t choose_any_tag_name .`
25+
26+
Now you should be able to see your docker img tag in Docker in your PyCharm services:
27+
28+
![image](https://user-images.githubusercontent.com/50303550/185483233-b77c45b1-75a9-404d-8fdb-c4a7aad2f72f.png)
29+
30+
Step 5: As another sainity check, `Create Container` (right mouse click on the img tag) with the following run options arguments `--gpus=all --runtime=nvidia` (click on `Modify Options`, then on `Run Options`):
31+
32+
![image](https://user-images.githubusercontent.com/50303550/185483940-f272742a-b15d-44bc-aa1d-a222b9d1e433.png)
33+
34+
You may set the container name and the Docker name as you desire.
35+
36+
37+
Step 6: Create a project in PyCharm and put all the files from the repository in there except the `external packages`, which you should take from this folder.
38+
39+
Step 7: in file `models/PWC-Net.py` at the head of it, add:
40+
41+
`import os ;
42+
os.system("bash /external_packages/correlation-pytorch-master/make_cuda.sh")
43+
`
44+
45+
Step 7: Go to Python Interpreter window in PyCharm and click on `Add Interpreter` and choose `On Docker`:
46+
47+
![image](https://user-images.githubusercontent.com/50303550/185485149-87092a37-5d2c-48c1-a4bc-57c63412666f.png)
48+
49+
50+
choose option `pull` and write your image tag and then add `:latest` (it should pop up from the list as you can see below) and click `next`:
51+
52+
![image](https://user-images.githubusercontent.com/50303550/185485744-6e3b9d5b-ff78-4c78-9c4a-c35b90e4d3af.png)
53+
54+
it should end with `Introspection completed ; Removing introspection container`. click again `next`.
55+
56+
57+
choose `System Enterpreter`, then click on the `...` and enter `/usr/local/bin/python` (this should be the path on your docker to the python interpreter).
58+
Notice that you didn't choose it yet, just click on the toggle arrow and click on the path you've just added.
59+
60+
61+
### You are done and you should see how the interpreter now updates in libraries and in a couple of minutes it is ready for running and debugging.
62+
63+
If everything worked, the first thing you would see each time your run the console is how the external packages are compiled with nvcc and the correlation layer is installed.
64+
Notice this must happen each run because docker running a clean version of the container with everything installed from your build command in step 4.
65+
66+
For compiling the external_packages on the docker in file `make_cuda.sh` I changed the setup command to `pip install .` and also set the absolute path from `~` directory on the docker.
67+
also in `external_packages/correlation-pytorch-master/correlation-pytorch/correlation_package/_ext/corr/__init__.py`
68+
69+
I modificated the import to be:
70+
71+
`from torch.utils.ffi import _wrap_function ;
72+
import imp ;
73+
_corr = imp.load_dynamic('_corr','/usr/local/lib/python2.7/site-packages/correlation_package/_ext/corr/_corr.so') ;
74+
from _corr import lib as _lib, ffi as _ffi` ;
75+
76+
eventually that how it worked for me.
77+
78+
79+
# Super important note:
80+
81+
notice the authors used a GPU of Pascal series for which CUDNN of particular versions only suitable and there for CUDA and torch.
82+
My GPU wasn't compatible, because for torch 0.2.0, CUDA8.0 and compatibele CUDNN a GPU with compute capability of 6.x is needed.
83+
But some how, except very slow few first GPU commands such as `.cuda()` it worked.
84+
85+
If you want to be able to run it without such side-effects, you will probably have to run on it on some older GPU with compute capability of 6.x,
86+
and the sure solution is to run it with a similiar GPU version to which the authors mention in the paper.
87+
88+
89+
90+
91+
92+
93+
94+
95+
96+
97+
98+
99+
100+
101+
102+
103+
104+
105+
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins.
2+
3+
This directory caches those eggs to prevent repeated downloads.
4+
5+
However, it is safe to delete this directory.
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Except when otherwise stated (look for LICENSE files in directories or
3+
information at the beginning of each file) all software and
4+
documentation is licensed as follows:
5+
6+
The MIT License
7+
8+
Permission is hereby granted, free of charge, to any person
9+
obtaining a copy of this software and associated documentation
10+
files (the "Software"), to deal in the Software without
11+
restriction, including without limitation the rights to use,
12+
copy, modify, merge, publish, distribute, sublicense, and/or
13+
sell copies of the Software, and to permit persons to whom the
14+
Software is furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included
17+
in all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25+
DEALINGS IN THE SOFTWARE.
26+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Metadata-Version: 2.1
2+
Name: cffi
3+
Version: 1.15.1
4+
Summary: Foreign Function Interface for Python calling C code.
5+
Home-page: http://cffi.readthedocs.org
6+
Author: Armin Rigo, Maciej Fijalkowski
7+
Author-email: python-cffi@googlegroups.com
8+
License: MIT
9+
Platform: UNKNOWN
10+
Classifier: Programming Language :: Python
11+
Classifier: Programming Language :: Python :: 2
12+
Classifier: Programming Language :: Python :: 2.7
13+
Classifier: Programming Language :: Python :: 3
14+
Classifier: Programming Language :: Python :: 3.6
15+
Classifier: Programming Language :: Python :: 3.7
16+
Classifier: Programming Language :: Python :: 3.8
17+
Classifier: Programming Language :: Python :: 3.9
18+
Classifier: Programming Language :: Python :: 3.10
19+
Classifier: Programming Language :: Python :: Implementation :: CPython
20+
Classifier: Programming Language :: Python :: Implementation :: PyPy
21+
Classifier: License :: OSI Approved :: MIT License
22+
Requires-Dist: pycparser
23+
24+
CFFI
25+
====
26+
27+
Foreign Function Interface for Python calling C code.
28+
Please see the `Documentation <http://cffi.readthedocs.org/>`_.
29+
30+
Contact
31+
-------
32+
33+
`Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
34+
35+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
_cffi_backend.so,sha256=8YrQLM1nwNmAVj9VdUqADK9LBgSuXOnh-oL3B8b4nMg,847804
2+
cffi-1.15.1.dist-info/top_level.txt,sha256=rE7WR3rZfNKxWI9-jn6hsHCAl7MDkB-FmuQbxWjFehQ,19
3+
cffi-1.15.1.dist-info/entry_points.txt,sha256=Q9f5C9IpjYxo0d2PK9eUcnkgxHc9pHWwjEMaANPKNCI,76
4+
cffi-1.15.1.dist-info/WHEEL,sha256=xIMo9FffJ9e90LlGcE7k4UedKvWdvgFuFEg1EAZP6Xc,110
5+
cffi-1.15.1.dist-info/LICENSE,sha256=BLgPWwd7vtaICM_rreteNSPyqMmpZJXFh72W3x6sKjM,1294
6+
cffi-1.15.1.dist-info/METADATA,sha256=q6tBTBdFHdedHoe-W_-D9ioSiZWZaEQ4MJGUm-HxNOM,1141
7+
cffi-1.15.1.dist-info/RECORD,,
8+
cffi/vengine_gen.py,sha256=5dX7s1DU6pTBOMI6oTVn_8Bnmru_lj932B6b4v29Hlg,26684
9+
cffi/backend_ctypes.py,sha256=h5ZIzLc6BFVXnGyc9xPqZWUS7qGy7yFSDqXe68Sa8z4,42454
10+
cffi/cparser.py,sha256=rO_1pELRw1gI1DE1m4gi2ik5JMfpxouAACLXpRPlVEA,44231
11+
cffi/_cffi_errors.h,sha256=zQXt7uR_m8gUW-fI2hJg0KoSkJFwXv8RGUkEDZ177dQ,3908
12+
cffi/api.py,sha256=yxJalIePbr1mz_WxAHokSwyP5CVYde44m-nolHnbJNo,42064
13+
cffi/_embedding.h,sha256=9tnjF44QRobR8z0FGqAmAZY-wMSBOae1SUPqHccowqc,17680
14+
cffi/pkgconfig.py,sha256=LP1w7vmWvmKwyqLaU1Z243FOWGNQMrgMUZrvgFuOlco,4374
15+
cffi/commontypes.py,sha256=QS4uxCDI7JhtTyjh1hlnCA-gynmaszWxJaRRLGkJa1A,2689
16+
cffi/model.py,sha256=_GH_UF1Rn9vC4AvmgJm6qj7RUXXG3eqKPc8bPxxyBKE,21768
17+
cffi/_cffi_include.h,sha256=tKnA1rdSoPHp23FnDL1mDGwFo-Uj6fXfA6vA6kcoEUc,14800
18+
cffi/parse_c_type.h,sha256=OdwQfwM9ktq6vlCB43exFQmxDBtj2MBNdK8LYl15tjw,5976
19+
cffi/lock.py,sha256=l9TTdwMIMpi6jDkJGnQgE9cvTIR7CAntIJr8EGHt3pY,747
20+
cffi/recompiler.py,sha256=YgVYTh2CrXIobo-vMk7_K9mwAXdd_LqB4-IbYABQ488,64598
21+
cffi/vengine_cpy.py,sha256=YglN8YS-UaHEv2k2cxgotNWE87dHX20-68EyKoiKUYA,43320
22+
cffi/ffiplatform.py,sha256=HMXqR8ks2wtdsNxGaWpQ_PyqIvtiuos_vf1qKCy-cwg,4046
23+
cffi/setuptools_ext.py,sha256=RUR17N5f8gpiQBBlXL34P9FtOu1mhHIaAf3WJlg5S4I,8931
24+
cffi/cffi_opcode.py,sha256=v9RdD_ovA8rCtqsC95Ivki5V667rAOhGgs3fb2q9xpM,5724
25+
cffi/error.py,sha256=v6xTiS4U0kvDcy4h_BDRo5v39ZQuj-IMRYLv5ETddZs,877
26+
cffi/__init__.py,sha256=6xB_tafGvhhM5Xvj0Ova3oPC2SEhVlLTEObVLnazeiM,513
27+
cffi/verifier.py,sha256=ESwuXWXtXrKEagCKveLRDjFzLNCyaKdqAgAlKREcyhY,11253
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Wheel-Version: 1.0
2+
Generator: bdist_wheel (0.36.2)
3+
Root-Is-Purelib: false
4+
Tag: cp27-cp27mu-manylinux1_x86_64
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[distutils.setup_keywords]
2+
cffi_modules = cffi.setuptools_ext:cffi_modules
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pycparser

0 commit comments

Comments
 (0)