00001
00009 #ifndef INTERCOMM_H
00010 #define INTERCOMM_H
00011
00012 #include "ezxml/ezxml.h"
00013
00014
00015 #define IC_BDECOMP 1
00016 #define IC_TTABLE 2
00017
00018
00019
00021 typedef struct {
00022 int nbNode;
00023 char* name;
00024 int* tid;
00025 int myPos;
00026 char* joined;
00027 } IC_Program;
00028
00029 struct leaf_node;
00030
00032 typedef struct decomp_TREE {
00033 int nDims;
00034 int num_of_partitions;
00035 struct decomp_TREE* children;
00036 int* keys;
00037 struct leaf_node* block_info;
00038 } IC_Tree;
00039
00041 typedef struct {
00042 int type;
00043 void* spec;
00044 } IC_Desc;
00045
00046 typedef enum { R_Enum, R_HPF } T_RegionType;
00047 typedef enum { R_replicated, R_distributed, R_local } T_RegionDistribution;
00048 typedef enum { Mem_Copy, Mem_Pointer } T_MemOp;
00049
00050
00052 typedef struct {
00053 T_RegionType type;
00054 T_RegionDistribution distribution;
00055 T_MemOp mem_type;
00056 int size;
00057 } IC_Region;
00058
00059 typedef struct OneSched_ {
00060 struct OneSched_ *next;
00061 int offset;
00062 int size;
00063 } OneSched_s;
00064
00066 typedef struct {
00067 int nproc;
00068 int *size;
00069 OneSched_s **sched;
00070 OneSched_s **last;
00071 } IC_Sched;
00072
00073
00078 typedef struct IC_XJDComp_node {
00079 char* id;
00080 char* name;
00081 int ntask;
00082
00083 IC_Program* comp;
00084 struct IC_XJDComp_node* next;
00085 } IC_XJDComponent;
00086
00092 typedef struct IC_XJDRgn_node{
00093 char* myname;
00094 char* my_region_name;
00095 IC_Program* me;
00096
00097 char* partnername;
00098 char* partner_region_name;
00099 IC_Program* partner;
00100
00101 IC_Region** region;
00102 int rgn_size;
00103 char* commtype;
00104 char* type;
00105 int tag;
00106 void* local_data;
00107
00108 IC_Desc* rgn_desc;
00109 IC_Sched* sched;
00110
00111 struct IC_XJDRgn_node* next;
00112 } IC_XJDRegion;
00113
00114
00120 typedef struct {
00121 char* version;
00122
00123 IC_XJDComponent* cHeader;
00124 IC_XJDComponent* cTail;
00125 IC_XJDRegion* rHeader;
00126 IC_XJDRegion* rTail;
00127 ezxml_t xmlRoot;
00128
00129
00130
00131 void* meou;
00132 } IC_XJD;
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00147 enum {
00148 IC_COLUMN_MAJOR = 1,
00149 IC_ROW_MAJOR = 2,
00150 };
00151
00152
00160 IC_Program* IC_Init(char* name, int tasks, int rank);
00161
00168 IC_Program* IC_Wait(char* name, int tasks);
00169
00176 int IC_Sync(IC_Program* myprog, IC_Program* prog);
00177
00187 IC_Desc* IC_Create_bdecomp_desc(int ndims, int* blocks, int* tasks, int count, int arrayOrder);
00188
00197 IC_Desc* IC_Create_ttable_desc(int* globals, int* locals, int* tasks, int count);
00198
00203 IC_Tree* IC_Create_bdecomp_tree();
00204
00212 void IC_Section(IC_Tree* root, int dim, int count, int* indices);
00213
00223 void IC_Partition(IC_Tree* root, int dim, int* block, int count, int* indices);
00224
00235 IC_Desc* IC_Verify_bdecomp_tree(IC_Tree* root, int ndims, int* size, int* tasks, int count, int arrayOrder);
00236
00245 IC_Region* IC_Create_block_region(int ndims, int* lower, int* upper, int* stride);
00246
00253 IC_Region* IC_Create_enum_region(int* indices, int count);
00254
00255
00265 IC_Sched* IC_Compute_schedule(IC_Program* myprog, IC_Program* prog, IC_Desc* desc,
00266 IC_Region** region_set, int set_size);
00267
00268
00269 #define TYPE void
00270
00286 int IC_Send_TYPE(IC_Program* to, IC_Sched* sched, TYPE* data, int tag);
00287
00288 int IC_Send_char(IC_Program* to, IC_Sched* sched, char* data, int tag);
00289 int IC_Send_short(IC_Program* to, IC_Sched* sched, short* data, int tag);
00290 int IC_Send_int(IC_Program* to, IC_Sched* sched, int* data, int tag);
00291 int IC_Send_long(IC_Program* to, IC_Sched* sched, long* data, int tag);
00292 int IC_Send_float(IC_Program* to, IC_Sched* sched, float* data, int tag);
00293 int IC_Send_double(IC_Program* to, IC_Sched* sched, double* data, int tag);
00294
00310 int IC_Recv_TYPE(IC_Program* from, IC_Sched* sched, TYPE* data, int tag);
00311
00312 int IC_Recv_char(IC_Program* from, IC_Sched* sched, char* data, int tag);
00313 int IC_Recv_short(IC_Program* from, IC_Sched* sched, short* data, int tag);
00314 int IC_Recv_int(IC_Program* from, IC_Sched* sched, int* data, int tag);
00315 int IC_Recv_float(IC_Program* from, IC_Sched* sched, float* data, int tag);
00316 int IC_Recv_double(IC_Program* from, IC_Sched* sched, double* data, int tag);
00317
00322 void IC_Free_sched(IC_Sched* sched);
00323
00328 void IC_Free_region(IC_Region* region);
00329
00334 void IC_Free_desc(IC_Desc* desc);
00335
00340 void IC_Free_program(IC_Program* prog);
00341
00347 void IC_Quit(IC_Program* myprog);
00348
00353 void IC_Print_error(char* msg);
00354
00355
00368 IC_XJD* IC_Initialize(char* pName, int rank, char* xjdname, int* status);
00369
00370
00392 void IC_Register_region(IC_XJD* xjd, IC_Region** rgnset, int set_size, char* set_name, IC_Desc* desc, void* local_data, int* status);
00393
00394
00400 void IC_Commit_region(IC_XJD* xjd, int* status);
00401
00402
00412 int IC_Export(IC_XJD* xjd, char* rgnset_name);
00413
00414
00424 int IC_Import(IC_XJD* xjd, char* rgnset_name);
00425
00426
00440 int IC_BCast_Local_TYPE(IC_Program* to, TYPE* data, int nelems, int tag);
00441
00442 int IC_BCast_Local_char(IC_Program* to, char* data, int nelems, int tag);
00443 int IC_BCast_Local_short(IC_Program* to, short* data, int nelems, int tag);
00444 int IC_BCast_Local_int(IC_Program* to, int* data, int nelems, int tag);
00445 int IC_BCast_Local_float(IC_Program* to, float* data, int nelems, int tag);
00446 int IC_BCast_Local_double(IC_Program* to, double* data, int nelems, int tag);
00447
00448
00463 int IC_Recv_Local_TYPE(IC_Program* from, TYPE* data, int nelems, int tag);
00464
00465 int IC_Recv_Local_char(IC_Program* from, char* data, int nelems, int tag);
00466 int IC_Recv_Local_short(IC_Program* from, short* data, int nelems, int tag);
00467 int IC_Recv_Local_int(IC_Program* from, int* data, int nelems, int tag);
00468 int IC_Recv_Local_float(IC_Program* from, float* data, int nelems, int tag);
00469 int IC_Recv_Local_double(IC_Program* from, double* data, int nelems, int tag);
00470
00471
00472
00481 int IC_BCast_Local(IC_XJD* xjd, char* rgnset_name, void* data, int nelems);
00482
00483
00493 int IC_Recv_Local(IC_XJD* xjd, char* rgnset_name, void* data, int nelems);
00494
00495
00511 void IC_Finalize(IC_XJD* xjd, int* icsts);
00512
00513
00514 #endif