Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Podhorszki, Norbert
ADIOS2
Commits
efe04da7
Commit
efe04da7
authored
Mar 06, 2020
by
Ruonan Wang
Browse files
added sleep
parent
b8fc7346
Changes
2
Hide whitespace changes
Inline
Side-by-side
source/adios2/helper/adiosMpiHandshake.cpp
View file @
efe04da7
...
...
@@ -10,6 +10,7 @@
#include
<chrono>
#include
<cstring>
#include
<iostream>
#include
<thread>
namespace
adios2
{
...
...
@@ -193,12 +194,13 @@ void MpiHandshake::Handshake(const std::string &filename, const char mode,
// wait and check if required RendezvousAppCount reached
auto
start
_t
ime
=
std
::
chrono
::
system_clock
::
now
();
auto
start
T
ime
=
std
::
chrono
::
system_clock
::
now
();
while
(
!
Check
(
filename
))
{
auto
now_time
=
std
::
chrono
::
system_clock
::
now
();
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
microseconds
(
100
));
auto
nowTime
=
std
::
chrono
::
system_clock
::
now
();
auto
duration
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
seconds
>
(
now
_t
ime
-
start
_t
ime
);
now
T
ime
-
start
T
ime
);
if
(
duration
.
count
()
>
timeoutSeconds
)
{
throw
(
std
::
runtime_error
(
"Mpi handshake timeout"
));
...
...
source/adios2/helper/adiosMpiHandshake.h
View file @
efe04da7
...
...
@@ -26,12 +26,48 @@ namespace helper
class
MpiHandshake
{
public:
/**
* Start the handshake operations and wait until the rendezvous conditions
* are reached, or timeout.
*
* @param filename: name of the staging stream, must be within the length of
* maxFilenameLength
*
* @param mode: 'r' or 'w', read or write
*
* @param timeoutSeconds: timeout for the handshake, will throw exception
* when reaching this timeout
*
* @param maxStreamsPerApp: the maximum number of streams that all apps
* sharing this MPI_COMM_WORLD can possibly open. It is required that this
* number is consistent across all ranks. This is used for pre-allocating
* the vectors holding MPI requests and must be specified correctly,
* otherwise strange errors could occur. This class does not provide any
* mechanism to check whether this number being passed is actually correct
* or not accross all ranks, because implementing this logic for an
* arbitrary communication pattern is overly expensive, if not impossible.
*
* @param maxFilenameLength: the maximum possible length of filename that
* all apps sharing this MPI_COMM_WORLD could possibly define. It is
* required that this number is consistent across all ranks. This is used
* for pre-allocating the buffer for aggregating the global MPI information.
* An exception will be thrown if any filename on any rank is found to be
* longer than this.
*
* @param rendezvousAppCountForStream: the number of apps, including both
* writers and readers, that will work on this stream. The function will
* block until it receives the MPI handshake information from all these
* apps, or until timeoutSeconds is passed.
*
* @param localComm: local MPI communicator for the app
*/
static
void
Handshake
(
const
std
::
string
&
filename
,
const
char
mode
,
const
int
timeoutSeconds
,
const
size_t
maxStreamsPerApp
,
const
size_t
maxFilenameLength
,
const
size_t
R
endezvousAppCountForStream
,
const
size_t
r
endezvousAppCountForStream
,
MPI_Comm
localComm
);
static
const
std
::
map
<
int
,
std
::
vector
<
int
>>
&
GetWriterMap
(
const
std
::
string
&
filename
);
static
const
std
::
map
<
int
,
std
::
vector
<
int
>>
&
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment