Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a4997311
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a4997311
编写于
5月 06, 2023
作者:
K
Kim Yann
提交者:
GitHub
5月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rem npu in test (#53469)
* rem npu in test * restore some code
上级
13e2e10c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
9 addition
and
66 deletion
+9
-66
test/CMakeLists.txt
test/CMakeLists.txt
+8
-18
test/cpp/inference/api/api_impl_tester.cc
test/cpp/inference/api/api_impl_tester.cc
+0
-4
test/cpp/inference/test_helper.h
test/cpp/inference/test_helper.h
+0
-3
test/cpp/phi/common/test_backend.cc
test/cpp/phi/common/test_backend.cc
+0
-4
test/cpp/phi/core/test_dense_tensor.cc
test/cpp/phi/core/test_dense_tensor.cc
+1
-36
test/xpu/test_merged_momentum_op_xpu_base.py
test/xpu/test_merged_momentum_op_xpu_base.py
+0
-1
未找到文件。
test/CMakeLists.txt
浏览文件 @
a4997311
...
@@ -186,24 +186,14 @@ if(${len} GREATER_EQUAL 1)
...
@@ -186,24 +186,14 @@ if(${len} GREATER_EQUAL 1)
if
(
WITH_XPU
)
if
(
WITH_XPU
)
target_link_libraries
(
${
test_name
}
xpulib
)
target_link_libraries
(
${
test_name
}
xpulib
)
endif
()
endif
()
if
(
NOT
cc_test_run
(
(
"
${
test_name
}
"
STREQUAL
"c_broadcast_op_npu_test"
${
test_name
}
OR
"
${
test_name
}
"
STREQUAL
"c_allreduce_sum_op_npu_test"
COMMAND
OR
"
${
test_name
}
"
STREQUAL
"c_allreduce_max_op_npu_test"
${
test_name
}
OR
"
${
test_name
}
"
STREQUAL
"c_reducescatter_op_npu_test"
ARGS
OR
"
${
test_name
}
"
STREQUAL
"c_allgather_op_npu_test"
${
test_arg
}
OR
"
${
test_name
}
"
STREQUAL
"send_v2_op_npu_test"
DIR
OR
"
${
test_name
}
"
STREQUAL
"c_reduce_sum_op_npu_test"
${
CC_TESTS_DIR
}
)
OR
"
${
test_name
}
"
STREQUAL
"recv_v2_op_npu_test"
))
cc_test_run
(
${
test_name
}
COMMAND
${
test_name
}
ARGS
${
test_arg
}
DIR
${
CC_TESTS_DIR
}
)
endif
()
elseif
(
WITH_TESTING AND NOT TEST
${
test_name
}
)
elseif
(
WITH_TESTING AND NOT TEST
${
test_name
}
)
add_test
(
NAME
${
test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E echo CI skip
add_test
(
NAME
${
test_name
}
COMMAND
${
CMAKE_COMMAND
}
-E echo CI skip
${
test_name
}
.
)
${
test_name
}
.
)
...
...
test/cpp/inference/api/api_impl_tester.cc
浏览文件 @
a4997311
...
@@ -72,7 +72,6 @@ void MainWord2Vec(const paddle::PaddlePlace& place) {
...
@@ -72,7 +72,6 @@ void MainWord2Vec(const paddle::PaddlePlace& place) {
auto
predictor
=
CreatePaddlePredictor
<
NativeConfig
>
(
config
);
auto
predictor
=
CreatePaddlePredictor
<
NativeConfig
>
(
config
);
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_npu
=
paddle
::
npu_place_used
(
place
);
phi
::
DenseTensor
first_word
,
second_word
,
third_word
,
fourth_word
;
phi
::
DenseTensor
first_word
,
second_word
,
third_word
,
fourth_word
;
framework
::
LoD
lod
{{
0
,
1
}};
framework
::
LoD
lod
{{
0
,
1
}};
...
@@ -125,7 +124,6 @@ void MainImageClassification(const paddle::PaddlePlace& place) {
...
@@ -125,7 +124,6 @@ void MainImageClassification(const paddle::PaddlePlace& place) {
NativeConfig
config
=
GetConfig
();
NativeConfig
config
=
GetConfig
();
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_npu
=
paddle
::
npu_place_used
(
place
);
config
.
model_dir
=
config
.
model_dir
=
FLAGS_book_dirname
+
"/image_classification_resnet.inference.model"
;
FLAGS_book_dirname
+
"/image_classification_resnet.inference.model"
;
...
@@ -169,7 +167,6 @@ void MainThreadsWord2Vec(const paddle::PaddlePlace& place) {
...
@@ -169,7 +167,6 @@ void MainThreadsWord2Vec(const paddle::PaddlePlace& place) {
NativeConfig
config
=
GetConfig
();
NativeConfig
config
=
GetConfig
();
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_npu
=
paddle
::
npu_place_used
(
place
);
auto
main_predictor
=
CreatePaddlePredictor
<
NativeConfig
>
(
config
);
auto
main_predictor
=
CreatePaddlePredictor
<
NativeConfig
>
(
config
);
// prepare inputs data and reference results
// prepare inputs data and reference results
...
@@ -234,7 +231,6 @@ void MainThreadsImageClassification(const paddle::PaddlePlace& place) {
...
@@ -234,7 +231,6 @@ void MainThreadsImageClassification(const paddle::PaddlePlace& place) {
NativeConfig
config
=
GetConfig
();
NativeConfig
config
=
GetConfig
();
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_gpu
=
paddle
::
gpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_xpu
=
paddle
::
xpu_place_used
(
place
);
config
.
use_npu
=
paddle
::
npu_place_used
(
place
);
config
.
model_dir
=
config
.
model_dir
=
FLAGS_book_dirname
+
"/image_classification_resnet.inference.model"
;
FLAGS_book_dirname
+
"/image_classification_resnet.inference.model"
;
...
...
test/cpp/inference/test_helper.h
浏览文件 @
a4997311
...
@@ -35,9 +35,6 @@ bool gpu_place_used(const paddle::PaddlePlace& place) {
...
@@ -35,9 +35,6 @@ bool gpu_place_used(const paddle::PaddlePlace& place) {
bool
xpu_place_used
(
const
paddle
::
PaddlePlace
&
place
)
{
bool
xpu_place_used
(
const
paddle
::
PaddlePlace
&
place
)
{
return
place
==
paddle
::
PaddlePlace
::
kXPU
;
return
place
==
paddle
::
PaddlePlace
::
kXPU
;
}
}
bool
npu_place_used
(
const
paddle
::
PaddlePlace
&
place
)
{
return
place
==
paddle
::
PaddlePlace
::
kNPU
;
}
bool
cpu_place_used
(
const
paddle
::
PaddlePlace
&
place
)
{
bool
cpu_place_used
(
const
paddle
::
PaddlePlace
&
place
)
{
return
place
==
paddle
::
PaddlePlace
::
kCPU
;
return
place
==
paddle
::
PaddlePlace
::
kCPU
;
}
}
...
...
test/cpp/phi/common/test_backend.cc
浏览文件 @
a4997311
...
@@ -36,9 +36,6 @@ TEST(Backend, OStream) {
...
@@ -36,9 +36,6 @@ TEST(Backend, OStream) {
oss
<<
phi
::
Backend
::
XPU
;
oss
<<
phi
::
Backend
::
XPU
;
EXPECT_EQ
(
oss
.
str
(),
"XPU"
);
EXPECT_EQ
(
oss
.
str
(),
"XPU"
);
oss
.
str
(
""
);
oss
.
str
(
""
);
oss
<<
phi
::
Backend
::
NPU
;
EXPECT_EQ
(
oss
.
str
(),
"NPU"
);
oss
.
str
(
""
);
oss
<<
phi
::
Backend
::
ONEDNN
;
oss
<<
phi
::
Backend
::
ONEDNN
;
EXPECT_EQ
(
oss
.
str
(),
"ONEDNN"
);
EXPECT_EQ
(
oss
.
str
(),
"ONEDNN"
);
oss
.
str
(
""
);
oss
.
str
(
""
);
...
@@ -62,7 +59,6 @@ TEST(Backend, StringToBackend) {
...
@@ -62,7 +59,6 @@ TEST(Backend, StringToBackend) {
EXPECT_EQ
(
phi
::
Backend
::
CPU
,
pexp
::
StringToBackend
(
"CPU"
));
EXPECT_EQ
(
phi
::
Backend
::
CPU
,
pexp
::
StringToBackend
(
"CPU"
));
EXPECT_EQ
(
phi
::
Backend
::
GPU
,
pexp
::
StringToBackend
(
"GPU"
));
EXPECT_EQ
(
phi
::
Backend
::
GPU
,
pexp
::
StringToBackend
(
"GPU"
));
EXPECT_EQ
(
phi
::
Backend
::
XPU
,
pexp
::
StringToBackend
(
"XPU"
));
EXPECT_EQ
(
phi
::
Backend
::
XPU
,
pexp
::
StringToBackend
(
"XPU"
));
EXPECT_EQ
(
phi
::
Backend
::
NPU
,
pexp
::
StringToBackend
(
"NPU"
));
EXPECT_EQ
(
phi
::
Backend
::
ONEDNN
,
pexp
::
StringToBackend
(
"OneDNN"
));
EXPECT_EQ
(
phi
::
Backend
::
ONEDNN
,
pexp
::
StringToBackend
(
"OneDNN"
));
EXPECT_EQ
(
phi
::
Backend
::
GPUDNN
,
pexp
::
StringToBackend
(
"GPUDNN"
));
EXPECT_EQ
(
phi
::
Backend
::
GPUDNN
,
pexp
::
StringToBackend
(
"GPUDNN"
));
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
...
...
test/cpp/phi/core/test_dense_tensor.cc
浏览文件 @
a4997311
...
@@ -129,13 +129,6 @@ TEST(dense_tensor, shallow_copy) {
...
@@ -129,13 +129,6 @@ TEST(dense_tensor, shallow_copy) {
CHECK
(
tensor_0
.
meta
()
==
tensor_1
.
meta
());
CHECK
(
tensor_0
.
meta
()
==
tensor_1
.
meta
());
}
}
struct
TestStorageProperties
:
public
StorageProperties
,
public
TypeInfoTraits
<
StorageProperties
,
NPUStorageProperties
>
{
virtual
~
TestStorageProperties
()
=
default
;
static
const
char
*
name
()
{
return
"TestStorageProperties"
;
}
};
TEST
(
dense_tensor
,
storage_properties
)
{
TEST
(
dense_tensor
,
storage_properties
)
{
const
DataType
dtype
{
DataType
::
FLOAT32
};
const
DataType
dtype
{
DataType
::
FLOAT32
};
const
DDim
dims
({
1
,
2
});
const
DDim
dims
({
1
,
2
});
...
@@ -144,29 +137,9 @@ TEST(dense_tensor, storage_properties) {
...
@@ -144,29 +137,9 @@ TEST(dense_tensor, storage_properties) {
auto
fancy_allocator
=
std
::
unique_ptr
<
Allocator
>
(
new
FancyAllocator
);
auto
fancy_allocator
=
std
::
unique_ptr
<
Allocator
>
(
new
FancyAllocator
);
DenseTensor
tensor
(
fancy_allocator
.
get
(),
meta
);
DenseTensor
tensor
(
fancy_allocator
.
get
(),
meta
);
// test no storage properties
bool
caught_exception
=
false
;
try
{
tensor
.
storage_properties
<
NPUStorageProperties
>
();
}
catch
(
phi
::
enforce
::
EnforceNotMet
&
error
)
{
caught_exception
=
true
;
}
EXPECT_TRUE
(
caught_exception
);
// test custom device storage properties
EXPECT_FALSE
(
tensor
.
storage_properties_initialized
());
auto
npu_properties
=
std
::
make_unique
<
NPUStorageProperties
>
();
npu_properties
->
storage_format
=
3
;
npu_properties
->
storage_dims
=
{
1
,
1
,
1
,
1
,
16
};
tensor
.
set_storage_properties
(
std
::
move
(
npu_properties
));
EXPECT_TRUE
(
tensor
.
storage_properties_initialized
());
auto
get_npu_properties
=
tensor
.
storage_properties
<
NPUStorageProperties
>
();
CHECK_EQ
(
get_npu_properties
.
storage_format
,
3
);
CHECK_EQ
(
get_npu_properties
.
storage_dims
.
size
(),
5
);
// test error type storage properties
// test error type storage properties
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
caught_exception
=
false
;
bool
caught_exception
=
false
;
try
{
try
{
tensor
.
storage_properties
<
OneDNNStorageProperties
>
();
tensor
.
storage_properties
<
OneDNNStorageProperties
>
();
}
catch
(
phi
::
enforce
::
EnforceNotMet
&
error
)
{
}
catch
(
phi
::
enforce
::
EnforceNotMet
&
error
)
{
...
@@ -174,14 +147,6 @@ TEST(dense_tensor, storage_properties) {
...
@@ -174,14 +147,6 @@ TEST(dense_tensor, storage_properties) {
}
}
EXPECT_TRUE
(
caught_exception
);
EXPECT_TRUE
(
caught_exception
);
#endif
#endif
// test copy storage properties
auto
cp_tensor
=
tensor
;
auto
get_cp_npu_properties
=
cp_tensor
.
storage_properties
<
NPUStorageProperties
>
();
CHECK_EQ
(
get_cp_npu_properties
.
storage_format
,
3
);
CHECK_EQ
(
get_cp_npu_properties
.
storage_dims
.
size
(),
5
);
}
}
}
// namespace tests
}
// namespace tests
}
// namespace phi
}
// namespace phi
test/xpu/test_merged_momentum_op_xpu_base.py
浏览文件 @
a4997311
...
@@ -211,7 +211,6 @@ class TestMergedMomentumBase(unittest.TestCase):
...
@@ -211,7 +211,6 @@ class TestMergedMomentumBase(unittest.TestCase):
)
)
def
run_op
(
use_nesterov
,
use_merged
):
def
run_op
(
use_nesterov
,
use_merged
):
# NPU Momentum Op does not support rescale_grad
rescale_grad
=
1.0
rescale_grad
=
1.0
return
run_momentum_op
(
return
run_momentum_op
(
params
,
params
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录