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
9b6c9e39
Commit
9b6c9e39
authored
5 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Use the rank to fill the data, not some random pattern
parent
72a17124
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
+19
-20
19 additions, 20 deletions
swiftmpiproxies.c
with
19 additions
and
20 deletions
swiftmpiproxies.c
+
19
−
20
View file @
9b6c9e39
...
...
@@ -60,13 +60,11 @@ 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
fill value used in fill, note data type
.
* @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
;
static
void
datacheck_fill
(
unsigned
char
fill
,
size_t
size
,
void
*
data
)
{
unsigned
char
*
p
=
(
unsigned
char
*
)
data
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
p
[
i
]
=
fill
;
...
...
@@ -74,23 +72,21 @@ static void datacheck_fill(int offset, size_t size, void *data) {
}
/**
* @brief test a filled data area for our pattern.
* @brief test a filled data area for the given value. Returns 0 if not found
* in all elements of data.
*
* @param
offset check for offset bit pattern 01010101 otherwise 10101010
.
* @param
fill value used in fill, note data type
.
* @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
;
static
int
datacheck_test
(
unsigned
char
fill
,
size_t
size
,
void
*
data
)
{
unsigned
char
*
p
=
(
unsigned
char
*
)
data
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
if
(
p
[
i
]
!=
fill
)
{
if
(
verbose
)
{
message
(
"%d
: %d
!= %d"
,
offset
,
p
[
i
],
fill
);
message
(
"%d != %d"
,
p
[
i
],
fill
);
fflush
(
stdout
);
}
return
0
;
...
...
@@ -271,10 +267,9 @@ int main(int argc, char *argv[]) {
&
req_send_counts
[
k
]);
if
(
res
!=
MPI_SUCCESS
)
error
(
"Counts MPI_Isend failed."
);
/* Start Isend of pcells, filling the data with a pattern for checking
* on arrival. */
/* Start Isend of pcells, fill with our rank value. */
log
->
data
=
calloc
(
log
->
size
,
1
);
datacheck_fill
(
0
,
log
->
size
,
log
->
data
);
datacheck_fill
(
myrank
,
log
->
size
,
log
->
data
);
res
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
basetag
+
proxy_tag_cells
,
MPI_COMM_WORLD
,
...
...
@@ -309,8 +304,8 @@ int main(int argc, char *argv[]) {
pcells_in
[
pid
]
=
calloc
(
pcells_size
[
pid
],
1
);
/* Fill data with
a pattern for checking when overwritten
. */
datacheck_fill
(
1
,
pcells_size
[
pid
],
pcells_in
[
pid
]);
/* Fill data with
our rank
. */
datacheck_fill
(
myrank
,
pcells_size
[
pid
],
pcells_in
[
pid
]);
res
=
MPI_Irecv
(
pcells_in
[
pid
],
pcells_size
[
pid
],
MPI_BYTE
,
log
->
otherrank
,
basetag
+
proxy_tag_cells
,
MPI_COMM_WORLD
,
...
...
@@ -335,8 +330,10 @@ int main(int argc, char *argv[]) {
if
(
res
!=
MPI_SUCCESS
||
pid
==
MPI_UNDEFINED
)
error
(
"MPI_Waitany failed."
);
/* Check the data received is correct. */
if
(
!
datacheck_test
(
0
,
pcells_size
[
pid
],
pcells_in
[
pid
]))
{
/* Check the data received is correct. Should be filled with
* rank of sender. */
if
(
!
datacheck_test
(
status
.
MPI_SOURCE
,
pcells_size
[
pid
],
pcells_in
[
pid
]))
{
message
(
"Received data is not correct"
);
/* Report the tag and source of the request. */
...
...
@@ -347,7 +344,9 @@ int main(int argc, char *argv[]) {
status
.
MPI_ERROR
);
datacheck_fulltest
(
pcells_size
[
pid
],
pcells_in
[
pid
]);
if
(
datacheck_test
(
1
,
pcells_size
[
pid
],
pcells_in
[
pid
]))
{
fflush
(
stdout
);
if
(
datacheck_test
(
myrank
,
pcells_size
[
pid
],
pcells_in
[
pid
]))
{
error
(
"Received data is not modified on receive"
);
}
else
{
error
(
"Received data is corrupt"
);
...
...
@@ -368,7 +367,7 @@ int main(int argc, char *argv[]) {
/* Check data is unmodified while being offloaded. */
for
(
int
k
=
0
;
k
<
nr_send_pcells
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
send_pcells
[
k
];
if
(
!
datacheck_test
(
0
,
log
->
size
,
log
->
data
))
{
if
(
!
datacheck_test
(
myrank
,
log
->
size
,
log
->
data
))
{
datacheck_fulltest
(
log
->
size
,
log
->
data
);
error
(
"Sent data has been corrupted"
);
}
else
{
...
...
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