Commit 1f62d956 by abergeron Committed by Tianqi Chen

More fixes and tweaks to the cuda conda packages (#3281)

parent d8132c55
...@@ -220,3 +220,7 @@ patched.txt ...@@ -220,3 +220,7 @@ patched.txt
# pipenv file # pipenv file
Pipfile Pipfile
Pipfile.lock Pipfile.lock
# conda package artifacts
conda/Dockerfile.cuda*
conda/pkg
...@@ -15,7 +15,13 @@ ...@@ -15,7 +15,13 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
FROM nvidia/cuda:10.0-devel-centos6 FROM nvidia/cuda:{{ cuda_version }}-devel-centos6
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 && \
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 && \ RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \ chmod +x ~/miniconda.sh && \
...@@ -30,4 +36,4 @@ ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 ...@@ -30,4 +36,4 @@ ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64
WORKDIR /workspace WORKDIR /workspace
RUN chmod -R a+w /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 CMD conda build --output-folder /workspace/conda/pkg --variants '{cuda: True, cuda_version: {{ cuda_version }}}' /workspace/conda/tvm-libs
...@@ -15,19 +15,8 @@ ...@@ -15,19 +15,8 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
FROM nvidia/cuda:9.2-devel-centos6 packages:
conda build tvm-libs
RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ conda build tvm
chmod +x ~/miniconda.sh && \ conda build topi
~/miniconda.sh -b -p /opt/conda && \ conda built nnvm
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.2}' /workspace/conda/tvm-libs
# 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.
import os
import sys
import subprocess
from jinja2 import Template
CUDA_VERSIONS = ['10.0', '9.0']
# Make sure that the cudnn version you set here is available
# for all the cuda versions that you want both from nvidia
# and from conda.
# These two must be in sync
CUDNN_FULL_VERSION = '7.3.1.20'
CUDNN_VERSION = '7.3.1'
condadir = os.path.dirname(sys.argv[0])
condadir = os.path.abspath(condadir)
srcdir = os.path.dirname(condadir)
with open(os.path.join(condadir, 'Dockerfile.template')) as f:
docker_template = Template(f.read())
def render_dockerfile(version):
txt = docker_template.render(cuda_version=version,
cudnn_short_version=CUDNN_VERSION,
cudnn_version=CUDNN_FULL_VERSION)
fname = os.path.join(condadir,
'Dockerfile.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)
# 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.
#/bin/sh
condadir=`dirname $0`
condadir=`readlink -f $condadir`
srcdir=`dirname $condadir`
docker build -t tvm-cuda100-forge $condadir -f $condadir/Dockerfile.cuda100
docker run --rm -v $srcdir:/workspace tvm-cuda100-forge
docker build -t tvm-cuda92-forge $condadir -f $condadir/Dockerfile.cuda92
docker run --rm -v $srcdir:/workspace tvm-cuda92-forge
sudo chown -R `whoami` $condadir/pkg
# 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.
# this one is important
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_PLATFORM Linux)
#this one not so much
set(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
set(CMAKE_C_COMPILER $ENV{CC})
# where is the target environment
set(CMAKE_FIND_ROOT_PATH $ENV{PREFIX} $ENV{BUILD_PREFIX}/$ENV{HOST}/sysroot)
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# god-awful hack because it seems to not run correct tests to determine this:
set(__CHAR_UNSIGNED___EXITCODE 1)
...@@ -25,7 +25,7 @@ source: ...@@ -25,7 +25,7 @@ source:
path: ../.. path: ../..
build: build:
number: 0 number: 1
skip: True # [win] skip: True # [win]
requirements: requirements:
......
...@@ -25,7 +25,7 @@ source: ...@@ -25,7 +25,7 @@ source:
path: ../.. path: ../..
build: build:
number: 0 number: 1
requirements: requirements:
host: host:
......
...@@ -16,42 +16,25 @@ ...@@ -16,42 +16,25 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
# Fix for OSX build to hide the clang LLVM
rm -f ${BUILD_PREFIX}/bin/llvm-config
rm -rf ${BUILD_PREFIX}/lib/cmake
set -e set -e
if [ -z "$PREFIX" ]; then if [ "$cuda" == "True" ]; then
PREFIX="$CONDA_PREFIX" CUDA_OPT="-DUSE_CUDA=ON -DUSE_CUBLAS=ON -DUSE_CUDNN=ON"
fi
if [ -z "$cuda" ] || [ "$cuda" == "False" ]; then
CUDA_OPT=""
else else
CUDA_OPT="-DUSE_CUDA=ON -DUSE_CUBLAS=ON" CUDA_OPT=""
fi fi
if [ "$target_platform" == "osx-64" ]; then if [ "$target_platform" == "osx-64" ]; then
# macOS 64 bits # macOS 64 bits
METAL_OPT="" # Conda can only target 10.9 for now METAL_OPT="" # Conda can only target 10.9 for now
TOOLCHAIN_OPT=""
else else
METAL_OPT="" 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)
METAL_OPT=""
TOOLCHAIN_OPT=""
fi
fi fi
rm -rf build || true rm -rf build || true
mkdir -p build mkdir -p build
cd build cd build
cmake $METAL_OPT $CUDA_OPT -DUSE_LLVM=ON -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" $TOOLCHAIN_OPT .. cmake $METAL_OPT $CUDA_OPT -DUSE_LLVM=$PREFIX/bin/llvm-config -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
make -j${CPU_COUNT} VERBOSE=1 make -j${CPU_COUNT} VERBOSE=1
make install make install
cd .. cd ..
...@@ -25,7 +25,7 @@ source: ...@@ -25,7 +25,7 @@ source:
path: ../.. path: ../..
build: build:
number: 0 number: 1
string: cuda{{ cuda_version }}_{{ PKG_BUILDNUM }} # [cuda] string: cuda{{ cuda_version }}_{{ PKG_BUILDNUM }} # [cuda]
requirements: requirements:
...@@ -39,6 +39,7 @@ requirements: ...@@ -39,6 +39,7 @@ requirements:
- zlib # [linux] - zlib # [linux]
run: run:
- {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda] - {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda]
- {{ pin_compatible('cudnn', lower_bound='7.3.1', max_pin='x') }} # [cuda]
about: about:
home: https://github.com/dmlc/tvm home: https://github.com/dmlc/tvm
......
...@@ -25,7 +25,7 @@ source: ...@@ -25,7 +25,7 @@ source:
path: ../.. path: ../..
build: build:
number: 0 number: 1
requirements: requirements:
build: build:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment