00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00033 #include "bsp_exptable.h"
00034 #include "bsp_memreg.h"
00035 #include "bsp_mesgqueue.h"
00036
00045 void
00046 deliveryTable_execute (ExpandableTable * restrict table,
00047 ExpandableTable * restrict memreg,
00048 MessageQueue * restrict mesgq, const int rank)
00049 {
00050 int p, i;
00051 const DelivElement *restrict element;
00052 DelivElement * restrict message = NULL;
00053 const ALIGNED_TYPE * restrict pointer;
00054 const unsigned int tag_size =
00055 no_slots(sizeof(DelivElement), sizeof(ALIGNED_TYPE));
00056
00057 for (p = 0; p < table->nprocs; p++)
00058 {
00059
00060 pointer = (ALIGNED_TYPE *) table->data + p * table->rows +
00061 table->info.deliv.start[p][put] ;
00062
00063 for (i = 0; i < table->info.deliv.count[p][put]; i++)
00064 {
00065 element = (DelivElement *) pointer;
00066 memcpy(element->info.put.dst, pointer + tag_size, element->size);
00067 pointer+=element->next;
00068 }
00069
00070
00071 pointer = (ALIGNED_TYPE *) table->data + p * table->rows +
00072 table->info.deliv.start[p][pushreg];
00073
00074 for (i = 0; i < table->info.deliv.count[p][pushreg]; i++)
00075 {
00076 element = (DelivElement *) pointer;
00077 memoryRegister_push( memreg, p, element->info.push.address);
00078 pointer+=element->next;
00079 }
00080
00081
00082 pointer = (ALIGNED_TYPE *) table->data + p * table->rows +
00083 table->info.deliv.start[p][send];
00084
00085
00086 if (message != NULL)
00087 message->next = ((unsigned long) pointer - (unsigned long) message) / sizeof(ALIGNED_TYPE);
00088
00089 for (i = 0; i < table->info.deliv.count[p][send]; i++)
00090 {
00091 message = (DelivElement *) pointer;
00092 mesgq->accum_size += message->size;
00093 mesgq->n_mesg ++;
00094 pointer+=message->next;
00095 }
00096
00097 }
00098
00099
00100
00101 pointer = (ALIGNED_TYPE *) table->data + rank * table->rows +
00102 table->info.deliv.start[rank][popreg];
00103 for (i = 0; i < table->info.deliv.count[rank][popreg]; i++)
00104 {
00105 element = (DelivElement *) pointer;
00106 memoryRegister_pop( memreg, rank, element->info.pop.address);
00107 pointer+=element->next;
00108 }
00109
00110
00111 pointer = (ALIGNED_TYPE *) table->data + rank * table->rows +
00112 table->info.deliv.start[rank][settag];
00113 for (i = 0; i < table->info.deliv.count[rank][settag]; i++)
00114 {
00115 element = (DelivElement *) pointer;
00116 mesgq->send_tag_size = element->info.settag.tag_size;
00117 pointer+=element->next;
00118 }
00119
00120
00121 for (p = 0; p < table->nprocs; p++)
00122 {
00123 if ( table->info.deliv.count[p][send] > 0 )
00124 {
00125 mesgq->head = (ALIGNED_TYPE *) table->data + p * table->rows
00126 + table->info.deliv.start[p][send];
00127 break;
00128 }
00129 }
00130 }
00131
00132
00133