Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
anijain2305 committed Jul 8, 2019
2 parents 0b00e96 + 2a7aebe commit 9596535
Show file tree
Hide file tree
Showing 238 changed files with 3,997 additions and 3,132 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ file(GLOB_RECURSE NNVM_COMPILER_SRCS
file(GLOB TOPI_SRCS
topi/src/*.cc
)
file(GLOB_RECURSE HALIDEIR_SRCS 3rdparty/HalideIR/src/*.cpp)
file(GLOB_RECURSE HALIDEIR_SRCS
3rdparty/HalideIR/src/base/*.cpp
3rdparty/HalideIR/src/ir/*.cpp
3rdparty/HalideIR/src/tvm/*.cpp
)
list(APPEND COMPILER_SRCS ${HALIDEIR_SRCS})
file(GLOB RUNTIME_SRCS
src/runtime/*.cc
Expand Down
18 changes: 18 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,24 @@ 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
sh "${docker_run} tvmai/conda-cuda100 ./conda/build_cuda.sh
}
}
// Here we could upload the packages to anaconda for releases
// and/or the master branch
}
*/

stage('Deploy') {
node('doc') {
ws('workspace/tvm/deploy-docs') {
Expand Down
20 changes: 18 additions & 2 deletions apps/android_rpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,25 @@ cd apps/android_rpc
gradle clean build
```

In `app/build/outputs/apk` you'll find `app-release-unsigned.apk`, use `dev_tools/gen_keystore.sh` to generate a signature and use `dev_tools/sign_apk.sh` to get the signed apk file `app/build/outputs/apk/tvmrpc-release.apk`.
In `app/build/outputs/apk` you'll find `app-release-unsigned.apk`, use `dev_tools/gen_keystore.sh` to generate a signature and use `dev_tools/sign_apk.sh` to get the signed apk file `app/build/outputs/apk/release/tvmrpc-release.apk`.

Upload `tvmrpc-release.apk` to your Android device and install it.
Upload `tvmrpc-release.apk` to your Android device and install it:

```bash
$ANDROID_HOME/platform-tools/adb install app/build/outputs/apk/release/tvmrpc-release.apk
```

If you see error:

adb: failed to install app/build/outputs/apk/release/tvmrpc-release.apk:
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE:
Package ml.dmlc.tvm.tvmrpc signatures do not match the previously installed version; ignoring!]

Run uninstall first:

```bash
$ANDROID_HOME/platform-tools/adb uninstall ml.dmlc.tvm.tvmrpc
```

### Build with OpenCL

Expand Down
4 changes: 4 additions & 0 deletions apps/android_rpc/app/src/main/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ ifeq ($(USE_VULKAN), 1)
APP_CPPFLAGS += -DTVM_VULKAN_RUNTIME=1
APP_LDFLAGS += -lvulkan
endif

ifeq ($(USE_SORT), 1)
APP_CPPFLAGS += -DUSE_SORT=1
endif
3 changes: 3 additions & 0 deletions apps/android_rpc/app/src/main/jni/make/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ USE_OPENCL = 0
# whether to enable Vulkan during compile
USE_VULKAN = 0

# whether to enable contrib sort functions during compile
USE_SORT = 1

ifeq ($(USE_VULKAN), 1)
# Statically linking vulkan requires API Level 24 or higher
APP_PLATFORM = android-24
Expand Down
4 changes: 4 additions & 0 deletions apps/android_rpc/app/src/main/jni/tvm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
#include "../src/runtime/vulkan/vulkan_module.cc"
#endif

#ifdef USE_SORT
#include "../src/contrib/sort/sort.cc"
#endif


#include <android/log.h>

Expand Down
15 changes: 11 additions & 4 deletions conda/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
# specific language governing permissions and limitations
# under the License.

FROM nvidia/cuda:{{ cuda_version }}-devel-centos6
FROM nvidia/cuda:{{ cuda_version }}-devel-ubuntu16.04

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 apt-get update && apt-get install -y --no-install-recommends \
bzip2 curl sudo binutils && \
rm -rf /var/lib/apt/lists/*

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
Expand All @@ -27,13 +31,16 @@ RUN curl -o ~/miniconda.sh -O https://repo.continuum.io/miniconda/Miniconda3-lat
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

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

CMD conda build --output-folder /workspace/conda/pkg --variants '{cuda: True, cuda_version: {{ cuda_version }}}' /workspace/conda/tvm-libs
22 changes: 0 additions & 22 deletions conda/Makefile

This file was deleted.

19 changes: 14 additions & 5 deletions conda/nnvm/build.sh → conda/build_cpu.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
#!/bin/sh
# 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
Expand All @@ -17,6 +17,15 @@
# under the License.

set -e
set -u

cd nnvm/python
$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt
# This is a fix for a weird bug in conda that makes it think
# it can't write in /tmp
HOME=/tmp
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
18 changes: 13 additions & 5 deletions conda/topi/build.sh → conda/build_cuda.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash
#!/bin/sh
# 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
Expand All @@ -17,6 +17,14 @@
# under the License.

set -e
set -u

cd topi/python
$PYTHON setup.py install --single-version-externally-managed --record=/tmp/record.txt
# This is a fix for a weird bug in conda that makes it think
# it can't write in /tmp
HOME=/tmp
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
45 changes: 16 additions & 29 deletions conda/topi/meta.yaml → conda/cross-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,24 @@
# specific language governing permissions and limitations
# under the License.

{% set version = "0.6.dev" %}
# this one is important
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_PLATFORM Linux)
#this one not so much
set(CMAKE_SYSTEM_VERSION 1)

package:
name: topi
version: {{ version }}
# specify the cross compiler
set(CMAKE_C_COMPILER $ENV{CC})

source:
path: ../..
# where is the target environment
set(CMAKE_FIND_ROOT_PATH $ENV{PREFIX} $ENV{BUILD_PREFIX}/$ENV{HOST}/sysroot)

build:
number: 1
# search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

requirements:
host:
- python {{ python }}
- numpy
- setuptools
- decorator
- tvm-libs =={{ version }}
run:
- python
- {{ pin_compatible('numpy') }}
- decorator
- tvm-libs =={{ version }}
- tvm =={{ version }}
# for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

test:
imports:
- topi

about:
home: https://github.com/dmlc/tvm
license: Apache2
summary: "TOPI: TVM Operator Inventory"
# god-awful hack because it seems to not run correct tests to determine this:
set(__CHAR_UNSIGNED___EXITCODE 1)
56 changes: 0 additions & 56 deletions conda/nnvm/meta.yaml

This file was deleted.

23 changes: 4 additions & 19 deletions conda/build_cuda.py → conda/render_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
# and from conda.

# These two must be in sync
CUDNN_FULL_VERSION = '7.3.1.20'
CUDNN_VERSION = '7.3.1'
CUDNN_FULL_VERSION = '7.6.0.64'
CUDNN_VERSION = '7.6.0'


condadir = os.path.dirname(sys.argv[0])
Expand All @@ -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('.', ''))
'../docker/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)
Loading

0 comments on commit 9596535

Please sign in to comment.