From b78912263c0621ac817bd47a9b191be6796ac5f8 Mon Sep 17 00:00:00 2001 From: Tianqi Chen Date: Fri, 23 Oct 2020 20:41:10 -0400 Subject: [PATCH] [CONDA] Revamp conda recipe. (#6732) * [CONDA] Revamp conda recipe. - Combines two packages into a single recipe. - Enable windows build. - Better packaging hash tag (use git string). * Address comment --- .gitignore | 2 +- conda/Dockerfile.template | 22 +---- conda/build_cpu.sh | 4 +- conda/build_cuda.sh | 3 +- conda/build_win.bat | 18 ++++ conda/recipe/bld.bat | 38 ++++++++ conda/{tvm-libs => recipe}/build.sh | 44 ++++++---- conda/{ => recipe}/conda_build_config.yaml | 2 +- conda/{ => recipe}/cross-linux.cmake | 0 conda/recipe/install_libtvm.bat | 22 +++++ .../build.sh => recipe/install_libtvm.sh} | 5 +- conda/recipe/install_tvm_python.bat | 20 +++++ .../install_tvm_python.sh} | 49 ++--------- conda/recipe/meta.yaml | 88 +++++++++++++++++++ ...der_cuda.py => render_cuda_dockerfiles.py} | 2 +- conda/tvm-libs/meta.yaml | 48 ---------- docker/Dockerfile.conda_cpu | 23 ++--- docker/Dockerfile.conda_cuda100 | 22 +---- docker/Dockerfile.conda_cuda90 | 22 +---- docker/bash.sh | 2 +- docker/build.sh | 2 +- docker/install/ubuntu_install_conda.sh | 30 +++++++ include/tvm/parser/source_map.h | 2 +- tests/lint/add_asf_header.py | 20 +++++ tests/lint/check_file_type.py | 1 + version.py | 4 +- 26 files changed, 296 insertions(+), 199 deletions(-) create mode 100644 conda/build_win.bat create mode 100644 conda/recipe/bld.bat rename conda/{tvm-libs => recipe}/build.sh (63%) mode change 100644 => 100755 rename conda/{ => recipe}/conda_build_config.yaml (99%) rename conda/{ => recipe}/cross-linux.cmake (100%) create mode 100644 conda/recipe/install_libtvm.bat rename conda/{tvm/build.sh => recipe/install_libtvm.sh} (88%) mode change 100644 => 100755 create mode 100644 conda/recipe/install_tvm_python.bat rename conda/{tvm/meta.yaml => recipe/install_tvm_python.sh} (50%) mode change 100644 => 100755 create mode 100644 conda/recipe/meta.yaml rename conda/{render_cuda.py => render_cuda_dockerfiles.py} (98%) delete mode 100644 conda/tvm-libs/meta.yaml create mode 100755 docker/install/ubuntu_install_conda.sh diff --git a/.gitignore b/.gitignore index 77c593ca2ab8..cdcf6780a3f2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ var/ *.egg-info/ .installed.cfg *.egg - +.conda/ # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. diff --git a/conda/Dockerfile.template b/conda/Dockerfile.template index 1b5dc6fbef5e..342d532bbff5 100644 --- a/conda/Dockerfile.template +++ b/conda/Dockerfile.template @@ -17,30 +17,16 @@ FROM nvidia/cuda:{{ cuda_version }}-devel-ubuntu16.04 -RUN apt-get update && apt-get install -y --no-install-recommends \ - bzip2 curl sudo binutils && \ - rm -rf /var/lib/apt/lists/* +RUN apt-get update --fix-missing && apt-get install -y bzip2 wget sudo binutils git -RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v{{ cudnn_short_version }}/cudnn-{{ cuda_version }}-linux-x64-v{{ cudnn_version }}.tgz -O && \ +RUN wget -q http://developer.download.nvidia.com/compute/redist/cudnn/v{{ cudnn_short_version }}/cudnn-{{ cuda_version }}-linux-x64-v{{ cudnn_version }}.tgz && \ tar --no-same-owner -xzf cudnn-{{ cuda_version }}-linux-x64-v{{ cudnn_version }}.tgz -C /usr/local && \ rm cudnn-{{ cuda_version }}-linux-x64-v{{ cudnn_version }}.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 upgrade --all && \ - /opt/conda/bin/conda install conda-build conda-verify && \ - /opt/conda/bin/conda clean -ya - -RUN /opt/conda/bin/conda install --download-only cmake make zlib -RUN /opt/conda/bin/conda install --download-only -c numba llvmdev=8.0.0 +COPY install/ubuntu_install_conda.sh /install/ubuntu_install_conda.sh +RUN bash /install/ubuntu_install_conda.sh ENV PATH /opt/conda/bin:$PATH ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 ENV CONDA_BLD_PATH /tmp - -WORKDIR /workspace -RUN chmod -R a+w /workspace diff --git a/conda/build_cpu.sh b/conda/build_cpu.sh index 992b1a369b96..48b93b23dc0f 100755 --- a/conda/build_cpu.sh +++ b/conda/build_cpu.sh @@ -26,6 +26,4 @@ mkdir -p /tmp/.conda/pkgs touch /tmp/.conda/pkgs/urls.txt touch /tmp/.conda/environments.txt - -conda build --output-folder=conda/pkg -c numba conda/tvm-libs -conda build --output-folder=conda/pkg -m conda/conda_build_config.yaml conda/tvm +conda build --output-folder=conda/pkg conda/recipe diff --git a/conda/build_cuda.sh b/conda/build_cuda.sh index 2c9a20ae66ae..ec4a144852b7 100755 --- a/conda/build_cuda.sh +++ b/conda/build_cuda.sh @@ -26,5 +26,4 @@ mkdir -p /tmp/.conda/pkgs touch /tmp/.conda/pkgs/urls.txt touch /tmp/.conda/environments.txt - -conda build --output-folder=conda/pkg --variants "{cuda: True, cuda_version: ${CUDA_VERSION%.*}}" -c numba conda/tvm-libs +conda build --output-folder=conda/pkg --variants "{cuda: True, cuda_version: ${CUDA_VERSION%.*}}" conda/recipe diff --git a/conda/build_win.bat b/conda/build_win.bat new file mode 100644 index 000000000000..59d0d07340c7 --- /dev/null +++ b/conda/build_win.bat @@ -0,0 +1,18 @@ +:: 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. + +conda build --output-folder=conda/pkg conda/recipe diff --git a/conda/recipe/bld.bat b/conda/recipe/bld.bat new file mode 100644 index 000000000000..9fc0469febc6 --- /dev/null +++ b/conda/recipe/bld.bat @@ -0,0 +1,38 @@ +:: 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. +echo on + +rd /s /q build +mkdir build +cd build + +cmake ^ + -DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^ + -DCMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^ + -DUSE_LLVM=ON ^ + -DUSE_RPC=ON ^ + -DUSE_CPP_RPC=ON ^ + -DUSE_SORT=ON ^ + -DUSE_RANDOM=ON ^ + -DUSE_GRAPH_RUNTIME_DEBUG=ON ^ + -DINSTALL_DEV=ON ^ + %SRC_DIR% + +cd .. +:: defer build to install stage to avoid rebuild. +:: sometimes windows msbuild is not very good at file +:: caching and install will results in a rebuild diff --git a/conda/tvm-libs/build.sh b/conda/recipe/build.sh old mode 100644 new mode 100755 similarity index 63% rename from conda/tvm-libs/build.sh rename to conda/recipe/build.sh index 94919c60e779..c9e76314da31 --- a/conda/tvm-libs/build.sh +++ b/conda/recipe/build.sh @@ -6,9 +6,9 @@ # 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 @@ -19,35 +19,41 @@ set -e set -u +GPU_OPT="" +TOOLCHAIN_OPT="" + if [ "$target_platform" == "osx-64" ]; then # macOS 64 bits - METAL_OPT="-DUSE_METAL=ON" - TOOLCHAIN_OPT="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.11" -else - METAL_OPT="" - if [ "$target_platform" == "linux-64" ]; then - # Linux 64 bits - TOOLCHAIN_OPT="-DCMAKE_TOOLCHAIN_FILE=${RECIPE_DIR}/../cross-linux.cmake" - else - # Windows (or 32 bits, which we don't support) - TOOLCHAIN_OPT="" - fi + GPU_OPT="-DUSE_METAL=ON" +elif [ "$target_platform" == "linux-64" ]; then + TOOLCHAIN_OPT="-DCMAKE_TOOLCHAIN_FILE=${RECIPE_DIR}/cross-linux.cmake" fi # When cuda is not set, we default to False cuda=${cuda:-False} if [ "$cuda" == "True" ]; then - CUDA_OPT="-DUSE_CUDA=ON -DUSE_CUBLAS=ON -DUSE_CUDNN=ON" + GPU_OPT="-DUSE_CUDA=ON -DUSE_CUBLAS=ON -DUSE_CUDNN=ON" TOOLCHAIN_OPT="" -else - CUDA_OPT="" fi +# remove touched cmake config +rm -f config.cmake rm -rf build || true mkdir -p build cd build -cmake $METAL_OPT $CUDA_OPT -DUSE_LLVM=$PREFIX/bin/llvm-config -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" $TOOLCHAIN_OPT .. -make -j${CPU_COUNT} VERBOSE=1 -make install + +cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_RPC=ON \ + -DUSE_CPP_RPC=OFF \ + -DUSE_SORT=ON \ + -DUSE_RANDOM=ON \ + -DUSE_GRAPH_RUNTIME_DEBUG=ON \ + -DUSE_LLVM=ON \ + -DINSTALL_DEV=ON \ + ${GPU_OPT} ${TOOLCHAIN_OPT} \ + ${SRC_DIR} + +make -j${CPU_COUNT} cd .. diff --git a/conda/conda_build_config.yaml b/conda/recipe/conda_build_config.yaml similarity index 99% rename from conda/conda_build_config.yaml rename to conda/recipe/conda_build_config.yaml index 79d6bfe3c175..938d294da556 100644 --- a/conda/conda_build_config.yaml +++ b/conda/recipe/conda_build_config.yaml @@ -16,9 +16,9 @@ # under the License. python: - - 3.5 - 3.6 - 3.7 + - 3.8 cuda: - False diff --git a/conda/cross-linux.cmake b/conda/recipe/cross-linux.cmake similarity index 100% rename from conda/cross-linux.cmake rename to conda/recipe/cross-linux.cmake diff --git a/conda/recipe/install_libtvm.bat b/conda/recipe/install_libtvm.bat new file mode 100644 index 000000000000..f423c521f84e --- /dev/null +++ b/conda/recipe/install_libtvm.bat @@ -0,0 +1,22 @@ +:: 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. + +cmake --build build --config Release --target install + +:: Copy files into library bin so that they can be found +cp %LIBRARY_LIB%\tvm.dll %LIBRARY_BIN%\tvm.dll +cp %LIBRARY_LIB%\tvm_runtime.dll %LIBRARY_BIN%\tvm_runtime.dll diff --git a/conda/tvm/build.sh b/conda/recipe/install_libtvm.sh old mode 100644 new mode 100755 similarity index 88% rename from conda/tvm/build.sh rename to conda/recipe/install_libtvm.sh index 9bdbe0a6f509..b236c7dc2720 --- a/conda/tvm/build.sh +++ b/conda/recipe/install_libtvm.sh @@ -19,6 +19,5 @@ set -e set -u -cd python -$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt -cd .. +cd build +make install diff --git a/conda/recipe/install_tvm_python.bat b/conda/recipe/install_tvm_python.bat new file mode 100644 index 000000000000..96187468c2b2 --- /dev/null +++ b/conda/recipe/install_tvm_python.bat @@ -0,0 +1,20 @@ +:: 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. +echo on + +cd %SRC_DIR%\python +%PYTHON% setup.py install --single-version-externally-managed --record=%SRC_DIR%\record.txt diff --git a/conda/tvm/meta.yaml b/conda/recipe/install_tvm_python.sh old mode 100644 new mode 100755 similarity index 50% rename from conda/tvm/meta.yaml rename to conda/recipe/install_tvm_python.sh index 9e8f94789394..2c721c64a156 --- a/conda/tvm/meta.yaml +++ b/conda/recipe/install_tvm_python.sh @@ -1,3 +1,4 @@ +#!/bin/bash # 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 @@ -15,48 +16,8 @@ # specific language governing permissions and limitations # under the License. -{% set version = "0.8.dev0" %} +set -e +set -u -package: - name: tvm - version: {{ version }} - -source: - path: ../.. - -build: - number: 0 - -requirements: - build: - - {{ compiler('cxx') }} - host: - - python {{ python }} - - cython - - numpy - - setuptools - - decorator - - tvm-libs {{ version }} - run: - - python {{ python }} - - {{ pin_compatible('numpy') }} - - decorator - - tvm-libs {{ version }} - - psutil - -test: - imports: - - tvm - requires: - - pytest - - scipy - source_files: - - tests/python - commands: - - python -m pytest -v tests/python/integration - -about: - home: https://github.com/apache/incubator-tvm - license: Apache-2.0 - license_family: Apache - summary: a low level domain specific language for compiling tensor computation pipelines +cd ${SRC_DIR}/python +${PYTHON} setup.py install --single-version-externally-managed --record=/tmp/record.txt diff --git a/conda/recipe/meta.yaml b/conda/recipe/meta.yaml new file mode 100644 index 000000000000..67ba7fec1869 --- /dev/null +++ b/conda/recipe/meta.yaml @@ -0,0 +1,88 @@ +# 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. + +{% set version = '0.8.dev0' %} +{% set pkg_name = 'tvm' %} +{% set cuda_tag = cuda_version | replace('.', '') %} # [cuda] +{% set pkg_name = pkg_name + '-cu' + cuda_tag %} # [cuda] +{% set build_tag = environ.get('GIT_BUILD_STR', 'unknown') %} +{% set build_tag = build_tag + '_h' + PKG_HASH + '_' + PKG_BUILDNUM %} + +package: + name: {{ pkg_name }}-package + version: {{ version }} + +source: + path: '../..' + +build: + number: 0 + include_recipe: False + missing_dso_whitelist: + - "*libcuda.*" # [linux] + +requirements: + build: + # The anaconda compilers for OS X are old an annoying + # so we rely on the platform ones for now + - {{ compiler('cxx') }} # [not osx] + - cmake + - make # [not win] + host: + - zlib + - llvmdev ==10.0.0 + +outputs: + - name: {{ pkg_name }}-libs + script: install_libtvm.bat # [win] + script: install_libtvm.sh # [not win] + string: {{ build_tag }} + requirements: + build: + - {{ compiler('cxx') }} + - cmake + - git + - make # [not win] + host: + - zlib + - llvmdev ==10.0.0 + - {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda] + - {{ pin_compatible('cudnn', lower_bound='7.6.0', max_pin='x') }} # [cuda] + run: + - llvmdev ==10.0.0 + - {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda] + - {{ pin_compatible('cudnn', lower_bound='7.6.0', max_pin='x') }} # [cuda] + + - name: {{ pkg_name }} + script: install_tvm_python.sh # [not win] + script: install_tvm_python.bat # [win] + string: {{ build_tag }}_py{{ PY_VER | replace('.', '')}} + requirements: + host: + - python + - setuptools + run: + - python + - decorator + - psutil + - {{ pin_compatible('numpy') }} + - {{ pin_subpackage(pkg_name + '-libs', exact=True) }} + +about: + home: https://tvm.apache.org + license: Apache2 + summary: An End to End Deep Learning Compiler Stack for CPUs, GPUs and accelerators. diff --git a/conda/render_cuda.py b/conda/render_cuda_dockerfiles.py similarity index 98% rename from conda/render_cuda.py rename to conda/render_cuda_dockerfiles.py index efd616946314..d9d32f05fb5e 100644 --- a/conda/render_cuda.py +++ b/conda/render_cuda_dockerfiles.py @@ -48,7 +48,7 @@ def render_dockerfile(version): ) fname = os.path.join(condadir, "../docker/Dockerfile.conda_cuda" + version.replace(".", "")) with open(fname, "w") as f: - f.write(txt) + f.write(txt + "\n") return fname diff --git a/conda/tvm-libs/meta.yaml b/conda/tvm-libs/meta.yaml deleted file mode 100644 index f151048e445b..000000000000 --- a/conda/tvm-libs/meta.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# 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. - -{% set version = "0.8.dev0" %} - -package: - name: tvm-libs - version: {{ version }} - -source: - path: ../.. - -build: - number: 0 - string: cuda{{ cuda_version | replace('.', '') }}h{{ PKG_HASH }}_{{ PKG_BUILDNUM }} # [cuda] - -requirements: - build: - # The anaconda compilers for OS X are old an annoying - # so we rely on the platform ones for now - - {{ compiler('cxx') }} # [linux] - - cmake - - make - host: - - llvmdev ==8.0.0 - - zlib # [linux] - run: - - {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda] - - {{ pin_compatible('cudnn', lower_bound='7.6.0', max_pin='x') }} # [cuda] - -about: - home: https://github.com/apache/incubator-tvm - license: Apache2 - summary: a low level domain specific language for compiling tensor computation pipelines \ No newline at end of file diff --git a/docker/Dockerfile.conda_cpu b/docker/Dockerfile.conda_cpu index 4e0c35a26e55..d2779afbdaf3 100644 --- a/docker/Dockerfile.conda_cpu +++ b/docker/Dockerfile.conda_cpu @@ -17,25 +17,12 @@ FROM ubuntu:16.04 -RUN apt-get update && apt-get install -y bzip2 curl sudo binutils && rm -rf /var/lib/apt/lists/* +RUN apt-get update --fix-missing && apt-get install -y bzip2 wget sudo binutils git -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 upgrade --all && \ - /opt/conda/bin/conda install conda-build conda-verify && \ - /opt/conda/bin/conda clean -ya - -# Cache some of the packages for the builds -RUN /opt/conda/bin/conda install --download-only cmake make zlib && \ - /opt/conda/bin/conda install --download-only -c numba llvmdev=8.0.0 && \ - /opt/conda/bin/conda create -n py35 --download-only pytest scipy numpy=1.11 cython decorator python=3.5 && \ - /opt/conda/bin/conda create -n py36 --download-only pytest scipy numpy=1.11 cython decorator python=3.6 && \ - /opt/conda/bin/conda create -n py37 --download-only pytest scipy numpy=1.11 cython decorator python=3.7 +COPY install/ubuntu_install_conda.sh /install/ubuntu_install_conda.sh +RUN bash /install/ubuntu_install_conda.sh ENV PATH /opt/conda/bin:$PATH ENV CONDA_BLD_PATH /tmp - -WORKDIR /workspace -RUN chmod -R a+w /workspace +ENV CONDA_PKGS_DIRS /workspace/.conda/pkgs +ENV CONDA_ENVS_DIRS /workspace/.conda/env diff --git a/docker/Dockerfile.conda_cuda100 b/docker/Dockerfile.conda_cuda100 index d6e1cddbfd37..7705c8548b52 100644 --- a/docker/Dockerfile.conda_cuda100 +++ b/docker/Dockerfile.conda_cuda100 @@ -17,30 +17,16 @@ FROM nvidia/cuda:10.0-devel-ubuntu16.04 -RUN apt-get update && apt-get install -y --no-install-recommends \ - bzip2 curl sudo binutils && \ - rm -rf /var/lib/apt/lists/* +RUN apt-get update --fix-missing && apt-get install -y bzip2 wget sudo binutils git -RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.0/cudnn-10.0-linux-x64-v7.6.0.64.tgz -O && \ +RUN wget -q http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.0/cudnn-10.0-linux-x64-v7.6.0.64.tgz && \ tar --no-same-owner -xzf cudnn-10.0-linux-x64-v7.6.0.64.tgz -C /usr/local && \ rm cudnn-10.0-linux-x64-v7.6.0.64.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 upgrade --all && \ - /opt/conda/bin/conda install conda-build conda-verify && \ - /opt/conda/bin/conda clean -ya - -RUN /opt/conda/bin/conda install --download-only cmake make zlib -RUN /opt/conda/bin/conda install --download-only -c numba llvmdev=8.0.0 +COPY install/ubuntu_install_conda.sh /install/ubuntu_install_conda.sh +RUN bash /install/ubuntu_install_conda.sh ENV PATH /opt/conda/bin:$PATH ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 ENV CONDA_BLD_PATH /tmp - -WORKDIR /workspace -RUN chmod -R a+w /workspace \ No newline at end of file diff --git a/docker/Dockerfile.conda_cuda90 b/docker/Dockerfile.conda_cuda90 index f55aa1bf2e12..372167438141 100644 --- a/docker/Dockerfile.conda_cuda90 +++ b/docker/Dockerfile.conda_cuda90 @@ -17,30 +17,16 @@ FROM nvidia/cuda:9.0-devel-ubuntu16.04 -RUN apt-get update && apt-get install -y --no-install-recommends \ - bzip2 curl sudo binutils && \ - rm -rf /var/lib/apt/lists/* +RUN apt-get update --fix-missing && apt-get install -y bzip2 wget sudo binutils git -RUN curl -fsSL http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.0/cudnn-9.0-linux-x64-v7.6.0.64.tgz -O && \ +RUN wget -q http://developer.download.nvidia.com/compute/redist/cudnn/v7.6.0/cudnn-9.0-linux-x64-v7.6.0.64.tgz && \ tar --no-same-owner -xzf cudnn-9.0-linux-x64-v7.6.0.64.tgz -C /usr/local && \ rm cudnn-9.0-linux-x64-v7.6.0.64.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 upgrade --all && \ - /opt/conda/bin/conda install conda-build conda-verify && \ - /opt/conda/bin/conda clean -ya - -RUN /opt/conda/bin/conda install --download-only cmake make zlib -RUN /opt/conda/bin/conda install --download-only -c numba llvmdev=8.0.0 +COPY install/ubuntu_install_conda.sh /install/ubuntu_install_conda.sh +RUN bash /install/ubuntu_install_conda.sh ENV PATH /opt/conda/bin:$PATH ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 ENV CONDA_BLD_PATH /tmp - -WORKDIR /workspace -RUN chmod -R a+w /workspace \ No newline at end of file diff --git a/docker/bash.sh b/docker/bash.sh index d2424f170219..a87701afb918 100755 --- a/docker/bash.sh +++ b/docker/bash.sh @@ -70,7 +70,7 @@ else CUDA_ENV="" fi -if [[ "${DOCKER_IMAGE_NAME}" == *"gpu"* ]]; then +if [[ "${DOCKER_IMAGE_NAME}" == *"gpu"* || "${DOCKER_IMAGE_NAME}" == *"cuda"* ]]; then if ! type "nvidia-docker" 1> /dev/null 2> /dev/null then DOCKER_BINARY="docker" diff --git a/docker/build.sh b/docker/build.sh index 43f0a08700a4..7d9145832000 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -91,7 +91,7 @@ if [ "$#" -lt 1 ] || [ ! -e "${SCRIPT_DIR}/Dockerfile.${CONTAINER_TYPE}" ]; then fi # Use nvidia-docker if the container is GPU. -if [[ "${CONTAINER_TYPE}" == *"gpu"* ]]; then +if [[ "${CONTAINER_TYPE}" == *"gpu"* || "${CONTAINER_TYPE}" == *"cuda"* ]]; then if ! type "nvidia-docker" 1> /dev/null 2> /dev/null then DOCKER_BINARY="docker" diff --git a/docker/install/ubuntu_install_conda.sh b/docker/install/ubuntu_install_conda.sh new file mode 100755 index 000000000000..ef059ce42aa0 --- /dev/null +++ b/docker/install/ubuntu_install_conda.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# 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. + +set -e +set -u +set -o pipefail + +cd /tmp && wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh +chmod +x Miniconda3-latest-Linux-x86_64.sh +/tmp/Miniconda3-latest-Linux-x86_64.sh -b -p /opt/conda +rm /tmp/Miniconda3-latest-Linux-x86_64.sh +/opt/conda/bin/conda upgrade --all +/opt/conda/bin/conda clean -ya +/opt/conda/bin/conda install conda-build conda-verify +chmod -R a+w /opt/conda/ diff --git a/include/tvm/parser/source_map.h b/include/tvm/parser/source_map.h index 5595574265c6..1153deb95dc3 100644 --- a/include/tvm/parser/source_map.h +++ b/include/tvm/parser/source_map.h @@ -101,7 +101,7 @@ class SourceMap : public ObjectRef { TVM_DLL SourceMap(std::initializer_list> source_map) : SourceMap(Map(source_map)) {} - TVM_DLL SourceMap() : SourceMap({}) {} + TVM_DLL SourceMap() : SourceMap(Map()) {} TVM_DLL static SourceMap Global(); diff --git a/tests/lint/add_asf_header.py b/tests/lint/add_asf_header.py index a83373cea078..477ef2db4390 100644 --- a/tests/lint/add_asf_header.py +++ b/tests/lint/add_asf_header.py @@ -115,6 +115,25 @@ // under the License. """.strip() +header_cmdstyle = """ +:: 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. +""".strip() + FMT_MAP = { "sh": header_pystyle, "cc": header_cstyle, @@ -141,6 +160,7 @@ "plist": header_mdstyle, "xcworkspacedata": header_mdstyle, "html": header_mdstyle, + "bat": header_cmdstyle, } diff --git a/tests/lint/check_file_type.py b/tests/lint/check_file_type.py index 8a90bb3745ca..7d3e95d5af13 100644 --- a/tests/lint/check_file_type.py +++ b/tests/lint/check_file_type.py @@ -44,6 +44,7 @@ "pyd", "pyx", "cu", + "bat", # relay text format "rly", # configurations diff --git a/version.py b/version.py index 6554343ac7c6..0338d13661e0 100644 --- a/version.py +++ b/version.py @@ -75,10 +75,10 @@ def main(): __version__, ) # conda - for path in ["tvm", "tvm-libs"]: + for path in ["recipe"]: update( os.path.join(proj_root, "conda", path, "meta.yaml"), - '(?<=version = ")[.0-9a-z]+', + "(?<=version = ')[.0-9a-z]+", __version__, )