#include <netmpi.h>
Static Public Member Functions | |
static int | rank () |
static int | nProcess () |
static bool | isLastProcess () |
static void | setTrace (bool b) |
static std::ostream & | getLog () |
static void | setLog (std::ostream &out) |
static void | Isend (VecDouble &v, int dst, int tag, MPI_Request &req) |
static void | Barrier () |
static void | Irecv (VecDouble &v, int src, int tag, MPI_Request &req) |
static void | exchangeDataRedBlack (VecIndex &vLSndMap, VecDouble &vLSnd, VecIndex &vLRcvMap, VecDouble &vLRcv, VecIndex &vRSndMap, VecDouble &vRSnd, VecIndex &vRRcvMap, VecDouble &vRRcv, VecDouble &data, int tag) |
static void | exchangeDataRedBlack (VecIndex &vLSndMap, VecDouble &vLSnd, VecDouble &vLRcv, VecIndex &vRSndMap, VecDouble &vRSnd, VecDouble &vRRcv, VecDouble &data, int tag, VecReq &req) |
static void | exchangeDataRedBlack (VecIndex &vLSndMap, VecDouble &vLSnd, VecIndex &vLRcvMap, VecDouble &vLRcv, VecIndex &vRSndMap, VecDouble &vRSnd, VecIndex &vRRcvMap, VecDouble &vRRcv, VecDouble &dataSnd, VecDouble &dataRcv, int tag) |
static void | trace (const char *format,...) |
static void | debugPoint () |
static double | getMinValue (double localValue) |
Static Public Attributes | |
static std::ostream * | m_out = &(std::cout) |
Static Protected Attributes | |
static int | m_nP = -1 |
static int | m_rank = -1 |
Static Private Attributes | |
static bool | m_loop = false |
static bool | b1 = false |
static bool | b2 = false |
static bool | m_print = false |
Definition at line 44 of file netmpi.h.
static void NetMPI::Barrier | ( | ) | [inline, static] |
void NetMPI::debugPoint | ( | ) | [static] |
Definition at line 174 of file netmpi.cpp.
void NetMPI::exchangeDataRedBlack | ( | VecIndex & | vLSndMap, | |
VecDouble & | vLSnd, | |||
VecIndex & | vLRcvMap, | |||
VecDouble & | vLRcv, | |||
VecIndex & | vRSndMap, | |||
VecDouble & | vRSnd, | |||
VecIndex & | vRRcvMap, | |||
VecDouble & | vRRcv, | |||
VecDouble & | dataSnd, | |||
VecDouble & | dataRcv, | |||
int | tag | |||
) | [static] |
Definition at line 56 of file netmpi.cpp.
00057 { 00058 MPI_Request _req[4]; 00059 MPI_Status _status[4]; 00060 assert(vLSndMap.size() == vLSnd.size()); 00061 assert(vRSndMap.size() == vRSnd.size()); 00062 assert(vRRcvMap.size() == vRRcv.size()); 00063 assert(vLRcvMap.size() == vLRcv.size()); 00064 _req[0]=_req[1]=_req[2]=_req[3] = MPI_REQUEST_NULL; 00065 00066 int next = NetMPI::rank()+1; 00067 int prev = NetMPI::rank()-1; 00068 if (NetMPI::rank()%2 == 0) //Red Node 00069 { 00070 for (unsigned i=0;i<vLSndMap.size();i++) 00071 vLSnd(i)=dataSnd(vLSndMap[i]); 00072 NetMPI::Isend(vLSnd,prev,tag,_req[0]); 00073 00074 for (unsigned i=0;i<vRSndMap.size();i++) 00075 vRSnd(i)=dataSnd(vRSndMap[i]); 00076 NetMPI::Isend(vRSnd,next,tag,_req[1]); 00077 00078 NetMPI::Irecv(vLRcv,prev,tag,_req[2]); 00079 NetMPI::Irecv(vRRcv,next,tag,_req[3]); 00080 00081 } 00082 else if (NetMPI::rank()%2 == 1) //Black Node 00083 { 00084 NetMPI::Irecv(vRRcv,next,tag,_req[0]); 00085 NetMPI::Irecv(vLRcv,prev,tag,_req[1]); 00086 00087 for (unsigned i=0;i<vRSndMap.size();i++) 00088 vRSnd(i)=dataSnd(vRSndMap[i]); 00089 NetMPI::Isend(vRSnd,next,tag,_req[2]); 00090 00091 00092 for (unsigned i=0;i<vLSndMap.size();i++) 00093 vLSnd(i)=dataSnd(vLSndMap[i]); 00094 NetMPI::Isend(vLSnd,prev,tag,_req[3]); 00095 00096 } 00097 MPI_Waitall(4,_req,_status); 00098 for (unsigned i=0;i<vLRcv.size();i++) 00099 { 00100 dataRcv(vLRcvMap[i]) = vLRcv(i); 00101 } 00102 for (unsigned i=0;i<vRRcv.size();i++) 00103 { 00104 dataRcv(vRRcvMap[i]) = vRRcv(i); 00105 } 00106 00107 00108 }
void NetMPI::exchangeDataRedBlack | ( | VecIndex & | vLSndMap, | |
VecDouble & | vLSnd, | |||
VecDouble & | vLRcv, | |||
VecIndex & | vRSndMap, | |||
VecDouble & | vRSnd, | |||
VecDouble & | vRRcv, | |||
VecDouble & | data, | |||
int | tag, | |||
VecReq & | req | |||
) | [static] |
Definition at line 117 of file netmpi.cpp.
00118 { 00119 assert(_req.size() == 4); 00120 assert(vLSndMap.size() == vLSnd.size()); 00121 assert(vRSndMap.size() == vRSnd.size()); 00122 00123 00124 00125 int next = NetMPI::rank()+1; 00126 int prev = NetMPI::rank()-1; 00127 if (NetMPI::rank()%2 == 0) //Red Node 00128 { 00129 for (unsigned i=0;i<vLSndMap.size();i++) 00130 vLSnd(i)=data(vLSndMap[i]); 00131 NetMPI::Isend(vLSnd,prev,tag,_req[0]); 00132 00133 for (unsigned i=0;i<vRSndMap.size();i++) 00134 vRSnd(i)=data(vRSndMap[i]); 00135 NetMPI::Isend(vRSnd,next,tag,_req[1]); 00136 00137 NetMPI::Irecv(vLRcv,prev,tag,_req[2]); 00138 NetMPI::Irecv(vRRcv,next,tag,_req[3]); 00139 00140 } 00141 else if (NetMPI::rank()%2 == 1) //Black Node 00142 { 00143 NetMPI::Irecv(vRRcv,next,tag,_req[0]); 00144 NetMPI::Irecv(vLRcv,prev,tag,_req[1]); 00145 00146 for (unsigned i=0;i<vRSndMap.size();i++) 00147 vRSnd(i)=data(vRSndMap[i]); 00148 NetMPI::Isend(vRSnd,next,tag,_req[2]); 00149 00150 00151 for (unsigned i=0;i<vLSndMap.size();i++) 00152 vLSnd(i)=data(vLSndMap[i]); 00153 NetMPI::Isend(vLSnd,prev,tag,_req[3]); 00154 00155 } 00156 00157 }
void NetMPI::exchangeDataRedBlack | ( | VecIndex & | vLSndMap, | |
VecDouble & | vLSnd, | |||
VecIndex & | vLRcvMap, | |||
VecDouble & | vLRcv, | |||
VecIndex & | vRSndMap, | |||
VecDouble & | vRSnd, | |||
VecIndex & | vRRcvMap, | |||
VecDouble & | vRRcv, | |||
VecDouble & | data, | |||
int | tag | |||
) | [static] |
Definition at line 111 of file netmpi.cpp.
00112 { 00113 exchangeDataRedBlack(vLSndMap,vLSnd,vLRcvMap,vLRcv,vRSndMap,vRSnd,vRRcvMap,vRRcv,data,data,tag); 00114 00115 }
std::ostream & NetMPI::getLog | ( | ) | [static] |
Definition at line 48 of file netmpi.cpp.
00049 { 00050 return *m_out; 00051 }
double NetMPI::getMinValue | ( | double | localValue | ) | [static] |
Definition at line 185 of file netmpi.cpp.
static void NetMPI::Irecv | ( | VecDouble & | v, | |
int | src, | |||
int | tag, | |||
MPI_Request & | req | |||
) | [inline, static] |
static void NetMPI::Isend | ( | VecDouble & | v, | |
int | dst, | |||
int | tag, | |||
MPI_Request & | req | |||
) | [inline, static] |
bool NetMPI::isLastProcess | ( | ) | [static] |
Definition at line 43 of file netmpi.cpp.
int NetMPI::nProcess | ( | ) | [static] |
int NetMPI::rank | ( | ) | [static] |
static void NetMPI::setLog | ( | std::ostream & | out | ) | [inline, static] |
static void NetMPI::setTrace | ( | bool | b | ) | [inline, static] |
void NetMPI::trace | ( | const char * | format, | |
... | ||||
) | [static] |
Definition at line 160 of file netmpi.cpp.
bool NetMPI::b1 = false [static, private] |
bool NetMPI::b2 = false [static, private] |
bool NetMPI::m_loop = false [static, private] |
int NetMPI::m_nP = -1 [static, protected] |
std::ostream * NetMPI::m_out = &(std::cout) [static] |
bool NetMPI::m_print = false [static, private] |
int NetMPI::m_rank = -1 [static, protected] |