Exemplo n.º 1
0
static int progress()
{
    opal_list_item_t *item, *next;
    int ret, flag, count;
    ROMIO_PREFIX(MPIO_Request) romio_rq;
    mca_io_base_request_t *ioreq;

    /* Troll through all pending requests and try to progress them.
       If a request finishes, remove it from the list. */

    count = 0;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    for (item = opal_list_get_first(&mca_io_romio_pending_requests);
         item != opal_list_get_end(&mca_io_romio_pending_requests); 
         item = next) {
        next = opal_list_get_next(item);

        ioreq = (mca_io_base_request_t*) item;
        romio_rq = ((mca_io_romio_request_t *) item)->romio_rq;
        ret = ROMIO_PREFIX(MPIO_Test)(&romio_rq, &flag, 
                                      &(((ompi_request_t *) item)->req_status));
        if ((0 != ret) || (0 != flag)) {
            ioreq->super.req_status.MPI_ERROR = ret;
            ++count;
            /* we're done, so remove us from the pending list */
            opal_list_remove_item(&mca_io_romio_pending_requests, item);
            /* mark as complete (and make sure to wake up any waiters */
            ompi_request_complete((ompi_request_t*) item);
            mca_io_base_request_progress_del();
            /* if the request has been freed already, the user isn't
             * going to call test or wait on us, so we need to do it
             * here
             */
            if (ioreq->free_called) {
                ret = ompi_request_free((ompi_request_t**) &ioreq);
                if (OMPI_SUCCESS != ret) {
                    OPAL_THREAD_UNLOCK(&mca_io_romio_mutex);
                    return count;
                }
            }
        }
    }
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    /* Return how many requests completed */

    return count;
}
Exemplo n.º 2
0
int
mca_io_romio314_file_set_view (ompi_file_t *fh,
                            MPI_Offset disp,
                            struct ompi_datatype_t *etype,
                            struct ompi_datatype_t *filetype,
                            const char *datarep,
                            opal_info_t *info)
{
    int ret;
    mca_io_romio314_data_t *data;

// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
    ompi_info_t *ompi_info;
    ompi_info = OBJ_NEW(ompi_info_t);
    if (!ompi_info) { return(MPI_ERR_NO_MEM); }
    opal_info_t *opal_info = &(ompi_info->super);
    opal_info_dup (info, &opal_info);

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_set_view) (data->romio_fh, disp, etype, filetype,
                                        datarep, ompi_info);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    ompi_info_free(&ompi_info);
    return ret;
}
Exemplo n.º 3
0
int
mca_io_romio314_file_open (ompi_communicator_t *comm,
                        const char *filename,
                        int amode,
                        opal_info_t *info,
                        ompi_file_t *fh)
{
    int ret;
    mca_io_romio314_data_t *data;

// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
    ompi_info_t *ompi_info;
    ompi_info = OBJ_NEW(ompi_info_t);
    if (!ompi_info) { return(MPI_ERR_NO_MEM); }
    opal_info_t *opal_info = &(ompi_info->super);
    opal_info_dup (info, &opal_info);

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
//    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, ompi_info,
                                      &data->romio_fh);
//    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    ompi_info_free(&ompi_info);
    return ret;
}
Exemplo n.º 4
0
int
mca_io_romio321_file_iwrite_at_all (ompi_file_t *fh,
                                    MPI_Offset offset,
                                    const void *buf,
                                    int count,
                                    struct ompi_datatype_t *datatype,
                                    ompi_request_t **request)
{
    int         ret;
    mca_io_romio321_data_t *data;

    data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
    // ----------------------------------------------------
    // NOTE: If you upgrade ROMIO, replace this with the actual ROMIO call.
    // ----------------------------------------------------
    // No support for non-blocking collective I/O operations.
    // Fake it with individual non-blocking I/O operations.
    // Similar to OMPIO
    ret =
        ROMIO_PREFIX(MPI_File_iwrite_at_all) (data->romio_fh, offset, buf, count,
                                             datatype, request);
    OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);

    return ret;
}
Exemplo n.º 5
0
int
mca_io_romio314_file_close (ompi_file_t *fh)
{
    int ret;
    mca_io_romio314_data_t *data;

    /* If we've already started MPI_Finalize by this point, then just
       give up (because ROMIO's file close routine calls MPI_Barrier,
       which we obviously can't do if we've started to MPI_Finalize).
       The user didn't close the file, so they should expect
       unexpected behavior. */
    if (ompi_mpi_finalized) {
        return OMPI_SUCCESS;
    }

    /* Because ROMIO expects the MPI library to provide error handler
     * management routines but it doesn't ever participate in
     * MPI_File_close, we have to somehow inform the MPI library that
     * we no longer hold a reference to any user defined error
     * handler.  We do this by setting the errhandler at this point to
     * MPI_ERRORS_RETURN. */
    if (fh->error_handler != &ompi_mpi_errors_return.eh) {
        OBJ_RELEASE(fh->error_handler);
        fh->error_handler = &ompi_mpi_errors_return.eh;
        OBJ_RETAIN(fh->error_handler);
    }

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;

    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_close) (&data->romio_fh);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 6
0
static int delete_select(char *filename, struct ompi_info_t *info,
                         struct mca_io_base_delete_t *private_data)
{
    int ret;

    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret = ROMIO_PREFIX(MPI_File_delete)(filename, info);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 7
0
int
mca_io_romio314_file_sync (ompi_file_t *fh)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_sync) (data->romio_fh);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 8
0
int
mca_io_romio314_file_get_atomicity (ompi_file_t *fh,
                                 int *flag)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_get_atomicity) (data->romio_fh, flag);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 9
0
int
mca_io_romio314_file_get_info (ompi_file_t *fh,
                            opal_info_t ** info_used)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, info_used);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 10
0
int
mca_io_romio_file_get_amode (ompi_file_t *fh,
                             int *amode)
{
    int ret;
    mca_io_romio_data_t *data;

    data = (mca_io_romio_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret = ROMIO_PREFIX(MPI_File_get_amode) (data->romio_fh, amode);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 11
0
int
mca_io_romio314_file_get_position (ompi_file_t *fh,
                                MPI_Offset * offset)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_get_position) (data->romio_fh, offset);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 12
0
int
mca_io_romio314_file_preallocate (ompi_file_t *fh,
                               MPI_Offset size)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_preallocate) (data->romio_fh, size);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 13
0
int
mca_io_romio_file_read_all_end (ompi_file_t *fh,
                                void *buf,
                                ompi_status_public_t * status)
{
    int         ret;
    mca_io_romio_data_t *data;

    data = (mca_io_romio_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret = ROMIO_PREFIX(MPI_File_read_all_end) (data->romio_fh, buf, status);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 14
0
int
mca_io_romio314_file_seek (ompi_file_t *fh,
                        MPI_Offset offset,
                        int whence)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_seek) (data->romio_fh, offset, whence);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 15
0
int
mca_io_romio_file_get_byte_offset (ompi_file_t *fh,
                                   MPI_Offset offset,
                                   MPI_Offset * disp)
{
    int ret;
    mca_io_romio_data_t *data;

    data = (mca_io_romio_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret = ROMIO_PREFIX(MPI_File_get_byte_offset) (data->romio_fh, offset, disp);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 16
0
int
mca_io_romio314_file_get_type_extent (ompi_file_t *fh,
                                   struct ompi_datatype_t *datatype,
                                   MPI_Aint * extent)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_get_type_extent) (data->romio_fh, datatype, extent);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 17
0
static int
register_datarep(char * datarep,
                 MPI_Datarep_conversion_function* read_fn,
                 MPI_Datarep_conversion_function* write_fn,
                 MPI_Datarep_extent_function* extent_fn,
                 void* state)
{
    int ret;

    OPAL_THREAD_LOCK(&mca_io_romio_mutex);
    ret = ROMIO_PREFIX(MPI_Register_datarep(datarep, read_fn, write_fn,
                                            extent_fn, state));
    OPAL_THREAD_UNLOCK(&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 18
0
int
mca_io_romio321_file_write_ordered_begin (ompi_file_t *fh,
                                       const void *buf,
                                       int count,
                                       struct ompi_datatype_t *datatype)
{
    int         ret;
    mca_io_romio321_data_t *data;

    data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
    ret = ROMIO_PREFIX(MPI_File_write_ordered_begin) (data->romio_fh, buf,
                                                     count, datatype);
    OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);

    return ret;
}
Exemplo n.º 19
0
int
mca_io_romio314_file_open (ompi_communicator_t *comm,
                        const char *filename,
                        int amode,
                        opal_info_t *info,
                        ompi_file_t *fh)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_open)(comm, filename, amode, info,
                                      &data->romio_fh);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;
}
Exemplo n.º 20
0
int
mca_io_romio_file_read_at_all_begin (ompi_file_t *fh,
                                     MPI_Offset offset,
                                     void *buf,
                                     int count,
                                     struct ompi_datatype_t *datatype)
{
    int         ret;
    mca_io_romio_data_t *data;

    data = (mca_io_romio_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_read_at_all_begin) (data->romio_fh, offset, buf,
                                                 count, datatype);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 21
0
int
mca_io_romio_file_iread_shared (ompi_file_t *fh,
                                void *buf,
                                int count,
                                struct ompi_datatype_t *datatype,
                                ompi_request_t **request)
{
    int ret;
    mca_io_romio_data_t *data;

    data = (mca_io_romio_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_iread_shared) (data->romio_fh, buf, count, 
                                             datatype, request);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 22
0
int
mca_io_romio_file_read_ordered (ompi_file_t *fh,
                                void *buf,
                                int count,
                                struct ompi_datatype_t *datatype,
                                ompi_status_public_t * status)
{
    int         ret;
    mca_io_romio_data_t *data;

    data = (mca_io_romio_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_read_ordered) (data->romio_fh, buf, count,
                                             datatype, status);
    OPAL_THREAD_UNLOCK (&mca_io_romio_mutex);

    return ret;
}
Exemplo n.º 23
0
int
mca_io_romio321_file_iwrite_at (ompi_file_t *fh,
                             MPI_Offset offset,
                             const void *buf,
                             int count,
                             struct ompi_datatype_t *datatype,
                             ompi_request_t **request)
{
    int ret;
    mca_io_romio321_data_t *data;

    data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_iwrite_at) (data->romio_fh, offset, buf, count,
                                          datatype, request);
    OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);

    return ret;
}
Exemplo n.º 24
0
int
mca_io_romio321_file_write_at_all (ompi_file_t *fh,
                                MPI_Offset offset,
                                const void *buf,
                                int count,
                                struct ompi_datatype_t *datatype,
                                ompi_status_public_t * status)
{
    int         ret;
    mca_io_romio321_data_t *data;

    data = (mca_io_romio321_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio321_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_write_at_all) (data->romio_fh, offset, buf,
                                             count, datatype, status);
    OPAL_THREAD_UNLOCK (&mca_io_romio321_mutex);

    return ret;
}
Exemplo n.º 25
0
int
mca_io_romio314_file_get_view (ompi_file_t *fh,
                            MPI_Offset * disp,
                            struct ompi_datatype_t ** etype,
                            struct ompi_datatype_t ** filetype,
                            char *datarep)
{
    int ret;
    mca_io_romio314_data_t *data;

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret =
        ROMIO_PREFIX(MPI_File_get_view) (data->romio_fh, disp, etype, filetype,
                                        datarep);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    return ret;

}
Exemplo n.º 26
0
int
mca_io_romio314_file_get_info (ompi_file_t *fh,
                            opal_info_t ** info_used)
{
    int ret;
    mca_io_romio314_data_t *data;

// An opal_info_t isn't a full ompi_info_t. so if we're using an MPI call
// below with an MPI_Info, we need to create an equivalent MPI_Info. This
// isn't ideal but it only happens a few places.
    ompi_info_t *ompi_info;
    ompi_info = OBJ_NEW(ompi_info_t);
    if (!ompi_info) { return(MPI_ERR_NO_MEM); }

    data = (mca_io_romio314_data_t *) fh->f_io_selected_data;
    OPAL_THREAD_LOCK (&mca_io_romio314_mutex);
    ret = ROMIO_PREFIX(MPI_File_get_info) (data->romio_fh, &ompi_info);
    OPAL_THREAD_UNLOCK (&mca_io_romio314_mutex);

    opal_info_dup (&(ompi_info->super), info_used);
    ompi_info_free(&ompi_info);
    return ret;
}