- if ( (rank < participants) ) {
-
- /* Determine what rows are my responsibility */
- int block_size = MAX_PROCESSES / participants;
- int begin_row = rank * block_size;
- int end_row = (rank+1) * block_size;
- int send_count = block_size * MAX_PROCESSES;
- int recv_count = send_count;
-
- /* Paint my rows my color */
- for (i=begin_row; i<end_row ;i++)
- for (j=0; j<MAX_PROCESSES; j++)
- table[i][j] = rank + 10;
-
- /* Everybody gets the gathered table */
- MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL,
- &table[0][0], recv_count, MPI_INT, MPI_COMM_WORLD);
-
- /* Everybody should have the same table now, */
- /* This test does not in any way guarantee there are no errors */
- /* Print out a table or devise a smart test to make sure it's correct */
- for (i=0; i<MAX_PROCESSES;i++) {
- if ( (table[i][0] - table[i][MAX_PROCESSES-1] !=0) )
- errors++;
- }
- }
-
- MTest_Finalize( errors );
+ if ((rank < participants)) {
+
+ /* Determine what rows are my responsibility */
+ int block_size = MAX_PROCESSES / participants;
+ int begin_row = rank * block_size;
+ int end_row = (rank + 1) * block_size;
+ int send_count = block_size * MAX_PROCESSES;
+ int recv_count = send_count;
+
+ /* Paint my rows my color */
+ for (i = begin_row; i < end_row; i++)
+ for (j = 0; j < MAX_PROCESSES; j++)
+ table[i][j] = rank + 10;
+
+ /* Everybody gets the gathered table */
+ MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL,
+ &table[0][0], recv_count, MPI_INT, MPI_COMM_WORLD);
+
+ /* Everybody should have the same table now, */
+ /* This test does not in any way guarantee there are no errors */
+ /* Print out a table or devise a smart test to make sure it's correct */
+ for (i = 0; i < MAX_PROCESSES; i++) {
+ if ((table[i][0] - table[i][MAX_PROCESSES - 1] != 0))
+ errors++;
+ }
+ }
+
+ MTest_Finalize(errors);