1 /*@ BMmsg.h - Include file for the compiled message-passing code. 2 This code is indepedent (we hope) of the sparse matrix 3 code. The basic idea is to isolate the message-passing 4 code from the sparse matrix code to allow optimizations 5 to be done transparently. 6 @*/ 7 8 #ifndef __BMmsgh 9 #define __BMmsgh 10 11 /* the "preferred" maximum message size */ 12 #define PREFER_MAX_MSG_SIZE 262144 13 14 /* Definitions indicating the status of a message */ 15 #define NOT_COMPLETED 0 16 #define COMPLETED 1 17 18 /* A description of the user-specified data being sent */ 19 typedef struct __BMuser_data { 20 int length; /* length of the data in number of ints */ 21 int *data; /* pointer to the data */ 22 void (*free_data)(int *); /* pointer to a function for freeing the data */ 23 } BMuser_data; 24 25 /* A description of a message */ 26 typedef struct __BMmsg { 27 int phase; /* the phase to which this message belongs */ 28 int msg_type; /* message type: standard interpretation */ 29 int proc; /* processor to/from */ 30 int size; /* size of the message, in bytes */ 31 BMuser_data user_data; /* user data structure (see above) */ 32 BMuser_data setup_data; /* user data structure for setting up message */ 33 void *msg; /* the actual message */ 34 MPI_Datatype msg_data_type; /* the data type of the messages */ 35 MPI_Request recv_id; /* message id (used if async. recv) */ 36 MPI_Request send_id; /* message id (used if async. send) */ 37 int status; /* COMPLETED/NOT COMPLETED */ 38 int alloced; /* message allocated or not allocated */ 39 struct __BMmsg *next; /* pointer to next message in phase */ 40 } BMmsg; 41 42 /* a group of messages to be sent/received in the same phase */ 43 typedef struct __BMphase { 44 int phase; /* phase number */ 45 BMmsg *msg_list; /* pointer to a list of messages */ 46 BMmsg *end_msg_list; /* pointer to the end of msg_list */ 47 struct __BMphase *next; /* pointer to next phase */ 48 BMmsg *cur_list_ptr; /* current pointer in the list, if any */ 49 void *cur_recv_msg; /* holds the current blocked message for freeing */ 50 BSmsg_list *cur_msg; /* pointer the current message block, if any */ 51 /* this is ONLY used when messages are grouped */ 52 /* rather than sent individually */ 53 BSmsg_list *async_list; /* pointer to list of outstanding messages */ 54 /* this is ONLY used when messages are grouped */ 55 /* rather than sent individually */ 56 } BMphase; 57 58 /* the compiled message structure consisting of several phases */ 59 typedef struct __BMcomp_msg { 60 int num_phases; /* number of phases */ 61 BMphase *phase_list; /* pointer to a list of phases */ 62 int base_type; /* the base message type for this compiled 63 message structure. The structure will 64 use message numbers from base_type to 65 num_phases*num_processors; up to a 66 maximum of MAX_NUM_MSGS at which point 67 an error will occur and the code will 68 generate an error message. */ 69 int num_msgs; /* total number of messages in this structure */ 70 } BMcomp_msg; 71 72 /* list of function declarations for BMcomp_msg.c */ 73 /* These prototypes are now in BSsparse.h */ 74 75 /* 76 BMcomp_msg *BMcomp_init(); 77 void BMfree_comp_msg(); 78 BMphase *BMget_phase(); 79 void BMadd_msg(); 80 BMmsg *BMcreate_msg(); 81 int BMget_msg_size(); 82 void BMset_msg_size(); 83 void BMinit_user(); 84 void BMfree_user(); 85 void BMfree_user_data(); 86 void BMfree_setup_data(); 87 void BMset_user(); 88 void BMset_user_data(); 89 void BMset_setup_data(); 90 int *BMget_user(); 91 int *BMget_setup(); 92 void BMset_msg_ptr(); 93 char *BMget_msg_ptr(); 94 BMmsg *BMnext_msg(); 95 void BMalloc_msg(); 96 int BMfix_send(); 97 void BMinit_comp_msg(); 98 void BMfinish_comp_msg(); 99 void BMsendf_msg(); 100 void BMsend_block_msg(); 101 BMmsg *BMrecv_msg(); 102 BMmsg *BMrecv_block_msg(); 103 void BMfree_msg(); 104 void BMfree_block_msg(); 105 void BMfinish_on_async_block(); 106 void BMcheck_on_async_block(); 107 */ 108 109 #endif 110