Skip to content

Commit db569f2

Browse files
committed
fix merge conflict
2 parents 5ece5c9 + 2e1d968 commit db569f2

File tree

80 files changed

+5783
-537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+5783
-537
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ addons:
3535
- libgoogle-glog-dev
3636
- libgflags-dev
3737
- libgtest-dev
38+
- curl
39+
- lcov
3840
- graphviz
3941
before_install:
4042
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo paddle/scripts/travis/before_install.linux.sh; fi

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(PADDLE_VERSION ${PADDLE_MAJOR_VERSION}.${PADDLE_MINOR_VERSION}.${PADDLE_PATC
99
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
1010
set(PROJ_ROOT ${CMAKE_SOURCE_DIR})
1111
include(package)
12-
include(swig)
12+
find_package(SWIG 2.0)
1313
find_package(CUDA QUIET)
1414
find_package(Protobuf REQUIRED)
1515
find_package(PythonLibs 2.7 REQUIRED)
@@ -40,6 +40,9 @@ option(WITH_TESTING "Compile and run unittest for PaddlePaddle" ${GTEST_FOUND})
4040
option(WITH_DOC "Compile PaddlePaddle with documentation" OFF)
4141
option(WITH_SWIG_PY "Compile PaddlePaddle with py PaddlePaddle prediction api" ${SWIG_FOUND})
4242
option(ON_TRAVIS "Running test on travis-ci or not." OFF)
43+
option(ON_COVERALLS "Generating code coverage data on coveralls or not." OFF)
44+
option(COVERALLS_UPLOAD "Uploading the generated coveralls json." ON)
45+
4346
if(NOT CMAKE_BUILD_TYPE)
4447
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
4548
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
@@ -49,11 +52,16 @@ endif()
4952
include(enableCXX11)
5053
include(cpplint)
5154
include(ccache)
55+
if(WITH_RDMA)
56+
include(rdma)
57+
endif()
5258
include(util)
5359
include(flags)
5460
include(cudnn)
5561
include(FindPythonModule)
5662
include(check_packages)
63+
include(swig)
64+
include(coveralls)
5765

5866
# add PaddlePaddle version
5967
if(DEFINED ENV{PADDLE_VERSION})
@@ -129,9 +137,11 @@ else(WITH_PYTHON)
129137
add_definitions(-DPADDLE_NO_PYTHON)
130138
endif(WITH_PYTHON)
131139

132-
if(NOT WITH_RDMA)
133-
add_definitions(-DPADDLE_DISABLE_RDMA)
134-
endif()
140+
if(WITH_RDMA)
141+
include_directories("${RDMA_INC_DIR}")
142+
else(WITH_RDMA)
143+
add_definitions(-DPADDLE_DISABLE_RDMA)
144+
endif(WITH_RDMA)
135145

136146
if(WITH_GLOG)
137147
add_definitions(-DPADDLE_USE_GLOG)

ISSUE_TEMPLATE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Thank you for contributing to PaddlePaddle. Submitting an issue is a great help for us.
2+
Both Chinese and English issues are welcome.
3+
4+
It's hard to solve a problem when important details are missing.
5+
Before submitting the issue, look over the following criteria before handing your request in.
6+
7+
- [ ] Was there a similar issue submitted or resolved before ? You could search issue in the github.
8+
- [ ] Did you retrieve your issue from widespread search engines ?
9+
- [ ] Is my description of the issue clear enough to reproduce this problem?
10+
* If some errors occurred, we need details about `how do you run your code?`, `what system do you use?`, `Are you using GPU or not?`, etc.
11+
* If you use an recording [asciinema](https://asciinema.org/) to show what you are doing to make it happen, that's awesome! We could help you solve the problem more quickly.
12+
- [ ] Is my description of the issue use the github markdown correctly?
13+
* Please use the proper markdown syntaxes for styling all forms of writing, e.g, source code, error information, etc.
14+
* Check out [this page](https://guides.github.com/features/mastering-markdown/) to find out much more about markdown.

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# PaddlePaddle
22

3-
| **`Linux`** | **`License`** | **`Chat Room`** |
4-
|----------------|---------------|-----------------|
5-
|[![Build Status](https://travis-ci.org/baidu/Paddle.svg?branch=master)](https://travis-ci.org/baidu/Paddle)|[![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)|[![Join the chat at https://gitter.im/PaddlePaddle/Deep_Learning](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PaddlePaddle/Deep_Learning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)|
3+
4+
[![Build Status](https://travis-ci.org/baidu/Paddle.svg?branch=master)](https://travis-ci.org/baidu/Paddle)
5+
[![Coverage Status](https://coveralls.io/repos/github/baidu/Paddle/badge.svg?branch=develop)](https://coveralls.io/github/baidu/Paddle?branch=develop)
6+
[![Join the chat at https://gitter.im/PaddlePaddle/Deep_Learning](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PaddlePaddle/Deep_Learning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7+
[![License](https://img.shields.io/badge/license-Apache%202.0-green.svg)](LICENSE)
68

79
Welcome to the PaddlePaddle GitHub.
810

cmake/cblas.cmake

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Find the CBlas libraries
1+
# Find the CBlas and lapack libraries
22
#
33
# It will search MKL, atlas, OpenBlas, reference-cblas in order.
44
#
@@ -19,6 +19,8 @@ set(MKL_ROOT $ENV{MKL_ROOT} CACHE PATH "Folder contains MKL")
1919

2020
find_path(MKL_INCLUDE_DIR mkl.h PATHS
2121
${MKL_ROOT}/include)
22+
find_path(MKL_INCLUDE_DIR mkl_lapacke.h PATHS
23+
${MKL_ROOT}/include)
2224
find_library(MKL_CORE_LIB NAMES mkl_core PATHS
2325
${MKL_ROOT}/lib
2426
${MKL_ROOT}/lib/intel64)
@@ -37,6 +39,7 @@ if(MKL_INCLUDE_DIR AND MKL_CORE_LIB AND MKL_SEQUENTIAL_LIB AND MKL_INTEL_LP64)
3739
${MKL_SEQUENTIAL_LIB}
3840
${MKL_CORE_LIB})
3941
add_definitions(-DPADDLE_USE_MKL)
42+
message(STATUS "Found MKL (include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBS})")
4043
return() # return file.
4144
endif()
4245

@@ -55,15 +58,19 @@ set(ATLAS_LIB_SEARCH_PATHS
5558
)
5659
find_path(ATLAS_INC_DIR NAMES cblas.h
5760
PATHS ${ATLAS_INCLUDE_SEARCH_PATHS})
61+
find_path(ATLAS_CLAPACK_INC_DIR NAMES clapack.h
62+
PATHS ${ATLAS_INCLUDE_SEARCH_PATHS})
5863
find_library(ATLAS_CBLAS_LIB NAMES cblas libcblas.so.3
5964
PATHS ${ATLAS_LIB_SEARCH_PATHS})
60-
find_library(ATLAS_LIB NAMES atlas libatlas.so.3
65+
find_library(ATLAS_LIB NAMES lapack_atlas liblapack_atlas.so.3
6166
PATHS ${ATLAS_LIB_SEARCH_PATHS})
6267

6368
if(ATLAS_INC_DIR AND ATLAS_CBLAS_LIB AND ATLAS_LIB)
6469
set(CBLAS_PROVIDER ATLAS)
65-
set(CBLAS_INC_DIR ${ATLAS_INC_DIR})
70+
set(CBLAS_INC_DIR ${ATLAS_INC_DIR} ${ATLAS_CLAPACK_INC_DIR})
6671
set(CBLAS_LIBS ${ATLAS_LIB} ${ATLAS_CBLAS_LIB})
72+
add_definitions(-DPADDLE_USE_ATLAS)
73+
message(STATUS "Found Atlas (include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBS})")
6774
return()
6875
endif()
6976

@@ -83,13 +90,16 @@ set(OPENBLAS_LIB_SEARCH_PATHS
8390

8491
find_path(OPENBLAS_INC_DIR NAMES cblas.h
8592
PATHS ${OPENBLAS_INCLUDE_SEARCH_PATHS})
93+
find_path(OPENBLAS_LAPACKE_INC_DIR NAMES lapacke.h
94+
PATHS ${OPENBLAS_INCLUDE_SEARCH_PATHS})
8695
find_library(OPENBLAS_LIB NAMES openblas
8796
PATHS ${OPENBLAS_LIB_SEARCH_PATHS})
8897

8998
if(OPENBLAS_INC_DIR AND OPENBLAS_LIB)
9099
set(CBLAS_PROVIDER OPENBLAS)
91100
set(CBLAS_INC_DIR ${OPENBLAS_INC_DIR})
92101
set(CBLAS_LIBS ${OPENBLAS_LIB})
102+
message(STATUS "Found OpenBlas (include: ${CBLAS_INC_DIR}, library: ${CBLAS_LIBS})")
93103
return()
94104
endif()
95105

cmake/coveralls.cmake

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# CMake script for code coverage.
2+
# If _COVERALLS_UPLOAD is ON, it will upload json files to overalls.io automatically.
3+
4+
# Param _COVERAGE_SRCS A list of coverage source files.
5+
# Param _COVERALLS_UPLOAD Upload the result to coveralls.
6+
# Param _CMAKE_SCRIPT_PATH CMake script path.
7+
function(code_coverage _COVERAGE_SRCS _COVERALLS_UPLOAD _CMAKE_SCRIPT_PATH)
8+
# clean previous gcov data.
9+
file(REMOVE_RECURSE ${PROJECT_BINARY_DIR}/*.gcda)
10+
11+
# find curl for upload JSON soon.
12+
if (_COVERALLS_UPLOAD)
13+
find_program(CURL_EXECUTABLE curl)
14+
if (NOT CURL_EXECUTABLE)
15+
message(FATAL_ERROR "Coveralls: curl not found!")
16+
endif()
17+
endif()
18+
19+
# When passing a CMake list to an external process, the list
20+
# will be converted from the format "1;2;3" to "1 2 3".
21+
set(COVERAGE_SRCS "")
22+
foreach (SINGLE_SRC ${_COVERAGE_SRCS})
23+
set(COVERAGE_SRCS "${COVERAGE_SRCS}*${SINGLE_SRC}")
24+
endforeach()
25+
26+
# query number of logical cores
27+
cmake_host_system_information(RESULT core_size QUERY NUMBER_OF_LOGICAL_CORES)
28+
# coveralls json file.
29+
set(COVERALLS_FILE ${PROJECT_BINARY_DIR}/coveralls.json)
30+
add_custom_target(coveralls_generate
31+
# Run regress tests.
32+
COMMAND ${CMAKE_CTEST_COMMAND}
33+
-j ${core_size}
34+
--output-on-failure
35+
# Generate Gcov and translate it into coveralls JSON.
36+
COMMAND ${CMAKE_COMMAND}
37+
-DCOVERAGE_SRCS="${COVERAGE_SRCS}"
38+
-DCOVERALLS_OUTPUT_FILE="${COVERALLS_FILE}"
39+
-DCOV_PATH="${PROJECT_BINARY_DIR}"
40+
-DPROJECT_ROOT="${PROJECT_SOURCE_DIR}"
41+
-P "${_CMAKE_SCRIPT_PATH}/coverallsGcovJsons.cmake"
42+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
43+
COMMENT "Coveralls: generating coveralls output..."
44+
)
45+
46+
if (_COVERALLS_UPLOAD)
47+
message("COVERALLS UPLOAD: ON")
48+
# Upload the JSON to coveralls.
49+
add_custom_target(coveralls_upload
50+
COMMAND ${CURL_EXECUTABLE}
51+
-S -F json_file=@${COVERALLS_FILE}
52+
https://coveralls.io/api/v1/jobs
53+
DEPENDS coveralls_generate
54+
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
55+
COMMENT "Coveralls: uploading coveralls output...")
56+
57+
add_custom_target(coveralls DEPENDS coveralls_upload)
58+
else()
59+
message("COVERALLS UPLOAD: OFF")
60+
add_custom_target(coveralls DEPENDS coveralls_generate)
61+
endif()
62+
endfunction()
63+
64+
if(ON_COVERALLS)
65+
set(CMAKE_BUILD_TYPE "Debug")
66+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
67+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
68+
69+
set(EXCLUDE_DIRS
70+
"demo/"
71+
"build/"
72+
"tests/"
73+
".test_env/"
74+
)
75+
76+
if(WITH_GPU)
77+
file(GLOB_RECURSE PADDLE_SOURCES RELATIVE "${PROJECT_SOURCE_DIR}" "*.cpp" "*.cc" ".c" "*.cu")
78+
else()
79+
file(GLOB_RECURSE PADDLE_SOURCES RELATIVE "${PROJECT_SOURCE_DIR}" "*.cpp" "*.cc" "*.c")
80+
endif()
81+
82+
# exclude trivial files in PADDLE_SOURCES
83+
foreach(EXCLUDE_DIR ${EXCLUDE_DIRS})
84+
foreach(TMP_PATH ${PADDLE_SOURCES})
85+
string(FIND ${TMP_PATH} ${EXCLUDE_DIR} EXCLUDE_DIR_FOUND)
86+
if(NOT ${EXCLUDE_DIR_FOUND} EQUAL -1)
87+
list(REMOVE_ITEM PADDLE_SOURCES ${TMP_PATH})
88+
endif()
89+
endforeach(TMP_PATH)
90+
endforeach()
91+
92+
# convert to absolute path
93+
set(PADDLE_SRCS "")
94+
foreach(PADDLE_SRC ${PADDLE_SOURCES})
95+
set(PADDLE_SRCS "${PADDLE_SRCS};${PROJECT_SOURCE_DIR}/${PADDLE_SRC}")
96+
endforeach()
97+
98+
code_coverage(
99+
"${PADDLE_SRCS}"
100+
${COVERALLS_UPLOAD}
101+
"${PROJECT_SOURCE_DIR}/cmake"
102+
)
103+
endif()

0 commit comments

Comments
 (0)