Parallel Communications Library

There is a group of collective communication routines (formerly in PMDB) that can also be useful to applications, and these are made available as a message-library independent method of doing some commonly-used collective communications.


Initialization

void com_init()
This function initializes internal communication variables for communications. This is called by any of the parallel mesh loading and partitioning operators in PMDB automatically, but if you plan to use any of the other communication routines before calling a mesh loading or partitioning routine, you should first call com_init()


void com_deinit()
This function cleans up when finished using the communication routines.


Aborting

void com_abort(char *function, char *message)
This function aborts the communications library and the program. If the function or message parameters are non-NULL, an error message is printed first.


Parallel Communication Parameters

int com_numprocs()
int COM_NUMPROCS
The number of processors, as computed by com_init(). This value is available through the function com_numprocs or in the global integer value COM_NUMPROCS.


int com_pid()
int COM_PID
The process ID as computed by com_init(). This value is available through the function com_pid or in the global integer value COM_PID.


int COM_MASTER
The process ID of the master process.


Processor Synchronization

void com_all_sync()
This function synchronizes all processors.


void com_sync_io()
Call this function to synchronize output. It doesn't always work, unforuntately. stdout printing is often highly asynchronous...


Combine Operators

In the following functions, there are three arguments. in provides an input array of count values, and the result of the operation is returned in the array out.


void com_prefix_long(long *in, long *out, int count)
This operator does a parallel prefix addition operation for long values.


void com_prefix_int(int *in, int *out, int count)
This operator does a parallel prefix addition operation for int values.


void com_prefix_float(float *in, float *out, int count)
This operator does a parallel prefix addition operation for float values.


void com_prefix_double(double *in, double *out, int count)
This operator does a parallel prefix addition operation for double values.


void com_add_long(long *in, long *out, int count)
This operator does an all-processor-result addition operation for long values.


void com_max_long(long *in, long *out, int count)
This operator does an all-processor-result max operation for long values.


void com_min_long(long *in, long *out, int count)
This operator does an all-processor-result min operation for long values.


void com_add_int(int *in, int *out, int count)
This operator does an all-processor-result addition operation for int values.


void com_max_int(int *in, int *out, int count)
This operator does an all-processor-result max operation for int values.


void com_add_double(double *in, double *out, int count)
This operator does an all-processor-result addition operation for double values.


void com_max_float(float *in, float *out, int count)
This operator does an all-processor-result max operation for float values.


void com_max_double(double *in, double *out, int count)
This operator does an all-processor-result max operation for double values.


void com_min_double(double *in, double *out, int count)
This operator does an all-processor-result min operation for double values.


Broadcast Operators

void com_bcast_int(int *buffer, int root, int count)
This operator does a broadcast operation of the buffer of int values from the buffer on processor root to the buffer on all other processors.


void com_bcast_double(double *buffer, int root, int count)
This operator does a broadcast operation of the buffer of double values from the buffer on processor root to the buffer on all other processors.


Timing

double com_wall_time()
This returns the number of seconds since a fixed time in the past. There is no consistency between processors.


Higher-level Communication Routines

void com_comp_recvs(int num_sends, int *dest_pids,
                    int *num_recvs, int **src_pids)
This operator computes a list and number of source pids for each processor, based on the number of sends and the destination pids for each processor. dest_pids points to a list of num_sends pids which this processor wished to send to. num_recvs is returned as the number of requests that other processors made to this processor, and src_pids is a pointer to a list of the pids which made requests. Note: the pointer returned in src_pids is dynamically allocated memory, and must be released with a call to free() after the values are used.


void com_request_pid(int req_from_pid, int *num_reqs_by, 
                    int **reqs_by)
This operator is called on each processor. Each processor sends a PID to request from in req_from_pid. In reqs_by, a list of PIDs which requested from this processor is returned, and the number of PIDs in the list is returned in num_reqs_by. Note: the pointer returned in reqs_by is dynamically allocated memory, and must be released with a call to free() after the values are used.



Jim Teresco
Thu Dec 7 09:55:16 EST 1995