00001
00002
00003
00004
00005
00006
00007
00008 void MPISendOrRecvOneBuffer(SMSG_LIST *smsg, int tag){
00009 int node = smsg->destpe;
00010 int size = smsg->size;
00011
00012 char *msg = smsg->msg;
00013 int dstrank;
00014
00015 #if CMK_MEM_CHECKPOINT || CMK_MESSAGE_LOGGING
00016 dstrank = petorank[node];
00017 smsg->dstrank = dstrank;
00018 #else
00019 dstrank=node;
00020 #endif
00021
00022 if(smsg->type == ONESIDED_BUFFER_DIRECT_SEND || smsg->type == ONESIDED_BUFFER_SEND) {
00023 if (MPI_SUCCESS != MPI_Isend((void *)msg, size, MPI_BYTE, dstrank, tag, charmComm, &(smsg->req)))
00024 CmiAbort("LrtsSendBuffer: MPI_Isend failed!\n");
00025 } else if(smsg->type == ONESIDED_BUFFER_DIRECT_RECV || smsg->type == ONESIDED_BUFFER_RECV) {
00026 if (MPI_SUCCESS != MPI_Irecv((void *)msg, size, MPI_BYTE, dstrank, tag, charmComm, &(smsg->req)))
00027 CmiAbort("LrtsSendBuffer: MPI_Irecv failed!\n");
00028 } else {
00029 CmiAbort("Invalid type of smsg\n");
00030 }
00031
00032
00033 CpvAccess(MsgQueueLen)++;
00034 if (CpvAccess(sent_msgs)==0)
00035 CpvAccess(sent_msgs) = smsg;
00036 else {
00037 CpvAccess(end_sent)->next = smsg;
00038 }
00039 CpvAccess(end_sent) = smsg;
00040 }
00041
00042
00043 void MPIPostOneBuffer(const void *buffer, void *ref, int size, int pe, int tag, int type) {
00044
00045 int destLocalNode = CmiNodeOf(pe);
00046 int destRank = CmiGetNodeGlobal(destLocalNode, CmiMyPartition());
00047
00048 SMSG_LIST *msg_tmp = allocateSmsgList((char *)buffer, destRank, size, 0, type, ref);
00049
00050 #if CMK_SMP
00051 #if MULTI_SENDQUEUE
00052 PCQueuePush(procState[CmiMyRank()].postMsgBuf,(char *)msg_tmp);
00053 return;
00054 #else
00055 if (Cmi_smp_mode_setting == COMM_THREAD_SEND_RECV) {
00056 PCQueuePush(postMsgBuf,(char *)msg_tmp);
00057 return;
00058 }
00059 #endif
00060 #endif //end of CMK_SMP
00061
00062 MPISendOrRecvOneBuffer(msg_tmp, tag);
00063 }
00064
00065
00066
00067
00068 void LrtsIssueRget(NcpyOperationInfo *ncpyOpInfoMsg) {
00069
00070
00071 int tag = getNewMPITag();
00072 SMSG_LIST *msg_tmp;
00073 MPI_Request reqBufferRecv;
00074
00075
00076
00077 CMI_MSGTYPE(ncpyOpInfoMsg) = POST_DIRECT_SEND;
00078
00079
00080 ncpyOpInfoMsg->tag = tag;
00081
00082
00083 int destLocalNode = CmiNodeOf(ncpyOpInfoMsg->srcPe);
00084 int destRank = CmiGetNodeGlobal(destLocalNode, CmiMyPartition());
00085
00086 #if CMK_SMP
00087 if (Cmi_smp_mode_setting == COMM_THREAD_SEND_RECV) {
00088 EnqueueMsg(ncpyOpInfoMsg, ncpyOpInfoMsg->ncpyOpInfoSize, destRank, 0, POST_DIRECT_SEND, NULL);
00089 }
00090 else
00091 #endif
00092 {
00093 msg_tmp = allocateSmsgList((char *)ncpyOpInfoMsg, destRank, ncpyOpInfoMsg->ncpyOpInfoSize, 0, POST_DIRECT_SEND, NULL);
00094 MPISendOneMsg(msg_tmp);
00095 }
00096
00097
00098
00099 MPIPostOneBuffer(ncpyOpInfoMsg->destPtr, ncpyOpInfoMsg, ncpyOpInfoMsg->srcSize, ncpyOpInfoMsg->srcPe, tag, ONESIDED_BUFFER_DIRECT_RECV);
00100 }
00101
00102
00103 void LrtsIssueRput(NcpyOperationInfo *ncpyOpInfoMsg) {
00104
00105
00106 int tag = getNewMPITag();
00107 SMSG_LIST *msg_tmp;
00108
00109
00110
00111 CMI_MSGTYPE(ncpyOpInfoMsg) = POST_DIRECT_RECV;
00112
00113
00114 ncpyOpInfoMsg->tag = tag;
00115
00116
00117 int destLocalNode = CmiNodeOf(ncpyOpInfoMsg->destPe);
00118 int destRank = CmiGetNodeGlobal(destLocalNode, CmiMyPartition());
00119
00120 #if CMK_SMP
00121 if (Cmi_smp_mode_setting == COMM_THREAD_SEND_RECV) {
00122 EnqueueMsg(ncpyOpInfoMsg, ncpyOpInfoMsg->ncpyOpInfoSize, destRank, 0, POST_DIRECT_RECV, NULL);
00123 }
00124 else
00125 #endif
00126 {
00127 msg_tmp = allocateSmsgList((char *)ncpyOpInfoMsg, destRank, ncpyOpInfoMsg->ncpyOpInfoSize, 0, POST_DIRECT_RECV, NULL);
00128 MPISendOneMsg(msg_tmp);
00129 }
00130
00131
00132
00133 MPIPostOneBuffer(ncpyOpInfoMsg->srcPtr, ncpyOpInfoMsg, ncpyOpInfoMsg->srcSize, ncpyOpInfoMsg->destPe, tag, ONESIDED_BUFFER_DIRECT_SEND);
00134 }
00135
00136
00137 void LrtsDeregisterMem(const void *ptr, void *info, int pe, unsigned short int mode){
00138 }