CMakeLists.txt 2.4 KB
Newer Older
Y
Yu Yang 已提交
1 2 3 4
set(AVX_SOURCES
    src/hl_math.cc
    src/hl_avx_functions.cc
)
5 6 7 8 9 10 11 12 13 14 15

if(WITH_AVX)
    set(CUDA_SOURCES
        src/hl_time.cc
        src/hl_cpu_functions.cc
        ${AVX_SOURCES})
else()
    set(CUDA_SOURCES
        src/hl_time.cc
        src/hl_cpu_functions.cc)
endif()
Z
zhangjinchao01 已提交
16 17

set(CUDA_CXX_WITH_GPU_SOURCES
18
    src/hl_cudart_wrap.cc
Z
zhangjinchao01 已提交
19 20
    src/hl_cuda_cublas.cc
    src/hl_cuda_cudnn.cc
21 22
    src/hl_cuda_device.cc
    )
Z
zhangjinchao01 已提交
23

24 25 26 27 28 29 30 31 32 33 34 35 36
if(WITH_GPU)
    set(CUDA_CXX_SOURCES
        src/hl_dso_loader.cc
        src/hl_warpctc_wrap.cc
        ${CUDA_CXX_WITH_GPU_SOURCES})

    set_source_files_properties(${CUDA_CXX_SOURCES}
                                PROPERTIES COMPILE_FLAGS "-D__NVCC__")
else()
    set(CUDA_CXX_SOURCES
        src/hl_dso_loader.cc
        src/hl_warpctc_wrap.cc)
endif()
Z
zhangjinchao01 已提交
37

Y
Yu Yang 已提交
38
set_source_files_properties(${AVX_SOURCES}
Z
zhangjinchao01 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
                            PROPERTIES COMPILE_FLAGS "-mavx")

set(CUDA_CU_SOURCES
    src/hl_perturbation_util.cu
    src/hl_cuda_aggregate.cu
    src/hl_cuda_matrix.cu
    src/hl_cuda_sparse.cu
    src/hl_cuda_cnn.cu
    src/hl_cuda_lstm.cu
    src/hl_top_k.cu
    src/hl_batch_transpose.cu
    src/hl_cuda_sequence.cu
    src/hl_table_apply.cu)

set(CUDA_HEADERS
    include/hl_time.h
    include/hl_dso_loader.h
56
    include/hl_warpctc_wrap.h
Z
zhangjinchao01 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
    include/hl_sequence.h
    include/hl_cuda_cublas.h
    include/hl_batch_transpose.h
    include/hl_avx_functions.h
    include/hl_sparse.h
    include/hl_functions.h
    include/hl_cuda_cudnn.h
    include/hl_activation_functions.h
    include/hl_base.h
    include/stub/hl_cuda_cudnn_stub.h
    include/stub/hl_cuda_stub.h
    include/stub/hl_cuda_cublas_stub.h
    include/stub/hl_cnn_stub.h
    include/stub/hl_lstm_stub.h
    include/stub/hl_sequence_stub.h
    include/stub/hl_aggregate_stub.h
    include/stub/hl_sparse_stub.h
    include/stub/hl_matrix_stub.h
    include/hl_aggregate.h
    include/hl_cuda.h
    include/hl_lstm.h
    include/hl_table_apply.h
    include/hl_gpu.h
    include/hl_top_k.h
    include/hl_matrix.h
    include/hl_cnn.h)

if(WITH_GPU)
    cuda_add_library(paddle_cuda
        ${CUDA_SOURCES}
        ${CUDA_CU_SOURCES}
88
        ${CUDA_CXX_SOURCES})
Z
zhangjinchao01 已提交
89
else()
90 91 92
    add_library(paddle_cuda
                ${CUDA_SOURCES}
                ${CUDA_CXX_SOURCES})
Z
zhangjinchao01 已提交
93 94
endif()

95 96 97
add_style_check_target(paddle_cuda
                       ${CUDA_SOURCES}
                       ${CUDA_HEADERS}
98
                       ${CUDA_CXX_SOURCES})