00001
00002 #ifndef COMLIB_H
00003 #define COMLIB_H
00004
00005 #include <converse.h>
00006 #include <stdlib.h>
00007 #include <math.h>
00008 #include "charm++.h"
00009
00010 #if CMK_BLUEGENE_CHARM
00011 #define CmiReservedHeaderSize CmiBlueGeneMsgHeaderSizeBytes
00012 #else
00013 #define CmiReservedHeaderSize CmiExtHeaderSizeBytes
00014 #endif
00015
00016 extern int comm_debug;
00017 #if CMK_OPTIMIZE
00018 inline void ComlibPrintf(...) {}
00019 #else
00020 #define ComlibPrintf if(comm_debug) CmiPrintf
00021 #endif
00022
00023 enum{BCAST=0,TREE, GRID, HCUBE};
00024
00025 #define USE_TREE 1 //Organizes the all to all as a tree
00026 #define USE_MESH 2 //Virtual topology is a mesh here
00027 #define USE_HYPERCUBE 3 //Virtual topology is a hypercube
00028 #define USE_DIRECT 4 //A dummy strategy that directly forwards
00029
00030 #define USE_GRID 5 //Virtual topology is a 3d grid
00031 #define USE_LINEAR 6 //Virtual topology is a linear array
00032 #define USE_PREFIX 7 //Prefix router to avoid contention
00033
00034 #define IS_BROADCAST -1
00035 #define IS_SECTION_MULTICAST -2
00036
00037 #define MAXNUMMSGS 1000
00038
00039 #define PERSISTENT_BUFSIZE 65536
00040
00041 typedef struct {
00042 int refno;
00043 int instanceID;
00044 char isAllToAll;
00045 } comID;
00046
00047 typedef struct {
00048 int msgsize;
00049 void *msg;
00050 } msgstruct ;
00051
00052 typedef struct {
00053 char core[CmiReservedHeaderSize];
00054 comID id;
00055 int magic;
00056 int refno;
00057 } DummyMsg ;
00058
00059
00060 CkpvExtern(int, RecvHandle);
00061
00062 CkpvExtern(int, ProcHandle);
00063
00064 CkpvExtern(int, DummyHandle);
00065
00066
00067
00068 CkpvExtern(int, RecvdummyHandle);
00069
00070 inline double cubeRoot(double d) {
00071 return pow(d,1.0/3.0);
00072 }
00073
00074
00075 #include "router.h"
00076
00077 #endif
00078
00079