void _rmw ( pami_context_t context, void * src_ptr_in, void * src_ptr_out, void * target_ptr, pami_atomic_t op, pami_type_t type, pami_endpoint_t target ) { pami_rmw_t rmw; memset(&rmw, 0, sizeof(pami_rmw_t)); rmw.cookie = (void *)&_send_active; rmw.done_fn = cb_done; int test = 0; rmw.local = src_ptr_out; rmw.remote = target_ptr; rmw.value = src_ptr_in; rmw.test = &test; rmw.type = type; rmw.operation = op; rmw.dest = target; #if ENABLE_PROGRESS pami_work_t work; PAMI_Context_post (context, &work, (pami_work_function)PAMI_Rmw, (void*)&rmw); while (_send_active == 1); #else RC( PAMI_Rmw (context, &rmw) ); while (_send_active) PAMI_Context_advance (context, POLL_CNT); #endif _send_active = 1; }
void get_contig ( pami_context_t context, void * lbuf, void * rbuf, void * lbase, void * rbase, pami_memregion_t * lmr, pami_memregion_t * rmr, size_t sndlen, pami_endpoint_t target ) { pami_rget_simple_t rget; rget.rma.dest = target; rget.rma.bytes = sndlen; rget.rma.cookie = (void*)&_send_active; rget.rma.done_fn = cb_done; rget.rma.hints.buffer_registered = PAMI_HINT_ENABLE; rget.rma.hints.use_rdma = PAMI_HINT_ENABLE; rget.rdma.local.mr = lmr; rget.rdma.local.offset = (size_t)lbuf - (size_t)lbase; rget.rdma.remote.mr = rmr; rget.rdma.remote.offset = (size_t)rbuf - (size_t)rbase; assert (_send_active == 1); #if ENABLE_PROGRESS pami_work_t work; PAMI_Context_post (context, &work, (pami_work_function)PAMI_Rget, (void*)&rget); while (_send_active == 1); #else RC( PAMI_Rget (context, &rget) ); while (_send_active) PAMI_Context_advance (context, POLL_CNT); #endif _send_active = 1; }
void send_contig ( pami_context_t context, size_t dispatch, void * metadata, size_t hdrsize, char * buffer, size_t sndlen, pami_endpoint_t target ) { //fprintf(stderr, "Calling send dispatch %ld, hdrsize %ld, bytes %ld\n", //dispatch, hdrsize, sndlen); pami_send_t parameters; parameters.send.dispatch = dispatch; parameters.send.header.iov_base = metadata; parameters.send.header.iov_len = hdrsize; parameters.send.data.iov_base = buffer; parameters.send.data.iov_len = sndlen; parameters.events.cookie = (void *) & _send_active; parameters.events.local_fn = NULL; //cb_done; parameters.events.remote_fn = cb_done; parameters.send.dest = target; memset(¶meters.send.hints, 0, sizeof(parameters.send.hints)); #if ENABLE_PROGRESS pami_work_t work; PAMI_Context_post (context, &work, (pami_work_function)PAMI_Send, (void*)¶meters); while (_send_active == 1); #else RC( PAMI_Send (context, ¶meters) ); while (_send_active) PAMI_Context_advance (context, POLL_CNT); #endif _send_active = 1; }
/** * \brief Initialize support for MPIR_* nbc implementation. * * The MPIR_* non-blocking collectives only work if the schedule is advanced. * This is done by posting a work function to context 0 that invokes the * schedule progress function. * * Because this is a persistent work function and will negatively impact the * performance of all other MPI operations - even when mpir non-blocking * collectives are not used - the work function is only posted if explicitly * requested. */ void MPIDI_NBC_init () { if (MPIDI_Process.mpir_nbc != 0) { PAMI_Context_post(MPIDI_Context[0], &mpidi_nbc_work_object, mpidi_nbc_work_function, NULL); } return; }
/** * This calculates a context to use and posts the short-send work to * it. It then advances all contexts until the send is complete. */ static void *SendShort(void *c) { pami_task_t remote_task = 1-task; size_t local_context = (remote_task+SHORT_DISPATCH)&(num_contexts-1); pami_work_t state; PAMI_Context_post(contexts[local_context], &state, SendShortHandoff, NULL); while (!done.sshort.send) //PAMI_Context_advancev(contexts, num_contexts, 1); PAMI_Context_trylock_advancev(contexts, num_contexts, 1); return NULL; }
/** * This calculates a context to use and posts the long-send work to * it. It then advances all contexts until the send is complete. * * Because SendLongHandoff may complete before sending the msginfo, I * declare it here and pass it in the cookie. Since this function * will not exit until the local sen is complete, it is safe to put * the msginfo on the stack for this one. */ static void *SendLong(void *c) { unsigned quad[] = {(unsigned)task, 0x11111, 0x22222, 0x33333}; pami_task_t remote_task = 1-task; size_t local_context = (remote_task+LONG_DISPATCH)&(num_contexts-1); pami_work_t state; PAMI_Context_post(contexts[local_context], &state, SendLongHandoff, quad); while (!done.slong.send) //PAMI_Context_advancev(contexts, num_contexts, 1); PAMI_Context_trylock_advancev(contexts, num_contexts, 1); return NULL; }
void put_contig ( pami_context_t context, void * srcbuf, void * dstbuf, void * src_base, void * dst_base, pami_memregion_t * src_mr, pami_memregion_t * dst_mr, size_t sndlen, pami_endpoint_t target ) { //fprintf(stderr, "Calling send dispatch %ld, hdrsize %ld, bytes %ld\n", // dispatch, hdrsize, sndlen); pami_rput_simple_t rput; rput.rma.dest = target; rput.rma.hints.buffer_registered = PAMI_HINT_ENABLE; rput.rma.hints.use_rdma = PAMI_HINT_ENABLE; rput.rma.bytes = sndlen; rput.rma.cookie = (void*)&_send_active; rput.rma.done_fn = NULL; //cb_done; rput.rdma.local.mr = src_mr; rput.rdma.local.offset = (size_t)srcbuf - (size_t)src_base; rput.rdma.remote.mr = dst_mr; rput.rdma.remote.offset = (size_t)dstbuf - (size_t)dst_base; rput.put.rdone_fn = cb_done; #if ENABLE_PROGRESS pami_work_t work; PAMI_Context_post (context, &work, (pami_work_function)PAMI_Rput, (void*)&rput); while (_send_active == 1); #else RC( PAMI_Rput (context, &rput) ); while (_send_active) PAMI_Context_advance (context, POLL_CNT); #endif _send_active = 1; }