Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzpei9
Paddle
提交
728e7e88
P
Paddle
项目概览
wzpei9
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
728e7e88
编写于
12月 17, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use xxHash as scope's hash algorithm
test=develop
上级
81651fca
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
23 addition
and
9 deletion
+23
-9
paddle/fluid/framework/CMakeLists.txt
paddle/fluid/framework/CMakeLists.txt
+1
-1
paddle/fluid/framework/scope.cc
paddle/fluid/framework/scope.cc
+1
-1
paddle/fluid/framework/scope.h
paddle/fluid/framework/scope.h
+20
-6
python/paddle/fluid/profiler.py
python/paddle/fluid/profiler.py
+1
-1
未找到文件。
paddle/fluid/framework/CMakeLists.txt
浏览文件 @
728e7e88
...
@@ -82,7 +82,7 @@ cc_test(variable_test SRCS variable_test.cc)
...
@@ -82,7 +82,7 @@ cc_test(variable_test SRCS variable_test.cc)
cc_library
(
threadpool SRCS threadpool.cc DEPS enforce
)
cc_library
(
threadpool SRCS threadpool.cc DEPS enforce
)
cc_test
(
threadpool_test SRCS threadpool_test.cc DEPS threadpool
)
cc_test
(
threadpool_test SRCS threadpool_test.cc DEPS threadpool
)
cc_library
(
scope SRCS scope.cc DEPS glog threadpool
)
cc_library
(
scope SRCS scope.cc DEPS glog threadpool
xxhash
)
cc_test
(
scope_test SRCS scope_test.cc DEPS scope
)
cc_test
(
scope_test SRCS scope_test.cc DEPS scope
)
cc_library
(
data_device_transform SRCS data_device_transform.cc DEPS tensor
)
cc_library
(
data_device_transform SRCS data_device_transform.cc DEPS tensor
)
...
...
paddle/fluid/framework/scope.cc
浏览文件 @
728e7e88
...
@@ -201,7 +201,7 @@ void Scope::RenameInternal(const std::string& origin_name,
...
@@ -201,7 +201,7 @@ void Scope::RenameInternal(const std::string& origin_name,
auto
new_it
=
vars_
.
find
(
new_name
);
auto
new_it
=
vars_
.
find
(
new_name
);
PADDLE_ENFORCE
(
new_it
==
vars_
.
end
(),
PADDLE_ENFORCE
(
new_it
==
vars_
.
end
(),
"The variable with name %s is already in the scope"
,
new_name
);
"The variable with name %s is already in the scope"
,
new_name
);
vars_
[
new_name
].
reset
(
origin_it
.
value
()
.
release
());
vars_
[
new_name
].
reset
(
origin_it
->
second
.
release
());
vars_
.
erase
(
origin_it
);
vars_
.
erase
(
origin_it
);
}
}
...
...
paddle/fluid/framework/scope.h
浏览文件 @
728e7e88
...
@@ -14,15 +14,18 @@ limitations under the License. */
...
@@ -14,15 +14,18 @@ limitations under the License. */
#pragma once
#pragma once
extern
"C"
{
#include <xxhash.h>
}
#include <functional>
#include <functional>
#include <list>
#include <list>
#include <memory>
#include <memory>
#include <string>
#include <string>
#include <unordered_map>
#include <utility>
#include <utility>
#include <vector>
#include <vector>
#include <tsl/robin_map.h> // NOLINT
#include "paddle/fluid/framework/rw_lock.h"
#include "paddle/fluid/framework/rw_lock.h"
#include "paddle/fluid/framework/variable.h"
#include "paddle/fluid/framework/variable.h"
#include "paddle/fluid/platform/macros.h"
#include "paddle/fluid/platform/macros.h"
...
@@ -35,6 +38,14 @@ bool IsFastEagerDeletionModeEnabled();
...
@@ -35,6 +38,14 @@ bool IsFastEagerDeletionModeEnabled();
class
Scope
;
class
Scope
;
namespace
inner
{
struct
KeyHasher
{
std
::
size_t
operator
()(
const
std
::
string
&
key
)
const
{
return
XXH32
(
key
.
c_str
(),
key
.
size
(),
1
);
}
};
}
// namespace inner
/**
/**
* @brief Scope that manage all variables.
* @brief Scope that manage all variables.
*
*
...
@@ -99,11 +110,14 @@ class Scope {
...
@@ -99,11 +110,14 @@ class Scope {
std
::
string
Rename
(
const
std
::
string
&
origin_name
)
const
;
std
::
string
Rename
(
const
std
::
string
&
origin_name
)
const
;
protected:
protected:
mutable
tsl
::
robin_map
<
mutable
std
::
unordered_map
<
std
::
string
,
std
::
unique_ptr
<
Variable
>
,
std
::
string
,
std
::
unique_ptr
<
Variable
>
,
std
::
hash
<
std
::
string
>
,
inner
::
KeyHasher
>
std
::
equal_to
<
std
::
string
>
,
std
::
allocator
<
std
::
pair
<
std
::
string
,
std
::
unique_ptr
<
Variable
>>>
,
true
>
vars_
;
vars_
;
// mutable tsl::robin_map<
// std::string, std::unique_ptr<Variable>, std::hash<std::string>,
// std::equal_to<std::string>,
// std::allocator<std::pair<std::string, std::unique_ptr<Variable>>>, true>
// vars_;
private:
private:
// Call Scope::NewScope for a sub-scope.
// Call Scope::NewScope for a sub-scope.
...
...
python/paddle/fluid/profiler.py
浏览文件 @
728e7e88
...
@@ -93,7 +93,7 @@ def cuda_profiler(output_file, output_mode=None, config=None):
...
@@ -93,7 +93,7 @@ def cuda_profiler(output_file, output_mode=None, config=None):
with
open
(
config_file
,
'wb'
)
as
fp
:
with
open
(
config_file
,
'wb'
)
as
fp
:
fp
.
writelines
([
six
.
b
(
"%s
\n
"
%
item
)
for
item
in
config
])
fp
.
writelines
([
six
.
b
(
"%s
\n
"
%
item
)
for
item
in
config
])
#Comment this for nvprof
#Comment this for nvprof
#
core.nvprof_init(output_file, output_mode, config_file)
core
.
nvprof_init
(
output_file
,
output_mode
,
config_file
)
# Enables profiler collection by the active CUDA profiling tool.
# Enables profiler collection by the active CUDA profiling tool.
core
.
nvprof_start
()
core
.
nvprof_start
()
yield
yield
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录