Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
95c0c126
P
Paddle
项目概览
PaddlePaddle
/
Paddle
12 个月 前同步成功
通知
2292
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
95c0c126
编写于
1月 11, 2018
作者:
R
ranqiu92
提交者:
GitHub
1月 11, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7384 from dzhwinter/feature/sync_wait
Feature/sync wait
上级
9867a379
92eb247f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
3 deletion
+14
-3
paddle/framework/operator.cc
paddle/framework/operator.cc
+13
-2
python/paddle/v2/fluid/__init__.py
python/paddle/v2/fluid/__init__.py
+1
-1
未找到文件。
paddle/framework/operator.cc
浏览文件 @
95c0c126
...
@@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
...
@@ -11,6 +11,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <glog/logging.h>
#include <algorithm>
#include <algorithm>
...
@@ -21,6 +22,10 @@ limitations under the License. */
...
@@ -21,6 +22,10 @@ limitations under the License. */
#include "paddle/framework/shape_inference.h"
#include "paddle/framework/shape_inference.h"
#include "paddle/framework/var_type.h"
#include "paddle/framework/var_type.h"
DEFINE_bool
(
op_sync
,
false
,
"Default cuda is asynchronous device, set to True will"
"force op run in synchronous mode."
);
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -542,8 +547,14 @@ void OperatorWithKernel::Run(const Scope& scope,
...
@@ -542,8 +547,14 @@ void OperatorWithKernel::Run(const Scope& scope,
auto
kernel_iter
=
kernels
.
find
(
expected_kernel_key
);
auto
kernel_iter
=
kernels
.
find
(
expected_kernel_key
);
kernel_iter
->
second
->
Compute
(
ExecutionContext
(
auto
*
new_dev_ctx
=
pool
.
Get
(
expected_kernel_key
.
place_
);
*
this
,
new_scope
,
*
pool
.
Get
(
expected_kernel_key
.
place_
)));
kernel_iter
->
second
->
Compute
(
ExecutionContext
(
*
this
,
new_scope
,
*
new_dev_ctx
));
/*For profiling/benchmark only*/
if
(
FLAGS_op_sync
)
{
new_dev_ctx
->
Wait
();
}
}
}
proto
::
DataType
OperatorWithKernel
::
IndicateDataType
(
proto
::
DataType
OperatorWithKernel
::
IndicateDataType
(
...
...
python/paddle/v2/fluid/__init__.py
浏览文件 @
95c0c126
...
@@ -58,7 +58,7 @@ def __bootstrap__():
...
@@ -58,7 +58,7 @@ def __bootstrap__():
read_env_flags
=
[
'use_pinned_memory'
,
'check_nan_inf'
]
read_env_flags
=
[
'use_pinned_memory'
,
'check_nan_inf'
]
if
core
.
is_compile_gpu
():
if
core
.
is_compile_gpu
():
read_env_flags
.
append
(
'fraction_of_gpu_memory_to_use'
)
read_env_flags
+=
[
'fraction_of_gpu_memory_to_use'
,
'op_sync'
]
core
.
init_gflags
([
sys
.
argv
[
0
]]
+
core
.
init_gflags
([
sys
.
argv
[
0
]]
+
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
core
.
init_glog
(
sys
.
argv
[
0
])
core
.
init_glog
(
sys
.
argv
[
0
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录