Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
be706306
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
be706306
编写于
5月 05, 2019
作者:
S
superjomn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable lite_test with light weight framework
上级
10e64565
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
87 addition
and
20 deletion
+87
-20
cmake/generic.cmake
cmake/generic.cmake
+38
-0
paddle/fluid/lite/CMakeLists.txt
paddle/fluid/lite/CMakeLists.txt
+3
-1
paddle/fluid/lite/api/CMakeLists.txt
paddle/fluid/lite/api/CMakeLists.txt
+4
-3
paddle/fluid/lite/api/cxx_api.cc
paddle/fluid/lite/api/cxx_api.cc
+1
-1
paddle/fluid/lite/api/cxx_api.h
paddle/fluid/lite/api/cxx_api.h
+2
-2
paddle/fluid/lite/api/cxx_api_test.cc
paddle/fluid/lite/api/cxx_api_test.cc
+2
-2
paddle/fluid/lite/api/light_api.h
paddle/fluid/lite/api/light_api.h
+2
-2
paddle/fluid/lite/api/light_api_test.cc
paddle/fluid/lite/api/light_api_test.cc
+1
-1
paddle/fluid/lite/core/CMakeLists.txt
paddle/fluid/lite/core/CMakeLists.txt
+1
-0
paddle/fluid/lite/core/lite_gtest_main.cc
paddle/fluid/lite/core/lite_gtest_main.cc
+21
-0
paddle/fluid/lite/core/mir/CMakeLists.txt
paddle/fluid/lite/core/mir/CMakeLists.txt
+9
-3
paddle/fluid/lite/core/op_lite.h
paddle/fluid/lite/core/op_lite.h
+0
-4
paddle/fluid/lite/kernels/CMakeLists.txt
paddle/fluid/lite/kernels/CMakeLists.txt
+3
-1
未找到文件。
cmake/generic.cmake
浏览文件 @
be706306
...
...
@@ -403,6 +403,44 @@ function(cc_test TARGET_NAME)
endif
()
endfunction
(
cc_test
)
# cc_test without default dependencies
function
(
raw_cc_test TARGET_NAME
)
if
(
WITH_TESTING
)
set
(
options SERIAL
)
set
(
oneValueArgs
""
)
set
(
multiValueArgs SRCS DEPS ARGS
)
cmake_parse_arguments
(
cc_test
"
${
options
}
"
"
${
oneValueArgs
}
"
"
${
multiValueArgs
}
"
${
ARGN
}
)
add_executable
(
${
TARGET_NAME
}
${
cc_test_SRCS
}
)
if
(
WIN32
)
if
(
"
${
cc_test_DEPS
}
;"
MATCHES
"python;"
)
list
(
REMOVE_ITEM cc_test_DEPS python
)
target_link_libraries
(
${
TARGET_NAME
}
${
PYTHON_LIBRARIES
}
)
endif
()
endif
(
WIN32
)
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
target_link_libraries
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
${
os_dependency_modules
}
lite_gtest_main gtest gflags glog
)
add_dependencies
(
${
TARGET_NAME
}
${
cc_test_DEPS
}
lite_gtest_main gtest gflags glog
)
common_link
(
${
TARGET_NAME
}
)
add_test
(
NAME
${
TARGET_NAME
}
COMMAND
${
TARGET_NAME
}
${
cc_test_ARGS
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
if
(
${
cc_test_SERIAL
}
)
set_property
(
TEST
${
TARGET_NAME
}
PROPERTY RUN_SERIAL 1
)
endif
()
# No unit test should exceed 10 minutes.
set_tests_properties
(
${
TARGET_NAME
}
PROPERTIES TIMEOUT 600
)
endif
()
endfunction
(
raw_cc_test
)
function
(
lite_cc_test args
)
if
(
LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
)
message
(
STATUS
"building lite raw test:
${
args
}
"
)
raw_cc_test
(
${
args
}
${
ARGN
}
)
else
()
cc_test
(
${
args
}
${
ARGN
}
)
endif
()
endfunction
()
function
(
nv_library TARGET_NAME
)
if
(
WITH_GPU
)
set
(
options STATIC static SHARED shared
)
...
...
paddle/fluid/lite/CMakeLists.txt
浏览文件 @
be706306
add_subdirectory
(
core
)
add_subdirectory
(
x86
)
add_subdirectory
(
host
)
add_subdirectory
(
cuda
)
if
(
LITE_WITH_CUDA
)
add_subdirectory
(
cuda
)
endif
()
add_subdirectory
(
operators
)
add_subdirectory
(
kernels
)
add_subdirectory
(
model_parser
)
...
...
paddle/fluid/lite/api/CMakeLists.txt
浏览文件 @
be706306
set
(
cxx_api_lite_deps scope_lite host_kernels ops_lite optimizer_lite target_wrapper_host
kernels_cuda
optimizer_lite model_parser_lite
)
set
(
cxx_api_lite_deps scope_lite host_kernels ops_lite optimizer_lite target_wrapper_host optimizer_lite model_parser_lite
)
if
(
LITE_WITH_CUDA
)
set
(
cxx_api_lite_deps
${
cxx_api_lite_deps
}
kernels_cuda
)
cc_library
(
cxx_api_lite_cuda SRCS cxx_api.cc DEPS
${
cxx_api_lite_deps
}
target_wrapper_cuda
)
nv_test
(
test_cxx_api_lite_cuda SRCS cxx_api_test.cc DEPS cxx_api_lite_cuda
)
endif
()
...
...
@@ -15,5 +16,5 @@ endif()
cc_library
(
light_api_lite SRCS light_api.cc DEPS
${
light_api_deps
}
)
cc_test
(
test_cxx_api_lite SRCS cxx_api_test.cc DEPS cxx_api_lite model_parser_lite target_wrapper_host host_kernels
)
cc_test
(
test_light_api SRCS light_api_test.cc DEPS light_api_lite
)
lite_
cc_test
(
test_cxx_api_lite SRCS cxx_api_test.cc DEPS cxx_api_lite model_parser_lite target_wrapper_host host_kernels
)
lite_
cc_test
(
test_light_api SRCS light_api_test.cc DEPS light_api_lite
)
paddle/fluid/lite/api/cxx_api.cc
浏览文件 @
be706306
...
...
@@ -18,7 +18,7 @@
namespace
paddle
{
namespace
lite
{
void
Cxx
Predictor
::
SaveModel
(
const
std
::
string
&
dir
)
{
void
Light
Predictor
::
SaveModel
(
const
std
::
string
&
dir
)
{
MkDirRecursively
(
dir
.
c_str
());
program_
->
PersistModel
(
dir
,
program_desc_
);
}
...
...
paddle/fluid/lite/api/cxx_api.h
浏览文件 @
be706306
...
...
@@ -25,9 +25,9 @@ namespace lite {
struct
Config
{};
class
Cxx
Predictor
{
class
Light
Predictor
{
public:
Cxx
Predictor
()
{
scope_
=
std
::
make_shared
<
Scope
>
();
}
Light
Predictor
()
{
scope_
=
std
::
make_shared
<
Scope
>
();
}
void
Build
(
const
std
::
string
&
model_path
,
const
Place
&
prefer_place
,
const
std
::
vector
<
Place
>&
valid_places
)
{
...
...
paddle/fluid/lite/api/cxx_api_test.cc
浏览文件 @
be706306
...
...
@@ -22,7 +22,7 @@ namespace paddle {
namespace
lite
{
TEST
(
CXXApi
,
test
)
{
lite
::
Cxx
Predictor
predictor
;
lite
::
Light
Predictor
predictor
;
#ifndef LITE_WITH_CUDA
std
::
vector
<
Place
>
valid_places
({
Place
{
TARGET
(
kHost
),
PRECISION
(
kFloat
)}});
#else
...
...
@@ -60,7 +60,7 @@ TEST(CXXApi, test) {
}
TEST
(
CXXApi
,
save_model
)
{
lite
::
Cxx
Predictor
predictor
;
lite
::
Light
Predictor
predictor
;
std
::
vector
<
Place
>
valid_places
({
Place
{
TARGET
(
kHost
),
PRECISION
(
kFloat
)}});
predictor
.
Build
(
"/home/chunwei/project/models/model2"
,
Place
{
TARGET
(
kCUDA
),
PRECISION
(
kFloat
)},
valid_places
);
...
...
paddle/fluid/lite/api/light_api.h
浏览文件 @
be706306
...
...
@@ -28,9 +28,9 @@
namespace
paddle
{
namespace
lite
{
class
Cxx
Predictor
{
class
Light
Predictor
{
public:
Cxx
Predictor
()
{
scope_
=
std
::
make_shared
<
Scope
>
();
}
Light
Predictor
()
{
scope_
=
std
::
make_shared
<
Scope
>
();
}
void
Build
(
const
std
::
string
&
model_dir
)
{
framework
::
proto
::
ProgramDesc
desc
;
...
...
paddle/fluid/lite/api/light_api_test.cc
浏览文件 @
be706306
...
...
@@ -23,7 +23,7 @@ const std::string model_dir =
"api/optimized_model"
;
TEST
(
LightAPI
,
load
)
{
Cxx
Predictor
predictor
;
Light
Predictor
predictor
;
predictor
.
Build
(
model_dir
);
auto
*
input_tensor
=
predictor
.
GetInput
(
0
);
...
...
paddle/fluid/lite/core/CMakeLists.txt
浏览文件 @
be706306
cc_library
(
lite_gtest_main SRCS lite_gtest_main.cc
)
cc_library
(
memory_lite SRCS memory.cc
)
cc_library
(
target_wrapper_lite SRCS target_wrapper.cc
)
cc_library
(
tensor_lite SRCS tensor.cc DEPS memory_lite target_wrapper_lite
)
...
...
paddle/fluid/lite/core/lite_gtest_main.cc
0 → 100644
浏览文件 @
be706306
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <gtest/gtest.h>
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
paddle/fluid/lite/core/mir/CMakeLists.txt
浏览文件 @
be706306
...
...
@@ -24,14 +24,20 @@ cc_test(test_ssa_graph SRCS ssa_graph_test.cc DEPS
mir_pass_manager
program_fake_utils
)
cc_test
(
test_variable_place_infrence_pass SRCS variable_place_inference_pass_test.cc
DEPS
set
(
test_variable_place_infrence_pass_
DEPS
ops_lite
host_kernels
kernels_cuda
mir_passes
mir_pass_manager
optimizer_lite
program_fake_utils
target_wrapper_host
target_wrapper_cuda
)
if
(
LITE_WITH_CUDA
)
set
(
test_variable_place_infrence_pass_DEPS
${
test_variable_place_infrence_pass_DEPS
}
target_wrapper_cuda
kernels_cuda
)
endif
()
cc_test
(
test_variable_place_infrence_pass SRCS variable_place_inference_pass_test.cc DEPS
${
test_variable_place_infrence_pass_DEPS
}
)
paddle/fluid/lite/core/op_lite.h
浏览文件 @
be706306
...
...
@@ -15,7 +15,6 @@
#pragma once
#include <glog/logging.h>
#include <boost/variant.hpp>
#include <map>
#include <memory>
#include <string>
...
...
@@ -28,9 +27,6 @@
namespace
paddle
{
namespace
lite
{
using
any_t
=
boost
::
variant
<
int
,
float
,
framework
::
Variable
*>
;
using
anys_t
=
std
::
map
<
std
::
string
,
any_t
>
;
// For registry factory.
struct
Registry
{
void
Touch
()
{}
...
...
paddle/fluid/lite/kernels/CMakeLists.txt
浏览文件 @
be706306
set
(
lite_kernel_deps type_system kernel_lite op_registry_lite
)
add_subdirectory
(
host
)
add_subdirectory
(
arm
)
add_subdirectory
(
cuda
)
if
(
LITE_WITH_CUDA
)
add_subdirectory
(
cuda
)
endif
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录