Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
6c675ed9
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
6c675ed9
编写于
7月 26, 2023
作者:
R
ronnywang
提交者:
GitHub
7月 26, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CustomDevice] fix SplitDenseTensor (#55615)
上级
f9b9b8b6
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
29 addition
and
17 deletion
+29
-17
paddle/fluid/memory/allocation/naive_best_fit_allocator.cc
paddle/fluid/memory/allocation/naive_best_fit_allocator.cc
+3
-1
paddle/fluid/pybind/process_group_utils.h
paddle/fluid/pybind/process_group_utils.h
+14
-4
test/custom_runtime/test_collective_process_group_xccl.py
test/custom_runtime/test_collective_process_group_xccl.py
+2
-2
test/custom_runtime/test_custom_cpu_plugin.py
test/custom_runtime/test_custom_cpu_plugin.py
+2
-2
test/custom_runtime/test_custom_cpu_profiler_plugin.py
test/custom_runtime/test_custom_cpu_profiler_plugin.py
+2
-2
test/custom_runtime/test_custom_cpu_to_static.py
test/custom_runtime/test_custom_cpu_to_static.py
+2
-2
test/custom_runtime/test_custom_op_setup.py
test/custom_runtime/test_custom_op_setup.py
+2
-2
test/custom_runtime/test_fleet_launch_custom_device.sh
test/custom_runtime/test_fleet_launch_custom_device.sh
+2
-2
未找到文件。
paddle/fluid/memory/allocation/naive_best_fit_allocator.cc
浏览文件 @
6c675ed9
...
...
@@ -531,7 +531,9 @@ void Free<platform::CustomPlace>(const platform::CustomPlace &place,
size_t
size
)
{
#ifdef PADDLE_WITH_CUSTOM_DEVICE
VLOG
(
10
)
<<
"Free pointer="
<<
p
<<
" on "
<<
platform
::
Place
(
place
);
GetBuddyAllocator
(
place
)
->
Free
(
p
);
if
(
phi
::
DeviceManager
::
HasDeviceType
(
place
.
GetDeviceType
()))
{
GetBuddyAllocator
(
place
)
->
Free
(
p
);
}
#else
PADDLE_THROW
(
platform
::
errors
::
PermissionDenied
(
"'CustomPlace' is not supported in CPU only device."
));
...
...
paddle/fluid/pybind/process_group_utils.h
浏览文件 @
6c675ed9
...
...
@@ -96,12 +96,22 @@ struct SplitDenseTensor<platform::CustomDeviceContext, T> {
const
phi
::
Scalar
&
,
std
::
vector
<
phi
::
DenseTensor
*>
);
auto
*
kernel_fn
=
kernel
.
GetVariadicKernelFn
<
kernel_signature
>
();
auto
in_dims
=
phi
::
vectorize
(
in
.
dims
());
auto
origin_out_dims
=
phi
::
vectorize
(
out
->
at
(
0
)
->
dims
());
for
(
auto
*
tensor
:
*
out
)
{
if
(
origin_out_dims
.
size
()
!=
in_dims
.
size
())
{
std
::
vector
<
int
>
new_dims
({
1
});
new_dims
.
insert
(
new_dims
.
end
(),
origin_out_dims
.
begin
(),
origin_out_dims
.
end
());
tensor
->
Resize
(
phi
::
make_ddim
(
new_dims
));
}
}
(
*
kernel_fn
)(
context
,
in
,
out
->
size
(),
phi
::
Scalar
(
0
),
*
out
);
for
(
auto
*
tensor
:
*
out
)
{
auto
dim_vec
=
phi
::
vectorize
<
int
>
(
tensor
->
dims
());
if
(
dim_vec
.
size
()
>
0
&&
dim_vec
[
0
]
==
1
)
{
tensor
->
Resize
(
phi
::
make_ddim
(
std
::
vector
<
int
>
(
dim_vec
.
begin
()
+
1
,
dim_vec
.
end
())));
auto
tensor_dims
=
phi
::
vectorize
(
tensor
->
dims
());
if
(
tensor_dims
.
size
()
!=
origin_out_dims
.
size
())
{
tensor
->
Resize
(
phi
::
make_ddim
(
origin_out_dims
));
}
}
}
...
...
test/custom_runtime/test_collective_process_group_xccl.py
浏览文件 @
6c675ed9
...
...
@@ -150,12 +150,12 @@ class TestProcessGroup(TestMultipleCustomCPU):
cur_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
'cd {}
\
&& git clone {}
\
&& git clone
--depth 1
{}
\
&& cd PaddleCustomDevice
\
&& git fetch origin
\
&& git checkout {} -b dev
\
&& cd backends/custom_cpu
\
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'
.
format
(
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={}
-DWITH_TESTING=OFF
&& make -j8'
.
format
(
self
.
temp_dir
.
name
,
os
.
getenv
(
'PLUGIN_URL'
),
os
.
getenv
(
'PLUGIN_TAG'
),
...
...
test/custom_runtime/test_custom_cpu_plugin.py
浏览文件 @
6c675ed9
...
...
@@ -26,12 +26,12 @@ class TestCustomCPUPlugin(unittest.TestCase):
cur_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
'cd {}
\
&& git clone {}
\
&& git clone
--depth 1
{}
\
&& cd PaddleCustomDevice
\
&& git fetch origin
\
&& git checkout {} -b dev
\
&& cd backends/custom_cpu
\
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'
.
format
(
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={}
-DWITH_TESTING=OFF
&& make -j8'
.
format
(
self
.
temp_dir
.
name
,
os
.
getenv
(
'PLUGIN_URL'
),
os
.
getenv
(
'PLUGIN_TAG'
),
...
...
test/custom_runtime/test_custom_cpu_profiler_plugin.py
浏览文件 @
6c675ed9
...
...
@@ -24,12 +24,12 @@ class TestCustomCPUProfilerPlugin(unittest.TestCase):
cur_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
'cd {}
\
&& git clone {}
\
&& git clone
--depth 1
{}
\
&& cd PaddleCustomDevice
\
&& git fetch origin
\
&& git checkout {} -b dev
\
&& cd backends/custom_cpu
\
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'
.
format
(
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={}
-DWITH_TESTING=OFF
&& make -j8'
.
format
(
self
.
temp_dir
.
name
,
os
.
getenv
(
'PLUGIN_URL'
),
os
.
getenv
(
'PLUGIN_TAG'
),
...
...
test/custom_runtime/test_custom_cpu_to_static.py
浏览文件 @
6c675ed9
...
...
@@ -106,12 +106,12 @@ class TestCustomCPUPlugin(unittest.TestCase):
cur_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
'cd {}
\
&& git clone {}
\
&& git clone
--depth 1
{}
\
&& cd PaddleCustomDevice
\
&& git fetch origin
\
&& git checkout {} -b dev
\
&& cd backends/custom_cpu
\
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8'
.
format
(
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={}
-DWITH_TESTING=OFF
&& make -j8'
.
format
(
self
.
temp_dir
.
name
,
os
.
getenv
(
'PLUGIN_URL'
),
os
.
getenv
(
'PLUGIN_TAG'
),
...
...
test/custom_runtime/test_custom_op_setup.py
浏览文件 @
6c675ed9
...
...
@@ -104,12 +104,12 @@ class TestNewCustomOpSetUpInstall(unittest.TestCase):
self
.
cur_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
self
.
temp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
'cd {}
\
&& git clone {}
\
&& git clone
--depth 1
{}
\
&& cd PaddleCustomDevice
\
&& git fetch origin
\
&& git checkout {} -b dev
\
&& cd backends/custom_cpu
\
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={} && make -j8
\
&& mkdir build && cd build && cmake .. -DPython_EXECUTABLE={}
-DWITH_TESTING=OFF
&& make -j8
\
&& cd {}'
.
format
(
self
.
temp_dir
.
name
,
os
.
getenv
(
'PLUGIN_URL'
),
...
...
test/custom_runtime/test_fleet_launch_custom_device.sh
浏览文件 @
6c675ed9
...
...
@@ -18,12 +18,12 @@ set -e
temp_dir
=
$(
mktemp
--directory
)
pushd
${
temp_dir
}
\
&&
git clone
${
PLUGIN_URL
}
\
&&
git clone
--depth
1
${
PLUGIN_URL
}
\
&&
pushd
PaddleCustomDevice/
\
&&
git fetch origin
\
&&
git checkout
${
PLUGIN_TAG
}
-b
dev
\
&&
pushd
backends/custom_cpu
\
&&
mkdir
build
&&
pushd
build
&&
cmake ..
-DPython_EXECUTABLE
=
${
PYTHON_EXECUTABLE
}
&&
make
-j8
&&
popd
&&
popd
&&
popd
&&
popd
&&
mkdir
build
&&
pushd
build
&&
cmake ..
-DPython_EXECUTABLE
=
${
PYTHON_EXECUTABLE
}
-DWITH_TESTING
=
OFF
&&
make
-j8
&&
popd
&&
popd
&&
popd
&&
popd
echo
"begin test use custom_cpu"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录