Skip to content
Snippets Groups Projects
Commit 82473678 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Also check sent data is unmodified

parent 606ff3ae
No related branches found
No related tags found
No related merge requests found
...@@ -266,7 +266,7 @@ int main(int argc, char *argv[]) { ...@@ -266,7 +266,7 @@ int main(int argc, char *argv[]) {
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. */ /* Fill data with a pattern for checking when overwritten. */
datacheck_fill(1, log->size, log->data); datacheck_fill(1, pcells_size[pid], pcells_in[pid]);
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]);
...@@ -290,8 +290,8 @@ int main(int argc, char *argv[]) { ...@@ -290,8 +290,8 @@ int main(int argc, char *argv[]) {
/* Check the data received is correct. */ /* Check the data received is correct. */
struct mpiuse_log_entry *log = send_pcells[pid]; struct mpiuse_log_entry *log = send_pcells[pid];
if (!datacheck_test(1, log->size, log->data)) { if (!datacheck_test(0, pcells_size[pid], pcells_in[pid])) {
if (datacheck_test(0, log->size, log->data)) { if (!datacheck_test(1, pcells_size[pid], pcells_in[pid])) {
error("Received data is not modified"); error("Received data is not modified");
} else { } else {
error("Received data is corrupt"); error("Received data is corrupt");
...@@ -299,6 +299,7 @@ int main(int argc, char *argv[]) { ...@@ -299,6 +299,7 @@ int main(int argc, char *argv[]) {
} else { } else {
message("Received data is correct"); message("Received data is correct");
} }
free(pcells_in[pid]);
} }
message("All proxy cells have arrived"); message("All proxy cells have arrived");
...@@ -306,6 +307,17 @@ int main(int argc, char *argv[]) { ...@@ -306,6 +307,17 @@ int main(int argc, char *argv[]) {
res = MPI_Waitall(nr_send_pcells, req_pcells_out, MPI_STATUSES_IGNORE); res = MPI_Waitall(nr_send_pcells, req_pcells_out, MPI_STATUSES_IGNORE);
if (res != MPI_SUCCESS) error("Waitall for pcells Isend failed."); if (res != MPI_SUCCESS) error("Waitall for pcells Isend failed.");
/* Check data is unmodified. */
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)) {
error("Sent data has been corrupted");
} else {
message("Sent data is correct");
}
free(log->data);
}
/* Shutdown MPI. */ /* Shutdown MPI. */
res = MPI_Finalize(); res = MPI_Finalize();
if (res != MPI_SUCCESS) if (res != MPI_SUCCESS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment