Skip to content

Commit

Permalink
[Fix](bangc-ops): fix kylin10 build cmakelist. (Cambricon#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangLearning authored Oct 24, 2022
1 parent dd8d000 commit 8ea4107
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 13 deletions.
7 changes: 3 additions & 4 deletions bangc-ops/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,16 @@ set(BANG_CNCC_FLAGS "${BANG_CNCC_FLAGS}" "--bang-mlu-arch=mtp_220"
)

file(GLOB_RECURSE src_files ${src_files} "${CMAKE_CURRENT_SOURCE_DIR}/kernels/*.mlu" "${CMAKE_CURRENT_SOURCE_DIR}/kernels/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/core/*.cpp")
file(GLOB_RECURSE obj_files ${obj_files} "${CMAKE_CURRENT_SOURCE_DIR}/kernels/*.o")
file(GLOB_RECURSE obj_files ${obj_files} "${CMAKE_CURRENT_SOURCE_DIR}/kernels/*/${MLUOPS_TARGET_CPU_ARCH}/*.o")
# set(src_files ${src_files} "${CMAKE_CURRENT_SOURCE_DIR}/test/main.cpp")


bang_add_library(mluops SHARED ${src_files})
target_link_libraries(mluops cnrt cndrv)
target_link_libraries(mluops ${obj_files})
set_target_properties(mluops PROPERTIES
set_target_properties(mluops PROPERTIES
OUTPUT_NAME "mluops"
PREFIX "lib"
VERSION "${BUILD_VERSION}"
VERSION "${BUILD_VERSION}"
SOVERSION "${MAJOR_VERSION}"
)

Expand Down
13 changes: 9 additions & 4 deletions bangc-ops/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e
SCRIPT_DIR=`dirname $0`
BUILD_PATH=${SCRIPT_DIR}/build
CMAKE=cmake
MLUOPS_TARGET_CPU_ARCH=`uname -m`

usage () {
echo "USAGE: ./build.sh <options>"
Expand Down Expand Up @@ -87,17 +88,21 @@ pushd ${BUILD_PATH} > /dev/null
if [[ ${MLUOP_BUILD_COVERAGE_TEST} == "ON" ]]; then
echo "-- Build cambricon coverage test cases."
${CMAKE} ../ -DNEUWARE_HOME="${NEUWARE_HOME}" \
-DMLUOP_BUILD_COVERAGE_TEST="${MLUOP_BUILD_COVERAGE_TEST}"
-DMLUOP_BUILD_COVERAGE_TEST="${MLUOP_BUILD_COVERAGE_TEST}" \
-DMLUOPS_TARGET_CPU_ARCH="${MLUOPS_TARGET_CPU_ARCH}"
else
echo "-- Build cambricon release test cases."
${CMAKE} ../ -DNEUWARE_HOME="${NEUWARE_HOME}" \
-DBUILD_VERSION="${BUILD_VERSION}" \
-DMAJOR_VERSION="${MAJOR_VERSION}"
fi
-DMAJOR_VERSION="${MAJOR_VERSION}" \
-DMLUOPS_TARGET_CPU_ARCH="${MLUOPS_TARGET_CPU_ARCH}"
fi

if [[ ${MLUOP_BUILD_ASAN_CHECK} == "ON" ]]; then
echo "-- Build cambricon ASAN leak check."
${CMAKE} ../ -DNEUWARE_HOME="${NEUWARE_HOME}" -DMLUOP_BUILD_ASAN_CHECK="${MLUOP_BUILD_ASAN_CHECK}"
${CMAKE} ../ -DNEUWARE_HOME="${NEUWARE_HOME}" \
-DMLUOP_BUILD_ASAN_CHECK="${MLUOP_BUILD_ASAN_CHECK}" \
-DMLUOPS_TARGET_CPU_ARCH="${MLUOPS_TARGET_CPU_ARCH}"
fi
popd > /dev/null
${CMAKE} --build build -- -j
Binary file added bangc-ops/kernels/copy/aarch64/copy_union1.mlu.o
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 5 additions & 5 deletions tools/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ else
filenames=$(git diff --diff-filter=A --diff-filter=C --diff-filter=M \
--diff-filter=R --diff-filter=T --cached --name-only \
| grep -v ${exclude_list} \
| grep -E ${check_list})
| grep -E ${check_list})
fi

ret=0
Expand Down Expand Up @@ -51,7 +51,7 @@ for i in ${filenames} ; do
check_dir=$(echo $i | grep -E "^core\/|^kernels\/")
#not_in_tools=$(echo $i | sed -r "s/^tools.*//")
if [[ -n "${include_mlu}" ]] && [[ -n "${check_dir}" ]]; then
printf_log=$(sed -n -e '/\<printf\>/=' -e ' \
printf_log=$(sed -n -e '/\<printf\>/=' -e ' \
/\<__bang_printf\>/=' -e '/\<std::cout\>/=' -e '/assert(/=' $i)
for line in ${printf_log};
do
Expand Down Expand Up @@ -83,15 +83,15 @@ fi
# include_mlu=$(echo $i | grep "\.mlu")
# if [[ -n "${include_mlu}" ]]; then
# # step1
# # launch_kernel_indexs represents the line index of "<<<.*queue>>>".
# # launch_kenel_indexs is an array, duo to there are many places to launch
# # launch_kernel_indexs represents the line index of "<<<.*queue>>>".
# # launch_kenel_indexs is an array, duo to there are many places to launch
# # kernel.
# launch_kernel_indexs=$(sed -n '/<<<.*queue>>>/=' $i)
# if [[ launch_kernel_indexs ]]; then
# for launch_kernel_index in ${launch_kernel_indexs}; do
# forward_line_num=1
# # step2
# # forward_line_num represents how many lines before "launch_kenel_index",
# # forward_line_num represents how many lines before "launch_kenel_index",
# # attempting to find the starting line of launch kernel
# while [[ ${forward_line_num} -le ${launch_kernel_index} ]]; do
# start_index_launch_kernel=`expr ${launch_kernel_index} - ${forward_line_num}`
Expand Down

0 comments on commit 8ea4107

Please sign in to comment.