This commit is contained in:
Raffaele Mignone 2021-03-26 17:37:13 +01:00
parent 4f03fc2d5b
commit 0637fcdba1
Signed by: norangebit
GPG Key ID: F5255658CB220573

5
main.c
View File

@ -4,6 +4,7 @@
#include "util.h" #include "util.h"
#include <mpi.h> #include <mpi.h>
#include <malloc.h> #include <malloc.h>
#include <papi.h>
#define MASTER 0 #define MASTER 0
#define DEFAULT_TAG 17 #define DEFAULT_TAG 17
@ -56,6 +57,7 @@ int main() {
int lps[pattern_len]; int lps[pattern_len];
create_lps(pattern, pattern_len, lps); create_lps(pattern, pattern_len, lps);
long_long start_time = PAPI_get_real_usec();
// search for matches // search for matches
int match_number = 0; int match_number = 0;
int residue; int residue;
@ -69,12 +71,15 @@ int main() {
collect_results(&match_number, matches); collect_results(&match_number, matches);
long_long end_time = PAPI_get_real_usec();
MPI_Finalize(); MPI_Finalize();
if (rank == MASTER) { if (rank == MASTER) {
printf("total matches: %d\n", total_match_number); printf("total matches: %d\n", total_match_number);
printf("matches index: "); printf("matches index: ");
print_array(total_matches, total_match_number); print_array(total_matches, total_match_number);
printf("elapsed: %d\n", end_time - start_time);
} }
} }