Skip to content

Commit

Permalink
Use conda for installing Python instead of system repos
Browse files Browse the repository at this point in the history
  • Loading branch information
driazati committed Sep 14, 2022
1 parent a64c63d commit d24b863
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
package_name: 'apache-tvm'
- cuda: '10.2'
image: 'tlcpack/package-cu102:1d98bf9'
package_name: 'apache-tvm'
package_name: 'apache-tvm-cu102'
- cuda: '11.3'
image: 'tlcpack/package-cu113:1d98bf9'
package_name: 'apache-tvm'
package_name: 'apache-tvm-cu113'
- cuda: '11.6'
image: 'tlcpack/package-cu116:1d98bf9'
package_name: 'apache-tvm'
package_name: 'apache-tvm-cu116'

runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.package-cu116
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ RUN conda create -n py310 python=3.10 -y
COPY install/centos_install_python_package.sh /install/centos_install_python_package.sh
RUN bash /install/centos_install_python_package.sh


COPY install/centos_install_auditwheel.sh /install/centos_install_auditwheel.sh
RUN bash /install/centos_install_auditwheel.sh

Expand Down
32 changes: 16 additions & 16 deletions wheel/build_wheel_manylinux.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
#!/usr/bin/env bash

set -ex
set -exo pipefail

source /multibuild/manylinux_utils.sh

TVM_PYTHON_DIR="/workspace/tvm/python"
PYTHON_VERSIONS_CPU=("3.7" "3.8" "3.9" "3.10")
PYTHON_VERSIONS_GPU=("3.7" "3.8" "3.9" "3.10")

PYTHON_VERSIONS=$(conda env list | grep py | awk '{print $1}' | tr -d py3 | xargs -I {} printf "3.{}\n" | sort -V)
PYTHON_VERSIONS_CPU=$PYTHON_VERSIONS
PYTHON_VERSIONS_GPU=$PYTHON_VERSIONS
CUDA_OPTIONS=("none" "10.2" "11.0" "11.1" "11.3" "11.6")
CUDA="none"


function activate() {
eval "$(conda shell.bash hook)"
PYTHON_VERSION=$1
ENV_NAME=$(echo "$PYTHON_VERSION" | tr -d 3. | xargs -I {} printf "py3{}\n")
conda activate "$ENV_NAME"
}


function usage() {
echo "Usage: $0 [--cuda CUDA]"
echo
Expand Down Expand Up @@ -73,18 +84,6 @@ while [[ $# -gt 0 ]]; do
esac
done

for python_version in ${PYTHON_VERSIONS[*]}
do
echo "> Looking for Python ${python_version}."
cpython_dir="$(cpython_path ${python_version} ${UNICODE_WIDTH} 2> /dev/null)"
if [ -d "${cpython_dir}" ]; then
echo "Python ${python_version} found";
else
echo "Python ${python_version} not found";
exit 1
fi
done


if ! in_array "${CUDA}" "${CUDA_OPTIONS[*]}" ; then
echo "Invalid CUDA option: ${CUDA}"
Expand Down Expand Up @@ -130,14 +129,15 @@ fi
mkdir -p build
cd build
cmake ..
make -j$(nproc)
make -j"$(nproc)"

UNICODE_WIDTH=32 # Dummy value, irrelevant for Python 3

# Not all manylinux Docker images will have all Python versions,
# so check the existing python versions before generating packages
for python_version in ${PYTHON_VERSIONS[*]}
do
activate "$python_version"
echo "> Looking for Python ${python_version}."
cpython_dir="$(cpython_path ${python_version} ${UNICODE_WIDTH} 2> /dev/null)"
if [ -d "${cpython_dir}" ]; then
Expand Down

0 comments on commit d24b863

Please sign in to comment.