Exemple #1
0
/*\ client receives strided data from server
\*/
void armci_ReadStridedFromDirect(int proc, request_header_t* msginfo,
                                 void *ptr, int strides, int stride_arr[],
                                 int count[])
{

    int server=armci_clus_id(proc);
    
    armci_mpi2_debug(armci_me, "armci_ReadStridedFromDirect: proc=%d "
                     "stride_levels=%d, server=%d bytes=%d (op=%d)\n",
                     proc, strides, server, msginfo->datalen,
                     msginfo->operation);

    
    if( !(server >= 0 && server < armci_nserver) )
       armci_die("armci_ReadStridedFromDirect: Invalid server.", 0);

#ifdef MPI_USER_DEF_DATATYPE
    if(strides > 0) 
    {
       armci_mpi_strided2(RECV, ptr, strides, stride_arr, count, server,
                          MPI_COMM_CLIENT2SERVER);
    }
    else
#endif
    {
       armci_mpi_strided(RECV, ptr, strides, stride_arr, count, server,
                         MPI_COMM_CLIENT2SERVER);
    }
}
static void armci_mpi_rcv_strided_data(request_header_t *msginfo,
                                       void *vdscr, int from)
{
    int bytes;
    void *ptr;
    char *dscr;
    int stride_levels, *stride_arr, *count;

    bytes = msginfo->dscrlen;
    dscr  = (char*)(msginfo + 1);
    *(void**)vdscr = (void *)dscr;

    ptr = *(void**)dscr;
    dscr += sizeof(void*);
    stride_levels = *(int*)dscr;
    dscr += sizeof(int);
    stride_arr = (int*)dscr;
    dscr += stride_levels*sizeof(int);
    count = (int*)dscr;
    dscr += (stride_levels+1)*sizeof(int);

#ifdef MPI_USER_DEF_DATATYPE
    if(stride_levels>0)
    {
        armci_mpi_strided2(RECV, ptr, stride_levels, stride_arr, count, from,
                           MPI_COMM_SERVER2CLIENT);
    }
    else
#endif
    {
        armci_mpi_strided(RECV, ptr, stride_levels, stride_arr, count, from,
                          MPI_COMM_SERVER2CLIENT);
    }
}
/*\ server sends strided data back to client
\*/
void armci_WriteStridedToDirect(int to, request_header_t* msginfo,
                                void *ptr, int strides, int stride_arr[],
                                int count[])
{
    armci_mpi2_server_debug(armci_server_me, "armci_WriteStridedToDirect: "
                            "to=%d, stride_levels=%d, bytes=%d\n", to, strides,
                            msginfo->datalen);

#ifdef MPI_USER_DEF_DATATYPE
    if(strides>0)
    {
        armci_mpi_strided2(SEND, ptr, strides, stride_arr, count, to,
                           MPI_COMM_SERVER2CLIENT);
    }
    else
#endif
    {
        armci_mpi_strided(SEND, ptr, strides, stride_arr, count, to,
                          MPI_COMM_SERVER2CLIENT);
    }

}
Exemple #4
0
/*\ client sends strided data + request to server
\*/
int armci_send_req_msg_strided(int proc, request_header_t *msginfo,char *ptr,
                               int strides, int stride_arr[], int count[])
{
    int server = armci_clus_id(proc);
    int bytes;

    armci_mpi2_debug(armci_me, "armci_send_req_msg_strided: proc=%d server=%d "
                     "bytes=%d (op=%d)\n", proc, server, msginfo->datalen,
                     msginfo->operation);

    THREAD_LOCK(armci_user_threads.net_lock);

    /* we write header + descriptor of strided data  */
    bytes = sizeof(request_header_t) + msginfo->dscrlen;
    armci_send_req_msg(proc, msginfo, bytes);
    
#ifdef MPI_USER_DEF_DATATYPE
    if(strides>0) 
    {
       armci_mpi_strided2(SEND, ptr, strides, stride_arr, count, server,
                          MPI_COMM_CLIENT2SERVER);
    }
    else
#endif
    {
       /* for larger blocks write directly thus avoiding memcopy */
       armci_mpi_strided(SEND, ptr, strides, stride_arr, count, server,
                         MPI_COMM_CLIENT2SERVER);
    }
       
    THREAD_UNLOCK(armci_user_threads.net_lock);

    armci_mpi2_debug(armci_me, "armci_send_req_msg_strided(): send msg to "
                     "server(%d), to fwd to client %d\n", server, proc);

    return 0;
}