未验证 提交 72ad280b 编写于 作者: Z zhangchunle 提交者: GitHub

get build time (#39368)

上级 be8ab0ea
......@@ -242,6 +242,15 @@ option(NEW_RELEASE_CUBIN "PaddlePaddle next-level release strategy for pypi cu
option(NEW_RELEASE_JIT "PaddlePaddle next-level release strategy for backup jit package" OFF)
option(WITH_ASCEND_INT64 "Compile with int64 kernel for ascend NPU" OFF)
option(WITH_POCKETFFT "Compile with pocketfft support" ON)
option(WITH_RECORD_BUILDTIME "Compile PaddlePaddle with record all targets build time" OFF)
if(WITH_RECORD_BUILDTIME)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_build_time.sh")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CMAKE_CURRENT_SOURCE_DIR}/tools/get_build_time.sh")
else()
include(ccache) # set ccache for compilation ; if WITH_RECORD_BUILDTIME=ON can't use ccache
endif()
unset(WITH_RECORD_BUILDTIME CACHE)
# PY_VERSION
if(NOT PY_VERSION)
......@@ -382,7 +391,6 @@ if(WITH_PROFILER)
add_definitions(-DWITH_GPERFTOOLS)
endif()
include(ccache) # set ccache for compilation
include(util) # set unittest and link libs
include(version) # set PADDLE_VERSION
include(coveralls) # set code coverage
......
......@@ -2,7 +2,6 @@ if(NOT WITH_GPU)
return()
endif()
if(WITH_NV_JETSON)
add_definitions(-DWITH_NV_JETSON)
set(paddle_known_gpu_archs "53 62 72")
......
......@@ -240,6 +240,7 @@ function cmake_base() {
-DON_INFER=${ON_INFER:-OFF}
-DWITH_HETERPS=${WITH_HETERPS:-OFF}
-DWITH_FLUID_ONLY=${WITH_FLUID_ONLY:-OFF}
-DWITH_RECORD_BUILDTIME=${WITH_RECORD_BUILDTIME:-OFF}
-DCUDA_ARCH_BIN="${CUDA_ARCH_BIN}"
========================================
EOF
......@@ -291,6 +292,7 @@ EOF
-DWITH_HETERPS=${WITH_HETERPS:-OFF} \
-DWITH_FLUID_ONLY=${WITH_FLUID_ONLY:-OFF} \
-DCUDA_ARCH_BIN="${CUDA_ARCH_BIN}" \
-DWITH_RECORD_BUILDTIME=${WITH_RECORD_BUILDTIME:-OFF} \
-DWITH_UNITY_BUILD=${WITH_UNITY_BUILD:-OFF};build_error=$?
if [ "$build_error" != 0 ];then
exit 7;
......@@ -454,6 +456,14 @@ function cmake_gen_and_build() {
echo "ipipe_log_param_Build_Time: $[ $endTime_s - $startTime_s ]s" >> ${PADDLE_ROOT}/build/build_summary.txt
}
function get_build_time_file() {
python ${PADDLE_ROOT}/tools/analysis_build_time.py
cat ${PADDLE_ROOT}/tools/buildTime.txt
today=$(date "+%Y-%m-%d")
mkdir -p /paddle_targets_buildtime_record
cp ${PADDLE_ROOT}/tools/buildTime.txt /paddle_targets_buildtime_record/${today}-buildTime.txt
}
function build_mac() {
set +e
mkdir -p ${PADDLE_ROOT}/build
......@@ -2485,6 +2495,10 @@ function build_pr_and_develop() {
mkdir ${PADDLE_ROOT}/build/dev_whl && cp ${PADDLE_ROOT}/build/python/dist/*.whl ${PADDLE_ROOT}/build/dev_whl
}
function build_develop() {
#git checkout -b develop_base_pr upstream/$BRANCH
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
}
function main() {
local CMD=$1
......@@ -2497,6 +2511,11 @@ function main() {
build_pr_dev)
build_pr_and_develop
;;
build_dev_test)
#build_develop
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
get_build_time_file
;;
build_and_check)
set +e
check_style_info=$(check_style)
......
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
root_path = os.path.abspath(os.path.join(os.getcwd(), ".."))
def strToSecond(strTime):
minute = int(strTime.split(':')[0])
second = int(strTime.split(':')[1].split('.')[0]) + 1
return minute * 60 + second
def getUsefulBuildTimeFile(filename):
os.system(
"grep -Po -- '-o .*' %s | grep ' elapsed' | grep -P -v '0:00.* elapse' > %s/tools/analysis_build_time"
% (filename, root_path))
os.system(
"grep -v -- '-o .*' %s |grep ' elapse' | grep -P -v '0:00.* elapse' >> %s/tools/analysis_build_time"
% (filename, root_path))
def analysisBuildTime():
filename = '%s/build/build-time' % root_path
getUsefulBuildTimeFile(filename)
os.system('rm -rf %s/tools/tempbuildTime.txt' % root_path)
with open('%s/tools/analysis_build_time' % root_path, 'r') as f:
lines = f.readlines()
for line in lines:
try:
line = line.strip()
if '-o ' in line:
buildFile = line.split(', ')[0].split(' ')[1]
buildTime = line.split(', ')[1].split('elapsed')[0].strip()
secondTime = strToSecond(buildTime)
os.system("echo %s, %s >> %s/tools/tempbuildTime.txt" %
(buildFile, secondTime, root_path))
else:
buildTime = line.split(', ')[1].split('elapsed')[0].strip()
secondTime = strToSecond(buildTime)
if secondTime > 30:
os.system("echo %s, %s >> %s/tools/tempbuildTime.txt" %
(line, secondTime, root_path))
except ValueError:
print(line)
os.system(
'sort -n -k 2 -r %s/tools/tempbuildTime.txt > %s/tools/buildTime.txt' %
(root_path, root_path))
analysisBuildTime()
#!/bin/bash
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
CUR_ROOT=$(dirname "$0")/..
/usr/bin/time -f '%C, %E elapsed, %U user, %S sys' "$@" >> $CUR_ROOT/build/build-time 2>&1
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册