1#!/bin/bash 2 3echo "RUNNING ON $(uname -a) WITH $(nproc) CPUS AND $(free -m)" 4set -eux -o pipefail 5source /env 6 7# Because most Circle executors only have 20 CPUs, using more causes OOMs w/ Ninja and nvcc parallelization 8MEMORY_LIMIT_MAX_JOBS=18 9NUM_CPUS=$(( $(nproc) - 2 )) 10 11# Defaults here for **binary** linux builds so they can be changed in one place 12export MAX_JOBS=${MAX_JOBS:-$(( ${NUM_CPUS} > ${MEMORY_LIMIT_MAX_JOBS} ? ${MEMORY_LIMIT_MAX_JOBS} : ${NUM_CPUS} ))} 13 14if [[ "${DESIRED_CUDA}" =~ cu1[1-2][0-9] ]]; then 15 export BUILD_SPLIT_CUDA="ON" 16fi 17 18# Parse the parameters 19if [[ "$PACKAGE_TYPE" == 'conda' ]]; then 20 build_script='conda/build_pytorch.sh' 21elif [[ "$DESIRED_CUDA" == cpu ]]; then 22 build_script='manywheel/build_cpu.sh' 23elif [[ "$DESIRED_CUDA" == *"rocm"* ]]; then 24 build_script='manywheel/build_rocm.sh' 25else 26 build_script='manywheel/build.sh' 27fi 28 29if [[ "$CIRCLE_BRANCH" == "main" ]] || [[ "$CIRCLE_BRANCH" == "master" ]] || [[ "$CIRCLE_BRANCH" == release/* ]]; then 30 export BUILD_DEBUG_INFO=1 31fi 32 33# Build the package 34SKIP_ALL_TESTS=1 "/builder/$build_script" 35