Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
327ca7c6
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
327ca7c6
编写于
3月 21, 2019
作者:
Z
zhangyang0701
提交者:
GitHub
3月 21, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1525 from zhangyang0701/develop
add new interface function for FPGA track close
#1479
上级
c78543c7
a2f7e643
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
33 addition
and
5 deletion
+33
-5
src/fpga/common/fpga_common.cpp
src/fpga/common/fpga_common.cpp
+12
-0
src/fpga/common/fpga_common.h
src/fpga/common/fpga_common.h
+4
-0
src/io/paddle_inference_api.h
src/io/paddle_inference_api.h
+2
-0
test/fpga/test_marker_api.cpp
test/fpga/test_marker_api.cpp
+6
-3
test/fpga/test_rfcn_api.cpp
test/fpga/test_rfcn_api.cpp
+9
-2
未找到文件。
src/fpga/common/fpga_common.cpp
浏览文件 @
327ca7c6
...
@@ -197,5 +197,17 @@ uint64_t vaddr_to_paddr(void *address) {
...
@@ -197,5 +197,17 @@ uint64_t vaddr_to_paddr(void *address) {
return
0
;
return
0
;
#endif
#endif
}
}
uint32_t
paddle_mobile_version
()
{
uint32_t
v_master
=
34
;
uint32_t
v_slave
=
34
;
uint32_t
first
=
1
,
second
=
2
,
fourth_master
=
1
,
fourth_slave
=
2
;
uint32_t
master
=
first
<<
24
|
second
<<
16
|
v_master
<<
8
|
fourth_master
;
uint32_t
slave
=
first
<<
24
|
second
<<
16
|
v_slave
<<
8
|
fourth_slave
;
return
slave
;
}
}
// namespace fpga
}
// namespace fpga
}
// namespace paddle_mobile
}
// namespace paddle_mobile
src/fpga/common/fpga_common.h
浏览文件 @
327ca7c6
...
@@ -30,6 +30,7 @@ limitations under the License. */
...
@@ -30,6 +30,7 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
fpga
{
namespace
fpga
{
enum
DataType
{
enum
DataType
{
DATA_TYPE_INT8
=
2
,
DATA_TYPE_INT8
=
2
,
DATA_TYPE_FP32
=
1
,
DATA_TYPE_FP32
=
1
,
...
@@ -275,5 +276,8 @@ uint64_t vaddr_to_paddr(void* address);
...
@@ -275,5 +276,8 @@ uint64_t vaddr_to_paddr(void* address);
void
expand_conv_arg
(
ConvArgs
*
arg
);
void
expand_conv_arg
(
ConvArgs
*
arg
);
void
expand_EW_arg
(
EWAddArgs
*
arg
);
void
expand_EW_arg
(
EWAddArgs
*
arg
);
inline
int32_t
convertmantissa
(
int32_t
i
);
inline
int32_t
convertmantissa
(
int32_t
i
);
uint32_t
paddle_mobile_version
();
}
// namespace fpga
}
// namespace fpga
}
// namespace paddle_mobile
}
// namespace paddle_mobile
src/io/paddle_inference_api.h
浏览文件 @
327ca7c6
...
@@ -30,10 +30,12 @@ limitations under the License. */
...
@@ -30,10 +30,12 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
namespace
fpga
{
namespace
fpga
{
int
open_device
();
int
open_device
();
void
*
fpga_malloc
(
size_t
size
);
void
*
fpga_malloc
(
size_t
size
);
void
fpga_free
(
void
*
ptr
);
void
fpga_free
(
void
*
ptr
);
uint32_t
paddle_mobile_version
();
}
// namespace fpga
}
// namespace fpga
#endif
#endif
...
...
test/fpga/test_marker_api.cpp
浏览文件 @
327ca7c6
...
@@ -139,6 +139,9 @@ PaddleMobileConfig GetConfig1() {
...
@@ -139,6 +139,9 @@ PaddleMobileConfig GetConfig1() {
int
main
()
{
int
main
()
{
open_device
();
open_device
();
timeval
start11
,
end11
;
long
dif_sec
,
dif_usec
;
// NOLINT
PaddleMobileConfig
config
=
GetConfig
();
PaddleMobileConfig
config
=
GetConfig
();
auto
predictor
=
auto
predictor
=
CreatePaddlePredictor
<
PaddleMobileConfig
,
CreatePaddlePredictor
<
PaddleMobileConfig
,
...
@@ -172,8 +175,6 @@ int main() {
...
@@ -172,8 +175,6 @@ int main() {
std
::
cout
<<
"Finishing feeding data "
<<
std
::
endl
;
std
::
cout
<<
"Finishing feeding data "
<<
std
::
endl
;
timeval
start11
,
end11
;
long
dif_sec
,
dif_usec
;
// NOLINT
gettimeofday
(
&
start11
,
NULL
);
gettimeofday
(
&
start11
,
NULL
);
predictor
->
Predict_From_To
(
0
,
-
1
);
predictor
->
Predict_From_To
(
0
,
-
1
);
gettimeofday
(
&
end11
,
NULL
);
gettimeofday
(
&
end11
,
NULL
);
...
@@ -189,8 +190,9 @@ int main() {
...
@@ -189,8 +190,9 @@ int main() {
std
::
cout
<<
"Output number is "
<<
v
.
size
()
<<
std
::
endl
;
std
::
cout
<<
"Output number is "
<<
v
.
size
()
<<
std
::
endl
;
for
(
int
fetchNum
=
0
;
fetchNum
<
v
.
size
();
fetchNum
++
)
{
for
(
int
fetchNum
=
0
;
fetchNum
<
v
.
size
();
fetchNum
++
)
{
std
::
string
dumpName
=
"marker_api_fetch_"
+
std
::
to_string
(
fetchNum
);
std
::
string
dumpName
=
"marker_api_fetch_"
+
std
::
to_string
(
fetchNum
);
dump_stride
(
dumpName
,
v
[
fetchNum
]);
//
dump_stride(dumpName, v[fetchNum]);
}
}
fpga_free
(
img
);
PaddleMobileConfig
config1
=
GetConfig1
();
PaddleMobileConfig
config1
=
GetConfig1
();
auto
predictor1
=
auto
predictor1
=
...
@@ -233,6 +235,7 @@ int main() {
...
@@ -233,6 +235,7 @@ int main() {
std
::
string
dumpName
=
"marker2_api_fetch_"
+
std
::
to_string
(
fetchNum
);
std
::
string
dumpName
=
"marker2_api_fetch_"
+
std
::
to_string
(
fetchNum
);
dump_stride
(
dumpName
,
v1
[
fetchNum
]);
dump_stride
(
dumpName
,
v1
[
fetchNum
]);
}
}
fpga_free
(
img1
);
}
}
return
0
;
return
0
;
}
}
test/fpga/test_rfcn_api.cpp
浏览文件 @
327ca7c6
...
@@ -16,6 +16,7 @@ limitations under the License. */
...
@@ -16,6 +16,7 @@ limitations under the License. */
#define PADDLE_MOBILE_FPGA
#define PADDLE_MOBILE_FPGA
#endif
#endif
#include <fstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iostream>
#include "../../src/io/paddle_inference_api.h"
#include "../../src/io/paddle_inference_api.h"
...
@@ -69,7 +70,7 @@ PaddleMobileConfig GetConfig1() {
...
@@ -69,7 +70,7 @@ PaddleMobileConfig GetConfig1() {
int
main
()
{
int
main
()
{
open_device
();
open_device
();
#if 0
PaddleMobileConfig config1 = GetConfig1();
PaddleMobileConfig config1 = GetConfig1();
auto predictor1 =
auto predictor1 =
CreatePaddlePredictor<PaddleMobileConfig,
CreatePaddlePredictor<PaddleMobileConfig,
...
@@ -98,7 +99,8 @@ int main() {
...
@@ -98,7 +99,8 @@ int main() {
predictor1->FetchPaddleTensors(&v1); // Old data in v will be cleared
predictor1->FetchPaddleTensors(&v1); // Old data in v will be cleared
std::cout << "Output number is " << v1.size() << std::endl;
std::cout << "Output number is " << v1.size() << std::endl;
std::cout << "out[0] length " << v1[0].data.length() << std::endl;
std::cout << "out[0] length " << v1[0].data.length() << std::endl;
fpga_free(img1);
#endif
////////////////////////////
////////////////////////////
PaddleMobileConfig
config
=
GetConfig
();
PaddleMobileConfig
config
=
GetConfig
();
...
@@ -160,6 +162,11 @@ int main() {
...
@@ -160,6 +162,11 @@ int main() {
}
}
}
}
std
::
cout
<<
"Finish getting vector values"
<<
std
::
endl
;
std
::
cout
<<
"Finish getting vector values"
<<
std
::
endl
;
fpga_free
(
img
);
auto
version
=
fpga
::
paddle_mobile_version
();
std
::
cout
<<
"0X0"
<<
std
::
hex
<<
version
<<
std
::
endl
;
return
0
;
return
0
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录