fix send
This commit is contained in:
parent
0a0b2f89ae
commit
d68792ae1c
@ -16,13 +16,10 @@ int find_end(int residue, char *pattern, char *text, int shift);
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int rank, size;
|
int rank, size;
|
||||||
int text_len; // length of all text
|
|
||||||
int private_text_len; // length of private text
|
int private_text_len; // length of private text
|
||||||
int pattern_len; //length of the pattern
|
int pattern_len; //length of the pattern
|
||||||
char *text;
|
|
||||||
char *pattern;
|
char *pattern;
|
||||||
int remain = 0;
|
int remain = 0;
|
||||||
int *text_piece;
|
|
||||||
int *displacements;
|
int *displacements;
|
||||||
char *private_text;
|
char *private_text;
|
||||||
int *match_numbers;
|
int *match_numbers;
|
||||||
@ -119,15 +116,16 @@ int main(int argc, char **argv) {
|
|||||||
if (rank != 0) {
|
if (rank != 0) {
|
||||||
MPI_Status myStatus;
|
MPI_Status myStatus;
|
||||||
MPI_Wait(&rec_rq, &myStatus);
|
MPI_Wait(&rec_rq, &myStatus);
|
||||||
|
int splitted_match = -1;
|
||||||
if (residue != 0) {
|
if (residue != 0) {
|
||||||
int splitted_match = find_end(other_residue, pattern, private_text, shift);
|
splitted_match = find_end(other_residue, pattern, private_text, shift);
|
||||||
MPI_Send(&splitted_match, 1, MPI_INT, MASTER, DEFAULT_TAG, MPI_COMM_WORLD);
|
|
||||||
}
|
}
|
||||||
|
MPI_Send(&splitted_match, 1, MPI_INT, MASTER, DEFAULT_TAG, MPI_COMM_WORLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rank == MASTER) {
|
if (rank == MASTER) {
|
||||||
int splitted_match;
|
int splitted_match;
|
||||||
for (int i = 0; i < size - 1; i++) {
|
for (int i = 1; i < size; i++) {
|
||||||
MPI_Recv(&splitted_match, 1, MPI_INT, MPI_ANY_SOURCE, DEFAULT_TAG, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
MPI_Recv(&splitted_match, 1, MPI_INT, MPI_ANY_SOURCE, DEFAULT_TAG, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
||||||
if (splitted_match > 0) {
|
if (splitted_match > 0) {
|
||||||
total_matches[total_match_number] = splitted_match;
|
total_matches[total_match_number] = splitted_match;
|
||||||
|
Loading…
Reference in New Issue
Block a user