docker.rst 2.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
..  Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

..    http://www.apache.org/licenses/LICENSE-2.0

..  Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.

18 19 20 21
.. _docker-images:

Docker Images
=============
22
We provide several prebuilt docker images to quickly try out TVM.
23
These images are also helpful run through TVM demo and tutorials.
24 25 26 27
You can get the docker images via the following steps.
We need `docker <https://docs.docker.com/engine/installation/>`_ and
`nvidia-docker <https://github.com/NVIDIA/nvidia-docker/>`_ if we want to use cuda.

28
First, clone TVM repo to get the auxiliary scripts
29 30 31 32 33 34

.. code:: bash

    git clone --recursive https://github.com/dmlc/tvm


35
We can then use the following command to launch a `tvmai/demo-cpu` image.
36 37 38

.. code:: bash

39
    /path/to/tvm/docker/bash.sh tvmai/demo-cpu
40

41 42
You can also change `demo-cpu` to `demo-gpu` to get a CUDA enabled image.
You can find all the prebuilt images in `<https://hub.docker.com/r/tvmai/>`_
43 44 45 46 47 48


This auxiliary script does the following things:

- Mount current directory to /workspace
- Switch user to be the same user that calls the bash.sh (so you can read/write host system)
49 50
- Use the host-side network on Linux. Use the bridge network and expose port 8888 on macOS,
  because host networking driver isn't supported. (so you can use jupyter notebook)
51 52 53 54 55 56 57 58


Then you can start a jupyter notebook by typing

.. code:: bash

   jupyter notebook

59 60 61 62 63 64 65 66 67 68
You might see an error ``OSError: [Errno 99] Cannot assign requested address`` when starting
a jupyter notebook on macOS. You can change the binding IP address by

.. code:: bash

   jupyter notebook --ip=0.0.0.0

Note that on macOS, because we use bridge network, jupyter notebook will be reportedly running
at an URL like ``http://{container_hostname}:8888/?token=...``. You should replace the ``container_hostname``
with ``localhost`` when pasting it into browser.
69 70 71

Docker Source
-------------
72
Check out `<https://github.com/dmlc/tvm/tree/master/docker>`_ if you are interested in
73
building your own docker images.