未验证 提交 05805d91 编写于 作者: zhouweiwei2014's avatar zhouweiwei2014 提交者: GitHub

Polish windows compile for Ninja, fix UT random compile (#34237)

* polish windows compile for Ninja, fix random compile fail

* polish windows compile for Ninja, fix random compile fail
上级 2f76bb8b
...@@ -119,8 +119,6 @@ if(WIN32) ...@@ -119,8 +119,6 @@ if(WIN32)
endforeach(flag_var) endforeach(flag_var)
endif() endif()
math(EXPR PROCESS_MAX "${CPU_CORES} * 2 / 3")
# windows build turn off warnings, use parallel compiling. # windows build turn off warnings, use parallel compiling.
foreach(flag_var foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
...@@ -128,8 +126,12 @@ if(WIN32) ...@@ -128,8 +126,12 @@ if(WIN32)
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/W[1-4]" " /W0 " ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/W[1-4]" " /W0 " ${flag_var} "${${flag_var}}")
# NOTE(zhouwei25): GPU compile have too high memory utilization when parallel compiling
if(NOT WITH_GPU) # NOTE(zhouwei25): GPU compile have too high memory utilization when parallel compiling,
# For Visual Studio generators, /MP should be added.
# For other generators like Ninja, it is not need to add /MP.
if("${CMAKE_GENERATOR}" STREQUAL "Visual Studio" AND NOT WITH_GPU)
math(EXPR PROCESS_MAX "${CPU_CORES} * 2 / 3")
set(${flag_var} "${${flag_var}} /MP${PROCESS_MAX}") set(${flag_var} "${${flag_var}} /MP${PROCESS_MAX}")
endif() endif()
endforeach(flag_var) endforeach(flag_var)
......
...@@ -18,7 +18,7 @@ elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja") ...@@ -18,7 +18,7 @@ elseif("${CMAKE_GENERATOR}" STREQUAL "Ninja")
if(SCCACHE_PATH) if(SCCACHE_PATH)
execute_process(COMMAND sccache -V OUTPUT_VARIABLE sccache_version) execute_process(COMMAND sccache -V OUTPUT_VARIABLE sccache_version)
message(STATUS "${sccache_version} is founded, use [${SCCACHE_PATH}] to speed up compile on Windows.") message(STATUS "sccache is founded, use [${SCCACHE_PATH}] to speed up compile on Windows.")
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE_PATH}) set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE_PATH})
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE_PATH}) set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE_PATH})
......
...@@ -324,14 +324,17 @@ if %day_now% NEQ %day_before% ( ...@@ -324,14 +324,17 @@ if %day_now% NEQ %day_before% (
echo %day_now% > %cache_dir%\day.txt echo %day_now% > %cache_dir%\day.txt
type %cache_dir%\day.txt type %cache_dir%\day.txt
if %day_now% EQU 21 ( if %day_now% EQU 21 (
del D:\sccache\sccache_log.txt
rmdir %cache_dir%\third_party_GPU /s/q rmdir %cache_dir%\third_party_GPU /s/q
rmdir %cache_dir%\third_party /s/q rmdir %cache_dir%\third_party /s/q
) )
if %day_now% EQU 11 ( if %day_now% EQU 11 (
del D:\sccache\sccache_log.txt
rmdir %cache_dir%\third_party_GPU /s/q rmdir %cache_dir%\third_party_GPU /s/q
rmdir %cache_dir%\third_party /s/q rmdir %cache_dir%\third_party /s/q
) )
if %day_now% EQU 01 ( if %day_now% EQU 01 (
del D:\sccache\sccache_log.txt
rmdir %cache_dir%\third_party_GPU /s/q rmdir %cache_dir%\third_party_GPU /s/q
rmdir %cache_dir%\third_party /s/q rmdir %cache_dir%\third_party /s/q
) )
......
...@@ -685,7 +685,6 @@ TWO_PARALLEL_JOB = [ ...@@ -685,7 +685,6 @@ TWO_PARALLEL_JOB = [
'test_nn_functional_hot_op', 'test_nn_functional_hot_op',
'test_op_name_conflict', 'test_op_name_conflict',
'test_imperative_gan', 'test_imperative_gan',
'test_simnet',
'test_amp_check_finite_and_scale_op', 'test_amp_check_finite_and_scale_op',
'test_random_seed', 'test_random_seed',
'test_histogram_op', 'test_histogram_op',
...@@ -819,7 +818,6 @@ TWO_PARALLEL_JOB = [ ...@@ -819,7 +818,6 @@ TWO_PARALLEL_JOB = [
'test_prelu_op', 'test_prelu_op',
'test_fill_zeros_like_op', 'test_fill_zeros_like_op',
'test_pool2d_op', 'test_pool2d_op',
'test_for_enumerate',
'test_gather_op', 'test_gather_op',
'test_partial_concat_op', 'test_partial_concat_op',
'test_gaussian_random_op', 'test_gaussian_random_op',
...@@ -883,7 +881,6 @@ TWO_PARALLEL_JOB = [ ...@@ -883,7 +881,6 @@ TWO_PARALLEL_JOB = [
'test_empty_like_op', 'test_empty_like_op',
'test_rank_loss_op', 'test_rank_loss_op',
'test_elementwise_mod_op', 'test_elementwise_mod_op',
'test_reinforcement_learning',
'test_elementwise_max_op', 'test_elementwise_max_op',
'test_retain_graph', 'test_retain_graph',
'test_edit_distance_op', 'test_edit_distance_op',
...@@ -1001,7 +998,6 @@ TWO_PARALLEL_JOB = [ ...@@ -1001,7 +998,6 @@ TWO_PARALLEL_JOB = [
'test_static_save_load', 'test_static_save_load',
'test_coalesce_tensor_op', 'test_coalesce_tensor_op',
'test_fuse_bn_act_pass', 'test_fuse_bn_act_pass',
'test_simnet_v2',
'test_shard_index_op', 'test_shard_index_op',
'test_cuda_random_seed', 'test_cuda_random_seed',
'test_dequantize_log_op', 'test_dequantize_log_op',
...@@ -1023,7 +1019,6 @@ TWO_PARALLEL_JOB = [ ...@@ -1023,7 +1019,6 @@ TWO_PARALLEL_JOB = [
'test_py_reader_pin_memory', 'test_py_reader_pin_memory',
'test_train_recognize_digits', 'test_train_recognize_digits',
'test_parallel_executor_feed_persistable_var', 'test_parallel_executor_feed_persistable_var',
'test_mnist',
'test_update_loss_scaling_op', 'test_update_loss_scaling_op',
'test_rnn_cell_api', 'test_rnn_cell_api',
'test_imperative_load_static_param', 'test_imperative_load_static_param',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册