Skip to content

Commit

Permalink
Improvements to the conda build (#2742)
Browse files Browse the repository at this point in the history
  • Loading branch information
abergeron authored and tqchen committed Mar 9, 2019
1 parent 3929424 commit 57381b6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 15 deletions.
20 changes: 20 additions & 0 deletions conda/cross-linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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)
2 changes: 1 addition & 1 deletion conda/nnvm/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source:
path: ../..

build:
number: 1
number: 0
skip: True # [win]

requirements:
Expand Down
2 changes: 1 addition & 1 deletion conda/topi/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source:
path: ../..

build:
number: 1
number: 0

requirements:
host:
Expand Down
26 changes: 23 additions & 3 deletions conda/tvm-libs/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

# Fix for OSX build to hide the clang LLVM
rm -f ${BUILD_PREFIX}/bin/llvm-config
rm -rf ${BUILD_PREFIX}/lib/cmake

set -e

if [ -z "$PREFIX" ]; then
Expand All @@ -9,13 +13,29 @@ fi
if [ -z "$cuda" ] || [ "$cuda" == "False" ]; then
CUDA_OPT=""
else
CUDA_OPT="-DUSE_CUDA=ON"
CUDA_OPT="-DUSE_CUDA=ON -DUSE_CUBLAS=ON"
fi

if [ "$target_platform" == "osx-64" ]; then
# macOS 64 bits
METAL_OPT="" # Conda can only target 10.9 for now
TOOLCHAIN_OPT=""
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)
METAL_OPT=""
TOOLCHAIN_OPT=""
fi
fi

rm -rf build || true
mkdir -p build
cd build
cmake $CUDA_OPT -DUSE_LLVM=ON -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" ..
make -j4 VERBOSE=1
cmake $METAL_OPT $CUDA_OPT -DUSE_LLVM=ON -DINSTALL_DEV=ON -DCMAKE_INSTALL_PREFIX="$PREFIX" $TOOLCHAIN_OPT ..
make -j${CPU_COUNT} VERBOSE=1
make install
cd ..
14 changes: 5 additions & 9 deletions conda/tvm-libs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@ source:
path: ../..

build:
number: 1
number: 0
string: cuda{{ cuda_version }}_{{ PKG_BUILDNUM }} # [cuda]

requirements:
build:
- {{ compiler('cxx') }} # [linux]
- llvmdev ==6.0.0 # [osx]
host:
# The OS X build will require some manual setup or it will break
# See https://conda.io/docs/user-guide/tasks/build-packages/compiler-tools.html#macos-sdk
# It is also ass-backward because of llvm brokeness when mixed with the
# conda OS X compiler
- {{ compiler('cxx') }} # [osx]
# See https://docs.conda.io/projects/conda-build/en/latest/source/resources/compiler-tools.html#macos-sdk
- {{ compiler('cxx') }}
host:
- cmake
- llvmdev ==6.0.0 # [linux]
- llvmdev ==6.0.0
- zlib # [linux]
run:
- {{ pin_compatible('cudatoolkit', lower_bound=cuda_version, max_pin='x.x') }} # [cuda]
Expand Down
2 changes: 1 addition & 1 deletion conda/tvm/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source:
path: ../..

build:
number: 1
number: 0

requirements:
build:
Expand Down

0 comments on commit 57381b6

Please sign in to comment.