Uses asynchronous send
This commit is contained in:
parent
d6f54cf62b
commit
3e9ea923b6
@ -130,15 +130,17 @@ void find_end(int residue, char *pattern, char *text, int **matches, int *match_
|
|||||||
void search_for_splitted_pattern(int *residue, int *match_number, int **matches) {
|
void search_for_splitted_pattern(int *residue, int *match_number, int **matches) {
|
||||||
// send the residue to the next process
|
// send the residue to the next process
|
||||||
if (rank + 1 != size) {
|
if (rank + 1 != size) {
|
||||||
MPI_Send(residue, 1, MPI_INT, rank + 1, DEFAULT_TAG, MPI_COMM_WORLD);
|
MPI_Request request;
|
||||||
|
MPI_Isend(residue, 1, MPI_INT, rank + 1, DEFAULT_TAG, MPI_COMM_WORLD, &request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// receiving the residue from the previous process
|
// receiving the residue from the previous process
|
||||||
|
int other_residue = 0;
|
||||||
if (rank != 0) {
|
if (rank != 0) {
|
||||||
MPI_Recv(residue, 1, MPI_INT, rank - 1, DEFAULT_TAG, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
MPI_Recv(&other_residue, 1, MPI_INT, rank - 1, DEFAULT_TAG, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
if (*residue != 0)
|
if (other_residue != 0)
|
||||||
// search for a split match
|
// search for a split match
|
||||||
find_end(*residue, pattern, private_text, matches, match_number);
|
find_end(other_residue, pattern, private_text, matches, match_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user