Skip to content

Commit

Permalink
[Feature](bangc-ops): Add concurrent build jobs (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
defei-coder authored Jun 12, 2023
1 parent 7d9aa2f commit f0695b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions bangc-ops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
| `MLUOP_BUILD_ASAN_CHECK` | OFF | 开启ASAN内存检查工具 | `MLUOP_BUILD_ASAN_CHECK` | --asan |
| `MLUOP_MLU_ARCH_LIST` | `mtp_372` | 目标mlu架构列表,分号分割的字符串,如"mtp_372" | `MLUOP_MLU_ARCH_LIST` | --mlu370 |
| `MLUOP_BUILD_SPECIFIC_OP` || 编译指定的算子 | `MLUOP_BUILD_SPECIFIC_OP` | --filter |
| `BUILD_JOBS` | 16 | 编译指定的线程数 | `BUILD_JOBS` | -j<br />--jobs |



Expand Down
12 changes: 11 additions & 1 deletion bangc-ops/independent_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export BUILD_MODE=${BUILD_MODE:-release} # release/debug
export MLUOP_BUILD_COVERAGE_TEST=${MLUOP_BUILD_COVERAGE_TEST:-OFF} # ON/OFF coverage mode
export MLUOP_BUILD_ASAN_CHECK=${MLUOP_BUILD_ASAN_CHECK:-OFF} # ON/OFF Address Sanitizer (ASan)
export MLUOP_BUILD_PREPARE=${MLUOP_BUILD_PREPARE:-ON}
export BUILD_JOBS="${BUILD_JOBS:-16}" # concurrent build jobs

# import common method like `download_pkg`, `get_json_val`, `common_extract`, etc
. ./scripts/utils.bash
Expand All @@ -31,13 +32,15 @@ short_args=(
c # coverage
h # help
d # debug
j: # jobs
)
# setup long options, follow alphabetical order
long_args=(
asan
coverage
debug
filter:
jobs:
help
mlu270 # mlu arch
mlu290 # mlu arch
Expand Down Expand Up @@ -102,6 +105,7 @@ usage () {
echo " __MLU_SRAM_SIZE__ = 2048KB"
echo " cncc --bang-mlu-arch=mtp_592, cnas --mlu-arch mtp_592"
echo " --filter=* Build specified OP only (string with ';' separated)"
echo " -j N, --jobs=N Build for N parallel jobs."
echo " --no_prepare Skip dependency download."
echo " --prepare Dependency download only."
echo
Expand Down Expand Up @@ -300,6 +304,11 @@ if [ $# != 0 ]; then
prog_log_note "Build libmluop.so with OP: ${MLUOP_BUILD_SPECIFIC_OP} only."
shift
;;
-j | --jobs)
shift
export BUILD_JOBS=$1
shift
;;
--no_prepare)
shift
export MLUOP_BUILD_PREPARE="OFF"
Expand Down Expand Up @@ -347,6 +356,7 @@ prog_log_info "MLUOP_BUILD_COVERAGE_TEST = ${MLUOP_BUILD_COVERAGE_TEST}"
prog_log_info "MLUOP_BUILD_ASAN_CHECK = ${MLUOP_BUILD_ASAN_CHECK}"
prog_log_info "MLUOP_MLU_ARCH_LIST = ${MLUOP_MLU_ARCH_LIST}"
prog_log_info "MLUOP_TARGET_CPU_ARCH = ${MLUOP_TARGET_CPU_ARCH}"
prog_log_info "BUILD_JOBS = ${BUILD_JOBS}"
#check compiler version and consider activate devtoolset for CentOS 7
if [ "$OS_RELEASE_ID" = "centos" -a "$OS_RELEASE_VERSION_ID" = "7" ]; then
if [ ! -f "/opt/rh/devtoolset-7/enable" ]; then
Expand Down Expand Up @@ -408,4 +418,4 @@ pushd ${BUILD_PATH} > /dev/null
-DMLUOP_SYMBOL_VIS_FILE="${MLUOP_SYMBOL_VIS_FILE}"

popd > /dev/null
${CMAKE} --build ${BUILD_PATH} -- -j
${CMAKE} --build ${BUILD_PATH} -- -j${BUILD_JOBS}

0 comments on commit f0695b5

Please sign in to comment.