Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e59a693e
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看板
未验证
提交
e59a693e
编写于
4月 02, 2022
作者:
L
Leo Chen
提交者:
GitHub
4月 02, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable new-executor on windows to test it (#41301)
* enable new-executor on windows to test it * add message * fix ut
上级
a5e00bb7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
14 deletion
+41
-14
paddle/phi/kernels/gpu/range_kernel.cu
paddle/phi/kernels/gpu/range_kernel.cu
+16
-3
python/paddle/fluid/executor.py
python/paddle/fluid/executor.py
+12
-1
python/paddle/fluid/tests/unittests/check_nan_inf_base.py
python/paddle/fluid/tests/unittests/check_nan_inf_base.py
+8
-7
python/paddle/fluid/tests/unittests/test_nan_inf.py
python/paddle/fluid/tests/unittests/test_nan_inf.py
+5
-3
未找到文件。
paddle/phi/kernels/gpu/range_kernel.cu
浏览文件 @
e59a693e
...
@@ -21,6 +21,19 @@
...
@@ -21,6 +21,19 @@
namespace
phi
{
namespace
phi
{
template
<
typename
T
,
typename
Context
>
inline
T
GetValue
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
x
)
{
T
value
=
static_cast
<
T
>
(
0
);
if
(
x
.
place
()
!=
CPUPlace
())
{
DenseTensor
cpu_x
;
Copy
(
dev_ctx
,
x
,
CPUPlace
(),
true
,
&
cpu_x
);
value
=
cpu_x
.
data
<
T
>
()[
0
];
}
else
{
value
=
x
.
data
<
T
>
()[
0
];
}
return
value
;
}
template
<
typename
T
>
template
<
typename
T
>
__global__
void
Range
(
T
start
,
T
step
,
int64_t
size
,
T
*
out
)
{
__global__
void
Range
(
T
start
,
T
step
,
int64_t
size
,
T
*
out
)
{
CUDA_KERNEL_LOOP
(
index
,
size
)
{
out
[
index
]
=
start
+
step
*
index
;
}
CUDA_KERNEL_LOOP
(
index
,
size
)
{
out
[
index
]
=
start
+
step
*
index
;
}
...
@@ -32,9 +45,9 @@ void RangeKernel(const Context& dev_ctx,
...
@@ -32,9 +45,9 @@ void RangeKernel(const Context& dev_ctx,
const
DenseTensor
&
end
,
const
DenseTensor
&
end
,
const
DenseTensor
&
step
,
const
DenseTensor
&
step
,
DenseTensor
*
out
)
{
DenseTensor
*
out
)
{
T
start_value
=
start
.
data
<
T
>
()[
0
]
;
T
start_value
=
GetValue
<
T
,
Context
>
(
dev_ctx
,
start
)
;
T
end_value
=
end
.
data
<
T
>
()[
0
]
;
T
end_value
=
GetValue
<
T
,
Context
>
(
dev_ctx
,
end
)
;
T
step_value
=
step
.
data
<
T
>
()[
0
]
;
T
step_value
=
GetValue
<
T
,
Context
>
(
dev_ctx
,
step
)
;
int64_t
size
=
0
;
int64_t
size
=
0
;
phi
::
funcs
::
GetSize
(
start_value
,
end_value
,
step_value
,
&
size
);
phi
::
funcs
::
GetSize
(
start_value
,
end_value
,
step_value
,
&
size
);
...
...
python/paddle/fluid/executor.py
浏览文件 @
e59a693e
...
@@ -394,9 +394,20 @@ def _is_enable_standalone_executor():
...
@@ -394,9 +394,20 @@ def _is_enable_standalone_executor():
Whether to use experimental executor `StandaloneExecutor`.
Whether to use experimental executor `StandaloneExecutor`.
"""
"""
flag
=
False
flag
=
False
env_val
=
os
.
environ
.
get
(
'FLAGS_USE_STANDALONE_EXECUTOR'
,
None
)
# NOTE(zhiqiu): enable STANDALONE_EXECUTOR on windows platform by default
# It should be enabled on all platform in the future.
import
platform
sysstr
=
platform
.
system
().
lower
()
if
sysstr
==
'windows'
:
env_val
=
os
.
environ
.
get
(
'FLAGS_USE_STANDALONE_EXECUTOR'
,
1
)
else
:
env_val
=
os
.
environ
.
get
(
'FLAGS_USE_STANDALONE_EXECUTOR'
,
None
)
if
env_val
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]:
if
env_val
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]:
flag
=
True
flag
=
True
warnings
.
warn
(
"STANDALONE_EXECUTOR is enabled."
)
return
flag
return
flag
...
...
python/paddle/fluid/tests/unittests/check_nan_inf_base.py
浏览文件 @
e59a693e
...
@@ -103,6 +103,14 @@ def check(use_cuda):
...
@@ -103,6 +103,14 @@ def check(use_cuda):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
try
:
check
(
use_cuda
=
False
)
assert
False
except
Exception
as
e
:
print
(
e
)
print
(
type
(
e
))
assert
type
(
e
)
==
RuntimeError
if
core
.
is_compiled_with_cuda
():
if
core
.
is_compiled_with_cuda
():
try
:
try
:
check
(
use_cuda
=
True
)
check
(
use_cuda
=
True
)
...
@@ -113,10 +121,3 @@ if __name__ == '__main__':
...
@@ -113,10 +121,3 @@ if __name__ == '__main__':
# Note. Enforce in cuda kernel may not catch in paddle, and
# Note. Enforce in cuda kernel may not catch in paddle, and
# Exception type will be RuntimeError
# Exception type will be RuntimeError
assert
type
(
e
)
==
OSError
or
type
(
e
)
==
RuntimeError
assert
type
(
e
)
==
OSError
or
type
(
e
)
==
RuntimeError
try
:
check
(
use_cuda
=
False
)
assert
False
except
Exception
as
e
:
print
(
e
)
print
(
type
(
e
))
assert
type
(
e
)
==
RuntimeError
python/paddle/fluid/tests/unittests/test_nan_inf.py
浏览文件 @
e59a693e
...
@@ -47,10 +47,12 @@ class TestNanInf(unittest.TestCase):
...
@@ -47,10 +47,12 @@ class TestNanInf(unittest.TestCase):
print
(
out
)
print
(
out
)
print
(
err
)
print
(
err
)
assert
returncode
==
0
# in python3, type(out+err) is 'bytes', need use encode
# in python3, type(out+err) is 'bytes', need use encode
assert
(
out
+
err
if
paddle
.
fluid
.
core
.
is_compiled_with_cuda
():
).
find
(
'There are `nan` or `inf` in tensor'
.
encode
())
!=
-
1
assert
(
out
+
err
).
find
(
'find nan or inf==='
.
encode
())
!=
-
1
else
:
assert
(
out
+
err
).
find
(
'There are `nan` or `inf` in tensor'
.
encode
())
!=
-
1
def
test_nan_inf_in_static_mode
(
self
):
def
test_nan_inf_in_static_mode
(
self
):
self
.
_python_interp
+=
" check_nan_inf_base.py"
self
.
_python_interp
+=
" check_nan_inf_base.py"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录