Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dockerfiles for the conda package builds #3344

Merged
merged 19 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,19 @@ stage('Integration Test') {
}
}

stage('Build packages') {
parallel 'conda CPU': {
node('CPU') {
sh "${docker_run} tvmai/conda-cpu ./conda/build_cpu.sh
}
},
'conda cuda': {
node('CPU') {
sh "${docker_run} tvmai/conda-cuda90 ./conda/build_cuda.sh
}
}
}

stage('Deploy') {
node('doc') {
ws('workspace/tvm/deploy-docs') {
Expand Down
5 changes: 5 additions & 0 deletions conda/build_cpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
conda build tvm-libs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For robustness it is good practice to include at least:
set -e
set -u
at the top of every .sh script. This will ensure that if any command in the script fails, the error is propagated rather than elided away, it will also ensure that scripts using undefined variables fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll do that.

conda build tvm
conda build topi
conda build nnvm
1 change: 1 addition & 0 deletions conda/build_cuda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
conda build --output-folder /workspace/conda/pkg --variants "{cuda: True, cuda_version: $CUDA_VERSION}" /workspace/conda/tvm-libs
19 changes: 2 additions & 17 deletions conda/build_cuda.py → conda/render_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,15 @@ def render_dockerfile(version):
cudnn_short_version=CUDNN_VERSION,
cudnn_version=CUDNN_FULL_VERSION)
fname = os.path.join(condadir,
'Dockerfile.cuda' + version.replace('.', ''))
'Dockerfile.conda_cuda' + version.replace('.', ''))
with open(fname, 'w') as f:
f.write(txt)
return fname


def build_docker(version):
vv = version.replace('.', '')
fname = render_dockerfile(version)
tagname = f'tvm-cuda{ vv }-forge'
subprocess.run(['docker', 'build', '-t', tagname,
condadir, '-f', fname], check=True)
return tagname


def build_pkg(version):
tagname = build_docker(version)
subprocess.run(['docker', 'run', '--rm', '-v', f'{ srcdir }:/workspace',
tagname], check=True)


if __name__ == '__main__':
build_versions = CUDA_VERSIONS
if len(sys.argv) > 1:
build_versions = sys.argv[1:]
for version in build_versions:
build_pkg(version)
render_dockerfile(version)
39 changes: 39 additions & 0 deletions docker/Dockerfile.conda_cuda100
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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.

FROM nvidia/cuda:10.0-devel-centos6

RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.3.1/cudnn-10.0-linux-x64-v7.3.1.20.tgz -O && \
tar --no-same-owner -xzf cudnn-10.0-linux-x64-v7.3.1.20.tgz -C /usr/local && \
rm cudnn-10.0-linux-x64-v7.3.1.20.tgz && \
ldconfig


RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install conda-build conda-verify && \
/opt/conda/bin/conda clean -ya

ENV PATH /opt/conda/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64

WORKDIR /workspace
RUN chmod -R a+w /workspace

CMD conda build --output-folder /workspace/conda/pkg --variants '{cuda: True, cuda_version: 10.0}' /workspace/conda/tvm-libs
39 changes: 39 additions & 0 deletions docker/Dockerfile.conda_cuda90
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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.

FROM nvidia/cuda:9.0-devel-centos6

RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.3.1/cudnn-9.0-linux-x64-v7.3.1.20.tgz -O && \
tar --no-same-owner -xzf cudnn-9.0-linux-x64-v7.3.1.20.tgz -C /usr/local && \
rm cudnn-9.0-linux-x64-v7.3.1.20.tgz && \
ldconfig


RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install conda-build conda-verify && \
/opt/conda/bin/conda clean -ya

ENV PATH /opt/conda/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64

WORKDIR /workspace
RUN chmod -R a+w /workspace

CMD conda build --output-folder /workspace/conda/pkg --variants '{cuda: True, cuda_version: 9.0}' /workspace/conda/tvm-libs