add_subdirectory(detail) function(math_library TARGET) # math_library is a function to create math library. # The interface is the same as cc_library. # But it handle split GPU/CPU code and link some common library. set(cc_srcs) set(cu_srcs) set(math_common_deps device_context framework_proto) set(multiValueArgs SRCS DEPS) cmake_parse_arguments(math_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}.cc) list(APPEND cc_srcs ${TARGET}.cc) endif() if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET}.cu) list(APPEND cu_srcs ${TARGET}.cu) endif() if (WITH_GPU) nv_library(${TARGET} SRCS ${cc_srcs} ${cu_srcs} DEPS ${math_library_DEPS} ${math_common_deps}) else() cc_library(${TARGET} SRCS ${cc_srcs} DEPS ${math_library_DEPS} ${math_common_deps}) endif() endfunction() math_library(math_function DEPS cblas) math_library(im2col) math_library(selected_rows_functor DEPS selected_rows) math_library(softmax) math_library(cross_entropy) math_library(pooling) math_library(sequence_pooling) math_library(vol2col) math_library(context_project) math_library(sequence2batch) math_library(sequence_padding) math_library(sequence_scale) math_library(maxouting) math_library(unpooling) math_library(cos_sim_functor) math_library(lstm_compute DEPS activation_functions) math_library(gru_compute DEPS activation_functions) if(WITH_GPU) nv_library(depthwise_conv SRCS depthwise_conv.cu DEPS device_context) nv_library(concat_functor SRCS concat.cc concat.cu DEPS device_context tensor) else() cc_library(concat_functor SRCS concat.cc DEPS device_context tensor) endif() cc_test(math_function_test SRCS math_function_test.cc) cc_test(selected_rows_functor_test SRCS selected_rows_functor_test.cc DEPS selected_rows_functor) cc_test(im2col_test SRCS im2col_test.cc DEPS im2col) cc_test(vol2col_test SRCS vol2col_test.cc DEPS vol2col) cc_test(sequence_padding_test SRCS sequence_padding_test.cc DEPS sequence_padding) if(WITH_GPU) nv_test(math_function_gpu_test SRCS math_function_test.cu) nv_test(selected_rows_functor_gpu_test SRCS selected_rows_functor_test.cu DEPS selected_rows_functor) endif() cc_test(concat_test SRCS concat_test.cc DEPS concat_functor tensor)