-
Notifications
You must be signed in to change notification settings - Fork 59
/
build.sh
executable file
·109 lines (86 loc) · 3.31 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# Copyright (c) 2020, NVIDIA CORPORATION.
#########################################
# ucx-py GPU build and test script for CI #
#########################################
set -e
NUMARGS=$#
ARGS=$*
# apt-get install libnuma libnuma-dev
# Arg parsing function
function hasArg {
(( ${NUMARGS} != 0 )) && (echo " ${ARGS} " | grep -q " $1 ")
}
# Set path and build parallel level
export PATH=/opt/conda/bin:/usr/local/cuda/bin:$PATH
export PARALLEL_LEVEL=${PARALLEL_LEVEL:-4}
# Set home to the job's workspace
export HOME=$WORKSPACE
# Parse git describe
cd $WORKSPACE
export GIT_DESCRIBE_TAG=`git describe --abbrev=0 --tags`
export MINOR_VERSION=`echo $GIT_DESCRIBE_TAG | grep -o -E '([0-9]+\.[0-9]+)'`
# Get CUDA and Python version
export CUDA_VERSION=${CUDA_VERSION:-$(cat /usr/local/cuda/version.txt | egrep -o "[[:digit:]]+.[[:digit:]]+.[[:digit:]]+")}
export CUDA_VER=${CUDA_VERSION%.*}
export PYTHON_VER=${PYTHON:-$(python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")}
echo "CUDA_VERSION: ${CUDA_VERSION}"
echo "CUDA_VER : ${CUDA_VER}"
echo "PYTHON_VER : ${PYTHON_VER}"
################################################################################
# SETUP - Check environment
################################################################################
gpuci_logger "Check environment"
env
gpuci_logger "Check GPU usage"
nvidia-smi
gpuci_logger "Activate conda env"
. /opt/conda/etc/profile.d/conda.sh
conda install -c conda-forge conda-build -y
################################################################################
# BUILD - Build cuCIM
################################################################################
# We don't use 'rapids' conda environment here.
# To use 'conda-forge'-based package installation and to use 'Project Flash' feature,
# we fake conda build folder for libcucim to '$WORKSPACE/ci/artifacts/cucim/cpu/conda-bld/' which is
# conda build folder for CPU build.
# For GPU build, we fake conda build folder for cucim to '/opt/conda/envs/rapids/conda-bld'.
LIBCUCIM_BLD_PATH=$WORKSPACE/ci/artifacts/cucim/cpu/.conda-bld
CUCIM_BLD_PATH=/opt/conda/envs/rapids/conda-bld
mkdir -p ${CUCIM_BLD_PATH}
gpuci_conda_retry build -c ${LIBCUCIM_BLD_PATH} -c conda-forge -c rapidsai-nightly \
--python=${PYTHON_VER} \
--dirty \
--no-remove-work-dir \
--croot ${CUCIM_BLD_PATH} \
conda/recipes/cucim
################################################################################
# TEST - Run py.tests for cuCIM
################################################################################
# Install cuCIM and its dependencies
gpuci_logger "Installing cuCIM and its dependencies"
gpuci_conda_retry install -y -c ${LIBCUCIM_BLD_PATH} -c ${CUCIM_BLD_PATH} \
"rapids-build-env=$MINOR_VERSION.*" \
libcucim \
cucim
gpuci_logger "Testing cuCIM import"
python -c 'import cucim'
gpuci_logger "Check versions"
python --version
$CC --version
$CXX --version
conda info
conda config --show-sources
conda list --show-channel-urls
if hasArg --skip-tests; then
gpuci_logger "Skipping Tests"
else
gpuci_logger "Check GPU usage"
nvidia-smi
gpuci_logger "Check NICs"
awk 'END{print $1}' /etc/hosts
cat /etc/hosts
gpuci_logger "Python py.test for cuCIM"
cd $WORKSPACE/python/cucim
py.test --cache-clear -v --ignore-glob . --rootdir=src
fi