Skip to content
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: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ project(paddle CXX C)
# enable language CUDA
# TODO(Shibo Tao): remove find_package(CUDA) completely.
find_package(CUDA QUIET)
find_package(MKL QUIET)
option(WITH_ONEMKL "Compile PaddlePaddle with oneMKL" ${MKL_FOUND})
option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND})
option(WITH_TENSORRT "Compile PaddlePaddle with NVIDIA TensorRT" OFF)
option(WITH_XPU "Compile PaddlePaddle with BAIDU KUNLUN XPU" OFF)
Expand Down Expand Up @@ -371,6 +373,10 @@ if (WITH_MIPS)
add_definitions(-DPADDLE_WITH_MIPS)
endif()

if (WITH_ONEMKL)
add_definitions(-DPADDLE_WITH_ONEMKL)
endif()

if (WITH_HETERPS)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -faligned-new")
Expand Down
34 changes: 24 additions & 10 deletions paddle/fluid/operators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,35 @@ if (WITH_GPU OR WITH_ROCM)
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale SRCS warpctc_op.cc warpctc_op.cu.cc)
else()
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale)
find_library(CUFFT_LIB libcufft.so
PATHS
${CUDA_TOOLKIT_ROOT_DIR}/lib64/
NO_DEFAULT_PATH
)
op_library(spectral_op SRCS spectral_op.cc spectral_op.cu DEPS ${OP_HEADER_DEPS})
target_link_libraries(spectral_op ${CUFFT_LIB})
endif()
op_library(sync_batch_norm_op)
file(APPEND ${pybind_file} "USE_CUDA_ONLY_OP(sync_batch_norm);\n")
else()
op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale)
if(WITH_ONEMKL)
target_link_libraries(spectral_op MKL::MKL)
endif()
endif()

op_library(spectral_op SRCS spectral_op.cc spectral_op.cu DEPS ${OP_HEADER_DEPS})
if (WITH_GPU)
find_library(CUFFT_LIB libcufft.so
PATHS
${CUDA_TOOLKIT_ROOT_DIR}/lib64/
NO_DEFAULT_PATH
)
target_link_libraries(spectral_op ${CUFFT_LIB})
endif()
if(WITH_ONEMKL)
find_library(ONEMKL_CORE libmkl_core.so
PATHS
${MKL_ROOT}/lib/${MKL_ARCH}
NO_DEFAULT_PATH
)
find_library(ONEMKL_THREAD libmkl_intel_thread.so
PATHS
${MKL_ROOT}/lib/${MKL_ARCH}
NO_DEFAULT_PATH
)
target_include_directories(spectral_op PRIVATE ${MKL_INCLUDE})
target_link_libraries(spectral_op MKL::mkl_core MKL::mkl_intel_thread)
endif()

op_library(lstm_op DEPS ${OP_HEADER_DEPS} lstm_compute)
Expand Down
Loading