Created by: T8T9
Motivation: The building stage of ci is too slow because
-
Paddle use
Find(CUDA)
to introduce CUDA currently, which doesn't support ccache. Because old cmake doesn't support CUDA, it can only add ccache prefix togcc
andg++
command.Find(Cuda)
includesFindCUDA
module underlying. It will generate a.cu.o.Release.cmake
script for every.cu
file,then callcmake -E <cmake script>
to compile.cu
files. cmake wouldn't addccache
prefix to cmake command. To confirm this, you can checkpaddle/fluid/operators/math/CMakeFiles/fc.dir/build.make
andpaddle/fluid/operators/math/CMakeFiles/fc.dir/fc_generated_fc.cu.o.Release.cmake
in your build directory.cmake 3.10 support CUDA, it can compile
.cu
files by callingnvcc
command directly, just likegcc
andg++
. So, to ccache CUDA object files, we need to use cmake built-in way. -
Paddle pass compiler options(-Wno-unused-function, -Werror etc.) to gcc/g++ by adding
-Xcompiler -Wno-unused-function -Xcompiler -Werror
flags to nvcc. We should notice there is a ' ' between flag-Xcompiler
and-Werror
, ccache might treat it as two separate flags. The problem is bothg++
andnvcc
have a built-in option-Werror
, and-Werror
is a compiler option, so ccache will remove this option when preprocess source files. In this case, ccache will change-Xcompiler -Werror
to-Xcompiler
, and preprocessor can not recognize-Xcompiler
, this will make preprocess fail, and then ccache.To fix this, we should use
-Xcompiler=-Werror
to tell ccache these two flags are binded, and they should be processed together.
related #24337