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 int arrayorder;
00083
00084 IC_Program* comp;
00085 struct IC_XJDComp_node* next;
00086 } IC_XJDComponent;
00087
00095 typedef struct IC_XJDRgn_node{
00096 char* myname;
00097 char* my_region_name;
00098 IC_Program* me;
00099
00100 char* partnername;
00101 char* partner_region_name;
00102 IC_Program* partner;
00103
00104 IC_Region** region;
00105 int rgn_size;
00106 char* commtype;
00107 char* type;
00108 int tag;
00109 int usetype;
00110 void* local_data;
00111
00112 IC_Desc* rgn_desc;
00113 IC_Sched* sched;
00114
00115 struct IC_XJDRgn_node* next;
00116 } IC_XJDRegion;
00117
00118
00124 typedef struct {
00125 char* version;
00126
00127 IC_XJDComponent* cHeader;
00128 IC_XJDComponent* cTail;
00129 IC_XJDRegion* rHeader;
00130 IC_XJDRegion* rTail;
00131 ezxml_t xmlRoot;
00132
00133
00134
00135 void* meou;
00136 } IC_XJD;
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00151 enum {
00152 IC_ROW_MAJOR = 0,
00153 IC_COLUMN_MAJOR = 1,
00154 };
00155
00156
00164 IC_Program* IC_Init(char* name, int tasks, int rank);
00165
00172 IC_Program* IC_Wait(char* name, int tasks);
00173
00180 int IC_Sync(IC_Program* myprog, IC_Program* prog);
00181
00191 IC_Desc* IC_Create_bdecomp_desc(int ndims, int* blocks, int* tasks, int count, int arrayOrder);
00192
00201 IC_Desc* IC_Create_ttable_desc(int* globals, int* locals, int* tasks, int count);
00202
00207 IC_Tree* IC_Create_bdecomp_tree();
00208
00216 void IC_Section(IC_Tree* root, int dim, int count, int* indices);
00217
00227 void IC_Partition(IC_Tree* root, int dim, int* block, int count, int* indices);
00228
00239 IC_Desc* IC_Verify_bdecomp_tree(IC_Tree* root, int ndims, int* size, int* tasks, int count, int arrayOrder);
00240
00249 IC_Region* IC_Create_block_region(int ndims, int* lower, int* upper, int* stride);
00250
00257 IC_Region* IC_Create_enum_region(int* indices, int count);
00258
00259
00269 IC_Sched* IC_Compute_schedule(IC_Program* myprog, IC_Program* prog, IC_Desc* desc,
00270 IC_Region** region_set, int set_size);
00271
00272
00273 #define TYPE void
00274
00290 int IC_Send_TYPE(IC_Program* to, IC_Sched* sched, TYPE* data, int tag);
00291
00292 int IC_Send_char(IC_Program* to, IC_Sched* sched, char* data, int tag);
00293 int IC_Send_short(IC_Program* to, IC_Sched* sched, short* data, int tag);
00294 int IC_Send_int(IC_Program* to, IC_Sched* sched, int* data, int tag);
00295 int IC_Send_long(IC_Program* to, IC_Sched* sched, long* data, int tag);
00296 int IC_Send_float(IC_Program* to, IC_Sched* sched, float* data, int tag);
00297 int IC_Send_double(IC_Program* to, IC_Sched* sched, double* data, int tag);
00298
00314 int IC_Recv_TYPE(IC_Program* from, IC_Sched* sched, TYPE* data, int tag);
00315
00316 int IC_Recv_char(IC_Program* from, IC_Sched* sched, char* data, int tag);
00317 int IC_Recv_short(IC_Program* from, IC_Sched* sched, short* data, int tag);
00318 int IC_Recv_int(IC_Program* from, IC_Sched* sched, int* data, int tag);
00319 int IC_Recv_float(IC_Program* from, IC_Sched* sched, float* data, int tag);
00320 int IC_Recv_double(IC_Program* from, IC_Sched* sched, double* data, int tag);
00321
00326 void IC_Free_sched(IC_Sched* sched);
00327
00332 void IC_Free_region(IC_Region* region);
00333
00338 void IC_Free_desc(IC_Desc* desc);
00339
00344 void IC_Free_program(IC_Program* prog);
00345
00351 void IC_Quit(IC_Program* myprog);
00352
00357 void IC_Print_error(char* msg);
00358
00359
00372 IC_XJD* IC_Initialize(char* pName, int rank, char* xjdname, int* status);
00373
00374
00396 void IC_Register_region(IC_XJD* xjd, IC_Region** rgnset, int set_size, char* set_name, IC_Desc* desc, void* local_data, int* status);
00397
00398
00404 void IC_Commit_region(IC_XJD* xjd, int* status);
00405
00406
00416 int IC_Export(IC_XJD* xjd, char* rgnset_name);
00417
00418
00428 int IC_Import(IC_XJD* xjd, char* rgnset_name);
00429
00430
00444 int IC_Bcast_local_TYPE(IC_Program* to, TYPE* data, int nelems, int tag);
00445
00446 int IC_Bcast_local_char(IC_Program* to, char* data, int nelems, int tag);
00447 int IC_Bcast_local_short(IC_Program* to, short* data, int nelems, int tag);
00448 int IC_Bcast_local_int(IC_Program* to, int* data, int nelems, int tag);
00449 int IC_Bcast_local_float(IC_Program* to, float* data, int nelems, int tag);
00450 int IC_Bcast_local_double(IC_Program* to, double* data, int nelems, int tag);
00451
00452
00467 int IC_Recv_local_TYPE(IC_Program* from, TYPE* data, int nelems, int tag);
00468
00469 int IC_Recv_local_char(IC_Program* from, char* data, int nelems, int tag);
00470 int IC_Recv_local_short(IC_Program* from, short* data, int nelems, int tag);
00471 int IC_Recv_local_int(IC_Program* from, int* data, int nelems, int tag);
00472 int IC_Recv_local_float(IC_Program* from, float* data, int nelems, int tag);
00473 int IC_Recv_local_double(IC_Program* from, double* data, int nelems, int tag);
00474
00475
00476
00485 int IC_Bcast_local(IC_XJD* xjd, char* rgnset_name, void* data, int nelems);
00486
00487
00497 int IC_Recv_local(IC_XJD* xjd, char* rgnset_name, void* data, int nelems);
00498
00499
00515 void IC_Finalize(IC_XJD* xjd, int* icsts);
00516
00517
00518 #endif