Ejemplo n.º 1
0
int OSPDI_GlobalBarrier()
{
    int status = OSP_SUCCESS;
    DCMF_Request_t request;
    DCMF_Callback_t done_callback;
    volatile int active;

    OSPU_FUNC_ENTER();

    active = 1;
    done_callback.function = OSPDI_Generic_done;
    done_callback.clientdata = (void *) &active;

    status = DCMF_GlobalBarrier(&OSPD_GlobalBarrier_protocol,
                                &request,
                                done_callback);
    OSPU_ERR_ABORT(status != DCMF_SUCCESS,
                  "DCMF_GlobalBarrier returned with an error");

    OSPDI_Conditional_advance(active > 0);

    fn_exit: OSPU_FUNC_EXIT();
    return status;

    fn_fail: goto fn_exit;

}
Ejemplo n.º 2
0
int OSPD_Get(int target, void* src, void* dst, int bytes)
{
    int status = OSP_SUCCESS;
    DCMF_Request_t request;
    DCMF_Callback_t callback;
    volatile int active;
    unsigned src_disp, dst_disp;

    OSPU_FUNC_ENTER();

    OSPDI_CRITICAL_ENTER();

    callback.function = OSPDI_Generic_done;
    callback.clientdata = (void *) &active;

    src_disp = (size_t) src - (size_t) OSPD_Membase_global[target];
    dst_disp = (size_t) dst - (size_t) OSPD_Membase_global[OSPD_Process_info.my_rank];

    active = 1;

    status = DCMF_Get(&OSPD_Generic_get_protocol,
                      &request,
                      callback,
                      DCMF_RELAXED_CONSISTENCY,
                      target,
                      bytes,
                      &OSPD_Memregion_global[target],
                      &OSPD_Memregion_global[OSPD_Process_info.my_rank],
                      src_disp,
                      dst_disp);
    OSPU_ERR_POP(status, "DCMF_Get returned with an error");

    OSPDI_Conditional_advance(active > 0);

  fn_exit: 
    OSPDI_CRITICAL_EXIT();
    OSPU_FUNC_EXIT();
    return status;

  fn_fail: 
    goto fn_exit;
}
Ejemplo n.º 3
0
int OSPD_PutAccV(int target,
                OSP_iov_t *iov_ar,
                int ar_len,
                OSP_datatype_t osp_type,
                void* scaling)
{
    int status = OSP_SUCCESS;
    OSPD_Handle_t *ospd_handle;

    OSPU_FUNC_ENTER();

    OSPDI_CRITICAL_ENTER();

    ospd_handle = OSPDI_Get_handle();
    OSPU_ERR_POP(status = (ospd_handle == NULL),
                "OSPDI_Get_handle returned NULL in OSPD_PutAccS.\n");

    status = OSPDI_Direct_putaccv(target,
                                 iov_ar,
                                 ar_len,
                                 osp_type,
                                 scaling,
                                 ospd_handle);
    OSPU_ERR_POP(status, "Direct putaccv function returned with an error \n");

    OSPDI_Conditional_advance(ospd_handle->active > 0);

  fn_exit:
    OSPDI_Release_handle(ospd_handle);
    OSPDI_CRITICAL_EXIT();
    OSPU_FUNC_EXIT();
    return status;

  fn_fail: 
    goto fn_exit;
}
Ejemplo n.º 4
0
int OSPDI_GlobalBcast(int root,
                     int count,
                     void *buffer)
{
    int status = OSP_SUCCESS;
    DCMF_Request_t request;
    DCMF_Callback_t done_callback;
    volatile unsigned gb_active = 0;

    OSPU_FUNC_ENTER();

    gb_active += 1;
    done_callback.function = OSPDI_Generic_done;
    done_callback.clientdata = (void *) &gb_active;

    status = DCMF_GlobalBcast(&OSPD_GlobalBcast_protocol,
                              &request,
                              done_callback,
                              DCMF_SEQUENTIAL_CONSISTENCY,
                              root,
                              (char *) buffer,
                              count);
    OSPU_ERR_POP(status != DCMF_SUCCESS,
                "DCMF_GlobalBcast returned with error %d \n",
                status);

    OSPDI_Conditional_advance(gb_active > 0);

    fn_exit:
    OSPU_FUNC_EXIT();
    return status;

    fn_fail:
    goto fn_exit;

}
Ejemplo n.º 5
0
int OSPDI_GlobalAllreduce(int count,
                         OSP_reduce_op_t osp_op,
                         OSP_datatype_t osp_type,
                         void *in,
                         void *out)
{
    int status = OSP_SUCCESS;
    DCMF_CollectiveRequest_t ar_crequest;
    DCMF_Callback_t done_callback;
    DCMF_Op reduce_op;
    DCMF_Dt datatype;
    int bytes = 0;
    void *in_abs = NULL;
    volatile unsigned ga_active = 0;

    OSPU_FUNC_ENTER();

    switch (osp_op)
    {
        case OSP_SUM:
            reduce_op = DCMF_SUM;
            break;
        case OSP_PROD:
            reduce_op = DCMF_PROD;
            break;
        case OSP_MAX:
        case OSP_MAXABS:
            reduce_op = DCMF_MAX;
            break;
        case OSP_MIN:
        case OSP_MINABS:
            reduce_op = DCMF_MIN;
            break;
        case OSP_OR:
            reduce_op = DCMF_LOR;
            break;
        default:
            OSPU_ERR_POP(status != DCMF_SUCCESS, "Unsupported OSP_reduce_op \n");
            break;
    }

    if (osp_op == OSP_MAXABS || osp_op == OSP_MINABS)
    {
        switch (osp_type)
        {
        case OSP_DOUBLE:
            datatype = DCMF_DOUBLE;
            bytes = count * sizeof(double);
            status = OSPDI_Malloc(&in_abs, bytes);
            OSPU_ERR_POP(status != OSP_SUCCESS,
                        "OSPDI_Malloc returned error in OSPDI_GlobalAllreduce \n");
            OSPDI_ABS(double, in, in_abs, count);
            in = in_abs;
            break;
        case OSP_INT32:
            datatype = DCMF_SIGNED_INT;
            bytes = count * sizeof(int32_t);
            status = OSPDI_Malloc(&in_abs, bytes);
            OSPU_ERR_POP(status != OSP_SUCCESS,
                        "OSPDI_Malloc returned error in OSPDI_GlobalAllreduce \n");
            OSPDI_ABS(int32_t, in, in_abs, count);
            in = in_abs;
            break;
        case OSP_INT64:
            datatype = DCMF_SIGNED_LONG_LONG;
            bytes = count * sizeof(int64_t);
            status = OSPDI_Malloc(&in_abs, bytes);
            OSPU_ERR_POP(status != OSP_SUCCESS,
                        "OSPDI_Malloc returned error in OSPDI_GlobalAllreduce \n");
            OSPDI_ABS(int64_t, in, in_abs, count);
            in = in_abs;
            break;
        case OSP_UINT32:
            datatype = DCMF_UNSIGNED_INT;
            break;
        case OSP_UINT64:
            datatype = DCMF_UNSIGNED_LONG_LONG;
            break;
        case OSP_FLOAT:
            datatype = DCMF_FLOAT;
            bytes = count * sizeof(float);
            status = OSPDI_Malloc(&in_abs, bytes);
            OSPU_ERR_POP(status != OSP_SUCCESS,
                        "OSPDI_Malloc returned error in OSPDI_GlobalAllreduce \n");
            OSPDI_ABS(float, in, in_abs, count);
            in = in_abs;
            break;
        default:
            OSPU_ERR_POP(status != DCMF_SUCCESS, "Unsupported OSP_datatype \n");
            break;
        }
    }
    else
    {
        switch (osp_type)
        {
        case OSP_DOUBLE:
            datatype = DCMF_DOUBLE;
            break;
        case OSP_INT32:
            datatype = DCMF_SIGNED_INT;
            break;
        case OSP_INT64:
            datatype = DCMF_SIGNED_LONG_LONG;
            break;
        case OSP_UINT32:
            datatype = DCMF_UNSIGNED_INT;
            break;
        case OSP_UINT64:
            datatype = DCMF_UNSIGNED_LONG_LONG;
            break;
        case OSP_FLOAT:
            datatype = DCMF_FLOAT;
            break;
        default:
            OSPU_ERR_ABORT(status != DCMF_SUCCESS, "Unsupported OSP_datatype \n");
            break;
        }
    }

    ga_active += 1;
    done_callback.function = OSPDI_Generic_done;
    done_callback.clientdata = (void *) &ga_active;

    status = DCMF_Allreduce(&OSPD_GlobalAllreduce_protocol,
                            &ar_crequest,
                            done_callback,
                            DCMF_SEQUENTIAL_CONSISTENCY,
                            &geometry,
                            (char *) in,
                            (char *) out,
                            count,
                            datatype,
                            reduce_op);

    OSPDI_Conditional_advance(ga_active > 0);

    fn_exit:
    if (in_abs != NULL) 
        OSPDI_Free(in_abs);
    OSPU_FUNC_EXIT();
    return status;

    fn_fail:
    goto fn_exit;

}