dockerhub.rst 4.47 KB
Newer Older
randyh62's avatar
randyh62 committed
1
2
3
4
5
6
7
.. meta::
  :description: Composable Kernel documentation and API reference library
  :keywords: composable kernel, CK, ROCm, API, documentation

.. _docker-hub:

********************************************************************
8
CK Docker Hub
randyh62's avatar
randyh62 committed
9
********************************************************************
pmaybank's avatar
pmaybank committed
10
11

Why do I need this?
randyh62's avatar
randyh62 committed
12
13
14
15
16
17
===================

To make things simpler, and bring Composable Kernel and its dependencies together, 
docker images can be found on `Docker Hub <https://hub.docker.com/r/rocm/composable_kernel/tags>`_. Docker images provide a complete image of the OS, the Composable Kernel library, and its dependencies in a single downloadable file. 

Refer to `Docker Overview <https://docs.docker.com/get-started/overview/>`_ for more information on Docker images and containers.
pmaybank's avatar
pmaybank committed
18

randyh62's avatar
randyh62 committed
19
20
Which image is right for me?
============================
pmaybank's avatar
pmaybank committed
21

randyh62's avatar
randyh62 committed
22
23
The image naming includes information related to the docker image. 
For example ``ck_ub20.04_rocm6.0`` indicates the following:
pmaybank's avatar
pmaybank committed
24

randyh62's avatar
randyh62 committed
25
26
27
* ``ck`` - made for running Composable Kernel;
* ``ub20.04`` - based on Ubuntu 20.04;
* ``rocm6.0`` - ROCm platform version 6.0.
pmaybank's avatar
pmaybank committed
28

randyh62's avatar
randyh62 committed
29
Download a docker image suitable for your OS and ROCm release, run or start the docker container, and then resume the tutorial from this point. Use the ``docker pull`` command to download the file::
pmaybank's avatar
pmaybank committed
30

randyh62's avatar
randyh62 committed
31
    docker pull rocm/composable_kernel:ck_ub20.04_rocm6.0
pmaybank's avatar
pmaybank committed
32
33


randyh62's avatar
randyh62 committed
34
35
36
37
38
What is inside the image?
-------------------------

The docker images have everything you need for running CK including:

Lisa's avatar
Lisa committed
39
* `ROCm <https://rocm.docs.amd.com/en/latest/index.html>`_
randyh62's avatar
randyh62 committed
40
* `CMake <https://cmake.org/getting-started/>`_
41
* `Compiler <https://github.com/ROCm/llvm-project>`_
randyh62's avatar
randyh62 committed
42
43
44
45
46
47
* `Composable Kernel library <https://github.com/ROCm/composable_kernel>`_

Running the docker container
============================

After downloading the docker image, you can start the container using one of a number of commands. Start with the ``docker run`` command as shown below::
pmaybank's avatar
pmaybank committed
48
49
50
51
52
53
54

    docker run                                                            \
    -it                                                                   \
    --privileged                                                          \
    --group-add sudo                                                      \
    -w /root/workspace                                                    \
    -v ${PATH_TO_LOCAL_WORKSPACE}:/root/workspace                         \
55
    rocm/composable_kernel:ck_ub20.04_rocm6.0                             \
pmaybank's avatar
pmaybank committed
56
57
    /bin/bash

randyh62's avatar
randyh62 committed
58
After starting the bash shell, the docker container current folder is `~/workspace`. The library path is ``~/workspace/composable_kernel``. Navigate to the library to begin the tutorial as explained in :ref:`hello-world`:
pmaybank's avatar
pmaybank committed
59

randyh62's avatar
randyh62 committed
60
.. note::
pmaybank's avatar
pmaybank committed
61

randyh62's avatar
randyh62 committed
62
    If your current folder is different from `${HOME}`, adjust the line ``-v ${HOME}:/root/workspace`` in the ``docker run`` command to fit your folder structure.
pmaybank's avatar
pmaybank committed
63

randyh62's avatar
randyh62 committed
64
65
Stop and restart the docker image
=================================
pmaybank's avatar
pmaybank committed
66

randyh62's avatar
randyh62 committed
67
After finishing the tutorial, or just when you have completed your work session, you can close the docker container, or stop the docker container to restart it at another time. Closing the docker container means that it is still in the active state, and can be resumed from where you left it. Stopping the container closes it, and returns the image to its initial state. 
pmaybank's avatar
pmaybank committed
68

randyh62's avatar
randyh62 committed
69
Use the ``Ctrl-D`` option to exit the container, while leaving it active, so you can return to the container in its current state to resume the tutorial, or pickup your project where you left off. 
pmaybank's avatar
pmaybank committed
70

randyh62's avatar
randyh62 committed
71
To restart the active container use the ``docker exec`` command to specify the container name and options as follows::
pmaybank's avatar
pmaybank committed
72

randyh62's avatar
randyh62 committed
73
    docker exec -it <container_name> bash
pmaybank's avatar
pmaybank committed
74

randyh62's avatar
randyh62 committed
75
Where: 
pmaybank's avatar
pmaybank committed
76

randyh62's avatar
randyh62 committed
77
78
79
80
* `exec` is the docker command
* `-it` is the interactive option for `exec`
* `<container_name>` specifies an active container on the system
* `bash` specifies the command to run in the interactive shell
pmaybank's avatar
pmaybank committed
81

randyh62's avatar
randyh62 committed
82
.. note::
pmaybank's avatar
pmaybank committed
83

randyh62's avatar
randyh62 committed
84
    You can use the ``docker container ls`` command to list the active containers on the system.
pmaybank's avatar
pmaybank committed
85

randyh62's avatar
randyh62 committed
86
To start a container from the image, use the ``docker start`` command::
pmaybank's avatar
pmaybank committed
87

randyh62's avatar
randyh62 committed
88
    docker start <container_name>
pmaybank's avatar
pmaybank committed
89

randyh62's avatar
randyh62 committed
90
Then use the docker exec command as shown above to start the bash shell. 
pmaybank's avatar
pmaybank committed
91

randyh62's avatar
randyh62 committed
92
Use the ``docker stop`` command to stop the container and restore the image to its initial state::
pmaybank's avatar
pmaybank committed
93

randyh62's avatar
randyh62 committed
94
95
96
97
    docker stop <container_name>
    
Editing the docker image
=======================
pmaybank's avatar
pmaybank committed
98

randyh62's avatar
randyh62 committed
99
If you want to customize the docker image, edit the
100
`Dockerfile <https://github.com/ROCm/composable_kernel/blob/develop/Dockerfile>`_
randyh62's avatar
randyh62 committed
101
from the GitHub repository to suit your needs.