Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
94ce0202
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看板
提交
94ce0202
编写于
3月 28, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mpi tools
上级
b1adcd46
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
105 addition
and
28 deletion
+105
-28
paddle/fluid/operators/detail/mpi_client.cpp
paddle/fluid/operators/detail/mpi_client.cpp
+29
-0
paddle/fluid/operators/detail/mpi_client.h
paddle/fluid/operators/detail/mpi_client.h
+20
-17
paddle/fluid/operators/detail/mpi_utils.cpp
paddle/fluid/operators/detail/mpi_utils.cpp
+45
-1
paddle/fluid/operators/detail/mpi_utils.h
paddle/fluid/operators/detail/mpi_utils.h
+11
-10
未找到文件。
paddle/fluid/operators/detail/mpi_client.cpp
0 → 100644
浏览文件 @
94ce0202
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "mpi_client.h"
#include "mpi_utils.h"
namespace
paddle
{
namespace
operators
{
namespace
detail
{
bool
MPIClient
::
AsyncSendVariable
()
{
char
*
msg
=
"123456787654"
;
int
dst
=
1
;
MPIIsend
send
=
MPIIsend
(
dst
,
msg
);
}
bool
MPIClient
::
Wait
()
{}
}
// namespace detail
}
// namespace operators
}
// namespace paddle
\ No newline at end of file
paddle/fluid/operators/detail/mpi_client.h
浏览文件 @
94ce0202
...
...
@@ -26,23 +26,26 @@ namespace operators {
namespace
detail
{
class
MPIClient
{
public:
bool
AsyncSendVariable
(
const
std
::
string
&
ep
,
const
platform
::
DeviceContext
&
ctx
,
const
framework
::
Scope
&
scope
,
const
std
::
string
&
var_name
,
int64_t
time_out
=
600
*
1000
);
bool
AsyncGetVariable
(
const
std
::
string
&
ep
,
const
platform
::
DeviceContext
&
ctx
,
const
framework
::
Scope
&
scope
,
const
std
::
string
&
var_name
,
int64_t
time_out
=
600
*
1000
);
void
AsyncSendBatchBarrier
(
const
std
::
string
&
ep
,
int64_t
time_out
=
600
*
1000
);
void
AsyncSendFetchBarrier
(
const
std
::
string
&
ep
,
int64_t
time_out
=
600
*
1000
);
// bool AsyncSendVariable(const std::string& ep,
// const platform::DeviceContext& ctx,
// const framework::Scope& scope,
// const std::string& var_name,
// int64_t time_out = 600 * 1000);
// bool AsyncGetVariable(const std::string& ep,
// const platform::DeviceContext& ctx,
// const framework::Scope& scope,
// const std::string& var_name,
// int64_t time_out = 600 * 1000);
// void AsyncSendBatchBarrier(const std::string& ep,
// int64_t time_out = 600 * 1000);
// void AsyncSendFetchBarrier(const std::string& ep,
// int64_t time_out = 600 * 1000);
bool
AsyncSendVariable
();
bool
Wait
();
private:
...
...
paddle/fluid/operators/detail/mpi_utils.cpp
浏览文件 @
94ce0202
...
...
@@ -3,10 +3,13 @@
//
#include <stdio.h>
#include <string.h>
#include "paddle/fluid/operators/detail/mpi_utils.h"
#include <mpi.h>
#include "mpi_utils.h"
#define max_worker_name_length 128
#define mpi_tag = 2008
namespace
paddle
{
namespace
operators
{
...
...
@@ -42,6 +45,47 @@ void MPIUtils::InitMPI() {
MPI_Get_processor_name
(
host_name
,
&
len
)
}
};
MPIIsend
::
MPIIsend
(
int
dst
,
const
char
*
req
)
{
done1
=
0
;
done2
=
0
;
length
=
strlen
(
req
);
req
=
req
;
}
MPIIsend
::
Send
()
{
MPI_Isend
(
&
req
,
length
,
MPI_CHAR
,
dst
,
mpi_tag
,
MPI_COMM_WORLD
,
&
msg1_
);
MPI_Test
(
&
msg1_
,
&
done1_
,
MPI_STATUS_IGNORE
)
}
bool
MPIIsend
::
IsFinished
()
{
MPI_Status
status
;
if
(
!
done1_
)
MPI_Test
(
&
msg1_
,
&
done1_
,
&
status
);
return
done1
;
}
MPIIsend
::~
MPIIsend
(){
MPI_Wait
(
&
msg1_
,
MPI_STATUS_IGNORE
);
MPI_Free_mem
(
req
);
}
MPIIrecv
::
MPIIrecv
(){
}
MPIIrecv
::
Recv
(){
}
MPIIrecv
::
IsFinished
(){
}
MPIIrecv
::~
MPIIrecv
(){
}
}
// namespace detail
}
// namespace operators
...
...
paddle/fluid/operators/detail/mpi_utils.h
浏览文件 @
94ce0202
...
...
@@ -10,7 +10,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <mpi
/mpi
.h>
#include <mpi.h>
#include <map>
#include <string>
#include <vector>
...
...
@@ -30,22 +30,23 @@ class MPIUtils {
class
MPIIsend
{
public:
void
init
(
);
int
i
sFinished
();
void
s
end
();
MPIIsend
(
int
dst
,
const
char
*
buf
);
bool
I
sFinished
();
void
S
end
();
~
MPIIsend
();
private:
int
done1
;
int
done2
;
sendrecv
::
VariableMessage
req
;
int
done1
;
int
length
;
char
*
req
;
MPI_Request
msg1_
;
};
class
MPIIrecv
{
public:
void
init
();
int
i
sFinished
();
void
r
ecv
();
MPIIrecv
();
bool
I
sFinished
();
void
R
ecv
();
~
MPIIrecv
();
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录