Zoltan Developer's Guide | Next | Previous

## Parallel Computing Routines

Parallel computing utilities are described in this section.

> Zoltan_Print_Sync_Start / Zoltan_Print_Sync_End: provide synchronization of processors for I/O (with example).
> Zoltan_Print_Stats : print statistics about a parallel variable.

void Zoltan_Print_Sync_Start(MPI_Comm communicator, int do_print_line);

The Zoltan_Print_Sync_Start function is adapted from work of John Shadid for the MPSalsa project at Sandia National Laboratories. With Zoltan_Print_Sync_End, it provides synchronization so that one processor in the Zoltan communicator can complete its I/O before the next processor begins its I/O. This synchronization utility is useful for debugging algorithms, as it allows the output from processors to be produced in an organized manner. It is, however, a serializing process, and thus, does not scale well to large number of processors.

Zoltan_Print_Sync_Start should called by each processor in the MPI communicator before the desired I/O is performed. Zoltan_Print_Sync_End is called by each processor after the I/O is performed. No communication can be performed between calls to Zoltan_Print_Sync_Start and Zoltan_Print_Sync_End. See the example below for usage of Zoltan_Print_Sync_Start.

Arguments: |
communicator | The MPI communicator containing all processors to participate in the synchronization.
do_print_line | A flag indicating whether to print a line of "#" characters before and after the synchronization block. If do_print_line is TRUE, a line is printed; no line is printed otherwise.

void Zoltan_Print_Sync_End(MPI_Comm communicator, int do_print_line);

The Zoltan_Print_Sync_End function is adapted from work of John Shadid for the MPSalsa project at Sandia National Laboratories. With Zoltan_Print_Sync_Start, it provides synchronization so that one processor in the Zoltan communicator can complete its I/O before the next processor begins its I/O. This synchronization utility is useful for debugging algorithms, as it allows the output from processors to be produced in an organized manner. It is, however, a serializing process, and thus, does not scale well to large number of processors.

Zoltan_Print_Sync_Start should called by each processor in the MPI communicator before the desired I/O is performed. Zoltan_Print_Sync_End is called by each processor after the I/O is performed. No communication can be performed between calls to Zoltan_Print_Sync_Start and Zoltan_Print_Sync_End. See the example below for usage of Zoltan_Print_Sync_End.

Arguments: |
communicator | The MPI communicator containing all processors to participate in the synchronization.
do_print_line | A flag indicating whether to print a line of "#" characters before and after the synchronization block. If do_print_line is TRUE, a line is printed; no line is printed otherwise.

void Zoltan_Print_Stats(MPI_Comm comm, int debug_proc, double x, char *msg);

Zoltan_Print_Stats is a very simple routine that computes the maximum and sum of the variable x over all processors associated with the MPI communicator comm. It also computes and prints the imbalance of x, that is, the maximum value divided by the average minus one. If x has the same value on all processors, the imbalance is zero.

Arguments: |
comm | The MPI Communicator to be used in maximum and sum operations.
debug_proc | The processor from which output should be printed.
x | The variable of which one wishes to display statistics.
msg | A string that typically describes the meaning of x.

####

Example Using Zoltan_Print_Sync_Start/Zoltan_Print_Sync_End

`...`
`if (zz->Debug_Level >= ZOLTAN_DEBUG_ALL) {`
`int i;`
`Zoltan_Print_Sync_Start(zz->Communicator, TRUE);`
`printf("Zoltan: Objects to be exported from Proc %d\n", zz->Proc);`
`for (i = 0; i < *num_export_objs; i++) {`
`printf(" Obj: ");`
`ZOLTAN_PRINT_GID(zz, &((*export_global_ids)[i*zz->Num_GID]));
`printf(" Destination: %4d\n",`
`(*export_procs)[i]);`
`}`
`Zoltan_Print_Sync_End(zz->Communicator, TRUE);`
`}``

Example usage of Zoltan_Print_Sync_Start and Zoltan_Print_Sync_End to synchronize output among processors. (Taken from Zoltan_LB_Partition in lb/lb_balance.c.)

[Table of Contents | Next: Object List Function | Previous: Parameter Setting Routines | Privacy and Security]