From ae4899839eab369f5d00ddf55382d75623428bf5 Mon Sep 17 00:00:00 2001
From: Brandon Rodriguez <brodriguez8774@gmail.com>
Date: Sat, 20 Feb 2021 13:36:44 -0500
Subject: [PATCH] Add recv to prevent grr main from constantly spamming all
 workers

---
 src/load_balance_schemes.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/load_balance_schemes.c b/src/load_balance_schemes.c
index 8ca3689..156a12d 100644
--- a/src/load_balance_schemes.c
+++ b/src/load_balance_schemes.c
@@ -290,6 +290,7 @@ void grr_main(thread_struct* thread_args_ptr) {
     int* recv_array;
     int msg_status_flag;
     int grr_counter;
+    int temp = 0;
     MPI_Request request_var;
 
     log("Starting GRR main.");
@@ -343,6 +344,9 @@ void grr_main(thread_struct* thread_args_ptr) {
                 msg_status_flag = 0;
                 MPI_Iprobe(grr_index, tag_grr_query, MPI_COMM_WORLD, &msg_status_flag, MPI_STATUS_IGNORE);
                 if (msg_status_flag == 1) {
+                    // Officially receive message. We don't care about contents though.
+                    MPI_Recv(&temp, 1, MPI_INT, grr_index, tag_grr_query, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
+
                     grr_counter = (grr_counter + 1) % thread_args_ptr->total_processors;
                     while (grr_counter == 0 || grr_counter == grr_index) {
                         grr_counter = (grr_counter + 1) % thread_args_ptr->total_processors;
-- 
GitLab