Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[MXNET-951] Python dockerfiles built on pip binaries and build/releas…
Browse files Browse the repository at this point in the history
…e script (#12556)

* Initial Commit for docker automation python

* Fixes

* change dir for tests

* Fix more issues

* fix docker tag command

* cosmetic changes

* update README

* update test to fail on version mismatch

* remove debug mode

* Update README.md

* Update README.md

* update README

* Add Licenses

* Some review comments

* Add Cuda80 and cuda92 dockerfiles and build steps

* Add renamed and hence untracked files for cu90

* Update README

* More ways to login

* Update README with login options

* Update README with links to test. test_mxnet link will work only after merge
  • Loading branch information
mbaijal authored and sandeep-krishnamurthy committed Sep 29, 2018
1 parent 4da3001 commit 063139d
Show file tree
Hide file tree
Showing 11 changed files with 428 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for CPU

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.cpu.mkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet CPU with MKL

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-mkl
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.gpu.cu80
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for GPU

FROM nvidia/cuda:8.0-cudnn5-devel

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-cu80
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.gpu.cu80.mkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for GPU with MKL

FROM nvidia/cuda:8.0-cudnn5-devel

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-cu80mkl
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.gpu.cu90
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for GPU

FROM nvidia/cuda:9.0-cudnn7-devel

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-cu90
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.gpu.cu90.mkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for GPU with MKL

FROM nvidia/cuda:9.0-cudnn7-devel

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-cu90mkl
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.gpu.cu92
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for GPU

FROM nvidia/cuda:9.2-cudnn7-devel

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-cu92
28 changes: 28 additions & 0 deletions docker/docker-python/Dockerfile.mxnet.python.gpu.cu92.mkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- mode: dockerfile -*-
# 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.
#
# Dockerfile to build MXNet for GPU with MKL

FROM nvidia/cuda:9.2-cudnn7-devel

RUN apt-get update
RUN apt-get install -y wget python gcc
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py

RUN pip install mxnet-cu92mkl
41 changes: 41 additions & 0 deletions docker/docker-python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Release Python Docker Images for MXNet

The `docker-python` directory can be used to release mxnet python docker images to dockerhub after any mxnet release.
It uses the appropriate pip binaries to build different docker images as -
* cpu
* cpu_mkl
* latest (same as cpu)
* gpu_cu90
* gpu_cu90_mkl
* gpu (same as gpu_cu90)
* gpu_cu80
* gpu_cu80_mkl
* gpu_cu92
* gpu_cu92_mkl


** Note: If you want to use a different pip binary (specific mxnet or cuda version, etc), you can edit the last line of the cpu or gpu dockerfile as required.

Refer: https://pypi.org/project/mxnet/

### Usage
`./build_python_dockerfile.sh <mxnet_version> <path_to_cloned_mxnet_repo>`

For example:
`./build_python_dockerfile.sh 1.3.0 ~/build-docker/incubator-mxnet`

** Note: The build script picks up the latest pip binaries. This means it uses the latest released mxnet version. The version specified as a parameter to the script is only used to tag the built image correctly.

### Tests run
* [test_conv.py](https://github.com/apache/incubator-mxnet/blob/master/tests/python/train/test_conv.py)
* [train_mnist.py](https://github.com/apache/incubator-mxnet/blob/master/example/image-classification/train_mnist.py)
* [test_mxnet.py](https://github.com/apache/incubator-mxnet/blob/master/docker/docker-python/test_mxnet.py): This script is used to make sure that the docker image builds the expected mxnet version. That is, the version picked by pip is the same as as the version passed as a parameter.

### Dockerhub Credentials
Dockerhub credentials will be required to push images at the end of this script.
Credentials can be provided in the following ways:
* **Interactive Login:** Run the script as is and it will ask you for credentials interactively.
* **Be Already Logged in:** Login to the mxnet dockerhub account before you run the build script and the script will complete build, test and push.
* **Set Environment Variables:** Set the following environment variables which the script will pick up to login to dockerhub at runtime -
* $MXNET_DOCKERHUB_PASSWORD
* $MXNET_DOCKERHUB_USERNAME
Loading

0 comments on commit 063139d

Please sign in to comment.