Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
swiftmpistepsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
swiftmpistepsim
Commits
606ff3ae
Commit
606ff3ae
authored
5 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add check that data received is as expected
parent
b0605d19
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swiftmpiproxies.c
+53
-1
53 additions, 1 deletion
swiftmpiproxies.c
with
53 additions
and
1 deletion
swiftmpiproxies.c
+
53
−
1
View file @
606ff3ae
...
@@ -54,6 +54,42 @@ int nr_send_pcells = 0;
...
@@ -54,6 +54,42 @@ int nr_send_pcells = 0;
struct
mpiuse_log_entry
**
recv_pcells
;
struct
mpiuse_log_entry
**
recv_pcells
;
int
nr_recv_pcells
=
0
;
int
nr_recv_pcells
=
0
;
/**
* @brief fill a data area with a pattern that can be checked for changes.
*
* @param offset use offset bit pattern 01010101 otherwise 10101010.
* @param size size of data in bytes.
* @param data the data to fill.
*/
static
void
datacheck_fill
(
int
offset
,
size_t
size
,
void
*
data
)
{
unsigned
char
fill
=
170
;
if
(
offset
)
fill
=
fill
>>
1
;
unsigned
char
*
p
=
(
unsigned
char
*
)
data
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
p
[
i
]
=
fill
;
}
}
/**
* @brief test a filled data area for our pattern.
*
* @param offset check for offset bit pattern 01010101 otherwise 10101010.
* @param size size of data in bytes.
* @param data the data to fill.
*
* @result 1 on success, 0 otherwise.
*/
static
int
datacheck_test
(
int
offset
,
size_t
size
,
void
*
data
)
{
unsigned
char
fill
=
170
;
if
(
offset
)
fill
=
fill
>>
1
;
unsigned
char
*
p
=
(
unsigned
char
*
)
data
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
if
(
p
[
i
]
!=
fill
)
return
0
;
}
return
1
;
}
/**
/**
* @brief Pick out the relevant logging data for our rank, i.e. all
* @brief Pick out the relevant logging data for our rank, i.e. all
* activations of sends and recvs. We ignore the original completion logs,
* activations of sends and recvs. We ignore the original completion logs,
...
@@ -195,6 +231,9 @@ int main(int argc, char *argv[]) {
...
@@ -195,6 +231,9 @@ int main(int argc, char *argv[]) {
/* Start Isend of pcells. */
/* Start Isend of pcells. */
log
->
data
=
calloc
(
log
->
size
,
1
);
log
->
data
=
calloc
(
log
->
size
,
1
);
/* Fill data with a pattern for checking on arrival. */
datacheck_fill
(
0
,
log
->
size
,
log
->
data
);
res
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
res
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
basetag
+
proxy_tag_cells
,
MPI_COMM_WORLD
,
basetag
+
proxy_tag_cells
,
MPI_COMM_WORLD
,
&
req_pcells_out
[
k
]);
&
req_pcells_out
[
k
]);
...
@@ -225,6 +264,9 @@ int main(int argc, char *argv[]) {
...
@@ -225,6 +264,9 @@ int main(int argc, char *argv[]) {
int
basetag
=
log
->
otherrank
*
proxy_tag_shift
;
int
basetag
=
log
->
otherrank
*
proxy_tag_shift
;
pcells_in
[
pid
]
=
calloc
(
pcells_size
[
pid
],
1
);
pcells_in
[
pid
]
=
calloc
(
pcells_size
[
pid
],
1
);
/* Fill data with a pattern for checking when overwritten. */
datacheck_fill
(
1
,
log
->
size
,
log
->
data
);
res
=
MPI_Irecv
(
pcells_in
[
pid
],
pcells_size
[
pid
],
MPI_BYTE
,
log
->
otherrank
,
res
=
MPI_Irecv
(
pcells_in
[
pid
],
pcells_size
[
pid
],
MPI_BYTE
,
log
->
otherrank
,
basetag
+
proxy_tag_cells
,
MPI_COMM_WORLD
,
basetag
+
proxy_tag_cells
,
MPI_COMM_WORLD
,
&
req_pcells_in
[
pid
]);
&
req_pcells_in
[
pid
]);
...
@@ -246,7 +288,17 @@ int main(int argc, char *argv[]) {
...
@@ -246,7 +288,17 @@ int main(int argc, char *argv[]) {
if
(
res
!=
MPI_SUCCESS
||
pid
==
MPI_UNDEFINED
)
if
(
res
!=
MPI_SUCCESS
||
pid
==
MPI_UNDEFINED
)
error
(
"MPI_Waitany failed."
);
error
(
"MPI_Waitany failed."
);
/* XXX check the data received is correct? */
/* Check the data received is correct. */
struct
mpiuse_log_entry
*
log
=
send_pcells
[
pid
];
if
(
!
datacheck_test
(
1
,
log
->
size
,
log
->
data
))
{
if
(
datacheck_test
(
0
,
log
->
size
,
log
->
data
))
{
error
(
"Received data is not modified"
);
}
else
{
error
(
"Received data is corrupt"
);
}
}
else
{
message
(
"Received data is correct"
);
}
}
}
message
(
"All proxy cells have arrived"
);
message
(
"All proxy cells have arrived"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment