-: 0:Source:/home/MPI/testing/mpich2/mpich2/src/mpid/ch3/src/ch3u_rma_sync.c
-: 0:Graph:ch3u_rma_sync.gcno
-: 0:Data:ch3u_rma_sync.gcda
-: 0:Runs:3459
-: 0:Programs:899
-: 1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
-: 2:/*
-: 3: * (C) 2001 by Argonne National Laboratory.
-: 4: * See COPYRIGHT in top-level directory.
-: 5: */
-: 6:
-: 7:#include "mpidimpl.h"
-: 8:#include "mpidrma.h"
-: 9:
-: 10:/*
-: 11: * These routines provide a default implementation of the MPI RMA operations
-: 12: * in terms of the low-level, two-sided channel operations. A channel
-: 13: * may override these functions, on a per-window basis, by defining
-: 14: * USE_CHANNEL_RMA_TABLE and providing the function MPIDI_CH3_RMAWinFnsInit.
-: 15: */
-: 16:
-: 17:/*
-: 18: * TODO:
-: 19: *
-: 20: */
-: 21:
-: 22:static int MPIDI_CH3I_Send_rma_msg(MPIDI_RMA_ops * rma_op, MPID_Win * win_ptr,
-: 23: MPI_Win source_win_handle,
-: 24: MPI_Win target_win_handle,
-: 25: MPIDI_RMA_dtype_info * dtype_info,
-: 26: void ** dataloop, MPID_Request ** request);
-: 27:static int MPIDI_CH3I_Recv_rma_msg(MPIDI_RMA_ops * rma_op, MPID_Win * win_ptr,
-: 28: MPI_Win source_win_handle,
-: 29: MPI_Win target_win_handle,
-: 30: MPIDI_RMA_dtype_info * dtype_info,
-: 31: void ** dataloop, MPID_Request ** request);
-: 32:static int MPIDI_CH3I_Do_passive_target_rma(MPID_Win *win_ptr,
-: 33: int *wait_for_rma_done_pkt);
-: 34:static int MPIDI_CH3I_Send_lock_put_or_acc(MPID_Win *win_ptr);
-: 35:static int MPIDI_CH3I_Send_lock_get(MPID_Win *win_ptr);
-: 36:
-: 37:static int create_datatype(const MPIDI_RMA_dtype_info *dtype_info,
-: 38: const void *dataloop, MPI_Aint dataloop_sz,
-: 39: const void *o_addr, int o_count, MPI_Datatype o_datatype,
-: 40: MPID_Datatype **combined_dtp);
-: 41:
-: 42:#undef FUNCNAME
-: 43:#define FUNCNAME MPIDI_Win_fence
-: 44:#undef FCNAME
-: 45:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 46:int MPIDI_Win_fence(int assert, MPID_Win *win_ptr)
28134: 47:{
28134: 48: int mpi_errno = MPI_SUCCESS;
-: 49: int comm_size, done, *recvcnts;
-: 50: int *rma_target_proc, *nops_to_proc, i, total_op_count, *curr_ops_cnt;
-: 51: MPIDI_RMA_ops *curr_ptr, *next_ptr;
-: 52: MPID_Comm *comm_ptr;
28134: 53: MPID_Request **requests=NULL; /* array of requests */
-: 54: MPI_Win source_win_handle, target_win_handle;
28134: 55: MPIDI_RMA_dtype_info *dtype_infos=NULL;
28134: 56: void **dataloops=NULL; /* to store dataloops for each datatype */
-: 57: MPID_Progress_state progress_state;
28134: 58: MPIU_CHKLMEM_DECL(7);
28134: 59: MPIU_THREADPRIV_DECL;
-: 60: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_FENCE);
-: 61:
-: 62: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_FENCE);
-: 63:
28134: 64: MPIU_THREADPRIV_GET;
-: 65: /* In case this process was previously the target of passive target rma
-: 66: * operations, we need to take care of the following...
-: 67: * Since we allow MPI_Win_unlock to return without a done ack from
-: 68: * the target in the case of multiple rma ops and exclusive lock,
-: 69: * we need to check whether there is a lock on the window, and if
-: 70: * there is a lock, poke the progress engine until the operartions
-: 71: * have completed and the lock is released. */
28134: 72: if (win_ptr->current_lock_type != MPID_LOCK_NONE)
-: 73: {
|
#####: 74: MPID_Progress_start(&progress_state);
#####: 75: while (win_ptr->current_lock_type != MPID_LOCK_NONE)
-: 76: {
-: 77: /* poke the progress engine */
#####: 78: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 79: /* --BEGIN ERROR HANDLING-- */
#####: 80: if (mpi_errno != MPI_SUCCESS) {
-: 81: MPID_Progress_end(&progress_state);
#####: 82: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 83: }
-: 84: /* --END ERROR HANDLING-- */
-: 85:
-: 86: }
-: 87: MPID_Progress_end(&progress_state);
-: 88: }
-: 89:
-: 90: /* Note that the NOPRECEDE and NOSUCCEED must be specified by all processes
-: 91: in the window's group if any specify it */
|
28134: 92: if (assert & MPI_MODE_NOPRECEDE)
-: 93: {
2791: 94: win_ptr->fence_cnt = (assert & MPI_MODE_NOSUCCEED) ? 0 : 1;
2791: 95: goto fn_exit;
-: 96: }
-: 97:
25343: 98: if (win_ptr->fence_cnt == 0)
-: 99: {
-: 100: /* win_ptr->fence_cnt == 0 means either this is the very first
-: 101: call to fence or the preceding fence had the
-: 102: MPI_MODE_NOSUCCEED assert.
-: 103:
-: 104: If this fence has MPI_MODE_NOSUCCEED, do nothing and return.
-: 105: Otherwise just increment the fence count and return. */
-: 106:
8520: 107: if (!(assert & MPI_MODE_NOSUCCEED)) win_ptr->fence_cnt = 1;
-: 108: }
-: 109: else
-: 110: {
-: 111: /* This is the second or later fence. Do all the preceding RMA ops. */
-: 112:
16823: 113: MPID_Comm_get_ptr( win_ptr->comm, comm_ptr );
-: 114:
-: 115: /* First inform every process whether it is a target of RMA
-: 116: ops from this process */
16823: 117: comm_size = comm_ptr->local_size;
-: 118:
16823: 119: MPIU_CHKLMEM_MALLOC(rma_target_proc, int *, comm_size*sizeof(int),
-: 120: mpi_errno, "rma_target_proc");
16823: 121: for (i=0; i<comm_size; i++) rma_target_proc[i] = 0;
-: 122:
-: 123: /* keep track of no. of ops to each proc. Needed for knowing
-: 124: whether or not to decrement the completion counter. The
-: 125: completion counter is decremented only on the last
-: 126: operation. */
16823: 127: MPIU_CHKLMEM_MALLOC(nops_to_proc, int *, comm_size*sizeof(int),
-: 128: mpi_errno, "nops_to_proc");
16823: 129: for (i=0; i<comm_size; i++) nops_to_proc[i] = 0;
-: 130:
-: 131: /* set rma_target_proc[i] to 1 if rank i is a target of RMA
-: 132: ops from this process */
16823: 133: total_op_count = 0;
16823: 134: curr_ptr = win_ptr->rma_ops_list;
48491: 135: while (curr_ptr != NULL)
-: 136: {
14845: 137: total_op_count++;
14845: 138: rma_target_proc[curr_ptr->target_rank] = 1;
14845: 139: nops_to_proc[curr_ptr->target_rank]++;
14845: 140: curr_ptr = curr_ptr->next;
-: 141: }
-: 142:
16823: 143: MPIU_CHKLMEM_MALLOC(curr_ops_cnt, int *, comm_size*sizeof(int),
-: 144: mpi_errno, "curr_ops_cnt");
16823: 145: for (i=0; i<comm_size; i++) curr_ops_cnt[i] = 0;
-: 146:
16823: 147: if (total_op_count != 0)
-: 148: {
6319: 149: MPIU_CHKLMEM_MALLOC(requests, MPID_Request **,
-: 150: total_op_count*sizeof(MPID_Request*),
-: 151: mpi_errno, "requests");
6319: 152: MPIU_CHKLMEM_MALLOC(dtype_infos, MPIDI_RMA_dtype_info *,
-: 153: total_op_count*sizeof(MPIDI_RMA_dtype_info),
-: 154: mpi_errno, "dtype_infos");
6319: 155: MPIU_CHKLMEM_MALLOC(dataloops, void **,
-: 156: total_op_count*sizeof(void*),
-: 157: mpi_errno, "dataloops");
6319: 158: for (i=0; i<total_op_count; i++) dataloops[i] = NULL;
-: 159: }
-: 160:
-: 161: /* do a reduce_scatter (with MPI_SUM) on rma_target_proc. As a result,
-: 162: each process knows how many other processes will be doing
-: 163: RMA ops on its window */
-: 164:
-: 165: /* first initialize the completion counter. */
16823: 166: win_ptr->my_counter = comm_size;
-: 167:
-: 168: /* set up the recvcnts array for reduce scatter */
16823: 169: MPIU_CHKLMEM_MALLOC(recvcnts, int *, comm_size*sizeof(int),
-: 170: mpi_errno, "recvcnts");
16823: 171: for (i=0; i<comm_size; i++) recvcnts[i] = 1;
-: 172:
16823: 173: MPIR_Nest_incr();
16823: 174: mpi_errno = NMPI_Reduce_scatter(MPI_IN_PLACE, rma_target_proc,
-: 175: recvcnts,
-: 176: MPI_INT, MPI_SUM, win_ptr->comm);
-: 177: /* result is stored in rma_target_proc[0] */
16823: 178: MPIR_Nest_decr();
|
16823: 179: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 180:
-: 181: /* Set the completion counter */
-: 182: /* FIXME: MT: this needs to be done atomically because other
-: 183: procs have the address and could decrement it. */
|
16823: 184: win_ptr->my_counter = win_ptr->my_counter - comm_size +
-: 185: rma_target_proc[0];
-: 186:
16823: 187: i = 0;
16823: 188: curr_ptr = win_ptr->rma_ops_list;
48491: 189: while (curr_ptr != NULL)
-: 190: {
-: 191: /* The completion counter at the target is decremented only on
-: 192: the last RMA operation. We indicate the last operation by
-: 193: passing the source_win_handle only on the last operation.
-: 194: Otherwise, we pass NULL */
14845: 195: if (curr_ops_cnt[curr_ptr->target_rank] ==
-: 196: nops_to_proc[curr_ptr->target_rank] - 1)
6346: 197: source_win_handle = win_ptr->handle;
-: 198: else
8499: 199: source_win_handle = MPI_WIN_NULL;
-: 200:
14845: 201: target_win_handle = win_ptr->all_win_handles[curr_ptr->target_rank];
-: 202:
14845: 203: switch (curr_ptr->type)
-: 204: {
-: 205: case (MPIDI_RMA_PUT):
-: 206: case (MPIDI_RMA_ACCUMULATE):
5707: 207: mpi_errno = MPIDI_CH3I_Send_rma_msg(curr_ptr, win_ptr,
-: 208: source_win_handle, target_win_handle,
-: 209: &dtype_infos[i],
-: 210: &dataloops[i], &requests[i]);
|
5707: 211: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 212: break;
-: 213: case (MPIDI_RMA_GET):
|
9138: 214: mpi_errno = MPIDI_CH3I_Recv_rma_msg(curr_ptr, win_ptr,
-: 215: source_win_handle, target_win_handle,
-: 216: &dtype_infos[i],
-: 217: &dataloops[i], &requests[i]);
|
9138: 218: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 219: break;
-: 220: default:
#####: 221: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winInvalidOp");
-: 222: }
|
14845: 223: i++;
14845: 224: curr_ops_cnt[curr_ptr->target_rank]++;
14845: 225: curr_ptr = curr_ptr->next;
-: 226: }
-: 227:
-: 228:
16823: 229: if (total_op_count)
-: 230: {
6319: 231: done = 1;
6319: 232: MPID_Progress_start(&progress_state);
32460: 233: while (total_op_count)
-: 234: {
8282028: 235: for (i=0; i<total_op_count; i++)
-: 236: {
8275709: 237: if (requests[i] != NULL)
-: 238: {
31906: 239: if (*(requests[i]->cc_ptr) != 0)
-: 240: {
19822: 241: done = 0;
19822: 242: break;
-: 243: }
-: 244: else
-: 245: {
12084: 246: mpi_errno = requests[i]->status.MPI_ERROR;
|
-: 247: /* --BEGIN ERROR HANDLING-- */
12084: 248: if (mpi_errno != MPI_SUCCESS)
-: 249: {
-: 250: MPID_Progress_end(&progress_state);
#####: 251: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 252: }
-: 253: /* --END ERROR HANDLING-- */
-: 254: /* if origin datatype was a derived
-: 255: datatype, it will get freed when the
-: 256: request gets freed. */
|
12084: 257: MPID_Request_release(requests[i]);
12084: 258: requests[i] = NULL;
-: 259: }
-: 260: }
-: 261: }
-: 262:
26141: 263: if (done)
-: 264: {
6319: 265: break;
-: 266: }
-: 267:
19822: 268: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 269: /* --BEGIN ERROR HANDLING-- */
19822: 270: if (mpi_errno != MPI_SUCCESS) {
-: 271: MPID_Progress_end(&progress_state);
#####: 272: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 273: }
-: 274: /* --END ERROR HANDLING-- */
-: 275:
|
19822: 276: done = 1;
-: 277: }
-: 278: MPID_Progress_end(&progress_state);
-: 279: }
-: 280:
16823: 281: if (total_op_count != 0)
-: 282: {
21164: 283: for (i=0; i<total_op_count; i++)
-: 284: {
14845: 285: if (dataloops[i] != NULL)
-: 286: {
1639: 287: MPIU_Free(dataloops[i]); /* allocated in send_rma_msg or
-: 288: recv_rma_msg */
-: 289: }
-: 290: }
-: 291: }
-: 292:
-: 293: /* free MPIDI_RMA_ops_list */
16823: 294: curr_ptr = win_ptr->rma_ops_list;
48491: 295: while (curr_ptr != NULL)
-: 296: {
14845: 297: next_ptr = curr_ptr->next;
14845: 298: MPIU_Free(curr_ptr);
14845: 299: curr_ptr = next_ptr;
-: 300: }
16823: 301: win_ptr->rma_ops_list = NULL;
-: 302:
-: 303: /* wait for all operations from other processes to finish */
16823: 304: if (win_ptr->my_counter)
-: 305: {
5122: 306: MPID_Progress_start(&progress_state);
17583: 307: while (win_ptr->my_counter)
-: 308: {
7339: 309: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 310: /* --BEGIN ERROR HANDLING-- */
7339: 311: if (mpi_errno != MPI_SUCCESS) {
-: 312: MPID_Progress_end(&progress_state);
#####: 313: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 314: }
-: 315: /* --END ERROR HANDLING-- */
-: 316: }
-: 317: MPID_Progress_end(&progress_state);
-: 318: }
-: 319:
|
16823: 320: if (assert & MPI_MODE_NOSUCCEED)
-: 321: {
2791: 322: win_ptr->fence_cnt = 0;
-: 323: }
-: 324: }
-: 325:
-: 326: fn_exit:
86249: 327: MPIU_CHKLMEM_FREEALL();
|
-: 328: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_FENCE);
|
28134: 329: return mpi_errno;
|
-: 330: /* --BEGIN ERROR HANDLING-- */
-: 331: fn_fail:
-: 332: goto fn_exit;
-: 333: /* --END ERROR HANDLING-- */
-: 334:}
-: 335:
-: 336:/* create_datatype() creates a new struct datatype for the dtype_info
-: 337: and the dataloop of the target datatype together with the user data */
-: 338:#undef FUNCNAME
-: 339:#define FUNCNAME create_datatype
-: 340:#undef FCNAME
-: 341:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 342:static int create_datatype(const MPIDI_RMA_dtype_info *dtype_info,
-: 343: const void *dataloop, MPI_Aint dataloop_sz,
-: 344: const void *o_addr, int o_count, MPI_Datatype o_datatype,
-: 345: MPID_Datatype **combined_dtp)
|
1639: 346:{
1639: 347: int mpi_errno = MPI_SUCCESS;
-: 348: /* datatype_set_contents wants an array 'ints' which is the
-: 349: blocklens array with count prepended to it. So blocklens
-: 350: points to the 2nd element of ints to avoid having to copy
-: 351: blocklens into ints later. */
-: 352: int ints[4];
1639: 353: int *blocklens = &ints[1];
-: 354: MPI_Aint displaces[3];
-: 355: MPI_Datatype datatypes[3];
1639: 356: const int count = 3;
-: 357: MPI_Datatype combined_datatype;
-: 358: MPIDI_STATE_DECL(MPID_STATE_CREATE_DATATYPE);
-: 359:
-: 360: MPIDI_FUNC_ENTER(MPID_STATE_CREATE_DATATYPE);
-: 361:
-: 362: /* create datatype */
1639: 363: displaces[0] = MPIU_PtrToAint(dtype_info);
1639: 364: blocklens[0] = sizeof(*dtype_info);
1639: 365: datatypes[0] = MPI_BYTE;
-: 366:
1639: 367: displaces[1] = MPIU_PtrToAint(dataloop);
1639: 368: blocklens[1] = dataloop_sz;
1639: 369: datatypes[1] = MPI_BYTE;
-: 370:
1639: 371: displaces[2] = MPIU_PtrToAint(o_addr);
1639: 372: blocklens[2] = o_count;
1639: 373: datatypes[2] = o_datatype;
-: 374:
1639: 375: mpi_errno = MPID_Type_struct(count,
-: 376: blocklens,
-: 377: displaces,
-: 378: datatypes,
-: 379: &combined_datatype);
|
1639: 380: if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-: 381:
|
1639: 382: ints[0] = count;
-: 383:
1639: 384: MPID_Datatype_get_ptr(combined_datatype, *combined_dtp);
1639: 385: mpi_errno = MPID_Datatype_set_contents(*combined_dtp,
-: 386: MPI_COMBINER_STRUCT,
-: 387: count+1, /* ints (cnt,blklen) */
-: 388: count, /* aints (disps) */
-: 389: count, /* types */
-: 390: ints,
-: 391: displaces,
-: 392: datatypes);
|
1639: 393: if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-: 394:
-: 395: /* Commit datatype */
-: 396:
|
1639: 397: MPID_Dataloop_create(combined_datatype,
-: 398: &(*combined_dtp)->dataloop,
-: 399: &(*combined_dtp)->dataloop_size,
-: 400: &(*combined_dtp)->dataloop_depth,
-: 401: MPID_DATALOOP_HOMOGENEOUS);
-: 402:
-: 403: /* create heterogeneous dataloop */
1639: 404: MPID_Dataloop_create(combined_datatype,
-: 405: &(*combined_dtp)->hetero_dloop,
-: 406: &(*combined_dtp)->hetero_dloop_size,
-: 407: &(*combined_dtp)->hetero_dloop_depth,
-: 408: MPID_DATALOOP_HETEROGENEOUS);
-: 409:
1639: 410: fn_exit:
|
-: 411: MPIDI_FUNC_EXIT(MPID_STATE_CREATE_DATATYPE);
|
1639: 412: return mpi_errno;
|
-: 413: fn_fail:
-: 414: goto fn_exit;
-: 415:}
-: 416:
-: 417:
-: 418:#undef FUNCNAME
-: 419:#define FUNCNAME MPIDI_CH3I_Send_rma_msg
-: 420:#undef FCNAME
-: 421:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 422:static int MPIDI_CH3I_Send_rma_msg(MPIDI_RMA_ops *rma_op, MPID_Win *win_ptr,
-: 423: MPI_Win source_win_handle,
-: 424: MPI_Win target_win_handle,
-: 425: MPIDI_RMA_dtype_info *dtype_info,
-: 426: void **dataloop, MPID_Request **request)
|
7361: 427:{
-: 428: MPIDI_CH3_Pkt_t upkt;
7361: 429: MPIDI_CH3_Pkt_put_t *put_pkt = &upkt.put;
7361: 430: MPIDI_CH3_Pkt_accum_t *accum_pkt = &upkt.accum;
-: 431: MPID_IOV iov[MPID_IOV_LIMIT];
7361: 432: int mpi_errno=MPI_SUCCESS, predefined;
-: 433: int origin_dt_derived, target_dt_derived, origin_type_size, iovcnt;
-: 434: MPIDI_VC_t * vc;
-: 435: MPID_Comm *comm_ptr;
7361: 436: MPID_Datatype *target_dtp=NULL, *origin_dtp=NULL;
7361: 437: MPIU_CHKPMEM_DECL(1);
-: 438: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SEND_RMA_MSG);
-: 439: MPIDI_STATE_DECL(MPID_STATE_MEMCPY);
-: 440:
-: 441: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SEND_RMA_MSG);
-: 442:
7361: 443: *request = NULL;
-: 444:
7361: 445: if (rma_op->type == MPIDI_RMA_PUT)
-: 446: {
5788: 447: MPIDI_Pkt_init(put_pkt, MPIDI_CH3_PKT_PUT);
5788: 448: put_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
-: 449: win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-: 450:
5788: 451: put_pkt->count = rma_op->target_count;
5788: 452: put_pkt->datatype = rma_op->target_datatype;
5788: 453: put_pkt->dataloop_size = 0;
5788: 454: put_pkt->target_win_handle = target_win_handle;
5788: 455: put_pkt->source_win_handle = source_win_handle;
-: 456:
5788: 457: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) put_pkt;
5788: 458: iov[0].MPID_IOV_LEN = sizeof(*put_pkt);
-: 459: }
-: 460: else
-: 461: {
1573: 462: MPIDI_Pkt_init(accum_pkt, MPIDI_CH3_PKT_ACCUMULATE);
1573: 463: accum_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
-: 464: win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
1573: 465: accum_pkt->count = rma_op->target_count;
1573: 466: accum_pkt->datatype = rma_op->target_datatype;
1573: 467: accum_pkt->dataloop_size = 0;
1573: 468: accum_pkt->op = rma_op->op;
1573: 469: accum_pkt->target_win_handle = target_win_handle;
1573: 470: accum_pkt->source_win_handle = source_win_handle;
-: 471:
1573: 472: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) accum_pkt;
1573: 473: iov[0].MPID_IOV_LEN = sizeof(*accum_pkt);
-: 474: }
-: 475:
-: 476: /* printf("send pkt: type %d, addr %d, count %d, base %d\n", rma_pkt->type,
-: 477: rma_pkt->addr, rma_pkt->count, win_ptr->base_addrs[rma_op->target_rank]);
-: 478: fflush(stdout);
-: 479: */
-: 480:
7361: 481: MPID_Comm_get_ptr(win_ptr->comm, comm_ptr);
7361: 482: MPIDI_Comm_get_vc_set_active(comm_ptr, rma_op->target_rank, &vc);
-: 483:
7361: 484: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(rma_op->origin_datatype, predefined);
7361: 485: if (!predefined)
-: 486: {
2689: 487: origin_dt_derived = 1;
2689: 488: MPID_Datatype_get_ptr(rma_op->origin_datatype, origin_dtp);
-: 489: }
-: 490: else
-: 491: {
4672: 492: origin_dt_derived = 0;
-: 493: }
-: 494:
7361: 495: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(rma_op->target_datatype, predefined);
7361: 496: if (!predefined)
-: 497: {
1639: 498: target_dt_derived = 1;
1639: 499: MPID_Datatype_get_ptr(rma_op->target_datatype, target_dtp);
-: 500: }
-: 501: else
-: 502: {
5722: 503: target_dt_derived = 0;
-: 504: }
-: 505:
7361: 506: if (target_dt_derived)
-: 507: {
-: 508: /* derived datatype on target. fill derived datatype info */
1639: 509: dtype_info->is_contig = target_dtp->is_contig;
1639: 510: dtype_info->max_contig_blocks = target_dtp->max_contig_blocks;
1639: 511: dtype_info->size = target_dtp->size;
1639: 512: dtype_info->extent = target_dtp->extent;
1639: 513: dtype_info->dataloop_size = target_dtp->dataloop_size;
1639: 514: dtype_info->dataloop_depth = target_dtp->dataloop_depth;
1639: 515: dtype_info->eltype = target_dtp->eltype;
1639: 516: dtype_info->dataloop = target_dtp->dataloop;
1639: 517: dtype_info->ub = target_dtp->ub;
1639: 518: dtype_info->lb = target_dtp->lb;
1639: 519: dtype_info->true_ub = target_dtp->true_ub;
1639: 520: dtype_info->true_lb = target_dtp->true_lb;
1639: 521: dtype_info->has_sticky_ub = target_dtp->has_sticky_ub;
1639: 522: dtype_info->has_sticky_lb = target_dtp->has_sticky_lb;
-: 523:
1639: 524: MPIU_CHKPMEM_MALLOC(*dataloop, void *, target_dtp->dataloop_size,
-: 525: mpi_errno, "dataloop");
-: 526:
-: 527: MPIDI_FUNC_ENTER(MPID_STATE_MEMCPY);
1639: 528: MPIU_Memcpy(*dataloop, target_dtp->dataloop, target_dtp->dataloop_size);
|
-: 529: MPIDI_FUNC_EXIT(MPID_STATE_MEMCPY);
-: 530: /* the dataloop can have undefined padding sections, so we need to let
-: 531: * valgrind know that it is OK to pass this data to writev later on */
-: 532: MPIU_VG_MAKE_MEM_DEFINED(*dataloop, target_dtp->dataloop_size);
-: 533:
|
1639: 534: if (rma_op->type == MPIDI_RMA_PUT)
-: 535: {
1205: 536: put_pkt->dataloop_size = target_dtp->dataloop_size;
-: 537: }
-: 538: else
-: 539: {
434: 540: accum_pkt->dataloop_size = target_dtp->dataloop_size;
-: 541: }
-: 542: }
-: 543:
7361: 544: MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
-: 545:
7361: 546: if (!target_dt_derived)
-: 547: {
-: 548: /* basic datatype on target */
5722: 549: if (!origin_dt_derived)
-: 550: {
-: 551: /* basic datatype on origin */
3705: 552: iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)rma_op->origin_addr;
3705: 553: iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
3705: 554: iovcnt = 2;
-: 555: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
3705: 556: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsgv(vc, iov, iovcnt, request));
-: 557: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
3705: 558: MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
-: 559: }
-: 560: else
-: 561: {
-: 562: /* derived datatype on origin */
2017: 563: *request = MPID_Request_create();
2017: 564: MPIU_ERR_CHKANDJUMP(*request == NULL,mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 565:
2017: 566: MPIU_Object_set_ref(*request, 2);
2017: 567: (*request)->kind = MPID_REQUEST_SEND;
-: 568:
2017: 569: (*request)->dev.segment_ptr = MPID_Segment_alloc( );
2017: 570: MPIU_ERR_CHKANDJUMP1((*request)->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
-: 571:
2017: 572: (*request)->dev.datatype_ptr = origin_dtp;
-: 573: /* this will cause the datatype to be freed when the request
-: 574: is freed. */
2017: 575: MPID_Segment_init(rma_op->origin_addr, rma_op->origin_count,
-: 576: rma_op->origin_datatype,
-: 577: (*request)->dev.segment_ptr, 0);
2017: 578: (*request)->dev.segment_first = 0;
2017: 579: (*request)->dev.segment_size = rma_op->origin_count * origin_type_size;
-: 580:
2017: 581: (*request)->dev.OnFinal = 0;
2017: 582: (*request)->dev.OnDataAvail = 0;
-: 583:
-: 584: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
2017: 585: mpi_errno = vc->sendNoncontig_fn(vc, *request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
-: 586: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
2017: 587: MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
-: 588: }
-: 589: }
-: 590: else
-: 591: {
-: 592: /* derived datatype on target */
1639: 593: MPID_Datatype *combined_dtp = NULL;
-: 594:
1639: 595: *request = MPID_Request_create();
1639: 596: if (*request == NULL) {
|
#####: 597: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 598: }
-: 599:
|
1639: 600: MPIU_Object_set_ref(*request, 2);
1639: 601: (*request)->kind = MPID_REQUEST_SEND;
-: 602:
1639: 603: (*request)->dev.segment_ptr = MPID_Segment_alloc( );
1639: 604: MPIU_ERR_CHKANDJUMP1((*request)->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
-: 605:
-: 606: /* create a new datatype containing the dtype_info, dataloop, and origin data */
-: 607:
1639: 608: mpi_errno = create_datatype(dtype_info, *dataloop, target_dtp->dataloop_size, rma_op->origin_addr,
-: 609: rma_op->origin_count, rma_op->origin_datatype, &combined_dtp);
|
1639: 610: if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-: 611:
|
1639: 612: (*request)->dev.datatype_ptr = combined_dtp;
-: 613: /* combined_datatype will be freed when request is freed */
-: 614:
1639: 615: MPID_Segment_init(MPI_BOTTOM, 1, combined_dtp->handle,
-: 616: (*request)->dev.segment_ptr, 0);
1639: 617: (*request)->dev.segment_first = 0;
1639: 618: (*request)->dev.segment_size = combined_dtp->size;
-: 619:
1639: 620: (*request)->dev.OnFinal = 0;
1639: 621: (*request)->dev.OnDataAvail = 0;
-: 622:
-: 623: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
1639: 624: mpi_errno = vc->sendNoncontig_fn(vc, *request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
-: 625: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
1639: 626: MPIU_ERR_CHKANDJUMP(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|rmamsg");
-: 627:
-: 628: /* we're done with the datatypes */
1639: 629: if (origin_dt_derived)
672: 630: MPID_Datatype_release(origin_dtp);
1639: 631: MPID_Datatype_release(target_dtp);
-: 632: }
-: 633:
7361: 634: fn_exit:
|
-: 635: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_SEND_RMA_MSG);
|
7361: 636: return mpi_errno;
|
-: 637: /* --BEGIN ERROR HANDLING-- */
#####: 638: fn_fail:
#####: 639: if (*request)
-: 640: {
#####: 641: MPIU_CHKPMEM_REAP();
#####: 642: if ((*request)->dev.datatype_ptr)
#####: 643: MPID_Datatype_release((*request)->dev.datatype_ptr);
#####: 644: MPIU_Object_set_ref(*request, 0);
#####: 645: MPIDI_CH3_Request_destroy(*request);
-: 646: }
#####: 647: *request = NULL;
#####: 648: goto fn_exit;
-: 649: /* --END ERROR HANDLING-- */
-: 650:}
-: 651:
-: 652:
-: 653:
-: 654:#undef FUNCNAME
-: 655:#define FUNCNAME MPIDI_CH3I_Recv_rma_msg
-: 656:#undef FCNAME
-: 657:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 658:static int MPIDI_CH3I_Recv_rma_msg(MPIDI_RMA_ops *rma_op, MPID_Win *win_ptr,
-: 659: MPI_Win source_win_handle,
-: 660: MPI_Win target_win_handle,
-: 661: MPIDI_RMA_dtype_info *dtype_info,
-: 662: void **dataloop, MPID_Request **request)
|
9830: 663:{
-: 664: MPIDI_CH3_Pkt_t upkt;
9830: 665: MPIDI_CH3_Pkt_get_t *get_pkt = &upkt.get;
9830: 666: int mpi_errno=MPI_SUCCESS, predefined;
-: 667: MPIDI_VC_t * vc;
-: 668: MPID_Comm *comm_ptr;
9830: 669: MPID_Request *req = NULL;
-: 670: MPID_Datatype *dtp;
-: 671: MPID_IOV iov[MPID_IOV_LIMIT];
9830: 672: MPIU_CHKPMEM_DECL(1);
-: 673: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_RECV_RMA_MSG);
-: 674: MPIDI_STATE_DECL(MPID_STATE_MEMCPY);
-: 675:
-: 676: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_RECV_RMA_MSG);
-: 677:
-: 678: /* create a request, store the origin buf, cnt, datatype in it,
-: 679: and pass a handle to it in the get packet. When the get
-: 680: response comes from the target, it will contain the request
-: 681: handle. */
9830: 682: req = MPID_Request_create();
9830: 683: if (req == NULL) {
|
#####: 684: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 685: }
-: 686:
|
9830: 687: *request = req;
-: 688:
9830: 689: MPIU_Object_set_ref(req, 2);
-: 690:
9830: 691: req->dev.user_buf = rma_op->origin_addr;
9830: 692: req->dev.user_count = rma_op->origin_count;
9830: 693: req->dev.datatype = rma_op->origin_datatype;
9830: 694: req->dev.target_win_handle = MPI_WIN_NULL;
9830: 695: req->dev.source_win_handle = source_win_handle;
9830: 696: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(req->dev.datatype, predefined);
9830: 697: if (!predefined)
-: 698: {
432: 699: MPID_Datatype_get_ptr(req->dev.datatype, dtp);
432: 700: req->dev.datatype_ptr = dtp;
-: 701: /* this will cause the datatype to be freed when the
-: 702: request is freed. */
-: 703: }
-: 704:
9830: 705: MPIDI_Pkt_init(get_pkt, MPIDI_CH3_PKT_GET);
9830: 706: get_pkt->addr = (char *) win_ptr->base_addrs[rma_op->target_rank] +
-: 707: win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
9830: 708: get_pkt->count = rma_op->target_count;
9830: 709: get_pkt->datatype = rma_op->target_datatype;
9830: 710: get_pkt->request_handle = req->handle;
9830: 711: get_pkt->target_win_handle = target_win_handle;
9830: 712: get_pkt->source_win_handle = source_win_handle;
-: 713:
-: 714:/* printf("send pkt: type %d, addr %d, count %d, base %d\n", rma_pkt->type,
-: 715: rma_pkt->addr, rma_pkt->count, win_ptr->base_addrs[rma_op->target_rank]);
-: 716: fflush(stdout);
-: 717:*/
-: 718:
9830: 719: MPID_Comm_get_ptr(win_ptr->comm, comm_ptr);
9830: 720: MPIDI_Comm_get_vc_set_active(comm_ptr, rma_op->target_rank, &vc);
-: 721:
9830: 722: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(rma_op->target_datatype, predefined);
9830: 723: if (predefined)
-: 724: {
-: 725: /* basic datatype on target. simply send the get_pkt. */
-: 726: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
8916: 727: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, get_pkt, sizeof(*get_pkt), &req));
-: 728: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
-: 729: }
-: 730: else
-: 731: {
-: 732: /* derived datatype on target. fill derived datatype info and
-: 733: send it along with get_pkt. */
-: 734:
914: 735: MPID_Datatype_get_ptr(rma_op->target_datatype, dtp);
914: 736: dtype_info->is_contig = dtp->is_contig;
914: 737: dtype_info->max_contig_blocks = dtp->max_contig_blocks;
914: 738: dtype_info->size = dtp->size;
914: 739: dtype_info->extent = dtp->extent;
914: 740: dtype_info->dataloop_size = dtp->dataloop_size;
914: 741: dtype_info->dataloop_depth = dtp->dataloop_depth;
914: 742: dtype_info->eltype = dtp->eltype;
914: 743: dtype_info->dataloop = dtp->dataloop;
914: 744: dtype_info->ub = dtp->ub;
914: 745: dtype_info->lb = dtp->lb;
914: 746: dtype_info->true_ub = dtp->true_ub;
914: 747: dtype_info->true_lb = dtp->true_lb;
914: 748: dtype_info->has_sticky_ub = dtp->has_sticky_ub;
914: 749: dtype_info->has_sticky_lb = dtp->has_sticky_lb;
-: 750:
914: 751: MPIU_CHKPMEM_MALLOC(*dataloop, void *, dtp->dataloop_size,
-: 752: mpi_errno, "dataloop");
-: 753:
-: 754: MPIDI_FUNC_ENTER(MPID_STATE_MEMCPY);
914: 755: MPIU_Memcpy(*dataloop, dtp->dataloop, dtp->dataloop_size);
|
-: 756: MPIDI_FUNC_EXIT(MPID_STATE_MEMCPY);
-: 757:
-: 758: /* the dataloop can have undefined padding sections, so we need to let
-: 759: * valgrind know that it is OK to pass this data to writev later on */
-: 760: MPIU_VG_MAKE_MEM_DEFINED(*dataloop, dtp->dataloop_size);
-: 761:
|
914: 762: get_pkt->dataloop_size = dtp->dataloop_size;
-: 763:
914: 764: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)get_pkt;
914: 765: iov[0].MPID_IOV_LEN = sizeof(*get_pkt);
914: 766: iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)dtype_info;
914: 767: iov[1].MPID_IOV_LEN = sizeof(*dtype_info);
914: 768: iov[2].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)*dataloop;
914: 769: iov[2].MPID_IOV_LEN = dtp->dataloop_size;
-: 770:
-: 771: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
914: 772: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsgv(vc, iov, 3, &req));
-: 773: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
-: 774:
-: 775: /* release the target datatype */
914: 776: MPID_Datatype_release(dtp);
-: 777: }
-: 778:
9830: 779: if (mpi_errno != MPI_SUCCESS) {
|
#####: 780: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
-: 781: }
-: 782:
-: 783: /* release the request returned by iStartMsg or iStartMsgv */
|
9830: 784: if (req != NULL)
-: 785: {
1999: 786: MPID_Request_release(req);
-: 787: }
-: 788:
9830: 789: fn_exit:
|
-: 790: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_RECV_RMA_MSG);
|
9830: 791: return mpi_errno;
-: 792:
|
-: 793: /* --BEGIN ERROR HANDLING-- */
-: 794: fn_fail:
#####: 795: MPIU_CHKPMEM_REAP();
-: 796: goto fn_exit;
-: 797: /* --END ERROR HANDLING-- */
-: 798:}
-: 799:
-: 800:
-: 801:
-: 802:
-: 803:#undef FUNCNAME
-: 804:#define FUNCNAME MPIDI_Win_post
-: 805:#undef FCNAME
-: 806:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 807:int MPIDI_Win_post(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr)
|
933: 808:{
933: 809: int nest_level_inc = FALSE;
933: 810: int mpi_errno=MPI_SUCCESS;
-: 811: MPI_Group win_grp, post_grp;
-: 812: int i, post_grp_size, *ranks_in_post_grp, *ranks_in_win_grp, dst, rank;
933: 813: MPIU_CHKLMEM_DECL(2);
933: 814: MPIU_THREADPRIV_DECL;
-: 815: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_POST);
-: 816:
-: 817: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_POST);
-: 818:
933: 819: MPIU_THREADPRIV_GET;
-: 820:
-: 821:#if 0
-: 822: /* Reset the fence counter so that in case the user has switched from
-: 823: fence to
-: 824: post-wait synchronization, he cannot use the previous fence to mark
-: 825: the beginning of a fence epoch. */
-: 826: /* FIXME: We can't do this because fence_cnt must be updated collectively */
-: 827: win_ptr->fence_cnt = 0;
-: 828:#endif
-: 829:
-: 830: /* In case this process was previously the target of passive target rma
-: 831: * operations, we need to take care of the following...
-: 832: * Since we allow MPI_Win_unlock to return without a done ack from
-: 833: * the target in the case of multiple rma ops and exclusive lock,
-: 834: * we need to check whether there is a lock on the window, and if
-: 835: * there is a lock, poke the progress engine until the operations
-: 836: * have completed and the lock is therefore released. */
933: 837: if (win_ptr->current_lock_type != MPID_LOCK_NONE)
-: 838: {
-: 839: MPID_Progress_state progress_state;
-: 840:
-: 841: /* poke the progress engine */
|
#####: 842: MPID_Progress_start(&progress_state);
#####: 843: while (win_ptr->current_lock_type != MPID_LOCK_NONE)
-: 844: {
#####: 845: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 846: /* --BEGIN ERROR HANDLING-- */
#####: 847: if (mpi_errno != MPI_SUCCESS) {
-: 848: MPID_Progress_end(&progress_state);
#####: 849: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 850: }
-: 851: /* --END ERROR HANDLING-- */
-: 852: }
-: 853: MPID_Progress_end(&progress_state);
-: 854: }
-: 855:
|
933: 856: post_grp_size = group_ptr->size;
-: 857:
-: 858: /* initialize the completion counter */
933: 859: win_ptr->my_counter = post_grp_size;
-: 860:
933: 861: if ((assert & MPI_MODE_NOCHECK) == 0)
-: 862: {
-: 863: /* NOCHECK not specified. We need to notify the source
-: 864: processes that Post has been called. */
-: 865:
-: 866: /* We need to translate the ranks of the processes in
-: 867: post_group to ranks in win_ptr->comm, so that we
-: 868: can do communication */
-: 869:
933: 870: MPIU_CHKLMEM_MALLOC(ranks_in_post_grp, int *,
-: 871: post_grp_size * sizeof(int),
-: 872: mpi_errno, "ranks_in_post_grp");
933: 873: MPIU_CHKLMEM_MALLOC(ranks_in_win_grp, int *,
-: 874: post_grp_size * sizeof(int),
-: 875: mpi_errno, "ranks_in_win_grp");
-: 876:
1932: 877: for (i=0; i<post_grp_size; i++)
-: 878: {
999: 879: ranks_in_post_grp[i] = i;
-: 880: }
-: 881:
933: 882: nest_level_inc = TRUE;
933: 883: MPIR_Nest_incr();
-: 884:
933: 885: mpi_errno = NMPI_Comm_group(win_ptr->comm, &win_grp);
|
933: 886: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 887:
|
933: 888: post_grp = group_ptr->handle;
-: 889:
933: 890: mpi_errno = NMPI_Group_translate_ranks(post_grp, post_grp_size,
-: 891: ranks_in_post_grp, win_grp,
-: 892: ranks_in_win_grp);
|
933: 893: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 894:
|
933: 895: NMPI_Comm_rank(win_ptr->comm, &rank);
-: 896:
-: 897: /* Send a 0-byte message to the source processes */
1932: 898: for (i=0; i<post_grp_size; i++)
-: 899: {
999: 900: dst = ranks_in_win_grp[i];
-: 901:
999: 902: if (dst != rank) {
992: 903: mpi_errno = NMPI_Send(&i, 0, MPI_INT, dst, 100, win_ptr->comm);
|
992: 904: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 905: }
-: 906: }
-: 907:
|
933: 908: mpi_errno = NMPI_Group_free(&win_grp);
|
933: 909: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 910: }
-: 911:
-: 912: fn_exit:
|
1866: 913: MPIU_CHKLMEM_FREEALL();
933: 914: if (nest_level_inc)
-: 915: {
933: 916: MPIR_Nest_decr();
-: 917: }
|
-: 918: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_POST);
|
933: 919: return mpi_errno;
|
-: 920: /* --BEGIN ERROR HANDLING-- */
-: 921: fn_fail:
-: 922: goto fn_exit;
-: 923: /* --END ERROR HANDLING-- */
-: 924:}
-: 925:
-: 926:
-: 927:
-: 928:#undef FUNCNAME
-: 929:#define FUNCNAME MPIDI_Win_start
-: 930:#undef FCNAME
-: 931:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 932:int MPIDI_Win_start(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr)
|
933: 933:{
933: 934: int mpi_errno=MPI_SUCCESS;
-: 935: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_START);
-: 936:
-: 937: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_START);
-: 938:
-: 939:#if 0
-: 940: /* Reset the fence counter so that in case the user has switched from
-: 941: fence to start-complete synchronization, he cannot use the previous
-: 942: fence to mark the beginning of a fence epoch. */
-: 943: /* FIXME: We can't do this because fence_cnt must be updated collectively */
-: 944: win_ptr->fence_cnt = 0;
-: 945:#endif
-: 946:
-: 947: /* In case this process was previously the target of passive target rma
-: 948: * operations, we need to take care of the following...
-: 949: * Since we allow MPI_Win_unlock to return without a done ack from
-: 950: * the target in the case of multiple rma ops and exclusive lock,
-: 951: * we need to check whether there is a lock on the window, and if
-: 952: * there is a lock, poke the progress engine until the operations
-: 953: * have completed and the lock is therefore released. */
933: 954: if (win_ptr->current_lock_type != MPID_LOCK_NONE)
-: 955: {
-: 956: MPID_Progress_state progress_state;
-: 957:
-: 958: /* poke the progress engine */
|
#####: 959: MPID_Progress_start(&progress_state);
#####: 960: while (win_ptr->current_lock_type != MPID_LOCK_NONE)
-: 961: {
#####: 962: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 963: /* --BEGIN ERROR HANDLING-- */
#####: 964: if (mpi_errno != MPI_SUCCESS) {
-: 965: MPID_Progress_end(&progress_state);
#####: 966: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 967: }
-: 968: /* --END ERROR HANDLING-- */
-: 969: }
-: 970: MPID_Progress_end(&progress_state);
-: 971: }
-: 972:
|
933: 973: win_ptr->start_group_ptr = group_ptr;
933: 974: MPIR_Group_add_ref( group_ptr );
933: 975: win_ptr->start_assert = assert;
-: 976:
|
933: 977: fn_fail:
-: 978: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_START);
|
933: 979: return mpi_errno;
-: 980:}
-: 981:
-: 982:
-: 983:
-: 984:#undef FUNCNAME
-: 985:#define FUNCNAME MPIDI_Win_complete
-: 986:#undef FCNAME
-: 987:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 988:int MPIDI_Win_complete(MPID_Win *win_ptr)
933: 989:{
933: 990: int nest_level_inc = FALSE;
933: 991: int mpi_errno = MPI_SUCCESS;
-: 992: int comm_size, *nops_to_proc, src, new_total_op_count;
-: 993: int i, j, dst, done, total_op_count, *curr_ops_cnt;
-: 994: MPIDI_RMA_ops *curr_ptr, *next_ptr;
-: 995: MPID_Comm *comm_ptr;
-: 996: MPID_Request **requests; /* array of requests */
-: 997: MPI_Win source_win_handle, target_win_handle;
933: 998: MPIDI_RMA_dtype_info *dtype_infos=NULL;
933: 999: void **dataloops=NULL; /* to store dataloops for each datatype */
-: 1000: MPI_Group win_grp, start_grp;
-: 1001: int start_grp_size, *ranks_in_start_grp, *ranks_in_win_grp, rank;
933: 1002: MPIU_CHKLMEM_DECL(7);
933: 1003: MPIU_THREADPRIV_DECL;
-: 1004: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_COMPLETE);
-: 1005:
-: 1006: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_COMPLETE);
-: 1007:
933: 1008: MPIU_THREADPRIV_GET;
933: 1009: MPID_Comm_get_ptr( win_ptr->comm, comm_ptr );
933: 1010: comm_size = comm_ptr->local_size;
-: 1011:
-: 1012: /* Translate the ranks of the processes in
-: 1013: start_group to ranks in win_ptr->comm */
-: 1014:
933: 1015: start_grp_size = win_ptr->start_group_ptr->size;
-: 1016:
933: 1017: MPIU_CHKLMEM_MALLOC(ranks_in_start_grp, int *, start_grp_size*sizeof(int),
-: 1018: mpi_errno, "ranks_in_start_grp");
-: 1019:
933: 1020: MPIU_CHKLMEM_MALLOC(ranks_in_win_grp, int *, start_grp_size*sizeof(int),
-: 1021: mpi_errno, "ranks_in_win_grp");
-: 1022:
1932: 1023: for (i=0; i<start_grp_size; i++)
-: 1024: {
999: 1025: ranks_in_start_grp[i] = i;
-: 1026: }
-: 1027:
933: 1028: nest_level_inc = TRUE;
933: 1029: MPIR_Nest_incr();
-: 1030:
933: 1031: mpi_errno = NMPI_Comm_group(win_ptr->comm, &win_grp);
|
933: 1032: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1033:
|
933: 1034: start_grp = win_ptr->start_group_ptr->handle;
-: 1035:
933: 1036: mpi_errno = NMPI_Group_translate_ranks(start_grp, start_grp_size,
-: 1037: ranks_in_start_grp, win_grp,
-: 1038: ranks_in_win_grp);
|
933: 1039: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1040:
-: 1041:
|
933: 1042: NMPI_Comm_rank(win_ptr->comm, &rank);
-: 1043: /* If MPI_MODE_NOCHECK was not specified, we need to check if
-: 1044: Win_post was called on the target processes. Wait for a 0-byte sync
-: 1045: message from each target process */
933: 1046: if ((win_ptr->start_assert & MPI_MODE_NOCHECK) == 0)
-: 1047: {
1932: 1048: for (i=0; i<start_grp_size; i++)
-: 1049: {
999: 1050: src = ranks_in_win_grp[i];
999: 1051: if (src != rank) {
992: 1052: mpi_errno = NMPI_Recv(NULL, 0, MPI_INT, src, 100,
-: 1053: win_ptr->comm, MPI_STATUS_IGNORE);
|
992: 1054: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1055: }
-: 1056: }
-: 1057: }
-: 1058:
-: 1059: /* keep track of no. of ops to each proc. Needed for knowing
-: 1060: whether or not to decrement the completion counter. The
-: 1061: completion counter is decremented only on the last
-: 1062: operation. */
-: 1063:
|
933: 1064: MPIU_CHKLMEM_MALLOC(nops_to_proc, int *, comm_size*sizeof(int),
-: 1065: mpi_errno, "nops_to_proc");
933: 1066: for (i=0; i<comm_size; i++) nops_to_proc[i] = 0;
-: 1067:
933: 1068: total_op_count = 0;
933: 1069: curr_ptr = win_ptr->rma_ops_list;
3233: 1070: while (curr_ptr != NULL)
-: 1071: {
1367: 1072: nops_to_proc[curr_ptr->target_rank]++;
1367: 1073: total_op_count++;
1367: 1074: curr_ptr = curr_ptr->next;
-: 1075: }
-: 1076:
933: 1077: MPIU_CHKLMEM_MALLOC(requests, MPID_Request **,
-: 1078: (total_op_count+start_grp_size) * sizeof(MPID_Request*),
-: 1079: mpi_errno, "requests");
-: 1080: /* We allocate a few extra requests because if there are no RMA
-: 1081: ops to a target process, we need to send a 0-byte message just
-: 1082: to decrement the completion counter. */
-: 1083:
933: 1084: MPIU_CHKLMEM_MALLOC(curr_ops_cnt, int *, comm_size*sizeof(int),
-: 1085: mpi_errno, "curr_ops_cnt");
933: 1086: for (i=0; i<comm_size; i++) curr_ops_cnt[i] = 0;
-: 1087:
933: 1088: if (total_op_count != 0)
-: 1089: {
926: 1090: MPIU_CHKLMEM_MALLOC(dtype_infos, MPIDI_RMA_dtype_info *,
-: 1091: total_op_count*sizeof(MPIDI_RMA_dtype_info),
-: 1092: mpi_errno, "dtype_infos");
926: 1093: MPIU_CHKLMEM_MALLOC(dataloops, void **, total_op_count*sizeof(void*),
-: 1094: mpi_errno, "dataloops");
926: 1095: for (i=0; i<total_op_count; i++) dataloops[i] = NULL;
-: 1096: }
-: 1097:
933: 1098: i = 0;
933: 1099: curr_ptr = win_ptr->rma_ops_list;
3233: 1100: while (curr_ptr != NULL)
-: 1101: {
-: 1102: /* The completion counter at the target is decremented only on
-: 1103: the last RMA operation. We indicate the last operation by
-: 1104: passing the source_win_handle only on the last operation.
-: 1105: Otherwise, we pass NULL */
1367: 1106: if (curr_ops_cnt[curr_ptr->target_rank] ==
-: 1107: nops_to_proc[curr_ptr->target_rank] - 1)
950: 1108: source_win_handle = win_ptr->handle;
-: 1109: else
417: 1110: source_win_handle = MPI_WIN_NULL;
-: 1111:
1367: 1112: target_win_handle = win_ptr->all_win_handles[curr_ptr->target_rank];
-: 1113:
1367: 1114: switch (curr_ptr->type)
-: 1115: {
-: 1116: case (MPIDI_RMA_PUT):
-: 1117: case (MPIDI_RMA_ACCUMULATE):
1157: 1118: mpi_errno = MPIDI_CH3I_Send_rma_msg(curr_ptr, win_ptr,
-: 1119: source_win_handle, target_win_handle,
-: 1120: &dtype_infos[i],
-: 1121: &dataloops[i], &requests[i]);
|
1157: 1122: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1123: break;
-: 1124: case (MPIDI_RMA_GET):
|
210: 1125: mpi_errno = MPIDI_CH3I_Recv_rma_msg(curr_ptr, win_ptr,
-: 1126: source_win_handle, target_win_handle,
-: 1127: &dtype_infos[i],
-: 1128: &dataloops[i], &requests[i]);
|
210: 1129: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1130: break;
-: 1131: default:
#####: 1132: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winInvalidOp");
-: 1133: }
|
1367: 1134: i++;
1367: 1135: curr_ops_cnt[curr_ptr->target_rank]++;
1367: 1136: curr_ptr = curr_ptr->next;
-: 1137: }
-: 1138:
-: 1139: /* If the start_group included some processes that did not end up
-: 1140: becoming targets of RMA operations from this process, we need
-: 1141: to send a dummy message to those processes just to decrement
-: 1142: the completion counter */
-: 1143:
933: 1144: j = i;
933: 1145: new_total_op_count = total_op_count;
1932: 1146: for (i=0; i<start_grp_size; i++)
-: 1147: {
999: 1148: dst = ranks_in_win_grp[i];
999: 1149: if (dst == rank) {
-: 1150: /* FIXME: MT: this has to be done atomically */
7: 1151: win_ptr->my_counter -= 1;
-: 1152: }
992: 1153: else if (nops_to_proc[dst] == 0)
-: 1154: {
-: 1155: MPIDI_CH3_Pkt_t upkt;
42: 1156: MPIDI_CH3_Pkt_put_t *put_pkt = &upkt.put;
-: 1157: MPIDI_VC_t * vc;
-: 1158:
42: 1159: MPIDI_Pkt_init(put_pkt, MPIDI_CH3_PKT_PUT);
42: 1160: put_pkt->addr = NULL;
42: 1161: put_pkt->count = 0;
42: 1162: put_pkt->datatype = MPI_INT;
42: 1163: put_pkt->target_win_handle = win_ptr->all_win_handles[dst];
42: 1164: put_pkt->source_win_handle = win_ptr->handle;
-: 1165:
42: 1166: MPIDI_Comm_get_vc_set_active(comm_ptr, dst, &vc);
-: 1167:
-: 1168: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
42: 1169: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, put_pkt,
-: 1170: sizeof(*put_pkt),
-: 1171: &requests[j]));
-: 1172: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
42: 1173: if (mpi_errno != MPI_SUCCESS) {
|
#####: 1174: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg" );
-: 1175: }
|
42: 1176: j++;
42: 1177: new_total_op_count++;
-: 1178: }
-: 1179: }
-: 1180:
933: 1181: if (new_total_op_count)
-: 1182: {
-: 1183: MPID_Progress_state progress_state;
-: 1184:
933: 1185: done = 1;
933: 1186: MPID_Progress_start(&progress_state);
2094: 1187: while (new_total_op_count)
-: 1188: {
32615: 1189: for (i=0; i<new_total_op_count; i++)
-: 1190: {
31682: 1191: if (requests[i] != NULL)
-: 1192: {
921: 1193: if (*(requests[i]->cc_ptr) != 0)
-: 1194: {
228: 1195: done = 0;
228: 1196: break;
-: 1197: }
-: 1198: else
-: 1199: {
693: 1200: mpi_errno = requests[i]->status.MPI_ERROR;
|
-: 1201: /* --BEGIN ERROR HANDLING-- */
693: 1202: if (mpi_errno != MPI_SUCCESS)
-: 1203: {
-: 1204: MPID_Progress_end(&progress_state);
#####: 1205: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMArequest");
-: 1206: }
-: 1207: /* --END ERROR HANDLING-- */
|
693: 1208: MPID_Request_release(requests[i]);
693: 1209: requests[i] = NULL;
-: 1210: }
-: 1211: }
-: 1212: }
-: 1213:
1161: 1214: if (done)
-: 1215: {
933: 1216: break;
-: 1217: }
-: 1218:
228: 1219: mpi_errno = MPID_Progress_wait(&progress_state);
228: 1220: done = 1;
-: 1221: }
-: 1222: MPID_Progress_end(&progress_state);
-: 1223: }
-: 1224:
933: 1225: if (total_op_count != 0)
-: 1226: {
2293: 1227: for (i=0; i<total_op_count; i++)
-: 1228: {
1367: 1229: if (dataloops[i] != NULL)
-: 1230: {
193: 1231: MPIU_Free(dataloops[i]);
-: 1232: }
-: 1233: }
-: 1234: }
-: 1235:
-: 1236: /* free MPIDI_RMA_ops_list */
933: 1237: curr_ptr = win_ptr->rma_ops_list;
3233: 1238: while (curr_ptr != NULL)
-: 1239: {
1367: 1240: next_ptr = curr_ptr->next;
1367: 1241: MPIU_Free(curr_ptr);
1367: 1242: curr_ptr = next_ptr;
-: 1243: }
933: 1244: win_ptr->rma_ops_list = NULL;
-: 1245:
933: 1246: mpi_errno = NMPI_Group_free(&win_grp);
|
933: 1247: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1248:
-: 1249: /* free the group stored in window */
|
933: 1250: MPIR_Group_release(win_ptr->start_group_ptr);
933: 1251: win_ptr->start_group_ptr = NULL;
-: 1252:
933: 1253: fn_exit:
933: 1254: if (nest_level_inc)
-: 1255: {
933: 1256: MPIR_Nest_decr();
-: 1257: }
6517: 1258: MPIU_CHKLMEM_FREEALL();
|
-: 1259: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_COMPLETE);
|
933: 1260: return mpi_errno;
|
-: 1261: /* --BEGIN ERROR HANDLING-- */
-: 1262: fn_fail:
-: 1263: goto fn_exit;
-: 1264: /* --END ERROR HANDLING-- */
-: 1265:}
-: 1266:
-: 1267:
-: 1268:
-: 1269:#undef FUNCNAME
-: 1270:#define FUNCNAME MPIDI_Win_wait
-: 1271:#undef FCNAME
-: 1272:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1273:int MPIDI_Win_wait(MPID_Win *win_ptr)
|
904: 1274:{
904: 1275: int mpi_errno=MPI_SUCCESS;
-: 1276:
-: 1277: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_WAIT);
-: 1278:
-: 1279: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_WAIT);
-: 1280:
-: 1281: /* wait for all operations from other processes to finish */
904: 1282: if (win_ptr->my_counter)
-: 1283: {
-: 1284: MPID_Progress_state progress_state;
-: 1285:
902: 1286: MPID_Progress_start(&progress_state);
3574: 1287: while (win_ptr->my_counter)
-: 1288: {
1770: 1289: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 1290: /* --BEGIN ERROR HANDLING-- */
1770: 1291: if (mpi_errno != MPI_SUCCESS)
-: 1292: {
-: 1293: MPID_Progress_end(&progress_state);
-: 1294: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_WAIT);
#####: 1295: return mpi_errno;
-: 1296: }
-: 1297: /* --END ERROR HANDLING-- */
-: 1298: }
-: 1299: MPID_Progress_end(&progress_state);
-: 1300: }
-: 1301:
-: 1302: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_WAIT);
|
904: 1303: return mpi_errno;
-: 1304:}
-: 1305:
-: 1306:#undef FUNCNAME
-: 1307:#define FUNCNAME MPIDI_Win_test
-: 1308:#undef FCNAME
-: 1309:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1310:int MPIDI_Win_test(MPID_Win *win_ptr, int *flag)
498781: 1311:{
498781: 1312: int mpi_errno=MPI_SUCCESS;
-: 1313:
-: 1314: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_TEST);
-: 1315:
-: 1316: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_TEST);
-: 1317:
498781: 1318: mpi_errno = MPID_Progress_test();
498781: 1319: if (mpi_errno != MPI_SUCCESS) {
|
#####: 1320: MPIU_ERR_POP(mpi_errno);
-: 1321: }
-: 1322:
|
498781: 1323: *flag = (win_ptr->my_counter) ? 0 : 1;
-: 1324:
|
498781: 1325: fn_fail:
-: 1326: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_TEST);
|
498781: 1327: return mpi_errno;
-: 1328:}
-: 1329:
-: 1330:
-: 1331:
-: 1332:
-: 1333:#undef FUNCNAME
-: 1334:#define FUNCNAME MPIDI_Win_lock
-: 1335:#undef FCNAME
-: 1336:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1337:int MPIDI_Win_lock(int lock_type, int dest, int assert, MPID_Win *win_ptr)
1099: 1338:{
1099: 1339: int mpi_errno = MPI_SUCCESS;
-: 1340: MPIDI_RMA_ops *new_ptr;
-: 1341: MPID_Comm *comm_ptr;
1099: 1342: MPIU_CHKPMEM_DECL(1);
-: 1343: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_LOCK);
-: 1344:
-: 1345: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_LOCK);
-: 1346:
-: 1347: MPIU_UNREFERENCED_ARG(assert);
-: 1348:
-: 1349:#if 0
-: 1350: /* Reset the fence counter so that in case the user has switched from
-: 1351: fence to lock-unlock synchronization, he cannot use the previous fence
-: 1352: to mark the beginning of a fence epoch. */
-: 1353: /* FIXME: We can't do this because fence_cnt must be updated collectively */
-: 1354: win_ptr->fence_cnt = 0;
-: 1355:#endif
-: 1356:
1099: 1357: if (dest == MPI_PROC_NULL) goto fn_exit;
-: 1358:
1099: 1359: MPID_Comm_get_ptr( win_ptr->comm, comm_ptr );
-: 1360:
1099: 1361: if (dest == comm_ptr->rank) {
-: 1362: /* The target is this process itself. We must block until the lock
-: 1363: * is acquired. */
-: 1364:
-: 1365: /* poke the progress engine until lock is granted */
8: 1366: if (MPIDI_CH3I_Try_acquire_win_lock(win_ptr, lock_type) == 0)
-: 1367: {
-: 1368: MPID_Progress_state progress_state;
-: 1369:
|
#####: 1370: MPID_Progress_start(&progress_state);
#####: 1371: while (MPIDI_CH3I_Try_acquire_win_lock(win_ptr, lock_type) == 0)
-: 1372: {
#####: 1373: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 1374: /* --BEGIN ERROR HANDLING-- */
#####: 1375: if (mpi_errno != MPI_SUCCESS) {
-: 1376: MPID_Progress_end(&progress_state);
#####: 1377: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 1378: }
-: 1379: /* --END ERROR HANDLING-- */
-: 1380: }
-: 1381: MPID_Progress_end(&progress_state);
-: 1382: }
-: 1383: /* local lock acquired. local puts, gets, accumulates will be done
-: 1384: directly without queueing. */
-: 1385: }
-: 1386:
-: 1387: else {
-: 1388: /* target is some other process. add the lock request to rma_ops_list */
-: 1389:
|
1091: 1390: MPIU_CHKPMEM_MALLOC(new_ptr, MPIDI_RMA_ops *, sizeof(MPIDI_RMA_ops),
-: 1391: mpi_errno, "RMA operation entry");
-: 1392:
1091: 1393: win_ptr->rma_ops_list = new_ptr;
-: 1394:
1091: 1395: new_ptr->next = NULL;
1091: 1396: new_ptr->type = MPIDI_RMA_LOCK;
1091: 1397: new_ptr->target_rank = dest;
1091: 1398: new_ptr->lock_type = lock_type;
-: 1399: }
-: 1400:
1099: 1401: fn_exit:
|
-: 1402: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_LOCK);
|
1099: 1403: return mpi_errno;
|
-: 1404: /* --BEGIN ERROR HANDLING-- */
-: 1405: fn_fail:
#####: 1406: MPIU_CHKPMEM_REAP();
-: 1407: goto fn_exit;
-: 1408: /* --END ERROR HANDLING-- */
-: 1409:}
-: 1410:
-: 1411:#undef FUNCNAME
-: 1412:#define FUNCNAME MPIDI_Win_unlock
-: 1413:#undef FCNAME
-: 1414:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1415:int MPIDI_Win_unlock(int dest, MPID_Win *win_ptr)
|
1099: 1416:{
1099: 1417: int mpi_errno=MPI_SUCCESS;
-: 1418: int single_op_opt, type_size;
-: 1419: MPIDI_RMA_ops *rma_op, *curr_op;
-: 1420: MPID_Comm *comm_ptr;
1099: 1421: MPID_Request *req=NULL;
-: 1422: MPIDI_CH3_Pkt_t upkt;
1099: 1423: MPIDI_CH3_Pkt_lock_t *lock_pkt = &upkt.lock;
-: 1424: MPIDI_VC_t * vc;
1099: 1425: int wait_for_rma_done_pkt = 0, predefined;
-: 1426: MPIDI_STATE_DECL(MPID_STATE_MPIDI_WIN_UNLOCK);
-: 1427: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_WIN_UNLOCK);
-: 1428:
1099: 1429: if (dest == MPI_PROC_NULL) goto fn_exit;
-: 1430:
1099: 1431: MPID_Comm_get_ptr( win_ptr->comm, comm_ptr );
-: 1432:
1099: 1433: if (dest == comm_ptr->rank) {
-: 1434: /* local lock. release the lock on the window, grant the next one
-: 1435: * in the queue, and return. */
8: 1436: mpi_errno = MPIDI_CH3I_Release_lock(win_ptr);
8: 1437: if (mpi_errno != MPI_SUCCESS) goto fn_exit;
8: 1438: mpi_errno = MPID_Progress_poke();
8: 1439: goto fn_exit;
-: 1440: }
-: 1441:
1091: 1442: rma_op = win_ptr->rma_ops_list;
-: 1443:
-: 1444: /* win_lock was not called. return error */
1091: 1445: if ( (rma_op == NULL) || (rma_op->type != MPIDI_RMA_LOCK) ) {
|
#####: 1446: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**rmasync");
-: 1447: }
-: 1448:
|
1091: 1449: if (rma_op->target_rank != dest) {
-: 1450: /* The target rank is different from the one passed to win_lock! */
|
#####: 1451: MPIU_ERR_SETANDJUMP2(mpi_errno,MPI_ERR_OTHER,"**winunlockrank",
-: 1452: "**winunlockrank %d %d", dest, rma_op->target_rank);
-: 1453: }
-: 1454:
|
1091: 1455: if (rma_op->next == NULL) {
-: 1456: /* only win_lock called, no put/get/acc. Do nothing and return. */
4: 1457: MPIU_Free(rma_op);
4: 1458: win_ptr->rma_ops_list = NULL;
4: 1459: goto fn_exit;
-: 1460: }
-: 1461:
1087: 1462: single_op_opt = 0;
-: 1463:
1087: 1464: MPIDI_Comm_get_vc_set_active(comm_ptr, dest, &vc);
-: 1465:
1087: 1466: if (rma_op->next->next == NULL) {
-: 1467: /* Single put, get, or accumulate between the lock and unlock. If it
-: 1468: * is of small size and predefined datatype at the target, we
-: 1469: * do an optimization where the lock and the RMA operation are
-: 1470: * sent in a single packet. Otherwise, we send a separate lock
-: 1471: * request first. */
-: 1472:
601: 1473: curr_op = rma_op->next;
-: 1474:
601: 1475: MPID_Datatype_get_size_macro(curr_op->origin_datatype, type_size);
-: 1476:
601: 1477: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(curr_op->target_datatype, predefined);
-: 1478:
601: 1479: if ( predefined &&
-: 1480: (type_size * curr_op->origin_count <= vc->eager_max_msg_sz) ) {
600: 1481: single_op_opt = 1;
-: 1482: /* Set the lock granted flag to 1 */
600: 1483: win_ptr->lock_granted = 1;
600: 1484: if (curr_op->type == MPIDI_RMA_GET) {
300: 1485: mpi_errno = MPIDI_CH3I_Send_lock_get(win_ptr);
300: 1486: wait_for_rma_done_pkt = 0;
-: 1487: }
-: 1488: else {
300: 1489: mpi_errno = MPIDI_CH3I_Send_lock_put_or_acc(win_ptr);
300: 1490: wait_for_rma_done_pkt = 1;
-: 1491: }
|
600: 1492: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1493: }
-: 1494: }
-: 1495:
|
1087: 1496: if (single_op_opt == 0) {
-: 1497:
-: 1498: /* Send a lock packet over to the target. wait for the lock_granted
-: 1499: * reply. then do all the RMA ops. */
-: 1500:
487: 1501: MPIDI_Pkt_init(lock_pkt, MPIDI_CH3_PKT_LOCK);
487: 1502: lock_pkt->target_win_handle = win_ptr->all_win_handles[dest];
487: 1503: lock_pkt->source_win_handle = win_ptr->handle;
487: 1504: lock_pkt->lock_type = rma_op->lock_type;
-: 1505:
-: 1506: /* Set the lock granted flag to 0 */
487: 1507: win_ptr->lock_granted = 0;
-: 1508:
-: 1509: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
487: 1510: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, lock_pkt, sizeof(*lock_pkt), &req));
-: 1511: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
487: 1512: if (mpi_errno != MPI_SUCCESS) {
|
#####: 1513: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 1514: }
-: 1515:
-: 1516: /* release the request returned by iStartMsg */
|
487: 1517: if (req != NULL)
-: 1518: {
|
#####: 1519: MPID_Request_release(req);
-: 1520: }
-: 1521:
-: 1522: /* After the target grants the lock, it sends a lock_granted
-: 1523: * packet. This packet is received in ch3u_handle_recv_pkt.c.
-: 1524: * The handler for the packet sets the win_ptr->lock_granted flag to 1.
-: 1525: */
-: 1526:
-: 1527: /* poke the progress engine until lock_granted flag is set to 1 */
|
487: 1528: if (win_ptr->lock_granted == 0)
-: 1529: {
-: 1530: MPID_Progress_state progress_state;
-: 1531:
487: 1532: MPID_Progress_start(&progress_state);
1476: 1533: while (win_ptr->lock_granted == 0)
-: 1534: {
502: 1535: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 1536: /* --BEGIN ERROR HANDLING-- */
502: 1537: if (mpi_errno != MPI_SUCCESS) {
-: 1538: MPID_Progress_end(&progress_state);
#####: 1539: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 1540: }
-: 1541: /* --END ERROR HANDLING-- */
-: 1542: }
-: 1543: MPID_Progress_end(&progress_state);
-: 1544: }
-: 1545:
-: 1546: /* Now do all the RMA operations */
|
487: 1547: mpi_errno = MPIDI_CH3I_Do_passive_target_rma(win_ptr,
-: 1548: &wait_for_rma_done_pkt);
|
487: 1549: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1550: }
-: 1551:
-: 1552: /* If the lock is a shared lock or we have done the single op
-: 1553: optimization, we need to wait until the target informs us that
-: 1554: all operations are done on the target. */
|
1087: 1555: if (wait_for_rma_done_pkt == 1) {
-: 1556: /* wait until the "pt rma done" packet is received from the
-: 1557: target. This packet resets the win_ptr->lock_granted flag back to
-: 1558: 0. */
-: 1559:
-: 1560: /* poke the progress engine until lock_granted flag is reset to 0 */
301: 1561: if (win_ptr->lock_granted != 0)
-: 1562: {
-: 1563: MPID_Progress_state progress_state;
-: 1564:
301: 1565: MPID_Progress_start(&progress_state);
905: 1566: while (win_ptr->lock_granted != 0)
-: 1567: {
303: 1568: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 1569: /* --BEGIN ERROR HANDLING-- */
303: 1570: if (mpi_errno != MPI_SUCCESS) {
-: 1571: MPID_Progress_end(&progress_state);
#####: 1572: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 1573: }
-: 1574: /* --END ERROR HANDLING-- */
-: 1575: }
-: 1576: MPID_Progress_end(&progress_state);
-: 1577: }
-: 1578: }
-: 1579: else
|
786: 1580: win_ptr->lock_granted = 0;
-: 1581:
1099: 1582: fn_exit:
|
-: 1583: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_WIN_UNLOCK);
|
1099: 1584: return mpi_errno;
|
-: 1585: /* --BEGIN ERROR HANDLING-- */
-: 1586: fn_fail:
-: 1587: goto fn_exit;
-: 1588: /* --END ERROR HANDLING-- */
-: 1589:}
-: 1590:
-: 1591:
-: 1592:#undef FUNCNAME
-: 1593:#define FUNCNAME MPIDI_CH3I_Do_passive_target_rma
-: 1594:#undef FCNAME
-: 1595:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1596:static int MPIDI_CH3I_Do_passive_target_rma(MPID_Win *win_ptr,
-: 1597: int *wait_for_rma_done_pkt)
|
487: 1598:{
487: 1599: int mpi_errno = MPI_SUCCESS, done, i, nops;
-: 1600: MPIDI_RMA_ops *curr_ptr, *next_ptr, **curr_ptr_ptr, *tmp_ptr;
-: 1601: MPID_Comm *comm_ptr;
487: 1602: MPID_Request **requests=NULL; /* array of requests */
487: 1603: MPIDI_RMA_dtype_info *dtype_infos=NULL;
487: 1604: void **dataloops=NULL; /* to store dataloops for each datatype */
-: 1605: MPI_Win source_win_handle, target_win_handle;
487: 1606: MPIU_CHKLMEM_DECL(3);
-: 1607: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_DO_PASSIVE_TARGET_RMA);
-: 1608:
-: 1609: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_DO_PASSIVE_TARGET_RMA);
-: 1610:
487: 1611: if (win_ptr->rma_ops_list->lock_type == MPI_LOCK_EXCLUSIVE) {
-: 1612: /* exclusive lock. no need to wait for rma done pkt at the end */
486: 1613: *wait_for_rma_done_pkt = 0;
-: 1614: }
-: 1615: else {
-: 1616: /* shared lock. check if any of the rma ops is a get. If so, move it
-: 1617: to the end of the list and do it last, in which case an rma done
-: 1618: pkt is not needed. If there is no get, rma done pkt is needed */
-: 1619:
-: 1620: /* First check whether the last operation is a get. Skip the first op,
-: 1621: which is a lock. */
-: 1622:
1: 1623: curr_ptr = win_ptr->rma_ops_list->next;
2: 1624: while (curr_ptr->next != NULL)
|
#####: 1625: curr_ptr = curr_ptr->next;
-: 1626:
|
1: 1627: if (curr_ptr->type == MPIDI_RMA_GET) {
-: 1628: /* last operation is a get. no need to wait for rma done pkt */
|
#####: 1629: *wait_for_rma_done_pkt = 0;
-: 1630: }
-: 1631: else {
-: 1632: /* go through the list and move the first get operation
-: 1633: (if there is one) to the end */
-: 1634:
|
1: 1635: curr_ptr = win_ptr->rma_ops_list->next;
1: 1636: curr_ptr_ptr = &(win_ptr->rma_ops_list->next);
-: 1637:
1: 1638: *wait_for_rma_done_pkt = 1;
-: 1639:
3: 1640: while (curr_ptr != NULL) {
1: 1641: if (curr_ptr->type == MPIDI_RMA_GET) {
|
#####: 1642: *wait_for_rma_done_pkt = 0;
#####: 1643: *curr_ptr_ptr = curr_ptr->next;
#####: 1644: tmp_ptr = curr_ptr;
#####: 1645: while (curr_ptr->next != NULL)
#####: 1646: curr_ptr = curr_ptr->next;
#####: 1647: curr_ptr->next = tmp_ptr;
#####: 1648: tmp_ptr->next = NULL;
#####: 1649: break;
-: 1650: }
-: 1651: else {
|
1: 1652: curr_ptr_ptr = &(curr_ptr->next);
1: 1653: curr_ptr = curr_ptr->next;
-: 1654: }
-: 1655: }
-: 1656: }
-: 1657: }
-: 1658:
487: 1659: MPID_Comm_get_ptr( win_ptr->comm, comm_ptr );
-: 1660:
-: 1661: /* Ignore the first op in the list because it is a win_lock and do
-: 1662: the rest */
-: 1663:
487: 1664: curr_ptr = win_ptr->rma_ops_list->next;
487: 1665: nops = 0;
1953: 1666: while (curr_ptr != NULL) {
979: 1667: nops++;
979: 1668: curr_ptr = curr_ptr->next;
-: 1669: }
-: 1670:
487: 1671: MPIU_CHKLMEM_MALLOC(requests, MPID_Request **, nops*sizeof(MPID_Request*),
-: 1672: mpi_errno, "requests");
487: 1673: MPIU_CHKLMEM_MALLOC(dtype_infos, MPIDI_RMA_dtype_info *,
-: 1674: nops*sizeof(MPIDI_RMA_dtype_info),
-: 1675: mpi_errno, "dtype_infos");
487: 1676: MPIU_CHKLMEM_MALLOC(dataloops, void **, nops*sizeof(void*),
-: 1677: mpi_errno, "dataloops");
-: 1678:
1466: 1679: for (i=0; i<nops; i++)
-: 1680: {
979: 1681: dataloops[i] = NULL;
-: 1682: }
-: 1683:
487: 1684: i = 0;
487: 1685: curr_ptr = win_ptr->rma_ops_list->next;
487: 1686: target_win_handle = win_ptr->all_win_handles[curr_ptr->target_rank];
1953: 1687: while (curr_ptr != NULL)
-: 1688: {
-: 1689: /* To indicate the last RMA operation, we pass the
-: 1690: source_win_handle only on the last operation. Otherwise,
-: 1691: we pass MPI_WIN_NULL. */
979: 1692: if (i == nops - 1)
487: 1693: source_win_handle = win_ptr->handle;
-: 1694: else
492: 1695: source_win_handle = MPI_WIN_NULL;
-: 1696:
979: 1697: switch (curr_ptr->type)
-: 1698: {
-: 1699: case (MPIDI_RMA_PUT): /* same as accumulate */
-: 1700: case (MPIDI_RMA_ACCUMULATE):
497: 1701: win_ptr->pt_rma_puts_accs[curr_ptr->target_rank]++;
497: 1702: mpi_errno = MPIDI_CH3I_Send_rma_msg(curr_ptr, win_ptr,
-: 1703: source_win_handle, target_win_handle, &dtype_infos[i],
-: 1704: &dataloops[i], &requests[i]);
|
497: 1705: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1706: break;
-: 1707: case (MPIDI_RMA_GET):
|
482: 1708: mpi_errno = MPIDI_CH3I_Recv_rma_msg(curr_ptr, win_ptr,
-: 1709: source_win_handle, target_win_handle, &dtype_infos[i],
-: 1710: &dataloops[i], &requests[i]);
|
482: 1711: if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
-: 1712: break;
-: 1713: default:
#####: 1714: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winInvalidOp");
-: 1715: }
|
979: 1716: i++;
979: 1717: curr_ptr = curr_ptr->next;
-: 1718: }
-: 1719:
487: 1720: if (nops)
-: 1721: {
-: 1722: MPID_Progress_state progress_state;
-: 1723:
487: 1724: done = 1;
487: 1725: MPID_Progress_start(&progress_state);
1465: 1726: while (nops)
-: 1727: {
2453: 1728: for (i=0; i<nops; i++)
-: 1729: {
1966: 1730: if (requests[i] != NULL)
-: 1731: {
1214: 1732: if (*(requests[i]->cc_ptr) != 0)
-: 1733: {
491: 1734: done = 0;
491: 1735: break;
-: 1736: }
-: 1737: else
-: 1738: {
723: 1739: mpi_errno = requests[i]->status.MPI_ERROR;
|
-: 1740: /* --BEGIN ERROR HANDLING-- */
723: 1741: if (mpi_errno != MPI_SUCCESS)
-: 1742: {
-: 1743: MPID_Progress_end(&progress_state);
#####: 1744: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 1745: }
-: 1746: /* --END ERROR HANDLING-- */
-: 1747: /* if origin datatype was a derived
-: 1748: datatype, it will get freed when the
-: 1749: request gets freed. */
|
723: 1750: MPID_Request_release(requests[i]);
723: 1751: requests[i] = NULL;
-: 1752: }
-: 1753: }
-: 1754: }
-: 1755:
978: 1756: if (done)
-: 1757: {
487: 1758: break;
-: 1759: }
-: 1760:
491: 1761: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 1762: /* --BEGIN ERROR HANDLING-- */
491: 1763: if (mpi_errno != MPI_SUCCESS) {
-: 1764: MPID_Progress_end(&progress_state);
#####: 1765: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winnoprogress");
-: 1766: }
-: 1767: /* --END ERROR HANDLING-- */
|
491: 1768: done = 1;
-: 1769: }
-: 1770: MPID_Progress_end(&progress_state);
-: 1771: }
-: 1772:
1466: 1773: for (i=0; i<nops; i++)
-: 1774: {
979: 1775: if (dataloops[i] != NULL)
-: 1776: {
721: 1777: MPIU_Free(dataloops[i]);
-: 1778: }
-: 1779: }
-: 1780:
-: 1781: /* free MPIDI_RMA_ops_list */
487: 1782: curr_ptr = win_ptr->rma_ops_list;
2440: 1783: while (curr_ptr != NULL)
-: 1784: {
1466: 1785: next_ptr = curr_ptr->next;
1466: 1786: MPIU_Free(curr_ptr);
1466: 1787: curr_ptr = next_ptr;
-: 1788: }
487: 1789: win_ptr->rma_ops_list = NULL;
-: 1790:
-: 1791: fn_exit:
1461: 1792: MPIU_CHKLMEM_FREEALL();
|
-: 1793: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_DO_PASSIVE_TARGET_RMA);
|
487: 1794: return mpi_errno;
|
-: 1795: /* --BEGIN ERROR HANDLING-- */
-: 1796: fn_fail:
-: 1797: goto fn_exit;
-: 1798: /* --END ERROR HANDLING-- */
-: 1799:}
-: 1800:
-: 1801:
-: 1802:#undef FUNCNAME
-: 1803:#define FUNCNAME MPIDI_CH3I_Send_lock_put_or_acc
-: 1804:#undef FCNAME
-: 1805:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1806:static int MPIDI_CH3I_Send_lock_put_or_acc(MPID_Win *win_ptr)
|
300: 1807:{
300: 1808: int mpi_errno=MPI_SUCCESS, lock_type, origin_dt_derived, iovcnt;
-: 1809: MPIDI_RMA_ops *rma_op;
300: 1810: MPID_Request *request=NULL;
-: 1811: MPIDI_VC_t * vc;
-: 1812: MPID_IOV iov[MPID_IOV_LIMIT];
-: 1813: MPID_Comm *comm_ptr;
300: 1814: MPID_Datatype *origin_dtp=NULL;
-: 1815: int origin_type_size, predefined;
-: 1816: MPIDI_CH3_Pkt_t upkt;
-: 1817: MPIDI_CH3_Pkt_lock_put_unlock_t *lock_put_unlock_pkt =
300: 1818: &upkt.lock_put_unlock;
-: 1819: MPIDI_CH3_Pkt_lock_accum_unlock_t *lock_accum_unlock_pkt =
300: 1820: &upkt.lock_accum_unlock;
-: 1821:
-: 1822: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SEND_LOCK_PUT_OR_ACC);
-: 1823:
-: 1824: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SEND_LOCK_PUT_OR_ACC);
-: 1825:
300: 1826: lock_type = win_ptr->rma_ops_list->lock_type;
-: 1827:
300: 1828: rma_op = win_ptr->rma_ops_list->next;
-: 1829:
300: 1830: win_ptr->pt_rma_puts_accs[rma_op->target_rank]++;
-: 1831:
300: 1832: if (rma_op->type == MPIDI_RMA_PUT) {
300: 1833: MPIDI_Pkt_init(lock_put_unlock_pkt, MPIDI_CH3_PKT_LOCK_PUT_UNLOCK);
300: 1834: lock_put_unlock_pkt->target_win_handle =
-: 1835: win_ptr->all_win_handles[rma_op->target_rank];
300: 1836: lock_put_unlock_pkt->source_win_handle = win_ptr->handle;
300: 1837: lock_put_unlock_pkt->lock_type = lock_type;
-: 1838:
300: 1839: lock_put_unlock_pkt->addr =
-: 1840: (char *) win_ptr->base_addrs[rma_op->target_rank] +
-: 1841: win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-: 1842:
300: 1843: lock_put_unlock_pkt->count = rma_op->target_count;
300: 1844: lock_put_unlock_pkt->datatype = rma_op->target_datatype;
-: 1845:
300: 1846: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) lock_put_unlock_pkt;
300: 1847: iov[0].MPID_IOV_LEN = sizeof(*lock_put_unlock_pkt);
-: 1848: }
-: 1849:
|
#####: 1850: else if (rma_op->type == MPIDI_RMA_ACCUMULATE) {
#####: 1851: MPIDI_Pkt_init(lock_accum_unlock_pkt, MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK);
#####: 1852: lock_accum_unlock_pkt->target_win_handle =
-: 1853: win_ptr->all_win_handles[rma_op->target_rank];
#####: 1854: lock_accum_unlock_pkt->source_win_handle = win_ptr->handle;
#####: 1855: lock_accum_unlock_pkt->lock_type = lock_type;
-: 1856:
#####: 1857: lock_accum_unlock_pkt->addr =
-: 1858: (char *) win_ptr->base_addrs[rma_op->target_rank] +
-: 1859: win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-: 1860:
#####: 1861: lock_accum_unlock_pkt->count = rma_op->target_count;
#####: 1862: lock_accum_unlock_pkt->datatype = rma_op->target_datatype;
#####: 1863: lock_accum_unlock_pkt->op = rma_op->op;
-: 1864:
#####: 1865: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) lock_accum_unlock_pkt;
#####: 1866: iov[0].MPID_IOV_LEN = sizeof(*lock_accum_unlock_pkt);
-: 1867: }
-: 1868:
|
300: 1869: MPID_Comm_get_ptr(win_ptr->comm, comm_ptr);
300: 1870: MPIDI_Comm_get_vc_set_active(comm_ptr, rma_op->target_rank, &vc);
-: 1871:
300: 1872: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(rma_op->origin_datatype, predefined);
300: 1873: if (!predefined)
-: 1874: {
|
#####: 1875: origin_dt_derived = 1;
#####: 1876: MPID_Datatype_get_ptr(rma_op->origin_datatype, origin_dtp);
-: 1877: }
-: 1878: else
-: 1879: {
|
300: 1880: origin_dt_derived = 0;
-: 1881: }
-: 1882:
300: 1883: MPID_Datatype_get_size_macro(rma_op->origin_datatype, origin_type_size);
-: 1884:
300: 1885: if (!origin_dt_derived)
-: 1886: {
-: 1887: /* basic datatype on origin */
-: 1888:
300: 1889: iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)rma_op->origin_addr;
300: 1890: iov[1].MPID_IOV_LEN = rma_op->origin_count * origin_type_size;
300: 1891: iovcnt = 2;
-: 1892:
-: 1893: MPIU_THREAD_CS_ENTER(CH3COMM,vc);
300: 1894: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsgv(vc, iov, iovcnt, &request));
-: 1895: MPIU_THREAD_CS_EXIT(CH3COMM,vc);
300: 1896: if (mpi_errno != MPI_SUCCESS) {
|
#####: 1897: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
-: 1898: }
-: 1899: }
-: 1900: else
-: 1901: {
-: 1902: /* derived datatype on origin */
-: 1903:
|
#####: 1904: iovcnt = 1;
-: 1905:
#####: 1906: request = MPID_Request_create();
#####: 1907: if (request == NULL) {
|
#####: 1908: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 1909: }
-: 1910:
|
#####: 1911: MPIU_Object_set_ref(request, 2);
#####: 1912: request->kind = MPID_REQUEST_SEND;
-: 1913:
#####: 1914: request->dev.datatype_ptr = origin_dtp;
-: 1915: /* this will cause the datatype to be freed when the request
-: 1916: is freed. */
-: 1917:
#####: 1918: request->dev.segment_ptr = MPID_Segment_alloc( );
#####: 1919: MPIU_ERR_CHKANDJUMP1(request->dev.segment_ptr == NULL, mpi_errno, MPI_ERR_OTHER, "**nomem", "**nomem %s", "MPID_Segment_alloc");
-: 1920:
#####: 1921: MPID_Segment_init(rma_op->origin_addr, rma_op->origin_count,
-: 1922: rma_op->origin_datatype,
-: 1923: request->dev.segment_ptr, 0);
#####: 1924: request->dev.segment_first = 0;
#####: 1925: request->dev.segment_size = rma_op->origin_count * origin_type_size;
-: 1926:
#####: 1927: request->dev.OnFinal = 0;
#####: 1928: request->dev.OnDataAvail = 0;
-: 1929:
#####: 1930: mpi_errno = vc->sendNoncontig_fn(vc, request, iov[0].MPID_IOV_BUF, iov[0].MPID_IOV_LEN);
|
-: 1931: /* --BEGIN ERROR HANDLING-- */
#####: 1932: if (mpi_errno)
-: 1933: {
#####: 1934: MPID_Datatype_release(request->dev.datatype_ptr);
#####: 1935: MPIU_Object_set_ref(request, 0);
#####: 1936: MPIDI_CH3_Request_destroy(request);
#####: 1937: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|loadsendiov");
-: 1938: }
-: 1939: /* --END ERROR HANDLING-- */
-: 1940: }
-: 1941:
|
300: 1942: if (request != NULL) {
|
#####: 1943: if (*(request->cc_ptr) != 0)
-: 1944: {
-: 1945: MPID_Progress_state progress_state;
-: 1946:
#####: 1947: MPID_Progress_start(&progress_state);
#####: 1948: while (*(request->cc_ptr) != 0)
-: 1949: {
#####: 1950: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 1951: /* --BEGIN ERROR HANDLING-- */
#####: 1952: if (mpi_errno != MPI_SUCCESS)
-: 1953: {
-: 1954: MPID_Progress_end(&progress_state);
#####: 1955: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 1956: }
-: 1957: /* --END ERROR HANDLING-- */
-: 1958: }
-: 1959: MPID_Progress_end(&progress_state);
-: 1960: }
-: 1961:
|
#####: 1962: mpi_errno = request->status.MPI_ERROR;
#####: 1963: if (mpi_errno != MPI_SUCCESS) {
|
#####: 1964: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 1965: }
-: 1966:
|
#####: 1967: MPID_Request_release(request);
-: 1968: }
-: 1969:
-: 1970: /* free MPIDI_RMA_ops_list */
|
300: 1971: MPIU_Free(win_ptr->rma_ops_list->next);
300: 1972: MPIU_Free(win_ptr->rma_ops_list);
300: 1973: win_ptr->rma_ops_list = NULL;
-: 1974:
|
300: 1975: fn_fail:
-: 1976: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_SEND_LOCK_PUT_OR_ACC);
|
300: 1977: return mpi_errno;
-: 1978:}
-: 1979:
-: 1980:
-: 1981:#undef FUNCNAME
-: 1982:#define FUNCNAME MPIDI_CH3I_Send_lock_get
-: 1983:#undef FCNAME
-: 1984:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 1985:static int MPIDI_CH3I_Send_lock_get(MPID_Win *win_ptr)
300: 1986:{
300: 1987: int mpi_errno=MPI_SUCCESS, lock_type, predefined;
-: 1988: MPIDI_RMA_ops *rma_op;
300: 1989: MPID_Request *rreq=NULL, *sreq=NULL;
-: 1990: MPIDI_VC_t * vc;
-: 1991: MPID_Comm *comm_ptr;
-: 1992: MPID_Datatype *dtp;
-: 1993: MPIDI_CH3_Pkt_t upkt;
-: 1994: MPIDI_CH3_Pkt_lock_get_unlock_t *lock_get_unlock_pkt =
300: 1995: &upkt.lock_get_unlock;
-: 1996:
-: 1997: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SEND_LOCK_GET);
-: 1998:
-: 1999: MPIDI_RMA_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SEND_LOCK_GET);
-: 2000:
300: 2001: lock_type = win_ptr->rma_ops_list->lock_type;
-: 2002:
300: 2003: rma_op = win_ptr->rma_ops_list->next;
-: 2004:
-: 2005: /* create a request, store the origin buf, cnt, datatype in it,
-: 2006: and pass a handle to it in the get packet. When the get
-: 2007: response comes from the target, it will contain the request
-: 2008: handle. */
300: 2009: rreq = MPID_Request_create();
300: 2010: if (rreq == NULL) {
|
#####: 2011: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 2012: }
-: 2013:
|
300: 2014: MPIU_Object_set_ref(rreq, 2);
-: 2015:
300: 2016: rreq->dev.user_buf = rma_op->origin_addr;
300: 2017: rreq->dev.user_count = rma_op->origin_count;
300: 2018: rreq->dev.datatype = rma_op->origin_datatype;
300: 2019: rreq->dev.target_win_handle = MPI_WIN_NULL;
300: 2020: rreq->dev.source_win_handle = win_ptr->handle;
-: 2021:
300: 2022: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(rreq->dev.datatype, predefined);
300: 2023: if (!predefined)
-: 2024: {
|
#####: 2025: MPID_Datatype_get_ptr(rreq->dev.datatype, dtp);
#####: 2026: rreq->dev.datatype_ptr = dtp;
-: 2027: /* this will cause the datatype to be freed when the
-: 2028: request is freed. */
-: 2029: }
-: 2030:
|
300: 2031: MPIDI_Pkt_init(lock_get_unlock_pkt, MPIDI_CH3_PKT_LOCK_GET_UNLOCK);
300: 2032: lock_get_unlock_pkt->target_win_handle =
-: 2033: win_ptr->all_win_handles[rma_op->target_rank];
300: 2034: lock_get_unlock_pkt->source_win_handle = win_ptr->handle;
300: 2035: lock_get_unlock_pkt->lock_type = lock_type;
-: 2036:
300: 2037: lock_get_unlock_pkt->addr =
-: 2038: (char *) win_ptr->base_addrs[rma_op->target_rank] +
-: 2039: win_ptr->disp_units[rma_op->target_rank] * rma_op->target_disp;
-: 2040:
300: 2041: lock_get_unlock_pkt->count = rma_op->target_count;
300: 2042: lock_get_unlock_pkt->datatype = rma_op->target_datatype;
300: 2043: lock_get_unlock_pkt->request_handle = rreq->handle;
-: 2044:
300: 2045: MPID_Comm_get_ptr(win_ptr->comm, comm_ptr);
300: 2046: MPIDI_Comm_get_vc_set_active(comm_ptr, rma_op->target_rank, &vc);
-: 2047:
300: 2048: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, lock_get_unlock_pkt,
-: 2049: sizeof(*lock_get_unlock_pkt), &sreq));
300: 2050: if (mpi_errno != MPI_SUCCESS) {
|
#####: 2051: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
-: 2052: }
-: 2053:
-: 2054: /* release the request returned by iStartMsg */
|
300: 2055: if (sreq != NULL)
-: 2056: {
|
#####: 2057: MPID_Request_release(sreq);
-: 2058: }
-: 2059:
-: 2060: /* now wait for the data to arrive */
|
300: 2061: if (*(rreq->cc_ptr) != 0)
-: 2062: {
-: 2063: MPID_Progress_state progress_state;
-: 2064:
300: 2065: MPID_Progress_start(&progress_state);
900: 2066: while (*(rreq->cc_ptr) != 0)
-: 2067: {
300: 2068: mpi_errno = MPID_Progress_wait(&progress_state);
|
-: 2069: /* --BEGIN ERROR HANDLING-- */
300: 2070: if (mpi_errno != MPI_SUCCESS)
-: 2071: {
-: 2072: MPID_Progress_end(&progress_state);
#####: 2073: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 2074: }
-: 2075: /* --END ERROR HANDLING-- */
-: 2076: }
-: 2077: MPID_Progress_end(&progress_state);
-: 2078: }
-: 2079:
|
300: 2080: mpi_errno = rreq->status.MPI_ERROR;
300: 2081: if (mpi_errno != MPI_SUCCESS) {
|
#####: 2082: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**winRMAmessage");
-: 2083: }
-: 2084:
-: 2085: /* if origin datatype was a derived datatype, it will get freed when the
-: 2086: rreq gets freed. */
|
300: 2087: MPID_Request_release(rreq);
-: 2088:
-: 2089: /* free MPIDI_RMA_ops_list */
300: 2090: MPIU_Free(win_ptr->rma_ops_list->next);
300: 2091: MPIU_Free(win_ptr->rma_ops_list);
300: 2092: win_ptr->rma_ops_list = NULL;
-: 2093:
|
300: 2094: fn_fail:
-: 2095: MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_SEND_LOCK_GET);
|
300: 2096: return mpi_errno;
-: 2097:}
-: 2098:
-: 2099:/* ------------------------------------------------------------------------ */
-: 2100:/*
-: 2101: * Utility routines
-: 2102: */
-: 2103:/* ------------------------------------------------------------------------ */
-: 2104:#undef FUNCNAME
-: 2105:#define FUNCNAME MPIDI_CH3I_Send_lock_granted_pkt
-: 2106:#undef FCNAME
-: 2107:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2108:int MPIDI_CH3I_Send_lock_granted_pkt(MPIDI_VC_t *vc, MPI_Win source_win_handle)
487: 2109:{
-: 2110: MPIDI_CH3_Pkt_t upkt;
487: 2111: MPIDI_CH3_Pkt_lock_granted_t *lock_granted_pkt = &upkt.lock_granted;
487: 2112: MPID_Request *req = NULL;
-: 2113: int mpi_errno;
-: 2114: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_SEND_LOCK_GRANTED_PKT);
-: 2115:
-: 2116: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_SEND_LOCK_GRANTED_PKT);
-: 2117:
-: 2118: /* send lock granted packet */
487: 2119: MPIDI_Pkt_init(lock_granted_pkt, MPIDI_CH3_PKT_LOCK_GRANTED);
487: 2120: lock_granted_pkt->source_win_handle = source_win_handle;
-: 2121:
487: 2122: mpi_errno = MPIU_CALL(MPIDI_CH3,iStartMsg(vc, lock_granted_pkt,
-: 2123: sizeof(*lock_granted_pkt), &req));
487: 2124: if (mpi_errno) {
|
#####: 2125: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
-: 2126: }
-: 2127:
|
487: 2128: if (req != NULL)
-: 2129: {
|
#####: 2130: MPID_Request_release(req);
-: 2131: }
-: 2132:
|
487: 2133: fn_fail:
-: 2134: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_SEND_LOCK_GRANTED_PKT);
-: 2135:
|
487: 2136: return mpi_errno;
-: 2137:}
-: 2138:
-: 2139:/* ------------------------------------------------------------------------ */
-: 2140:/*
-: 2141: * The following routines are the packet handlers for the packet types
-: 2142: * used above in the implementation of the RMA operations in terms
-: 2143: * of messages.
-: 2144: */
-: 2145:/* ------------------------------------------------------------------------ */
-: 2146:#undef FUNCNAME
-: 2147:#define FUNCNAME MPIDI_CH3_PktHandler_Put
-: 2148:#undef FCNAME
-: 2149:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2150:int MPIDI_CH3_PktHandler_Put( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2151: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
5830: 2152:{
5830: 2153: MPIDI_CH3_Pkt_put_t * put_pkt = &pkt->put;
5830: 2154: MPID_Request *req = NULL;
-: 2155: int predefined;
-: 2156: int type_size;
5830: 2157: int complete = 0;
5830: 2158: char *data_buf = NULL;
-: 2159: MPIDI_msg_sz_t data_len;
5830: 2160: int mpi_errno = MPI_SUCCESS;
-: 2161: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_PUT);
-: 2162:
-: 2163: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_PUT);
-: 2164:
-: 2165: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received put pkt");
-: 2166:
5830: 2167: if (put_pkt->count == 0)
-: 2168: {
-: 2169: MPID_Win *win_ptr;
-: 2170:
-: 2171: /* it's a 0-byte message sent just to decrement the
-: 2172: completion counter. This happens only in
-: 2173: post/start/complete/wait sync model; therefore, no need
-: 2174: to check lock queue. */
42: 2175: if (put_pkt->target_win_handle != MPI_WIN_NULL) {
42: 2176: MPID_Win_get_ptr(put_pkt->target_win_handle, win_ptr);
-: 2177: /* FIXME: MT: this has to be done atomically */
42: 2178: win_ptr->my_counter -= 1;
-: 2179: }
42: 2180: *buflen = sizeof(MPIDI_CH3_Pkt_t);
42: 2181: MPIDI_CH3_Progress_signal_completion();
42: 2182: *rreqp = NULL;
42: 2183: goto fn_exit;
-: 2184: }
-: 2185:
5788: 2186: data_len = *buflen - sizeof(MPIDI_CH3_Pkt_t);
5788: 2187: data_buf = (char *)pkt + sizeof(MPIDI_CH3_Pkt_t);
-: 2188:
5788: 2189: req = MPID_Request_create();
5788: 2190: MPIU_Object_set_ref(req, 1);
-: 2191:
5788: 2192: req->dev.user_buf = put_pkt->addr;
5788: 2193: req->dev.user_count = put_pkt->count;
5788: 2194: req->dev.target_win_handle = put_pkt->target_win_handle;
5788: 2195: req->dev.source_win_handle = put_pkt->source_win_handle;
-: 2196:
5788: 2197: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(put_pkt->datatype, predefined);
5788: 2198: if (predefined)
-: 2199: {
4583: 2200: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PUT_RESP);
4583: 2201: req->dev.datatype = put_pkt->datatype;
-: 2202:
4583: 2203: MPID_Datatype_get_size_macro(put_pkt->datatype,
-: 2204: type_size);
4583: 2205: req->dev.recv_data_sz = type_size * put_pkt->count;
-: 2206:
4583: 2207: if (req->dev.recv_data_sz == 0) {
|
#####: 2208: MPIDI_CH3U_Request_complete( req );
#####: 2209: *buflen = sizeof(MPIDI_CH3_Pkt_t);
#####: 2210: *rreqp = NULL;
#####: 2211: goto fn_exit;
-: 2212: }
-: 2213:
|
4583: 2214: mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
-: 2215: &complete);
4583: 2216: MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
-: 2217: "**ch3|postrecv %s", "MPIDI_CH3_PKT_PUT");
-: 2218: /* FIXME: Only change the handling of completion if
-: 2219: post_data_receive reset the handler. There should
-: 2220: be a cleaner way to do this */
4583: 2221: if (!req->dev.OnDataAvail) {
4583: 2222: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_PutAccumRespComplete;
-: 2223: }
-: 2224:
-: 2225: /* return the number of bytes processed in this function */
4583: 2226: *buflen = sizeof(MPIDI_CH3_Pkt_t) + data_len;
-: 2227:
4583: 2228: if (complete)
-: 2229: {
|
#####: 2230: mpi_errno = MPIDI_CH3_ReqHandler_PutAccumRespComplete(vc, req, &complete);
|
#####: 2231: if (mpi_errno) MPIU_ERR_POP(mpi_errno);
-: 2232:
|
#####: 2233: if (complete)
-: 2234: {
#####: 2235: *rreqp = NULL;
#####: 2236: goto fn_exit;
-: 2237: }
-: 2238: }
-: 2239: }
-: 2240: else
-: 2241: {
-: 2242: /* derived datatype */
|
1205: 2243: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PUT_RESP_DERIVED_DT);
1205: 2244: req->dev.datatype = MPI_DATATYPE_NULL;
-: 2245:
1205: 2246: req->dev.dtype_info = (MPIDI_RMA_dtype_info *)
-: 2247: MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
1205: 2248: if (! req->dev.dtype_info) {
|
#####: 2249: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 2250: }
-: 2251:
|
1205: 2252: req->dev.dataloop = MPIU_Malloc(put_pkt->dataloop_size);
1205: 2253: if (! req->dev.dataloop) {
|
#####: 2254: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 2255: }
-: 2256:
-: 2257: /* if we received all of the dtype_info and dataloop, copy it
-: 2258: now and call the handler, otherwise set the iov and let the
-: 2259: channel copy it */
|
1205: 2260: if (data_len >= sizeof(MPIDI_RMA_dtype_info) + put_pkt->dataloop_size)
-: 2261: {
-: 2262: /* copy all of dtype_info and dataloop */
|
#####: 2263: MPIU_Memcpy(req->dev.dtype_info, data_buf, sizeof(MPIDI_RMA_dtype_info));
#####: 2264: MPIU_Memcpy(req->dev.dataloop, data_buf + sizeof(MPIDI_RMA_dtype_info), put_pkt->dataloop_size);
-: 2265:
#####: 2266: *buflen = sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_RMA_dtype_info) + put_pkt->dataloop_size;
-: 2267:
-: 2268: /* All dtype data has been received, call req handler */
#####: 2269: mpi_errno = MPIDI_CH3_ReqHandler_PutRespDerivedDTComplete(vc, req, &complete);
#####: 2270: MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
-: 2271: "**ch3|postrecv %s", "MPIDI_CH3_PKT_PUT");
#####: 2272: if (complete)
-: 2273: {
#####: 2274: *rreqp = NULL;
#####: 2275: goto fn_exit;
-: 2276: }
-: 2277: }
-: 2278: else
-: 2279: {
|
1205: 2280: req->dev.iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)((char *)req->dev.dtype_info);
1205: 2281: req->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_RMA_dtype_info);
1205: 2282: req->dev.iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)req->dev.dataloop;
1205: 2283: req->dev.iov[1].MPID_IOV_LEN = put_pkt->dataloop_size;
1205: 2284: req->dev.iov_count = 2;
-: 2285:
1205: 2286: *buflen = sizeof(MPIDI_CH3_Pkt_t);
-: 2287:
1205: 2288: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_PutRespDerivedDTComplete;
-: 2289: }
-: 2290:
-: 2291: }
-: 2292:
5788: 2293: *rreqp = req;
-: 2294:
5788: 2295: if (mpi_errno != MPI_SUCCESS) {
|
#####: 2296: MPIU_ERR_SET1(mpi_errno,MPI_ERR_OTHER,"**ch3|postrecv",
-: 2297: "**ch3|postrecv %s", "MPIDI_CH3_PKT_PUT");
-: 2298: }
-: 2299:
-: 2300:
|
5830: 2301: fn_exit:
|
-: 2302: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_PUT);
|
5830: 2303: return mpi_errno;
|
-: 2304: fn_fail:
-: 2305: goto fn_exit;
-: 2306:}
-: 2307:
-: 2308:#undef FUNCNAME
-: 2309:#define FUNCNAME MPIDI_CH3_PktHandler_Get
-: 2310:#undef FCNAME
-: 2311:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2312:int MPIDI_CH3_PktHandler_Get( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2313: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
|
9830: 2314:{
9830: 2315: MPIDI_CH3_Pkt_get_t * get_pkt = &pkt->get;
9830: 2316: MPID_Request *req = NULL;
-: 2317: MPID_IOV iov[MPID_IOV_LIMIT];
-: 2318: int predefined;
-: 2319: int complete;
9830: 2320: char *data_buf = NULL;
-: 2321: MPIDI_msg_sz_t data_len;
9830: 2322: int mpi_errno = MPI_SUCCESS;
-: 2323: int type_size;
-: 2324: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET);
-: 2325:
-: 2326: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET);
-: 2327:
-: 2328: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received get pkt");
-: 2329:
9830: 2330: data_len = *buflen - sizeof(MPIDI_CH3_Pkt_t);
9830: 2331: data_buf = (char *)pkt + sizeof(MPIDI_CH3_Pkt_t);
-: 2332:
9830: 2333: req = MPID_Request_create();
9830: 2334: req->dev.target_win_handle = get_pkt->target_win_handle;
9830: 2335: req->dev.source_win_handle = get_pkt->source_win_handle;
-: 2336:
9830: 2337: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(get_pkt->datatype, predefined);
9830: 2338: if (predefined)
-: 2339: {
-: 2340: /* basic datatype. send the data. */
-: 2341: MPIDI_CH3_Pkt_t upkt;
8916: 2342: MPIDI_CH3_Pkt_get_resp_t * get_resp_pkt = &upkt.get_resp;
-: 2343:
8916: 2344: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_GET_RESP);
8916: 2345: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetSendRespComplete;
8916: 2346: req->dev.OnFinal = MPIDI_CH3_ReqHandler_GetSendRespComplete;
8916: 2347: req->kind = MPID_REQUEST_SEND;
-: 2348:
8916: 2349: MPIDI_Pkt_init(get_resp_pkt, MPIDI_CH3_PKT_GET_RESP);
8916: 2350: get_resp_pkt->request_handle = get_pkt->request_handle;
-: 2351:
8916: 2352: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_resp_pkt;
8916: 2353: iov[0].MPID_IOV_LEN = sizeof(*get_resp_pkt);
-: 2354:
8916: 2355: iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)get_pkt->addr;
8916: 2356: MPID_Datatype_get_size_macro(get_pkt->datatype, type_size);
8916: 2357: iov[1].MPID_IOV_LEN = get_pkt->count * type_size;
-: 2358:
-: 2359: /* Because this is in a packet handler, it is already within a critical section */
8916: 2360: mpi_errno = MPIU_CALL(MPIDI_CH3,iSendv(vc, req, iov, 2));
|
-: 2361: /* --BEGIN ERROR HANDLING-- */
8916: 2362: if (mpi_errno != MPI_SUCCESS)
-: 2363: {
#####: 2364: MPIU_Object_set_ref(req, 0);
#####: 2365: MPIDI_CH3_Request_destroy(req);
#####: 2366: MPIU_ERR_SETFATALANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
-: 2367: }
-: 2368: /* --END ERROR HANDLING-- */
-: 2369:
|
8916: 2370: *buflen = sizeof(MPIDI_CH3_Pkt_t);
8916: 2371: *rreqp = NULL;
-: 2372: }
-: 2373: else
-: 2374: {
-: 2375: /* derived datatype. first get the dtype_info and dataloop. */
-: 2376:
914: 2377: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_GET_RESP_DERIVED_DT);
914: 2378: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetRespDerivedDTComplete;
914: 2379: req->dev.OnFinal = 0;
914: 2380: req->dev.user_buf = get_pkt->addr;
914: 2381: req->dev.user_count = get_pkt->count;
914: 2382: req->dev.datatype = MPI_DATATYPE_NULL;
914: 2383: req->dev.request_handle = get_pkt->request_handle;
-: 2384:
914: 2385: req->dev.dtype_info = (MPIDI_RMA_dtype_info *)
-: 2386: MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
914: 2387: if (! req->dev.dtype_info) {
|
#####: 2388: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2389: }
-: 2390:
|
914: 2391: req->dev.dataloop = MPIU_Malloc(get_pkt->dataloop_size);
914: 2392: if (! req->dev.dataloop) {
|
#####: 2393: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2394: }
-: 2395:
-: 2396: /* if we received all of the dtype_info and dataloop, copy it
-: 2397: now and call the handler, otherwise set the iov and let the
-: 2398: channel copy it */
|
914: 2399: if (data_len >= sizeof(MPIDI_RMA_dtype_info) + get_pkt->dataloop_size)
-: 2400: {
-: 2401: /* copy all of dtype_info and dataloop */
|
#####: 2402: MPIU_Memcpy(req->dev.dtype_info, data_buf, sizeof(MPIDI_RMA_dtype_info));
#####: 2403: MPIU_Memcpy(req->dev.dataloop, data_buf + sizeof(MPIDI_RMA_dtype_info), get_pkt->dataloop_size);
-: 2404:
#####: 2405: *buflen = sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_RMA_dtype_info) + get_pkt->dataloop_size;
-: 2406:
-: 2407: /* All dtype data has been received, call req handler */
#####: 2408: mpi_errno = MPIDI_CH3_ReqHandler_GetRespDerivedDTComplete(vc, req, &complete);
#####: 2409: MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
-: 2410: "**ch3|postrecv %s", "MPIDI_CH3_PKT_GET");
#####: 2411: if (complete)
#####: 2412: *rreqp = NULL;
-: 2413: }
-: 2414: else
-: 2415: {
|
914: 2416: req->dev.iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)req->dev.dtype_info;
914: 2417: req->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_RMA_dtype_info);
914: 2418: req->dev.iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)req->dev.dataloop;
914: 2419: req->dev.iov[1].MPID_IOV_LEN = get_pkt->dataloop_size;
914: 2420: req->dev.iov_count = 2;
-: 2421:
914: 2422: *buflen = sizeof(MPIDI_CH3_Pkt_t);
914: 2423: *rreqp = req;
-: 2424: }
-: 2425:
-: 2426: }
|
9830: 2427: fn_fail:
-: 2428: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_GET);
|
9830: 2429: return mpi_errno;
-: 2430:
-: 2431:}
-: 2432:
-: 2433:#undef FUNCNAME
-: 2434:#define FUNCNAME MPIDI_CH3_PktHandler_Accumulate
-: 2435:#undef FCNAME
-: 2436:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2437:int MPIDI_CH3_PktHandler_Accumulate( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2438: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
1573: 2439:{
1573: 2440: MPIDI_CH3_Pkt_accum_t * accum_pkt = &pkt->accum;
1573: 2441: MPID_Request *req = NULL;
-: 2442: MPI_Aint true_lb, true_extent, extent;
1573: 2443: void *tmp_buf = NULL;
-: 2444: int predefined;
1573: 2445: int complete = 0;
1573: 2446: char *data_buf = NULL;
-: 2447: MPIDI_msg_sz_t data_len;
1573: 2448: int mpi_errno = MPI_SUCCESS;
-: 2449: int type_size;
-: 2450: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_ACCUMULATE);
-: 2451:
-: 2452: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_ACCUMULATE);
-: 2453:
-: 2454: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received accumulate pkt");
-: 2455:
1573: 2456: data_len = *buflen - sizeof(MPIDI_CH3_Pkt_t);
1573: 2457: data_buf = (char *)pkt + sizeof(MPIDI_CH3_Pkt_t);
-: 2458:
1573: 2459: req = MPID_Request_create();
1573: 2460: MPIU_Object_set_ref(req, 1);
1573: 2461: *rreqp = req;
-: 2462:
1573: 2463: req->dev.user_count = accum_pkt->count;
1573: 2464: req->dev.op = accum_pkt->op;
1573: 2465: req->dev.real_user_buf = accum_pkt->addr;
1573: 2466: req->dev.target_win_handle = accum_pkt->target_win_handle;
1573: 2467: req->dev.source_win_handle = accum_pkt->source_win_handle;
-: 2468:
1573: 2469: MPIDI_CH3I_DATATYPE_IS_PREDEFINED(accum_pkt->datatype, predefined);
1573: 2470: if (predefined)
-: 2471: {
1139: 2472: MPIU_THREADPRIV_DECL;
1139: 2473: MPIU_THREADPRIV_GET;
1139: 2474: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_ACCUM_RESP);
1139: 2475: req->dev.datatype = accum_pkt->datatype;
-: 2476:
1139: 2477: MPIR_Nest_incr();
1139: 2478: mpi_errno = NMPI_Type_get_true_extent(accum_pkt->datatype,
-: 2479: &true_lb, &true_extent);
1139: 2480: MPIR_Nest_decr();
1139: 2481: if (mpi_errno) {
|
#####: 2482: MPIU_ERR_POP(mpi_errno);
-: 2483: }
-: 2484:
|
1139: 2485: MPID_Datatype_get_extent_macro(accum_pkt->datatype, extent);
1139: 2486: tmp_buf = MPIU_Malloc(accum_pkt->count *
-: 2487: (MPIR_MAX(extent,true_extent)));
1139: 2488: if (!tmp_buf) {
|
#####: 2489: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
-: 2490: }
-: 2491:
-: 2492: /* adjust for potential negative lower bound in datatype */
|
1139: 2493: tmp_buf = (void *)((char*)tmp_buf - true_lb);
-: 2494:
1139: 2495: req->dev.user_buf = tmp_buf;
-: 2496:
1139: 2497: MPID_Datatype_get_size_macro(accum_pkt->datatype, type_size);
1139: 2498: req->dev.recv_data_sz = type_size * accum_pkt->count;
-: 2499:
1139: 2500: if (req->dev.recv_data_sz == 0) {
|
#####: 2501: MPIDI_CH3U_Request_complete(req);
#####: 2502: *buflen = sizeof(MPIDI_CH3_Pkt_t);
#####: 2503: *rreqp = NULL;
-: 2504: }
-: 2505: else {
|
1139: 2506: mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
-: 2507: &complete);
1139: 2508: MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
-: 2509: "**ch3|postrecv %s", "MPIDI_CH3_PKT_ACCUMULATE");
-: 2510: /* FIXME: Only change the handling of completion if
-: 2511: post_data_receive reset the handler. There should
-: 2512: be a cleaner way to do this */
1139: 2513: if (!req->dev.OnDataAvail) {
1139: 2514: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_PutAccumRespComplete;
-: 2515: }
-: 2516: /* return the number of bytes processed in this function */
1139: 2517: *buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
-: 2518:
1139: 2519: if (complete)
-: 2520: {
|
#####: 2521: mpi_errno = MPIDI_CH3_ReqHandler_PutAccumRespComplete(vc, req, &complete);
|
#####: 2522: if (mpi_errno) MPIU_ERR_POP(mpi_errno);
|
#####: 2523: if (complete)
-: 2524: {
#####: 2525: *rreqp = NULL;
#####: 2526: goto fn_exit;
-: 2527: }
-: 2528: }
-: 2529: }
-: 2530: }
-: 2531: else
-: 2532: {
|
434: 2533: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_ACCUM_RESP_DERIVED_DT);
434: 2534: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_AccumRespDerivedDTComplete;
434: 2535: req->dev.datatype = MPI_DATATYPE_NULL;
-: 2536:
434: 2537: req->dev.dtype_info = (MPIDI_RMA_dtype_info *)
-: 2538: MPIU_Malloc(sizeof(MPIDI_RMA_dtype_info));
434: 2539: if (! req->dev.dtype_info) {
|
#####: 2540: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2541: }
-: 2542:
|
434: 2543: req->dev.dataloop = MPIU_Malloc(accum_pkt->dataloop_size);
434: 2544: if (! req->dev.dataloop) {
|
#####: 2545: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2546: }
-: 2547:
|
434: 2548: if (data_len >= sizeof(MPIDI_RMA_dtype_info) + accum_pkt->dataloop_size)
-: 2549: {
-: 2550: /* copy all of dtype_info and dataloop */
|
#####: 2551: MPIU_Memcpy(req->dev.dtype_info, data_buf, sizeof(MPIDI_RMA_dtype_info));
#####: 2552: MPIU_Memcpy(req->dev.dataloop, data_buf + sizeof(MPIDI_RMA_dtype_info), accum_pkt->dataloop_size);
-: 2553:
#####: 2554: *buflen = sizeof(MPIDI_CH3_Pkt_t) + sizeof(MPIDI_RMA_dtype_info) + accum_pkt->dataloop_size;
-: 2555:
-: 2556: /* All dtype data has been received, call req handler */
#####: 2557: mpi_errno = MPIDI_CH3_ReqHandler_AccumRespDerivedDTComplete(vc, req, &complete);
#####: 2558: MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
-: 2559: "**ch3|postrecv %s", "MPIDI_CH3_ACCUMULATE");
#####: 2560: if (complete)
-: 2561: {
#####: 2562: *rreqp = NULL;
#####: 2563: goto fn_exit;
-: 2564: }
-: 2565: }
-: 2566: else
-: 2567: {
|
434: 2568: req->dev.iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)req->dev.dtype_info;
434: 2569: req->dev.iov[0].MPID_IOV_LEN = sizeof(MPIDI_RMA_dtype_info);
434: 2570: req->dev.iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)req->dev.dataloop;
434: 2571: req->dev.iov[1].MPID_IOV_LEN = accum_pkt->dataloop_size;
434: 2572: req->dev.iov_count = 2;
434: 2573: *buflen = sizeof(MPIDI_CH3_Pkt_t);
-: 2574: }
-: 2575:
-: 2576: }
-: 2577:
1573: 2578: if (mpi_errno != MPI_SUCCESS) {
|
#####: 2579: MPIU_ERR_SETANDJUMP1(mpi_errno,MPI_ERR_OTHER,"**ch3|postrecv",
-: 2580: "**ch3|postrecv %s", "MPIDI_CH3_PKT_ACCUMULATE");
-: 2581: }
-: 2582:
|
1573: 2583: fn_exit:
|
-: 2584: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_ACCUMULATE);
|
1573: 2585: return mpi_errno;
|
-: 2586: fn_fail:
-: 2587: goto fn_exit;
-: 2588:
-: 2589:}
-: 2590:
-: 2591:#undef FUNCNAME
-: 2592:#define FUNCNAME MPIDI_CH3_PktHandler_Lock
-: 2593:#undef FCNAME
-: 2594:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2595:int MPIDI_CH3_PktHandler_Lock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2596: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
|
487: 2597:{
487: 2598: MPIDI_CH3_Pkt_lock_t * lock_pkt = &pkt->lock;
487: 2599: MPID_Win *win_ptr = NULL;
487: 2600: int mpi_errno = MPI_SUCCESS;
-: 2601: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCK);
-: 2602:
-: 2603: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCK);
-: 2604:
-: 2605: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received lock pkt");
-: 2606:
487: 2607: *buflen = sizeof(MPIDI_CH3_Pkt_t);
-: 2608:
487: 2609: MPID_Win_get_ptr(lock_pkt->target_win_handle, win_ptr);
-: 2610:
487: 2611: if (MPIDI_CH3I_Try_acquire_win_lock(win_ptr,
-: 2612: lock_pkt->lock_type) == 1)
-: 2613: {
-: 2614: /* send lock granted packet. */
13: 2615: mpi_errno = MPIDI_CH3I_Send_lock_granted_pkt(vc,
-: 2616: lock_pkt->source_win_handle);
-: 2617: }
-: 2618:
-: 2619: else {
-: 2620: /* queue the lock information */
-: 2621: MPIDI_Win_lock_queue *curr_ptr, *prev_ptr, *new_ptr;
-: 2622:
-: 2623: /* FIXME: MT: This may need to be done atomically. */
-: 2624:
474: 2625: curr_ptr = (MPIDI_Win_lock_queue *) win_ptr->lock_queue;
474: 2626: prev_ptr = curr_ptr;
2091: 2627: while (curr_ptr != NULL)
-: 2628: {
1143: 2629: prev_ptr = curr_ptr;
1143: 2630: curr_ptr = curr_ptr->next;
-: 2631: }
-: 2632:
474: 2633: new_ptr = (MPIDI_Win_lock_queue *) MPIU_Malloc(sizeof(MPIDI_Win_lock_queue));
474: 2634: if (!new_ptr) {
|
#####: 2635: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2636: }
|
474: 2637: if (prev_ptr != NULL)
465: 2638: prev_ptr->next = new_ptr;
-: 2639: else
9: 2640: win_ptr->lock_queue = new_ptr;
-: 2641:
474: 2642: new_ptr->next = NULL;
474: 2643: new_ptr->lock_type = lock_pkt->lock_type;
474: 2644: new_ptr->source_win_handle = lock_pkt->source_win_handle;
474: 2645: new_ptr->vc = vc;
474: 2646: new_ptr->pt_single_op = NULL;
-: 2647: }
-: 2648:
487: 2649: *rreqp = NULL;
|
487: 2650: fn_fail:
-: 2651: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCK);
|
487: 2652: return mpi_errno;
-: 2653:}
-: 2654:
-: 2655:#undef FUNCNAME
-: 2656:#define FUNCNAME MPIDI_CH3_PktHandler_LockPutUnlock
-: 2657:#undef FCNAME
-: 2658:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2659:int MPIDI_CH3_PktHandler_LockPutUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2660: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
300: 2661:{
-: 2662: MPIDI_CH3_Pkt_lock_put_unlock_t * lock_put_unlock_pkt =
300: 2663: &pkt->lock_put_unlock;
300: 2664: MPID_Win *win_ptr = NULL;
300: 2665: MPID_Request *req = NULL;
-: 2666: int type_size;
-: 2667: int complete;
300: 2668: char *data_buf = NULL;
-: 2669: MPIDI_msg_sz_t data_len;
300: 2670: int mpi_errno = MPI_SUCCESS;
-: 2671: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKPUTUNLOCK);
-: 2672:
-: 2673: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKPUTUNLOCK);
-: 2674:
-: 2675: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received lock_put_unlock pkt");
-: 2676:
300: 2677: data_len = *buflen - sizeof(MPIDI_CH3_Pkt_t);
300: 2678: data_buf = (char *)pkt + sizeof(MPIDI_CH3_Pkt_t);
-: 2679:
300: 2680: req = MPID_Request_create();
300: 2681: MPIU_Object_set_ref(req, 1);
-: 2682:
300: 2683: req->dev.datatype = lock_put_unlock_pkt->datatype;
300: 2684: MPID_Datatype_get_size_macro(lock_put_unlock_pkt->datatype, type_size);
300: 2685: req->dev.recv_data_sz = type_size * lock_put_unlock_pkt->count;
300: 2686: req->dev.user_count = lock_put_unlock_pkt->count;
300: 2687: req->dev.target_win_handle = lock_put_unlock_pkt->target_win_handle;
-: 2688:
300: 2689: MPID_Win_get_ptr(lock_put_unlock_pkt->target_win_handle, win_ptr);
-: 2690:
300: 2691: if (MPIDI_CH3I_Try_acquire_win_lock(win_ptr,
-: 2692: lock_put_unlock_pkt->lock_type) == 1)
-: 2693: {
-: 2694: /* do the put. for this optimization, only basic datatypes supported. */
300: 2695: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PUT_RESP);
300: 2696: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_PutAccumRespComplete;
300: 2697: req->dev.user_buf = lock_put_unlock_pkt->addr;
300: 2698: req->dev.source_win_handle = lock_put_unlock_pkt->source_win_handle;
300: 2699: req->dev.single_op_opt = 1;
-: 2700: }
-: 2701:
-: 2702: else {
-: 2703: /* queue the information */
-: 2704: MPIDI_Win_lock_queue *curr_ptr, *prev_ptr, *new_ptr;
-: 2705:
|
#####: 2706: new_ptr = (MPIDI_Win_lock_queue *) MPIU_Malloc(sizeof(MPIDI_Win_lock_queue));
#####: 2707: if (!new_ptr) {
|
#####: 2708: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2709: }
-: 2710:
|
#####: 2711: new_ptr->pt_single_op = (MPIDI_PT_single_op *) MPIU_Malloc(sizeof(MPIDI_PT_single_op));
#####: 2712: if (new_ptr->pt_single_op == NULL) {
|
#####: 2713: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2714: }
-: 2715:
-: 2716: /* FIXME: MT: The queuing may need to be done atomically. */
-: 2717:
|
#####: 2718: curr_ptr = (MPIDI_Win_lock_queue *) win_ptr->lock_queue;
#####: 2719: prev_ptr = curr_ptr;
#####: 2720: while (curr_ptr != NULL)
-: 2721: {
#####: 2722: prev_ptr = curr_ptr;
#####: 2723: curr_ptr = curr_ptr->next;
-: 2724: }
-: 2725:
#####: 2726: if (prev_ptr != NULL)
#####: 2727: prev_ptr->next = new_ptr;
-: 2728: else
#####: 2729: win_ptr->lock_queue = new_ptr;
-: 2730:
#####: 2731: new_ptr->next = NULL;
#####: 2732: new_ptr->lock_type = lock_put_unlock_pkt->lock_type;
#####: 2733: new_ptr->source_win_handle = lock_put_unlock_pkt->source_win_handle;
#####: 2734: new_ptr->vc = vc;
-: 2735:
#####: 2736: new_ptr->pt_single_op->type = MPIDI_RMA_PUT;
#####: 2737: new_ptr->pt_single_op->addr = lock_put_unlock_pkt->addr;
#####: 2738: new_ptr->pt_single_op->count = lock_put_unlock_pkt->count;
#####: 2739: new_ptr->pt_single_op->datatype = lock_put_unlock_pkt->datatype;
-: 2740: /* allocate memory to receive the data */
#####: 2741: new_ptr->pt_single_op->data = MPIU_Malloc(req->dev.recv_data_sz);
#####: 2742: if (new_ptr->pt_single_op->data == NULL) {
|
#####: 2743: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2744: }
-: 2745:
|
#####: 2746: new_ptr->pt_single_op->data_recd = 0;
-: 2747:
#####: 2748: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PT_SINGLE_PUT);
#####: 2749: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_SinglePutAccumComplete;
#####: 2750: req->dev.user_buf = new_ptr->pt_single_op->data;
#####: 2751: req->dev.lock_queue_entry = new_ptr;
-: 2752: }
-: 2753:
|
300: 2754: if (req->dev.recv_data_sz == 0) {
|
#####: 2755: *buflen = sizeof(MPIDI_CH3_Pkt_t);
#####: 2756: MPIDI_CH3U_Request_complete(req);
#####: 2757: *rreqp = NULL;
-: 2758: }
-: 2759: else {
-: 2760: int (*fcn)( MPIDI_VC_t *, struct MPID_Request *, int * );
|
300: 2761: fcn = req->dev.OnDataAvail;
300: 2762: mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
-: 2763: &complete);
300: 2764: if (mpi_errno != MPI_SUCCESS) {
|
#####: 2765: MPIU_ERR_SETFATALANDJUMP1(mpi_errno,MPI_ERR_OTHER,
-: 2766: "**ch3|postrecv", "**ch3|postrecv %s",
-: 2767: "MPIDI_CH3_PKT_LOCK_PUT_UNLOCK");
-: 2768: }
|
300: 2769: req->dev.OnDataAvail = fcn;
300: 2770: *rreqp = req;
-: 2771:
300: 2772: if (complete)
-: 2773: {
|
#####: 2774: mpi_errno = fcn(vc, req, &complete);
#####: 2775: if (complete)
-: 2776: {
#####: 2777: *rreqp = NULL;
-: 2778: }
-: 2779: }
-: 2780:
-: 2781: /* return the number of bytes processed in this function */
|
300: 2782: *buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
-: 2783: }
-: 2784:
-: 2785:
300: 2786: if (mpi_errno != MPI_SUCCESS) {
|
#####: 2787: MPIU_ERR_SETFATALANDJUMP1(mpi_errno,MPI_ERR_OTHER,
-: 2788: "**ch3|postrecv", "**ch3|postrecv %s",
-: 2789: "MPIDI_CH3_PKT_LOCK_PUT_UNLOCK");
-: 2790: }
-: 2791:
300: 2792: fn_fail:
-: 2793: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKPUTUNLOCK);
|
300: 2794: return mpi_errno;
-: 2795:}
-: 2796:
-: 2797:#undef FUNCNAME
-: 2798:#define FUNCNAME MPIDI_CH3_PktHandler_LockGetUnlock
-: 2799:#undef FCNAME
-: 2800:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2801:int MPIDI_CH3_PktHandler_LockGetUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2802: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
300: 2803:{
-: 2804: MPIDI_CH3_Pkt_lock_get_unlock_t * lock_get_unlock_pkt =
300: 2805: &pkt->lock_get_unlock;
300: 2806: MPID_Win *win_ptr = NULL;
-: 2807: int type_size;
300: 2808: int mpi_errno = MPI_SUCCESS;
-: 2809: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGETUNLOCK);
-: 2810:
-: 2811: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGETUNLOCK);
-: 2812:
-: 2813: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received lock_get_unlock pkt");
-: 2814:
300: 2815: *buflen = sizeof(MPIDI_CH3_Pkt_t);
-: 2816:
300: 2817: MPID_Win_get_ptr(lock_get_unlock_pkt->target_win_handle, win_ptr);
-: 2818:
300: 2819: if (MPIDI_CH3I_Try_acquire_win_lock(win_ptr,
-: 2820: lock_get_unlock_pkt->lock_type) == 1)
-: 2821: {
-: 2822: /* do the get. for this optimization, only basic datatypes supported. */
-: 2823: MPIDI_CH3_Pkt_t upkt;
300: 2824: MPIDI_CH3_Pkt_get_resp_t * get_resp_pkt = &upkt.get_resp;
-: 2825: MPID_Request *req;
-: 2826: MPID_IOV iov[MPID_IOV_LIMIT];
-: 2827:
300: 2828: req = MPID_Request_create();
300: 2829: req->dev.target_win_handle = lock_get_unlock_pkt->target_win_handle;
300: 2830: req->dev.source_win_handle = lock_get_unlock_pkt->source_win_handle;
300: 2831: req->dev.single_op_opt = 1;
-: 2832:
300: 2833: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_GET_RESP);
300: 2834: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_GetSendRespComplete;
300: 2835: req->dev.OnFinal = MPIDI_CH3_ReqHandler_GetSendRespComplete;
300: 2836: req->kind = MPID_REQUEST_SEND;
-: 2837:
300: 2838: MPIDI_Pkt_init(get_resp_pkt, MPIDI_CH3_PKT_GET_RESP);
300: 2839: get_resp_pkt->request_handle = lock_get_unlock_pkt->request_handle;
-: 2840:
300: 2841: iov[0].MPID_IOV_BUF = (MPID_IOV_BUF_CAST) get_resp_pkt;
300: 2842: iov[0].MPID_IOV_LEN = sizeof(*get_resp_pkt);
-: 2843:
300: 2844: iov[1].MPID_IOV_BUF = (MPID_IOV_BUF_CAST)lock_get_unlock_pkt->addr;
300: 2845: MPID_Datatype_get_size_macro(lock_get_unlock_pkt->datatype, type_size);
300: 2846: iov[1].MPID_IOV_LEN = lock_get_unlock_pkt->count * type_size;
-: 2847:
300: 2848: mpi_errno = MPIU_CALL(MPIDI_CH3,iSendv(vc, req, iov, 2));
|
-: 2849: /* --BEGIN ERROR HANDLING-- */
300: 2850: if (mpi_errno != MPI_SUCCESS)
-: 2851: {
#####: 2852: MPIU_Object_set_ref(req, 0);
#####: 2853: MPIDI_CH3_Request_destroy(req);
#####: 2854: MPIU_ERR_SETFATALANDJUMP(mpi_errno,MPI_ERR_OTHER,"**ch3|rmamsg");
-: 2855: }
-: 2856: /* --END ERROR HANDLING-- */
-: 2857: }
-: 2858:
-: 2859: else {
-: 2860: /* queue the information */
-: 2861: MPIDI_Win_lock_queue *curr_ptr, *prev_ptr, *new_ptr;
-: 2862:
-: 2863: /* FIXME: MT: This may need to be done atomically. */
-: 2864:
|
#####: 2865: curr_ptr = (MPIDI_Win_lock_queue *) win_ptr->lock_queue;
#####: 2866: prev_ptr = curr_ptr;
#####: 2867: while (curr_ptr != NULL)
-: 2868: {
#####: 2869: prev_ptr = curr_ptr;
#####: 2870: curr_ptr = curr_ptr->next;
-: 2871: }
-: 2872:
#####: 2873: new_ptr = (MPIDI_Win_lock_queue *) MPIU_Malloc(sizeof(MPIDI_Win_lock_queue));
#####: 2874: if (!new_ptr) {
|
#####: 2875: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2876: }
|
#####: 2877: new_ptr->pt_single_op = (MPIDI_PT_single_op *) MPIU_Malloc(sizeof(MPIDI_PT_single_op));
#####: 2878: if (new_ptr->pt_single_op == NULL) {
|
#####: 2879: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2880: }
-: 2881:
|
#####: 2882: if (prev_ptr != NULL)
#####: 2883: prev_ptr->next = new_ptr;
-: 2884: else
#####: 2885: win_ptr->lock_queue = new_ptr;
-: 2886:
#####: 2887: new_ptr->next = NULL;
#####: 2888: new_ptr->lock_type = lock_get_unlock_pkt->lock_type;
#####: 2889: new_ptr->source_win_handle = lock_get_unlock_pkt->source_win_handle;
#####: 2890: new_ptr->vc = vc;
-: 2891:
#####: 2892: new_ptr->pt_single_op->type = MPIDI_RMA_GET;
#####: 2893: new_ptr->pt_single_op->addr = lock_get_unlock_pkt->addr;
#####: 2894: new_ptr->pt_single_op->count = lock_get_unlock_pkt->count;
#####: 2895: new_ptr->pt_single_op->datatype = lock_get_unlock_pkt->datatype;
#####: 2896: new_ptr->pt_single_op->data = NULL;
#####: 2897: new_ptr->pt_single_op->request_handle = lock_get_unlock_pkt->request_handle;
#####: 2898: new_ptr->pt_single_op->data_recd = 1;
-: 2899: }
-: 2900:
|
300: 2901: *rreqp = NULL;
-: 2902:
|
300: 2903: fn_fail:
-: 2904: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGETUNLOCK);
|
300: 2905: return mpi_errno;
-: 2906:}
-: 2907:
-: 2908:
-: 2909:#undef FUNCNAME
-: 2910:#define FUNCNAME MPIDI_CH3_PktHandler_LockAccumUnlock
-: 2911:#undef FCNAME
-: 2912:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 2913:int MPIDI_CH3_PktHandler_LockAccumUnlock( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
-: 2914: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
|
#####: 2915:{
-: 2916: MPIDI_CH3_Pkt_lock_accum_unlock_t * lock_accum_unlock_pkt =
#####: 2917: &pkt->lock_accum_unlock;
#####: 2918: MPID_Request *req = NULL;
#####: 2919: MPID_Win *win_ptr = NULL;
#####: 2920: MPIDI_Win_lock_queue *curr_ptr = NULL, *prev_ptr = NULL, *new_ptr = NULL;
-: 2921: int type_size;
-: 2922: int complete;
#####: 2923: char *data_buf = NULL;
-: 2924: MPIDI_msg_sz_t data_len;
#####: 2925: int mpi_errno = MPI_SUCCESS;
-: 2926: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKACCUMUNLOCK);
-: 2927:
-: 2928: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKACCUMUNLOCK);
-: 2929:
-: 2930: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received lock_accum_unlock pkt");
-: 2931:
-: 2932: /* no need to acquire the lock here because we need to receive the
-: 2933: data into a temporary buffer first */
-: 2934:
#####: 2935: data_len = *buflen - sizeof(MPIDI_CH3_Pkt_t);
#####: 2936: data_buf = (char *)pkt + sizeof(MPIDI_CH3_Pkt_t);
-: 2937:
#####: 2938: req = MPID_Request_create();
#####: 2939: MPIU_Object_set_ref(req, 1);
-: 2940:
#####: 2941: req->dev.datatype = lock_accum_unlock_pkt->datatype;
#####: 2942: MPID_Datatype_get_size_macro(lock_accum_unlock_pkt->datatype, type_size);
#####: 2943: req->dev.recv_data_sz = type_size * lock_accum_unlock_pkt->count;
#####: 2944: req->dev.user_count = lock_accum_unlock_pkt->count;
#####: 2945: req->dev.target_win_handle = lock_accum_unlock_pkt->target_win_handle;
-: 2946:
-: 2947: /* queue the information */
-: 2948:
#####: 2949: new_ptr = (MPIDI_Win_lock_queue *) MPIU_Malloc(sizeof(MPIDI_Win_lock_queue));
#####: 2950: if (!new_ptr) {
|
#####: 2951: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2952: }
-: 2953:
|
#####: 2954: new_ptr->pt_single_op = (MPIDI_PT_single_op *) MPIU_Malloc(sizeof(MPIDI_PT_single_op));
#####: 2955: if (new_ptr->pt_single_op == NULL) {
|
#####: 2956: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2957: }
-: 2958:
|
#####: 2959: MPID_Win_get_ptr(lock_accum_unlock_pkt->target_win_handle, win_ptr);
-: 2960:
-: 2961: /* FIXME: MT: The queuing may need to be done atomically. */
-: 2962:
#####: 2963: curr_ptr = (MPIDI_Win_lock_queue *) win_ptr->lock_queue;
#####: 2964: prev_ptr = curr_ptr;
#####: 2965: while (curr_ptr != NULL)
-: 2966: {
#####: 2967: prev_ptr = curr_ptr;
#####: 2968: curr_ptr = curr_ptr->next;
-: 2969: }
-: 2970:
#####: 2971: if (prev_ptr != NULL)
#####: 2972: prev_ptr->next = new_ptr;
-: 2973: else
#####: 2974: win_ptr->lock_queue = new_ptr;
-: 2975:
#####: 2976: new_ptr->next = NULL;
#####: 2977: new_ptr->lock_type = lock_accum_unlock_pkt->lock_type;
#####: 2978: new_ptr->source_win_handle = lock_accum_unlock_pkt->source_win_handle;
#####: 2979: new_ptr->vc = vc;
-: 2980:
#####: 2981: new_ptr->pt_single_op->type = MPIDI_RMA_ACCUMULATE;
#####: 2982: new_ptr->pt_single_op->addr = lock_accum_unlock_pkt->addr;
#####: 2983: new_ptr->pt_single_op->count = lock_accum_unlock_pkt->count;
#####: 2984: new_ptr->pt_single_op->datatype = lock_accum_unlock_pkt->datatype;
#####: 2985: new_ptr->pt_single_op->op = lock_accum_unlock_pkt->op;
-: 2986: /* allocate memory to receive the data */
#####: 2987: new_ptr->pt_single_op->data = MPIU_Malloc(req->dev.recv_data_sz);
#####: 2988: if (new_ptr->pt_single_op->data == NULL) {
|
#####: 2989: MPIU_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem" );
-: 2990: }
-: 2991:
|
#####: 2992: new_ptr->pt_single_op->data_recd = 0;
-: 2993:
#####: 2994: MPIDI_Request_set_type(req, MPIDI_REQUEST_TYPE_PT_SINGLE_ACCUM);
#####: 2995: req->dev.user_buf = new_ptr->pt_single_op->data;
#####: 2996: req->dev.lock_queue_entry = new_ptr;
-: 2997:
#####: 2998: *rreqp = req;
#####: 2999: if (req->dev.recv_data_sz == 0) {
#####: 3000: *buflen = sizeof(MPIDI_CH3_Pkt_t);
#####: 3001: MPIDI_CH3U_Request_complete(req);
#####: 3002: *rreqp = NULL;
-: 3003: }
-: 3004: else {
#####: 3005: mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf, &data_len,
-: 3006: &complete);
-: 3007: /* FIXME: Only change the handling of completion if
-: 3008: post_data_receive reset the handler. There should
-: 3009: be a cleaner way to do this */
#####: 3010: if (!req->dev.OnDataAvail) {
#####: 3011: req->dev.OnDataAvail = MPIDI_CH3_ReqHandler_SinglePutAccumComplete;
-: 3012: }
#####: 3013: if (mpi_errno != MPI_SUCCESS) {
|
#####: 3014: MPIU_ERR_SET1(mpi_errno,MPI_ERR_OTHER,"**ch3|postrecv",
-: 3015: "**ch3|postrecv %s", "MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK");
-: 3016: }
-: 3017: /* return the number of bytes processed in this function */
|
#####: 3018: *buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
-: 3019:
#####: 3020: if (complete)
-: 3021: {
#####: 3022: mpi_errno = MPIDI_CH3_ReqHandler_SinglePutAccumComplete(vc, req, &complete);
#####: 3023: if (complete)
-: 3024: {
#####: 3025: *rreqp = NULL;
-: 3026: }
-: 3027: }
-: 3028: }
|
#####: 3029: fn_fail:
-: 3030: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKACCUMUNLOCK);
|
#####: 3031: return mpi_errno;
-: 3032:}
-: 3033:
-: 3034:#undef FUNCNAME
-: 3035:#define FUNCNAME MPIDI_CH3_PktHandler_GetResp
-: 3036:#undef FCNAME
-: 3037:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 3038:int MPIDI_CH3_PktHandler_GetResp( MPIDI_VC_t *vc ATTRIBUTE((unused)),
-: 3039: MPIDI_CH3_Pkt_t *pkt,
-: 3040: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
|
10130: 3041:{
10130: 3042: MPIDI_CH3_Pkt_get_resp_t * get_resp_pkt = &pkt->get_resp;
-: 3043: MPID_Request *req;
-: 3044: int complete;
10130: 3045: char *data_buf = NULL;
-: 3046: MPIDI_msg_sz_t data_len;
10130: 3047: int mpi_errno = MPI_SUCCESS;
-: 3048: int type_size;
-: 3049: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_GETRESP);
-: 3050:
-: 3051: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_GETRESP);
-: 3052:
-: 3053: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received get response pkt");
-: 3054:
10130: 3055: data_len = *buflen - sizeof(MPIDI_CH3_Pkt_t);
10130: 3056: data_buf = (char *)pkt + sizeof(MPIDI_CH3_Pkt_t);
-: 3057:
10130: 3058: MPID_Request_get_ptr(get_resp_pkt->request_handle, req);
-: 3059:
10130: 3060: MPID_Datatype_get_size_macro(req->dev.datatype, type_size);
10130: 3061: req->dev.recv_data_sz = type_size * req->dev.user_count;
-: 3062:
-: 3063: /* FIXME: It is likely that this cannot happen (never perform
-: 3064: a get with a 0-sized item). In that case, change this
-: 3065: to an MPIU_Assert (and do the same for accumulate and put) */
10130: 3066: if (req->dev.recv_data_sz == 0) {
|
#####: 3067: MPIDI_CH3U_Request_complete( req );
#####: 3068: *buflen = sizeof(MPIDI_CH3_Pkt_t);
#####: 3069: *rreqp = NULL;
-: 3070: }
-: 3071: else {
|
10130: 3072: *rreqp = req;
10130: 3073: mpi_errno = MPIDI_CH3U_Receive_data_found(req, data_buf,
-: 3074: &data_len, &complete);
10130: 3075: MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv", "**ch3|postrecv %s", "MPIDI_CH3_PKT_GET_RESP");
10130: 3076: if (complete)
-: 3077: {
|
#####: 3078: MPIDI_CH3U_Request_complete(req);
#####: 3079: *rreqp = NULL;
-: 3080: }
-: 3081: /* return the number of bytes processed in this function */
|
10130: 3082: *buflen = data_len + sizeof(MPIDI_CH3_Pkt_t);
-: 3083: }
10130: 3084: fn_exit:
|
-: 3085: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_GETRESP);
|
10130: 3086: return mpi_errno;
|
-: 3087: fn_fail:
-: 3088: goto fn_exit;
-: 3089:}
-: 3090:
-: 3091:#undef FUNCNAME
-: 3092:#define FUNCNAME MPIDI_CH3_PktHandler_LockGranted
-: 3093:#undef FCNAME
-: 3094:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 3095:int MPIDI_CH3_PktHandler_LockGranted( MPIDI_VC_t *vc ATTRIBUTE((unused)),
-: 3096: MPIDI_CH3_Pkt_t *pkt,
-: 3097: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
|
487: 3098:{
487: 3099: MPIDI_CH3_Pkt_lock_granted_t * lock_granted_pkt = &pkt->lock_granted;
487: 3100: MPID_Win *win_ptr = NULL;
-: 3101: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGRANTED);
-: 3102:
-: 3103: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGRANTED);
-: 3104:
-: 3105: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received lock granted pkt");
-: 3106:
487: 3107: *buflen = sizeof(MPIDI_CH3_Pkt_t);
-: 3108:
487: 3109: MPID_Win_get_ptr(lock_granted_pkt->source_win_handle, win_ptr);
-: 3110: /* set the lock_granted flag in the window */
487: 3111: win_ptr->lock_granted = 1;
-: 3112:
487: 3113: *rreqp = NULL;
487: 3114: MPIDI_CH3_Progress_signal_completion();
-: 3115:
|
-: 3116: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_LOCKGRANTED);
|
487: 3117: return MPI_SUCCESS;
-: 3118:}
-: 3119:
-: 3120:#undef FUNCNAME
-: 3121:#define FUNCNAME MPIDI_CH3_PktHandler_PtRMADone
-: 3122:#undef FCNAME
-: 3123:#define FCNAME MPIDI_QUOTE(FUNCNAME)
-: 3124:int MPIDI_CH3_PktHandler_PtRMADone( MPIDI_VC_t *vc ATTRIBUTE((unused)),
-: 3125: MPIDI_CH3_Pkt_t *pkt,
-: 3126: MPIDI_msg_sz_t *buflen, MPID_Request **rreqp )
301: 3127:{
301: 3128: MPIDI_CH3_Pkt_pt_rma_done_t * pt_rma_done_pkt = &pkt->pt_rma_done;
301: 3129: MPID_Win *win_ptr = NULL;
-: 3130: MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_PKTHANDLER_PTRMADONE);
-: 3131:
-: 3132: MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_PKTHANDLER_PTRMADONE);
-: 3133:
-: 3134: MPIU_DBG_MSG(CH3_OTHER,VERBOSE,"received shared lock ops done pkt");
-: 3135:
301: 3136: *buflen = sizeof(MPIDI_CH3_Pkt_t);
-: 3137:
301: 3138: MPID_Win_get_ptr(pt_rma_done_pkt->source_win_handle, win_ptr);
-: 3139: /* reset the lock_granted flag in the window */
301: 3140: win_ptr->lock_granted = 0;
-: 3141:
301: 3142: *rreqp = NULL;
301: 3143: MPIDI_CH3_Progress_signal_completion();
-: 3144:
|
-: 3145: MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_PKTHANDLER_PTRMADONE);
|
301: 3146: return MPI_SUCCESS;
-: 3147:}
-: 3148:
-: 3149:/* ------------------------------------------------------------------------ */
-: 3150:/*
-: 3151: * For debugging, we provide the following functions for printing the
-: 3152: * contents of an RMA packet
-: 3153: */
-: 3154:/* ------------------------------------------------------------------------ */
-: 3155:#ifdef MPICH_DBG_OUTPUT
-: 3156:int MPIDI_CH3_PktPrint_Put( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3157:{
-: 3158: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_PUT\n"));
-: 3159: MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->put.addr));
-: 3160: MPIU_DBG_PRINTF((" count ........ %d\n", pkt->put.count));
-: 3161: MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->put.datatype));
-: 3162: MPIU_DBG_PRINTF((" dataloop_size. 0x%08X\n", pkt->put.dataloop_size));
-: 3163: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->put.target_win_handle));
-: 3164: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->put.source_win_handle));
-: 3165: /*MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->put.win_ptr));*/
-: 3166: return MPI_SUCCESS;
-: 3167:}
-: 3168:int MPIDI_CH3_PktPrint_Get( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3169:{
-: 3170: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_GET\n"));
-: 3171: MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->get.addr));
-: 3172: MPIU_DBG_PRINTF((" count ........ %d\n", pkt->get.count));
-: 3173: MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->get.datatype));
-: 3174: MPIU_DBG_PRINTF((" dataloop_size. %d\n", pkt->get.dataloop_size));
-: 3175: MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get.request_handle));
-: 3176: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->get.target_win_handle));
-: 3177: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->get.source_win_handle));
-: 3178: /*
-: 3179: MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get.request));
-: 3180: MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->get.win_ptr));
-: 3181: */
-: 3182: return MPI_SUCCESS;
-: 3183:}
-: 3184:int MPIDI_CH3_PktPrint_GetResp( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3185:{
-: 3186: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_GET_RESP\n"));
-: 3187: MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get_resp.request_handle));
-: 3188: /*MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->get_resp.request));*/
-: 3189: return MPI_SUCCESS;
-: 3190:}
-: 3191:int MPIDI_CH3_PktPrint_Accumulate( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3192:{
-: 3193: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_ACCUMULATE\n"));
-: 3194: MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->accum.addr));
-: 3195: MPIU_DBG_PRINTF((" count ........ %d\n", pkt->accum.count));
-: 3196: MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->accum.datatype));
-: 3197: MPIU_DBG_PRINTF((" dataloop_size. %d\n", pkt->accum.dataloop_size));
-: 3198: MPIU_DBG_PRINTF((" op ........... 0x%08X\n", pkt->accum.op));
-: 3199: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->accum.target_win_handle));
-: 3200: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->accum.source_win_handle));
-: 3201: /*MPIU_DBG_PRINTF((" win_ptr ...... 0x%08X\n", pkt->accum.win_ptr));*/
-: 3202: return MPI_SUCCESS;
-: 3203:}
-: 3204:int MPIDI_CH3_PktPrint_Lock( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3205:{
-: 3206: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK\n"));
-: 3207: MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock.lock_type));
-: 3208: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock.target_win_handle));
-: 3209: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock.source_win_handle));
-: 3210: return MPI_SUCCESS;
-: 3211:}
-: 3212:int MPIDI_CH3_PktPrint_LockPutUnlock( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3213:{
-: 3214: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_PUT_UNLOCK\n"));
-: 3215: MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->lock_put_unlock.addr));
-: 3216: MPIU_DBG_PRINTF((" count ........ %d\n", pkt->lock_put_unlock.count));
-: 3217: MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->lock_put_unlock.datatype));
-: 3218: MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock_put_unlock.lock_type));
-: 3219: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock_put_unlock.target_win_handle));
-: 3220: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_put_unlock.source_win_handle));
-: 3221: return MPI_SUCCESS;
-: 3222:}
-: 3223:int MPIDI_CH3_PktPrint_LockAccumUnlock( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3224:{
-: 3225: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_ACCUM_UNLOCK\n"));
-: 3226: MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->lock_accum_unlock.addr));
-: 3227: MPIU_DBG_PRINTF((" count ........ %d\n", pkt->lock_accum_unlock.count));
-: 3228: MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->lock_accum_unlock.datatype));
-: 3229: MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock_accum_unlock.lock_type));
-: 3230: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock_accum_unlock.target_win_handle));
-: 3231: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_accum_unlock.source_win_handle));
-: 3232: return MPI_SUCCESS;
-: 3233:}
-: 3234:int MPIDI_CH3_PktPrint_LockGetUnlock( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3235:{
-: 3236: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_GET_UNLOCK\n"));
-: 3237: MPIU_DBG_PRINTF((" addr ......... %p\n", pkt->lock_get_unlock.addr));
-: 3238: MPIU_DBG_PRINTF((" count ........ %d\n", pkt->lock_get_unlock.count));
-: 3239: MPIU_DBG_PRINTF((" datatype ..... 0x%08X\n", pkt->lock_get_unlock.datatype));
-: 3240: MPIU_DBG_PRINTF((" lock_type .... %d\n", pkt->lock_get_unlock.lock_type));
-: 3241: MPIU_DBG_PRINTF((" target ....... 0x%08X\n", pkt->lock_get_unlock.target_win_handle));
-: 3242: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_get_unlock.source_win_handle));
-: 3243: MPIU_DBG_PRINTF((" request ...... 0x%08X\n", pkt->lock_get_unlock.request_handle));
-: 3244: return MPI_SUCCESS;
-: 3245:}
-: 3246:int MPIDI_CH3_PktPrint_PtRMADone( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3247:{
-: 3248: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_PT_RMA_DONE\n"));
-: 3249: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_accum_unlock.source_win_handle));
-: 3250: return MPI_SUCCESS;
-: 3251:}
-: 3252:int MPIDI_CH3_PktPrint_LockGranted( FILE *fp, MPIDI_CH3_Pkt_t *pkt )
-: 3253:{
-: 3254: MPIU_DBG_PRINTF((" type ......... MPIDI_CH3_PKT_LOCK_GRANTED\n"));
-: 3255: MPIU_DBG_PRINTF((" source ....... 0x%08X\n", pkt->lock_granted.source_win_handle));
-: 3256: return MPI_SUCCESS;
-: 3257:}
-: 3258:#endif
|