@ -26,6 +26,11 @@ message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
" $ { C M A K E _ C _ C O M P I L E R _ I D } $ { C M A K E _ C _ C O M P I L E R _ V E R S I O N } " )
if ( WIN32 )
set ( CMAKE_STATIC_LIBRARY_PREFIX lib )
add_definitions ( "/DGOOGLE_GLOG_DLL_DECL=" )
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /bigobj /MTd" )
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /bigobj /MT" )
set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj /MTd" )
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /bigobj /MT" )
endif ( WIN32 )
if ( NOT CMAKE_CROSSCOMPILING )
@ -41,6 +46,7 @@ option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_F
option ( WITH_AMD_GPU "Compile PaddlePaddle with AMD GPU" OFF )
option ( WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${ AVX_FOUND } )
option ( WITH_MKL "Compile PaddlePaddle with MKL support." ${ AVX_FOUND } )
option ( WITH_NGRAPH "Compile PaddlePaddle with nGraph support." OFF )
option ( WITH_DSO "Compile PaddlePaddle with dynamic linked CUDA" ON )
option ( WITH_TESTING "Compile PaddlePaddle with unit testing" OFF )
option ( WITH_SWIG_PY "Compile PaddlePaddle with inference api" ON )
@ -62,13 +68,14 @@ option(WITH_DISTRIBUTE "Compile with distributed support" OFF)
option ( USE_EIGEN_FOR_BLAS "Use matrix multiplication in Eigen" OFF )
option ( EIGEN_USE_THREADS "Compile with multi-threaded Eigen" OFF )
option ( WITH_ARM_FP16 "Use half precision support on armv8.2-a cpu" OFF )
option ( WITH_FAST_BUNDLE_TEST "Bundle tests that can be run in a single process together to reduce launch overhead" OFF )
option ( WITH_CONTRIB "Compile the third-party contributation" OFF )
option ( REPLACE_ENFORCE_GLOG "Replace PADDLE_ENFORCE with glog/CHECK for better debug." OFF )
option ( WITH_ANAKIN "Compile with Anakin library" OFF )
option ( ANAKIN_BUILD_FAT_BIN "Build anakin cuda fat-bin lib for all device plantform, ignored when WITH_ANAKIN=OFF" OFF )
option ( ANAKIN_BUILD_CROSS_PLANTFORM "Build anakin lib for any nvidia device plantform. ignored when WITH_ANAKIN=OFF" ON )
option ( WITH_GRPC "Use grpc as the default rpc framework" ${ WITH_DISTRIBUTE } )
option ( WITH_BRPC_RDMA "Use brpc rdma as the rpc protocal" OFF )
option ( WITH_INFERENCE "Compile fluid inference library" ON )
option ( ON_INFER "Turn on inference optimization." OFF )
option ( WITH_INFERENCE_API_TEST "Test fluid inference high-level api interface" OFF )
option ( WITH_SYSTEM_BLAS "Use system blas library" OFF )
option ( PY_VERSION "Compile PaddlePaddle with python3 support" ${ PY_VERSION } )
@ -104,6 +111,8 @@ if(ANDROID OR IOS)
" D i s a b l e R D M A w h e n c r o s s - c o m p i l i n g f o r A n d r o i d a n d i O S " F O R C E )
set ( WITH_MKL OFF CACHE STRING
" D i s a b l e M K L w h e n c r o s s - c o m p i l i n g f o r A n d r o i d a n d i O S " F O R C E )
set ( WITH_NGRAPH OFF CACHE STRING
" D i s a b l e n G r a p h w h e n c r o s s - c o m p i l i n g f o r A n d r o i d a n d i O S " F O R C E )
set ( WITH_GOLANG OFF CACHE STRING
" D i s a b l e g o l a n g w h e n c r o s s - c o m p i l i n g f o r A n d r o i d a n d i O S " F O R C E )
@ -121,12 +130,30 @@ if (APPLE OR WIN32)
" D i s a b l e M K L f o r b u i l d i n g o n m a c a n d w i n d o w s " F O R C E )
endif ( )
if ( WIN32 )
set ( WITH_AVX OFF CACHE STRING
" D i s a b l e A V X w h e n c o m p i l i n g f o r W i n d o w s " F O R C E )
set ( WITH_DSO OFF CACHE STRING
" D i s a b l e D S O w h e n c o m p i l i n g f o r W i n d o w s " F O R C E )
set ( WITH_MKL OFF CACHE STRING
" D i s a b l e M K L w h e n c o m p i l i n g f o r W i n d o w s " F O R C E )
set ( WITH_DISTRIBUTE OFF CACHE STRING
" D i s a b l e D I S T R I B U T E w h e n c o m p i l i n g f o r W i n d o w s " F O R C E )
set ( WITH_C_API OFF CACHE STRING
" D i s a b l e C _ A P I w h e n c o m p i l i n g f o r W i n d o w s " F O R C E )
set ( WITH_FLUID_ONLY ON CACHE STRING
" E n a b l e F L U I D _ O N L Y w h e n c o m p i l i n g f o r W i n d o w s " F O R C E )
endif ( )
set ( THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
" A p a t h s e t t i n g t h i r d p a r t y l i b r a r i e s d o w n l o a d & b u i l d d i r e c t o r i e s . " )
set ( FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING
" A p a t h s e t t i n g f l u i d s h a r e d a n d s t a t i c l i b r a r i e s " )
set ( FLUID_INFERENCE_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_install_dir" CACHE STRING
" A p a t h s e t t i n g f l u i d i n f e r e n c e s h a r e d a n d s t a t i c l i b r a r i e s " )
if ( WITH_C_API AND WITH_PYTHON )
message ( WARNING "It is suggest not embedded a python interpreter in Paddle "
" w h e n u s i n g C - A P I . I t w i l l g i v e a n u n p r e d i c t a b l e b e h a v i o r w h e n u s i n g a "
@ -169,6 +196,7 @@ include(external/protobuf) # download, build, install protobuf
include ( external/python ) # d o w n l o a d , b u i l d , i n s t a l l p y t h o n
include ( external/openblas ) # d o w n l o a d , b u i l d , i n s t a l l o p e n b l a s
include ( external/mkldnn ) # d o w n l o a d , b u i l d , i n s t a l l m k l d n n
include ( external/ngraph ) # d o w n l o a d , b u i l d , i n s t a l l n G r a p h
include ( external/swig ) # d o w n l o a d , b u i l d , i n s t a l l s w i g
include ( external/boost ) # d o w n l o a d b o o s t
include ( external/any ) # d o w n l o a d l i b n : : a n y
@ -177,11 +205,14 @@ include(external/pybind11) # download pybind11
include ( external/cares )
include ( external/cub )
include ( external/gzstream )
i f ( NOT WIN32 )
# t h e r e i s n o o f f i c i a l s u p p o r t o f s n a p p y s t r e a m , w a r p c t c , n c c l , c u p t i i n w i n d o w s
include ( external/rocprim )
i nclude( external/xxhash ) # d o w n l o a d x x h a s h
include ( external/dlpack )
include ( external/snappy ) # d o w n l o a d s n a p p y
include ( external/snappystream ) # d o w n l o a d s n a p p y s t r e a m
if ( NOT WIN32 )
# t h e r e i s n o o f f i c i a l s u p p o r t o f w a r p c t c , n c c l , c u p t i i n w i n d o w s
include ( external/warpctc ) # d o w n l o a d , b u i l d , i n s t a l l w a r p c t c
include ( cupti )
endif ( NOT WIN32 )
@ -289,6 +320,14 @@ set(PADDLE_PYTHON_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/python/build")
set ( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" )
set ( CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" )
if ( ON_INFER )
message ( STATUS "On inference mode, will take place some specific optimization." )
add_definitions ( -DPADDLE_ON_INFERENCE )
else ( )
# TODO ( luotao ) , c o m b i n e t h i s w a r n i n g w i t h ` m a k e i n f e r e n c e _ l i b _ d i s t ` c o m m a n d .
message ( WARNING "On inference mode, will take place some specific optimization. Turn on the ON_INFER flag when building inference_lib only." )
endif ( )
add_subdirectory ( paddle )
if ( WITH_PYTHON )
add_subdirectory ( python )