Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve sccache hit rate on windows #34435

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions cmake/generic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,8 @@ function(generate_dummy_static_lib)
if(NOT dummy_GENERATOR)
message(FATAL_ERROR "You must provide a generator file name.")
endif()
# if ${dummy_GENERATOR} contains "/", it may be a file path
if(NOT ${dummy_GENERATOR} MATCHES ".*/.*")
set(dummy_GENERATOR "${CMAKE_CURRENT_LIST_DIR}/${dummy_GENERATOR}")
endif()
if(NOT dummy_CONTENT)
set(dummy_CONTENT "${dummy_FILE_PATH} for lib ${dummy_LIB_NAME}")
set(dummy_CONTENT "${dummy_LIB_NAME}_dummy.c for lib ${dummy_LIB_NAME}")
endif()

configure_file(${PROJECT_SOURCE_DIR}/cmake/dummy.c.in ${dummy_FILE_PATH} @ONLY)
Expand Down
7 changes: 5 additions & 2 deletions cmake/unity_build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,14 @@ function(compose_unity_target_sources TARGET TYPE)
get_property(unity_group_index_max GLOBAL PROPERTY ${TARGET}_${TYPE}_group_index)
foreach(src ${ARGN})
set(unity_file "")
# UB use absolute path of source.
# Note(zhouwei25): UB use the path releative to CMAKE_SOURCE_DIR.
# If use absolute path, sccache/ccache hit rate will be reduced.
if(IS_ABSOLUTE ${src})
set(src_absolute_path ${src})
file(RELATIVE_PATH src_relative_path ${CMAKE_SOURCE_DIR} ${src})
else()
set(src_absolute_path ${CMAKE_CURRENT_SOURCE_DIR}/${src})
file(RELATIVE_PATH src_relative_path ${CMAKE_SOURCE_DIR} ${src_absolute_path})
endif()
# If `unity_group_index_max` is empty, there is no combination
# relationship.
Expand All @@ -106,7 +109,7 @@ function(compose_unity_target_sources TARGET TYPE)
set_property(GLOBAL APPEND PROPERTY ${unity_file_sources} ${UNITY_CU_BEFORE_CODE})
endif()
endif()
set_property(GLOBAL APPEND PROPERTY ${unity_file_sources} "#include \"${src_absolute_path}\"")
set_property(GLOBAL APPEND PROPERTY ${unity_file_sources} "#include \"${src_relative_path}\"")
set(unity_target_sources ${unity_target_sources} ${unity_file})
break()
endif()
Expand Down
5 changes: 2 additions & 3 deletions paddle/scripts/paddle_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ dir %cache_dir%
dir paddle\fluid\pybind\Release
rem -------Caching strategy 1: End --------------------------------


rem -------Caching strategy 2: sccache decorate compiler-----------
if "%WITH_SCCACHE%"=="ON" (
del D:\sccache\sccache_log.txt
cmd /C sccache -V || call :install_sccache
sccache --stop-server 2> NUL
if not exist D:\sccache mkdir D:\sccache
Expand Down Expand Up @@ -324,17 +326,14 @@ if %day_now% NEQ %day_before% (
echo %day_now% > %cache_dir%\day.txt
type %cache_dir%\day.txt
if %day_now% EQU 21 (
del D:\sccache\sccache_log.txt
rmdir %cache_dir%\third_party_GPU /s/q
rmdir %cache_dir%\third_party /s/q
)
if %day_now% EQU 11 (
del D:\sccache\sccache_log.txt
rmdir %cache_dir%\third_party_GPU /s/q
rmdir %cache_dir%\third_party /s/q
)
if %day_now% EQU 01 (
del D:\sccache\sccache_log.txt
rmdir %cache_dir%\third_party_GPU /s/q
rmdir %cache_dir%\third_party /s/q
)
Expand Down
2 changes: 0 additions & 2 deletions tools/parallel_UT_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,6 @@
'test_fill_op',
'test_slice_op',
'test_cond',
'test_lstm',
'test_ema',
'test_nan_inf',
'test_isinstance',
Expand Down Expand Up @@ -810,7 +809,6 @@
'test_embedding_id_stop_gradient',
'test_empty_op',
'test_py_reader_combination',
'test_ptb_lm',
'test_expand_op',
'test_prroi_pool_op',
'test_fake_dequantize_op',
Expand Down