Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e4be077f
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e4be077f
编写于
7月 11, 2017
作者:
H
Helin Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add go testing into cmake and fix libpaddle_go_optimizer.a link path
上级
267f9a2c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
37 addition
and
12 deletion
+37
-12
CMakeLists.txt
CMakeLists.txt
+4
-0
cmake/generic.cmake
cmake/generic.cmake
+12
-9
go/CMakeLists.txt
go/CMakeLists.txt
+3
-0
go/master/CMakeLists.txt
go/master/CMakeLists.txt
+3
-0
go/pserver/CMakeLists.txt
go/pserver/CMakeLists.txt
+3
-0
go/pserver/client/c/CMakeLists.txt
go/pserver/client/c/CMakeLists.txt
+8
-0
go/pserver/optimizer.go
go/pserver/optimizer.go
+1
-2
go/utils/networkhelper/CMakeLists.txt
go/utils/networkhelper/CMakeLists.txt
+3
-0
paddle/CMakeLists.txt
paddle/CMakeLists.txt
+0
-1
未找到文件。
CMakeLists.txt
浏览文件 @
e4be077f
...
@@ -140,6 +140,10 @@ endif(USE_NNPACK)
...
@@ -140,6 +140,10 @@ endif(USE_NNPACK)
add_subdirectory
(
proto
)
add_subdirectory
(
proto
)
# "add_subdirectory(go)" should be placed after the following loine,
# because it depends on paddle/optimizer.
add_subdirectory
(
paddle/optimizer
)
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
# "add_subdirectory(paddle)" and "add_subdirectory(python)" should be
# placed after this block, because they depends on it.
# placed after this block, because they depends on it.
if
(
WITH_GOLANG
)
if
(
WITH_GOLANG
)
...
...
cmake/generic.cmake
浏览文件 @
e4be077f
...
@@ -301,7 +301,7 @@ function(go_library TARGET_NAME)
...
@@ -301,7 +301,7 @@ function(go_library TARGET_NAME)
file
(
GLOB GO_SOURCE RELATIVE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"*.go"
)
file
(
GLOB GO_SOURCE RELATIVE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"*.go"
)
string
(
REPLACE
"
${
PADDLE_GO_PATH
}
/"
""
CMAKE_CURRENT_SOURCE_REL_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
string
(
REPLACE
"
${
PADDLE_GO_PATH
}
/"
""
CMAKE_CURRENT_SOURCE_REL_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
# FIXME: link path
add_custom_command
(
TARGET
${
TARGET_NAME
}
POST_BUILD
add_custom_command
(
TARGET
${
TARGET_NAME
}
POST_BUILD
COMMAND rm
"
${${
TARGET_NAME
}
_LIB_PATH
}
"
COMMAND rm
"
${${
TARGET_NAME
}
_LIB_PATH
}
"
# Golang build source code
# Golang build source code
...
@@ -309,7 +309,7 @@ function(go_library TARGET_NAME)
...
@@ -309,7 +309,7 @@ function(go_library TARGET_NAME)
-o
"
${${
TARGET_NAME
}
_LIB_PATH
}
"
-o
"
${${
TARGET_NAME
}
_LIB_PATH
}
"
"./
${
CMAKE_CURRENT_SOURCE_REL_DIR
}
/
${
GO_SOURCE
}
"
"./
${
CMAKE_CURRENT_SOURCE_REL_DIR
}
/
${
GO_SOURCE
}
"
# must run under GOPATH
# must run under GOPATH
WORKING_DIRECTORY
"
${
PADDLE_IN_GOPATH
}
/go"
)
WORKING_DIRECTORY
"
${
PADDLE_IN_GOPATH
}
/go"
)
add_dependencies
(
${
TARGET_NAME
}
go_vendor
)
add_dependencies
(
${
TARGET_NAME
}
go_vendor
)
endfunction
(
go_library
)
endfunction
(
go_library
)
...
@@ -322,8 +322,8 @@ function(go_binary TARGET_NAME)
...
@@ -322,8 +322,8 @@ function(go_binary TARGET_NAME)
# FIXME: link path
# FIXME: link path
add_custom_command
(
OUTPUT
${
TARGET_NAME
}
_timestamp
add_custom_command
(
OUTPUT
${
TARGET_NAME
}
_timestamp
COMMAND env LIBRARY_PATH=
${
CMAKE_BINARY_DIR
}
/go/pserver/client/c/:$ENV{LIBRARY_PATH}
COMMAND env LIBRARY_PATH=
${
CMAKE_BINARY_DIR
}
/go/pserver/client/c/:$ENV{LIBRARY_PATH}
GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
build
GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
build
-o
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
"
-o
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
"
"./
${
CMAKE_CURRENT_SOURCE_REL_DIR
}
/
${
go_binary_SRCS
}
"
"./
${
CMAKE_CURRENT_SOURCE_REL_DIR
}
/
${
go_binary_SRCS
}
"
WORKING_DIRECTORY
"
${
PADDLE_IN_GOPATH
}
/go"
)
WORKING_DIRECTORY
"
${
PADDLE_IN_GOPATH
}
/go"
)
...
@@ -335,15 +335,18 @@ endfunction(go_binary)
...
@@ -335,15 +335,18 @@ endfunction(go_binary)
function
(
go_test TARGET_NAME
)
function
(
go_test TARGET_NAME
)
set
(
options OPTIONAL
)
set
(
options OPTIONAL
)
set
(
oneValueArgs
""
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs
SRCS
DEPS
)
set
(
multiValueArgs DEPS
)
cmake_parse_arguments
(
go_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
cmake_parse_arguments
(
go_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
add_custom_command
(
OUTPUT
${
TARGET_NAME
}
_timestamp
string
(
REPLACE
"
${
PADDLE_GO_PATH
}
"
""
CMAKE_CURRENT_SOURCE_REL_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_custom_target
(
${
TARGET_NAME
}
ALL DEPENDS go_vendor
${
go_test_DEPS
}
)
add_custom_command
(
TARGET
${
TARGET_NAME
}
POST_BUILD
COMMAND env GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
test
COMMAND env GOPATH=
${
GOPATH
}
${
CMAKE_Go_COMPILER
}
test
-c -o
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
"
-c -o
"
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
"
${
go_test_SRCS
}
".
${
CMAKE_CURRENT_SOURCE_REL_DIR
}
"
WORKING_DIRECTORY
"
${
PADDLE_IN_GOPATH
}
/go"
)
add_test
(
NAME
${
TARGET_NAME
}
COMMAND
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_custom_target
(
${
TARGET_NAME
}
ALL DEPENDS
${
TARGET_NAME
}
_timestamp
${
go_test_DEPS
}
)
add_test
(
${
TARGET_NAME
}
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
TARGET_NAME
}
)
endfunction
(
go_test
)
endfunction
(
go_test
)
function
(
proto_library TARGET_NAME
)
function
(
proto_library TARGET_NAME
)
...
...
go/CMakeLists.txt
浏览文件 @
e4be077f
...
@@ -17,3 +17,6 @@ add_subdirectory(pserver/client/c)
...
@@ -17,3 +17,6 @@ add_subdirectory(pserver/client/c)
add_subdirectory
(
cmd/pserver
)
add_subdirectory
(
cmd/pserver
)
add_subdirectory
(
cmd/master
)
add_subdirectory
(
cmd/master
)
add_subdirectory
(
master/c
)
add_subdirectory
(
master/c
)
add_subdirectory
(
master
)
add_subdirectory
(
pserver
)
add_subdirectory
(
utils/networkhelper
)
go/master/CMakeLists.txt
0 → 100644
浏览文件 @
e4be077f
if
(
WITH_TESTING
)
go_test
(
master_test
)
endif
()
go/pserver/CMakeLists.txt
0 → 100644
浏览文件 @
e4be077f
if
(
WITH_TESTING
)
go_test
(
pserver_test DEPS paddle_go_optimizer
)
endif
()
go/pserver/client/c/CMakeLists.txt
浏览文件 @
e4be077f
cc_library
(
paddle_go_optimizer DEPS paddle_optimizer paddle_proto glog gflags protobuf
)
cc_library
(
paddle_go_optimizer DEPS paddle_optimizer paddle_proto glog gflags protobuf
)
target_link_libraries
(
paddle_go_optimizer stdc++ m
)
target_link_libraries
(
paddle_go_optimizer stdc++ m
)
# Copy library to the required place.
# See: go/pserver/optimizer.go:
# // #cgo LDFLAGS: ${SRCDIR}/client/c/libpaddle_go_optimizer.a -lstdc++ -lm
add_custom_command
(
TARGET paddle_go_optimizer POST_BUILD
COMMAND cp
"
${
CMAKE_CURRENT_BINARY_DIR
}
/libpaddle_go_optimizer.a"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
go_library
(
paddle_pserver_cclient STATIC DEPS paddle_go_optimizer
)
go_library
(
paddle_pserver_cclient STATIC DEPS paddle_go_optimizer
)
if
(
WITH_TESTING
)
if
(
WITH_TESTING
)
# FIXME: this test requires pserver which is not managed by the test
# FIXME: this test requires pserver which is not managed by the test
...
...
go/pserver/optimizer.go
浏览文件 @
e4be077f
package
pserver
package
pserver
// #cgo CFLAGS: -I ../../
// #cgo CFLAGS: -I ../../
// //FIXME: ldflags contain "build" path
// #cgo LDFLAGS: ${SRCDIR}/client/c/libpaddle_go_optimizer.a -lstdc++ -lm
// #cgo LDFLAGS: ${SRCDIR}/../../build/go/pserver/client/c/libpaddle_go_optimizer.a -lstdc++ -lm
// #include "paddle/optimizer/optimizer.h"
// #include "paddle/optimizer/optimizer.h"
// #include <stdlib.h>
// #include <stdlib.h>
// #include <string.h>
// #include <string.h>
...
...
go/utils/networkhelper/CMakeLists.txt
0 → 100644
浏览文件 @
e4be077f
if
(
WITH_TESTING
)
go_test
(
network_helper_test
)
endif
()
paddle/CMakeLists.txt
浏览文件 @
e4be077f
...
@@ -8,7 +8,6 @@ add_subdirectory(gserver)
...
@@ -8,7 +8,6 @@ add_subdirectory(gserver)
add_subdirectory
(
pserver
)
add_subdirectory
(
pserver
)
add_subdirectory
(
trainer
)
add_subdirectory
(
trainer
)
add_subdirectory
(
scripts
)
add_subdirectory
(
scripts
)
add_subdirectory
(
optimizer
)
add_subdirectory
(
string
)
add_subdirectory
(
string
)
if
(
Boost_FOUND
)
if
(
Boost_FOUND
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录