diff --git a/src/main.c b/src/main.c index 627eeef3b392a7b68a133c8c16fb1a5902ed1e02..08cf7649e179f220bb3ba71f2583e72cd680ab92 100644 --- a/src/main.c +++ b/src/main.c @@ -64,6 +64,13 @@ int main(int argc, char* argv[]) { gettimeofday(&start_time, NULL); } + // Set a minimum of 4 active processes, unconditionally. + // One for handling "console output" and then at least 3 to function as workers. + // Doesn't make sense to have any fewer processes running, given the point of this program. + if (total_processors < 4) { + total_processors = 4; + } + // Validate program args. validate_args(argc, argv); @@ -82,7 +89,7 @@ int main(int argc, char* argv[]) { printf(" = %i Minutes Active Work\n", (seconds_active_work / 60)); printf("\n"); printf(" %i Total System Processors\n", get_nprocs()); - printf(" %i Processors in Use\n", total_processors); + printf(" %i Processors in Use (Min value of 4)\n", total_processors); printf("\n"); printf(" Expected total execution time with ideal processor usage (ignoring unused processors):\n"); expected_time_lapse = seconds_active_work / total_processors; @@ -200,15 +207,15 @@ void run_program() { total_processors, seconds_per_load, total_loads, process_rank ); - // arr_run(thread_args_ptr); - grr_run(thread_args_ptr); + arr_run(thread_args_ptr); + // grr_run(thread_args_ptr); // rp_run(thread_args_ptr); // nn_run(thread_args_ptr); free_thread_struct(thread_args_ptr); // Wait for all processes to synchronize. - // MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); if (process_rank == 0) { printf("\n");