Example #1
0
/*
 * Back end to MPI_FILE_OPEN
 */
int ompi_file_open(struct ompi_communicator_t *comm, const char *filename,
                   int amode, struct ompi_info_t *info, ompi_file_t **fh)
{
    int ret;
    ompi_file_t *file;

    file = OBJ_NEW(ompi_file_t);
    if (NULL == file) {
        return OMPI_ERR_OUT_OF_RESOURCE;
    }


    /* Save the params */

    file->f_comm = comm;
    OBJ_RETAIN(comm);

    if (MPI_INFO_NULL != info) {
        if(NULL == file->f_info) {
            file->f_info = OBJ_NEW(ompi_info_t);
        }
        if (OMPI_SUCCESS != (ret = ompi_info_dup(info, &file->f_info))) {
            OBJ_RELEASE(file);
            return ret;
        }
    } else {
        file->f_info = MPI_INFO_NULL;
        OBJ_RETAIN(MPI_INFO_NULL);
    }

    file->f_amode = amode;
    file->f_filename = strdup(filename);
    if (NULL == file->f_filename) {
        OBJ_RELEASE(file);
        return OMPI_ERR_OUT_OF_RESOURCE;
    }

    /* Create the mutex */
    OBJ_CONSTRUCT(&file->f_mutex, opal_mutex_t);

    /* Select a module and actually open the file */

    if (OMPI_SUCCESS != (ret = mca_io_base_file_select(file, NULL))) {
        OBJ_RELEASE(file);
        return ret;
    }

    /* All done */

    *fh = file;
    return OMPI_SUCCESS;
}
int
mca_io_ompio_file_get_info (ompi_file_t *fh,
                            ompi_info_t ** info_used)
{
    int ret = OMPI_SUCCESS;
    mca_io_ompio_data_t *data;

    data = (mca_io_ompio_data_t *) fh->f_io_selected_data;

    ret = ompi_info_dup (data->ompio_fh.f_info, info_used);

    return ret;
}
Example #3
0
int mca_io_ompio_file_set_info (ompi_file_t *fh,
				ompi_info_t *info)
{
    int ret = OMPI_SUCCESS;

    if ( MPI_INFO_NULL == fh->f_info ) {
	/* OBJ_RELEASE(MPI_INFO_NULL); */
    }
    else {
	ompi_info_free ( &fh->f_info);
	fh->f_info = OBJ_NEW(ompi_info_t);
	ret = ompi_info_dup (info, &fh->f_info);
    }

    return ret;
}
Example #4
0
int mca_io_ompio_file_get_info (ompi_file_t *fh,
				ompi_info_t ** info_used)
{
    int ret = OMPI_SUCCESS;
    ompi_info_t *info=NULL;

    info = OBJ_NEW(ompi_info_t);
    if (NULL == info) {
        return MPI_ERR_INFO;
    }
    if (MPI_INFO_NULL != fh->f_info) {
	ret = ompi_info_dup (fh->f_info, &info);
    }
    *info_used = info;

    return ret;
}
Example #5
0
int mca_io_ompio_file_get_info (ompi_file_t *fh,
				ompi_info_t ** info_used)
{
    int ret = OMPI_SUCCESS;
    ompi_info_t *info=NULL;

    if ( MPI_INFO_NULL == fh->f_info  ) {
	*info_used = MPI_INFO_NULL;
    }
    else {
	info = OBJ_NEW(ompi_info_t);
	ret = ompi_info_dup (fh->f_info, &info);
	*info_used = info;
    }

    return ret;
}