Add the automatic update of submodules in cmake.#951
Add the automatic update of submodules in cmake.#951Xreki wants to merge 3 commits intoPaddlePaddle:developfrom
Conversation
|
LGTM |
| # version.cmake will get the current PADDLE_VERSION | ||
| include(version) | ||
| add_definitions(-DPADDLE_VERSION=${PADDLE_VERSION}) | ||
| include(submodules) |
There was a problem hiding this comment.
名字叫submodules,以后的第三方模块意思是都写里面?
There was a problem hiding this comment.
这个,其实我不确定,原来有考虑要不要写一个通用的。不过,也许以后也不会再有submodule了。
| endfunction(FindWarpCTC) | ||
|
|
||
| FindWarpCTC() | ||
| if(NOT WARPCTC_INCLUDE_DIR) |
There was a problem hiding this comment.
是不是可以不用FindWarpCTC()?
if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules)
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init -- warp-ctc
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_OUTPUT
RESULT_VARIABLE GIT_RESULT)
message(STATUS ${GIT_OUTPUT})
if(${GIT_RESULT})
...
else()
fatal...
endif()
endif()另外modules一次性 --recursive 有什么区别?
There was a problem hiding this comment.
我其实对于这个GIT_RESULT做了挺多次实验,发现有时候,执行git submodule update --init -- warp-ctc并没有把warp-ctc拉下来,返回结果一直都是0。
There was a problem hiding this comment.
There was a problem hiding this comment.
这里可否用 @gangliao 在 https://github.com/gangliao/CodeCoverageCMake/blob/master/cmake/third_party.cmake 这里使用的 ExternalProject_Add,而不是自己写代码去 git pull warp-ctc 呢?
reyoung
left a comment
There was a problem hiding this comment.
另外,wrapCTC应该放到thrid_party里面,而不是根目录里面。
| @@ -0,0 +1,28 @@ | |||
| # Automatically init submodules | |||
| if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules) | |||
There was a problem hiding this comment.
PROJECT_SOURCE_DIR => ${PROJ_ROOT}
| WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
| OUTPUT_VARIABLE GIT_OUTPUT | ||
| RESULT_VARIABLE GIT_RESULT) | ||
| message(STATUS ${GIT_OUTPUT}) |
There was a problem hiding this comment.
我其实对于这个GIT_RESULT做了挺多次实验,发现有时候,执行git submodule update --init -- warp-ctc并没有把warp-ctc拉下来,返回结果一直都是0。不知道是不是我哪里弄得不对。。。
|
@reyoung 我想warp-ctc也是应该放在某个子目录下。但是感觉warp-ctc更像plugin而不是third_party,因为warp-ctc是一个可选的功能,当不用到这个功能,就不需要编译warp-ctc本身,而这不会影响paddle其他功能的使用。 |
| #ifndef HL_WARPCTC_WRAP_H_ | ||
| #define HL_WARPCTC_WRAP_H_ | ||
|
|
||
| #include "ctc.h" |
There was a problem hiding this comment.
这里是不是还是原来的写法(`#include "warp-ctc/include/ctc.h")更清晰,能体现出头文件到底在哪里。
There was a problem hiding this comment.
增加了一个WARPCTC_ROOT的cmake选项,原意是如果用户机器上已经安装过warp-ctc,则可以直接使用已经安装好的这个版本。看是否需要支持这种情况吧。
| endfunction(FindWarpCTC) | ||
|
|
||
| FindWarpCTC() | ||
| if(NOT WARPCTC_INCLUDE_DIR) |
There was a problem hiding this comment.
这里可否用 @gangliao 在 https://github.com/gangliao/CodeCoverageCMake/blob/master/cmake/third_party.cmake 这里使用的 ExternalProject_Add,而不是自己写代码去 git pull warp-ctc 呢?
|
@wangkuiyi 我尝试过 ExternalProject_Add(warp-ctc
PREFIX ${PROJECT_SOURCE_DIR}/warp-ctc
GIT_REPOSITORY "https://github.com/baidu-research/warp-ctc.git")也可以指定某次commit或者tag。
要不要在编译paddle的时候自动编译warp-ctc,这个问题也曾经和 @gangliao @luotao1 讨论过。 |
third_party是引第三方库的标准做法和标准目录结构。如果不是特别必要,还是大家咋弄咱咋弄比较好。 另外,单说plugin这个东西,和动态库以及运行时载入动态库的含义并不一致。关于plugin这个东西,一般会认为是具有统计的接口(interface)的一些不同动态库实现,这些动态库实现可以在运行时载入,卸载。为程序增加和删除功能。重点还是得接口一致,所以和这个ctc的实现不太一样。 可能的plugin的文章: |
|
@gangliao 将使用cmake的 |
* documents will be ready afterwards not ready now * Update index_en.rst * Update index_cn.rst * Update index_en.rst * Update index_cn.rst * Update index_en.rst
Tuple的init参数修改
增加了submodules.cmake,其中可以:
-DWARPCTC_ROOT=...设置warpctc头文件ctc.h的路径WARPCTC_ROOT/include和${PROJECT_SOURCE_DIR}/warp-ctc/include目录下都没有找到头文件'ctc.h'时,执行命令git submodule update --init -- warp-ctc,自动下载submodule。目前这个功能只能自动下载warp-ctc,看看这个功能是否需要吧。