00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(GCOMM_HPP)
00012 #define GCOMM_HPP
00013
00014 #include "gtypes.h"
00015 #include "gtbuffer.hpp"
00016 #if defined(MPI_GENERIC_DEFAULT)
00017 # include "mpi.h"
00018 #endif
00019
00020
00021 #if defined(MPI_GENERIC_DEFAULT)
00022
00023
00024 extern MPI_Op G2MPI_OPTYPE[] ;
00025
00026 #endif
00027
00028 #if !defined(GPARTITIONMAP_DEF)
00029 #define GPARTITIONMAP_DEF
00030 #define NPARTMAPST_MEM (5)
00031 struct stGPartitionMap {
00032 GKEY elem_key;
00033 GKEY parent_key;
00034 GSHORT proc_to;
00035 GSHORT bcoarsened;
00036 GFLOAT center[GDIM];
00037 friend ostream& operator<<(ostream&os, stGPartitionMap &pm) {
00038 os << "elem_key =" << pm.elem_key << endl
00039 << "parent_key=" << pm.parent_key << endl
00040 << "proc_to =" << pm.proc_to << endl
00041 << "bcoarsened=" << pm.bcoarsened << endl;
00042 return os;
00043 }
00044 };
00045 #endif
00046
00047 namespace GComm
00048 {
00049
00050 void InitComm (int *argc, char **argv[]);
00051 void TermComm ();
00052 GSHORT WorldRank ();
00053 GSHORT WorldSize ();
00054 GBOOL ASendRecv (void **RecvBuff, GINT nRecvBuff, GINT *irecv, GINT *maxRecvLen, GC_DATATYPE rtype, GSHORT *source, GBOOL bUseSource,
00055 void **SendBuff, GINT nSendBuff, GINT *isend, GINT *maxSendLen, GC_DATATYPE stype, GSHORT *dest );
00056 GBOOL ASendRecvDB(GDWBuffer **RecvBuff, GINT nRecvBuff, GINT *irecv, GINT maxRecvLen, GSHORT *source, GBOOL bUseSource,
00057 GDWBuffer **SendBuff, GINT nSendBuff, GINT *isend, GINT maxSendLen, GSHORT *dest );
00058 GBOOL ASendRecvNB(GNIDBuffer **RecvBuff, GINT nRecvBuff, GINT *irecv, GINT maxRecvLen, GSHORT *source, GBOOL bUseSource,
00059 GNIDBuffer **SendBuff, GINT nSendBuff, GINT *isend, GINT maxSendLen, GSHORT *dest );
00060 GSHORT Allreduce (void *, void *, const GINT count, GC_DATATYPE data_type, G_OP op);
00061 GSHORT Allreduce (void *, void *, const GINT count, GC_DATATYPE data_type, G_OP op, void *);
00062 GSHORT Allreduce (void *, void *, const GINT count, GC_DATATYPE data_type, GBOOL b, G_OP op);
00063 GSHORT Allgather (void *operand, GINT sendcount, GC_DATATYPE stype, void *result, GINT recvcount, GC_DATATYPE gtype);
00064 GSHORT Allgather (void *operand, GINT sendcount, GC_DATATYPE stype, void *result, GINT recvcount, GC_DATATYPE gtype, void *);
00065
00066 void ARecv (void **rbuff, GINT buffcount, GINT *bufflen, GINT *buffindex, GC_DATATYPE rtype, GSHORT *source, CHandle &);
00067 GBOOL BSend (void **rbuff, GINT buffcount, GINT *bufflen, GINT *buffindex, GC_DATATYPE stype, GSHORT *dest );
00068 GBOOL AWaitOnRecv(CHandle &handle);
00069 GBOOL DataTypeFromStruct(AGINT blk_ptr[], GC_DATATYPE blk_types[], GINT n_type[],
00070 const GINT num_typ, GC_DATATYPE *return_type);
00071 void DataTypeFree(GC_DATATYPE *type);
00072 void Address(void *location, AGINT *address);
00073 void Synch();
00074 void Synch(void *);
00075
00076
00077
00078 }
00079
00080 #endif
00081