Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
fdab43b5
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
fdab43b5
编写于
1月 21, 2022
作者:
F
fwenguang
提交者:
GitHub
1月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MLU]add mlu ci dockerfile (#39021)
* [MLU]add mlu ci dockerfile * fix comment * add cncl
上级
4f1fef60
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
94 addition
and
8 deletion
+94
-8
paddle/fluid/framework/tensor_util.h
paddle/fluid/framework/tensor_util.h
+1
-1
paddle/fluid/memory/memcpy.cc
paddle/fluid/memory/memcpy.cc
+17
-0
paddle/fluid/operators/mean_op_mlu.cc
paddle/fluid/operators/mean_op_mlu.cc
+2
-6
paddle/fluid/operators/mlu/CMakeLists.txt
paddle/fluid/operators/mlu/CMakeLists.txt
+1
-1
tools/dockerfile/Dockerfile.mlu
tools/dockerfile/Dockerfile.mlu
+73
-0
未找到文件。
paddle/fluid/framework/tensor_util.h
浏览文件 @
fdab43b5
...
...
@@ -235,7 +235,7 @@ void TensorFromVector(const std::vector<T>& src,
}
#endif
#ifdef PADDLE_WITH_MLU
if
(
platform
::
is_mlu_place
(
dst_place
))
{
else
if
(
platform
::
is_mlu_place
(
dst_place
))
{
// NOLINT
memory
::
Copy
(
dst_place
,
dst_ptr
,
src_place
,
src_ptr
,
size
,
reinterpret_cast
<
const
platform
::
MLUDeviceContext
&>
(
ctx
).
stream
());
...
...
paddle/fluid/memory/memcpy.cc
浏览文件 @
fdab43b5
...
...
@@ -962,6 +962,23 @@ void Copy<pten::Place, pten::MLUPlace>(pten::Place dst_place, void* dst,
stream
);
}
// NOTE: only for (MLUPlace) -> (CPUPlace) with mluStream.
template
<
>
void
Copy
<
pten
::
CPUPlace
,
pten
::
Place
>
(
pten
::
CPUPlace
dst_place
,
void
*
dst
,
pten
::
Place
src_place
,
const
void
*
src
,
size_t
num
,
mluStream
stream
)
{
Copy
(
pten
::
Place
(
dst_place
.
GetType
()),
dst
,
src_place
,
src
,
num
,
stream
);
}
// NOTE: only for (CPUPlace) -> (MLUPlace) with mluStream.
template
<
>
void
Copy
<
pten
::
Place
,
pten
::
CPUPlace
>
(
pten
::
Place
dst_place
,
void
*
dst
,
pten
::
CPUPlace
src_place
,
const
void
*
src
,
size_t
num
,
mluStream
stream
)
{
Copy
(
dst_place
,
dst
,
pten
::
Place
(
src_place
.
GetType
()),
src
,
num
,
stream
);
}
#endif // PADDLE_WITH_MLU
// NOTE: Only for CPUPlace, XPUPlace and PinnedPlace.
...
...
paddle/fluid/operators/mean_op_mlu.cc
浏览文件 @
fdab43b5
...
...
@@ -35,9 +35,7 @@ class MeanMLUKernel : public framework::OpKernel<T> {
auto
stream
=
context
.
template
device_context
<
MLUDeviceContext
>().
stream
();
if
(
rank
==
0
)
{
// scalar
auto
mlu_place
=
BOOST_GET
(
platform
::
MLUPlace
,
place
);
memory
::
Copy
(
mlu_place
,
out_data
,
mlu_place
,
in_data
,
numel
*
sizeof
(
T
),
stream
);
memory
::
Copy
(
place
,
out_data
,
place
,
in_data
,
numel
*
sizeof
(
T
),
stream
);
return
;
}
...
...
@@ -85,9 +83,7 @@ class MeanMLUGradKernel : public framework::OpKernel<T> {
auto
stream
=
context
.
template
device_context
<
MLUDeviceContext
>().
stream
();
if
(
rank
==
0
)
{
// scalar
auto
mlu_place
=
BOOST_GET
(
platform
::
MLUPlace
,
place
);
memory
::
Copy
(
mlu_place
,
out_data
,
mlu_place
,
in_data
,
numel
*
sizeof
(
T
),
stream
);
memory
::
Copy
(
place
,
out_data
,
place
,
in_data
,
numel
*
sizeof
(
T
),
stream
);
return
;
}
...
...
paddle/fluid/operators/mlu/CMakeLists.txt
浏览文件 @
fdab43b5
IF
(
WITH_MLU
)
cc_library
(
mlu_baseop SRCS mlu_baseop.cc DEPS neuware_lib
)
cc_library
(
mlu_baseop SRCS mlu_baseop.cc DEPS neuware_lib
framework_proto xxhash
)
cc_test
(
activation_op_mlu_test SRCS activation_op_mlu_test.cc DEPS op_registry activation_op scope device_context executor
)
ENDIF
()
tools/dockerfile/Dockerfile.mlu
0 → 100644
浏览文件 @
fdab43b5
# A image for building paddle binaries
# Update CNTOOLKIT_VERSION, CNNL_VERSION and CNCL_VERSION if using other versions
#
# Build:
# - CNTOOLKIT_VERSION 2.6.5-1
# - CNNL_VERSION 1.8.3-1
# - CNCL_VERSION 1.0.2-1
#
# Download three packages from FTP (need to connect cambricon AE to get FTP url)
# - cntoolkit_2.6.5-1.ubuntu18.04_amd64.deb
# - cnnl_1.8.3-1.ubuntu18.04_amd64.deb
# - cncl_1.0.2-1.ubuntu18.04_amd64.deb
# copy them to current directory first, then run build commands
#
# For example:
#
# cd Paddle/tools/dockerfile
#
# (get cntoolkit pkg)
# (get cnnl pkg)
# (get cncl pkg)
#
# docker build -f Dockerfile.mlu \
# --build-arg CNTOOLKIT_VERSION=2.6.5-1 \
# --build-arg CNNL_VERSION=1.8.3-1 \
# --build-arg CNCL_VERSION=1.0.2-1 \
# -t paddlepaddle/paddle:latest-dev-mlu .
#
# without mlu device:
# docker run -it --network=host --pids-limit 409600 \
# paddlepaddle/paddle:latest-dev-mlu /bin/bash
#
# with mlu device:
# docker run -it --network=host --pids-limit 409600 \
# --device=/dev/cambricon_ctl --device=/dev/cambricon_dev0 \
# paddlepaddle/paddle:latest-dev-mlu /bin/bash
FROM registry.baidubce.com/paddlepaddle/paddle:latest-dev
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
ENV WITH_GPU=OFF
ARG CNTOOLKIT_VERSION=2.6.5-1
ARG CNNL_VERSION=1.8.3-1
ARG CNCL_VERSION=1.0.2-1
ARG CNTOOLKIT_PKG=cntoolkit_$CNTOOLKIT_VERSION.ubuntu18.04_amd64.deb
ARG CNNL_PKG=cnnl_$CNNL_VERSION.ubuntu18.04_amd64.deb
ARG CNCL_PKG=cncl_$CNCL_VERSION.ubuntu18.04_amd64.deb
# install cntoolkit
COPY $CNTOOLKIT_PKG ./
RUN dpkg -i $CNTOOLKIT_PKG && \
apt-get update && \
apt-get install -y cnrt cnperf cnpapi cnlicense cngdb cndrv cndev cncodec cncc cnas cnbin cnstudio cnrtc cnpx && \
rm -f $CNTOOLKIT_PKG
ENV NEUWARE_HOME=/usr/local/neuware
ENV LD_LIBRARY_PATH=$NEUWARE_HOME/lib64:$LD_LIBRARY_PATH
# install cnnl
COPY $CNNL_PKG ./
RUN dpkg -i $CNNL_PKG && \
rm -f $CNNL_PKG
# install cncl
COPY $CNCL_PKG ./
RUN dpkg -i $CNCL_PKG && \
rm -f $CNCL_PKG
# Clean
RUN apt-get clean -y
EXPOSE 22
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录