Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wmsofts
Paddle
提交
10669f1f
P
Paddle
项目概览
wmsofts
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
10669f1f
编写于
4月 17, 2018
作者:
T
tangwei12
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Separate the implement to another PR later
上级
5bf671b4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
0 addition
and
281 deletion
+0
-281
paddle/fluid/operators/detail/mpi_client.cpp
paddle/fluid/operators/detail/mpi_client.cpp
+0
-29
paddle/fluid/operators/detail/mpi_client.h
paddle/fluid/operators/detail/mpi_client.h
+0
-56
paddle/fluid/operators/detail/mpi_server.h
paddle/fluid/operators/detail/mpi_server.h
+0
-23
paddle/fluid/operators/detail/mpi_utils.cpp
paddle/fluid/operators/detail/mpi_utils.cpp
+0
-90
paddle/fluid/operators/detail/mpi_utils.h
paddle/fluid/operators/detail/mpi_utils.h
+0
-83
未找到文件。
paddle/fluid/operators/detail/mpi_client.cpp
已删除
100644 → 0
浏览文件 @
5bf671b4
/* 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
已删除
100644 → 0
浏览文件 @
5bf671b4
/* 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. */
#pragma once
#include <iostream>
#include <map>
#include <string>
#include "paddle/fluid/framework/data_type.h"
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/framework/selected_rows.h"
namespace
paddle
{
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
();
bool
Wait
();
private:
int64_t
req_count_
=
0
;
};
}
// namespace detail
}
// namespace operators
}
// namespace paddle
paddle/fluid/operators/detail/mpi_server.h
已删除
100644 → 0
浏览文件 @
5bf671b4
/* 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. */
#pragma once
namespace
paddle
{
namespace
operators
{
namespace
detail
{
class
MPIServer
{
public:
private:
};
}
// namespace detail
}
// namespace operators
}
// namespace paddle
paddle/fluid/operators/detail/mpi_utils.cpp
已删除
100644 → 0
浏览文件 @
5bf671b4
//
// Created by tangwei12 on 2018/3/27.
//
#include <stdio.h>
#include <string.h>
#include <mpi.h>
#include "mpi_utils.h"
#define max_worker_name_length 128
#define mpi_tag = 2008
namespace
paddle
{
namespace
operators
{
namespace
detail
{
MPIUtils
::
MPIUtils
(
const
std
::
string
&
worker_name
)
{
InitMPI
();
int
rank
=
0
,
size
=
1
;
char
my_name
[
max_work_group_size
];
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
size
);
snprintf
(
my_name
,
max_worker_name_length
,
worker_name
.
c_str
());
std
::
vector
<
char
>
worker_names
(
size
*
max_worker_name_length
);
MPI_Allgather
(
my_name
,
max_worker_name_length
,
MPI_CHAR
,
&
worker_names
[
0
],
max_worker_name_length
,
MPI_CHAR
,
MPI_COMM_WORLD
);
for
(
int
i
=
0
;
i
<
number_of_procs
;
i
++
)
{
name_to_id_
[
std
::
string
(
&
worker_names
[
i
*
128
])]
=
i
;
}
}
void
MPIUtils
::
InitMPI
()
{
int
flag
=
0
;
MPI_CHECK
(
MPI_Initialized
(
&
flag
));
if
(
!
flag
)
{
int
rank
=
0
,
size
=
1
,
len
=
-
1
;
char
host_name
[
max_worker_name_length
];
MPI_Init
(
0
,
0
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
size
);
MPI_Get_processor_name
(
host_name
,
&
len
);
}
};
MPISend
::
MPISend
(
const
Meta
&
meta
)
{
done1_
=
1
;
done2_
=
0
;
this
->
meta
=
meta
;
}
MPISend
::
Send
()
{
MPI_Send
(
&
meta
.
request
,
meta
.
count
,
meta
.
datatype
,
meta
.
dst
,
meta
.
tag
,
MPI_COMM_WORLD
);
done2_
=
1
;
}
bool
MPISend
::
IsReady
()
{
return
true
;
}
bool
MPISend
::
IsFinished
()
{
return
done1_
&&
done2_
;
}
MPISend
::~
MPISend
()
{
MPI_Free_mem
(
meta
);
}
MPIRecv
::
MPIRecv
(
const
Meta
&
meta
)
{
this
->
meta
=
meta
;
}
MPIRecv
::
Recv
()
{}
bool
MPIRecv
::
IsReady
()
{
return
true
;
}
MPIRecv
::
IsFinished
()
{}
MPIRecv
::~
MPIRecv
()
{
MPI_Free_mem
(
meta
);
}
}
// namespace detail
}
// namespace operators
}
// namespace paddle
\ No newline at end of file
paddle/fluid/operators/detail/mpi_utils.h
已删除
100644 → 0
浏览文件 @
5bf671b4
/* 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. */
#pragma once
#include <mpi.h>
#include <map>
#include <string>
#include <vector>
namespace
paddle
{
namespace
operators
{
namespace
detail
{
class
MPIUtils
{
public:
MPIUtils
(
const
std
::
string
&
worker_name
);
const
int
GetRankID
(
const
std
::
string
&
task_id
);
private:
void
InitMPI
();
std
::
map
<
std
::
string
,
int
>
name_id_map
;
};
class
Meta
{
public:
int
src
;
int
dst
;
MPI_Datatype
datatype
;
char
*
request
;
int
count
;
int
tag
;
int
device
;
};
class
MPISend
{
public:
MPISend
(
const
Meta
&
meta
);
bool
IsFinished
();
bool
IsReady
();
void
Send
();
~
MPISend
();
private:
int
done1_
;
int
done2_
;
Meta
*
meta
;
};
class
MPIRecv
{
public:
MPIRecv
(
const
Meta
&
meta
);
bool
IsReady
();
bool
IsFinished
();
void
Recv
();
~
MPIRecv
();
private:
int
done1_
;
int
done2_
;
Meta
*
meta
;
};
}
// namespace detail
}
// namespace operators
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录