您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ADIOI_Datatype_iscontig函数代码示例

51自学网 2021-06-01 19:33:41
  C++
这篇教程C++ ADIOI_Datatype_iscontig函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ADIOI_Datatype_iscontig函数的典型用法代码示例。如果您正苦于以下问题:C++ ADIOI_Datatype_iscontig函数的具体用法?C++ ADIOI_Datatype_iscontig怎么用?C++ ADIOI_Datatype_iscontig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ADIOI_Datatype_iscontig函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MPIU_read_external32_conversion_fn

int MPIU_read_external32_conversion_fn(void *userbuf, MPI_Datatype datatype,        int count, void *filebuf){    int position_i = 0;    MPI_Aint position = 0;    MPI_Aint bytes = 0;    int mpi_errno = MPI_SUCCESS;    int is_contig = 0;    ADIOI_Datatype_iscontig(datatype, &is_contig);    mpi_errno = MPI_Pack_external_size("external32", count, datatype, &bytes);    if (mpi_errno != MPI_SUCCESS)        goto fn_exit;    if (is_contig)    {        mpi_errno = MPI_Unpack_external("external32", filebuf, bytes,                &position, userbuf, count,  datatype);        if (mpi_errno != MPI_SUCCESS)            goto fn_exit;    }    else    {        void *tmp_buf = NULL;        tmp_buf = ADIOI_Malloc(bytes);        if (!tmp_buf)        {            mpi_errno = MPI_ERR_NO_MEM;            goto fn_exit;        }        mpi_errno = MPI_Pack(filebuf, count, datatype, tmp_buf, bytes,                &position_i, MPI_COMM_WORLD);        if (mpi_errno != MPI_SUCCESS)        {            ADIOI_Free(tmp_buf);            goto fn_exit;        }        mpi_errno = MPI_Unpack_external("external32", tmp_buf, bytes,                &position, userbuf, count, datatype);        if (mpi_errno != MPI_SUCCESS)        {            ADIOI_Free(tmp_buf);            goto fn_exit;        }        ADIOI_Free(tmp_buf);    }fn_exit:    return mpi_errno;}
开发者ID:Dissolubilis,项目名称:ompi-svn-mirror,代码行数:52,


示例2: ADIOI_Get_position

void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset){    ADIOI_Flatlist_node *flat_file;    int i, n_filetypes, flag, frd_size;    int filetype_size, etype_size, filetype_is_contig;    MPI_Aint filetype_extent;    ADIO_Offset disp, byte_offset, sum, size_in_file;        ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    etype_size = fd->etype_size;    if (filetype_is_contig) *offset = (fd->fp_ind - fd->disp)/etype_size;    else {/* filetype already flattened in ADIO_Open */        flat_file = ADIOI_Flatlist;        while (flat_file->type != fd->filetype) flat_file = flat_file->next;	MPI_Type_size(fd->filetype, &filetype_size);	MPI_Type_extent(fd->filetype, &filetype_extent);	disp = fd->disp;	byte_offset = fd->fp_ind;	n_filetypes = -1;	flag = 0;	while (!flag) {	    sum = 0;	    n_filetypes++;	    for (i=0; i<flat_file->count; i++) {		sum += flat_file->blocklens[i];		if (disp + flat_file->indices[i] + 	     	    (ADIO_Offset) n_filetypes*filetype_extent + flat_file->blocklens[i] 		    >= byte_offset) {		    frd_size = (int) (disp + flat_file->indices[i] + 			(ADIO_Offset) n_filetypes*filetype_extent			+ flat_file->blocklens[i] - byte_offset);		    sum -= frd_size;		    flag = 1;		    break;		}	    }	}	size_in_file = (ADIO_Offset) n_filetypes*filetype_size + sum;	*offset = size_in_file/etype_size;    }}
开发者ID:carsten-clauss,项目名称:MP-MPICH,代码行数:45,


示例3: ADIOI_Get_position

void ADIOI_Get_position(ADIO_File fd, ADIO_Offset *offset){    ADIOI_Flatlist_node *flat_file;    int i, flag;    MPI_Count filetype_size, etype_size;    int filetype_is_contig;    MPI_Aint filetype_extent;    ADIO_Offset disp, byte_offset, sum=0, size_in_file, n_filetypes, frd_size;        ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    etype_size = fd->etype_size;    if (filetype_is_contig) *offset = (fd->fp_ind - fd->disp)/etype_size;    else {	flat_file = ADIOI_Flatten_and_find(fd->filetype);	MPI_Type_size_x(fd->filetype, &filetype_size);	MPI_Type_extent(fd->filetype, &filetype_extent);	disp = fd->disp;	byte_offset = fd->fp_ind;	n_filetypes = -1;	flag = 0;	while (!flag) {	    sum = 0;	    n_filetypes++;	    for (i=0; i<flat_file->count; i++) {		sum += flat_file->blocklens[i];		if (disp + flat_file->indices[i] + 	     	    n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + flat_file->blocklens[i] 		    >= byte_offset) {		    frd_size = disp + flat_file->indices[i] + 			n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent			+ flat_file->blocklens[i] - byte_offset;		    sum -= frd_size;		    flag = 1;		    break;		}	    }	}	size_in_file = n_filetypes * (ADIO_Offset)filetype_size + sum;	*offset = size_in_file/etype_size;    }}
开发者ID:NexMirror,项目名称:MPICH,代码行数:44,


示例4: ADIOI_Datatype_iscontig

void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag){    int nints, nadds, ntypes, combiner;    int *ints, ni, na, nt, cb;    MPI_Aint *adds;    MPI_Datatype *types;    MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner);    switch (combiner) {    case MPI_COMBINER_NAMED:	*flag = 1;	break;    case MPI_COMBINER_CONTIGUOUS:	ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int));	adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint));	types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype));	MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints,			      adds, types); 	ADIOI_Datatype_iscontig(types[0], flag);#ifndef MPISGI/* There is a bug in SGI's impl. of MPI_Type_get_contents. It doesn't   return new datatypes. Therefore no need to free. */	MPI_Type_get_envelope(types[0], &ni, &na, &nt, &cb);	if (cb != MPI_COMBINER_NAMED) MPI_Type_free(types);#endif	ADIOI_Free(ints);	ADIOI_Free(adds);	ADIOI_Free(types);	break;    default:	*flag = 0;	break;    }    /* This function needs more work. It should check for contiguity        in other cases as well.*/}
开发者ID:aosm,项目名称:openmpi,代码行数:40,


示例5: ADIOI_Get_byte_offset

void ADIOI_Get_byte_offset(ADIO_File fd, ADIO_Offset offset, ADIO_Offset * disp){    ADIOI_Flatlist_node *flat_file;    int i;    ADIO_Offset n_filetypes, etype_in_filetype, sum, abs_off_in_filetype = 0, size_in_filetype;    MPI_Count n_etypes_in_filetype, filetype_size, etype_size;    int filetype_is_contig;    MPI_Aint filetype_extent;    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    etype_size = fd->etype_size;    if (filetype_is_contig)        *disp = fd->disp + etype_size * offset;    else {        flat_file = ADIOI_Flatten_and_find(fd->filetype);        MPI_Type_size_x(fd->filetype, &filetype_size);        n_etypes_in_filetype = filetype_size / etype_size;        n_filetypes = offset / n_etypes_in_filetype;        etype_in_filetype = offset % n_etypes_in_filetype;        size_in_filetype = etype_in_filetype * etype_size;        sum = 0;        for (i = 0; i < flat_file->count; i++) {            sum += flat_file->blocklens[i];            if (sum > size_in_filetype) {                abs_off_in_filetype = flat_file->indices[i] +                    size_in_filetype - (sum - flat_file->blocklens[i]);                break;            }        }        /* abs. offset in bytes in the file */        MPI_Type_extent(fd->filetype, &filetype_extent);        *disp =            fd->disp + n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent +            abs_off_in_filetype;    }}
开发者ID:ParaStation,项目名称:psmpi2,代码行数:40,


示例6: ADIOI_LUSTRE_WriteStridedColl

void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, const void *buf, int count,				   MPI_Datatype datatype,				   int file_ptr_type, ADIO_Offset offset,				   ADIO_Status *status, int *error_code){    /* Uses a generalized version of the extended two-phase method described     * in "An Extended Two-Phase Method for Accessing Sections of     * Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary,     * Scientific Programming, (5)4:301--317, Winter 1996.     * http://www.mcs.anl.gov/home/thakur/ext2ph.ps     */    ADIOI_Access *my_req;    /* array of nprocs access structures, one for each other process has       this process's request */    ADIOI_Access *others_req;    /* array of nprocs access structures, one for each other process       whose request is written by this process. */    int i, filetype_is_contig, nprocs, myrank, do_collect = 0;    int contig_access_count = 0, buftype_is_contig, interleave_count = 0;    int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs;    ADIO_Offset orig_fp, start_offset, end_offset, off;    ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *end_offsets = NULL;    ADIO_Offset *len_list = NULL;    int **buf_idx = NULL, *striping_info = NULL;    int old_error, tmp_error;    MPI_Comm_size(fd->comm, &nprocs);    MPI_Comm_rank(fd->comm, &myrank);    orig_fp = fd->fp_ind;    /* IO patten identification if cb_write isn't disabled */    if (fd->hints->cb_write != ADIOI_HINT_DISABLE) {	/* For this process's request, calculate the list of offsets and	   lengths in the file and determine the start and end offsets. */	/* Note: end_offset points to the last byte-offset that will be accessed.         * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99         */	ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset,	                      &offset_list, &len_list, &start_offset,	                      &end_offset, &contig_access_count);	/* each process communicates its start and end offsets to other         * processes. The result is an array each of start and end offsets         * stored in order of process rank.         */	st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset));	end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * sizeof(ADIO_Offset));	MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1,		      ADIO_OFFSET, fd->comm);	MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1,		      ADIO_OFFSET, fd->comm);	/* are the accesses of different processes interleaved? */	for (i = 1; i < nprocs; i++)	    if ((st_offsets[i] < end_offsets[i-1]) &&                (st_offsets[i] <= end_offsets[i]))                interleave_count++;	/* This is a rudimentary check for interleaving, but should suffice	   for the moment. */	/* Two typical access patterns can benefit from collective write.         *   1) the processes are interleaved, and         *   2) the req size is small.         */        if (interleave_count > 0) {	    do_collect = 1;        } else {            do_collect = ADIOI_LUSTRE_Docollect(fd, contig_access_count,			                        len_list, nprocs);        }    }    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    /* Decide if collective I/O should be done */    if ((!do_collect && fd->hints->cb_write == ADIOI_HINT_AUTO) ||        fd->hints->cb_write == ADIOI_HINT_DISABLE) {	/* use independent accesses */	if (fd->hints->cb_write != ADIOI_HINT_DISABLE) {	    ADIOI_Free(offset_list);	    ADIOI_Free(len_list);            ADIOI_Free(st_offsets);            ADIOI_Free(end_offsets);	}	fd->fp_ind = orig_fp;	ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);	if (buftype_is_contig && filetype_is_contig) {	    if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {                off = fd->disp + (ADIO_Offset)(fd->etype_size) * offset;		ADIO_WriteContig(fd, buf, count, datatype,				 ADIO_EXPLICIT_OFFSET,				 off, status, error_code);	    } else		ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL,//.........这里部分代码省略.........
开发者ID:zhanglt,项目名称:mpich,代码行数:101,


示例7: ADIOI_LUSTRE_Exch_and_write

//.........这里部分代码省略.........        }    }    recv_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int));    send_curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int));    /* their use is explained below. calloc initializes to 0. */    recv_count = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* to store count of how many off-len pairs per proc are satisfied       in an iteration. */    send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* total size of data to be sent to each proc. in an iteration.       Of size nprocs so that I can use MPI_Alltoall later. */    recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* total size of data to be recd. from each proc. in an iteration. */    sent_to_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int));    /* amount of data sent to each proc so far. Used in       ADIOI_Fill_send_buffer. initialized to 0 here. */    send_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int));    curr_to_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int));    done_to_proc = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* Above three are used in ADIOI_Fill_send_buffer */    this_buf_idx = (int *) ADIOI_Malloc(nprocs * sizeof(int));    recv_start_pos = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* used to store the starting value of recv_curr_offlen_ptr[i] in       this iteration */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    if (!buftype_is_contig) {	flat_buf = ADIOI_Flatten_and_find(datatype);    }    MPI_Type_extent(datatype, &buftype_extent);    /* I need to check if there are any outstanding nonblocking writes to     * the file, which could potentially interfere with the writes taking     * place in this collective write call. Since this is not likely to be     * common, let me do the simplest thing possible here: Each process     * completes all pending nonblocking operations before completing.     */    /*ADIOI_Complete_async(error_code);    if (*error_code != MPI_SUCCESS) return;    MPI_Barrier(fd->comm);    */    iter_st_off = min_st_loc;    /* Although we have recognized the data according to OST index,     * a read-modify-write will be done if there is a hole between the data.     * For example: if blocksize=60, xfersize=30 and stripe_size=100,     * then rank0 will collect data [0, 30] and [60, 90] then write. There     * is a hole in [30, 60], which will cause a read-modify-write in [0, 90].     *     * To reduce its impact on the performance, we can disable data sieving     * by hint "ds_in_coll".     */    /* check the hint for data sieving */    data_sieving = fd->hints->fs_hints.lustre.ds_in_coll;    for (m = 0; m < max_ntimes; m++) {	/* go through all others_req and my_req to check which will be received         * and sent in this iteration.
开发者ID:zhanglt,项目名称:mpich,代码行数:67,


示例8: ADIOI_NFS_WriteStrided

void ADIOI_NFS_WriteStrided(ADIO_File fd, const void *buf, int count,                            MPI_Datatype datatype, int file_ptr_type,                            ADIO_Offset offset, ADIO_Status * status, int                            *error_code){/* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int i, j, k, err = -1, bwr_size, st_index = 0;    ADIO_Offset i_offset, sum, size_in_filetype;    ADIO_Offset num, size, n_etypes_in_filetype;    MPI_Count bufsize;    ADIO_Offset n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype = 0;    int req_len;    MPI_Count filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off;    ADIO_Offset off, req_off, disp, end_offset = 0, writebuf_off, start_off;    char *writebuf = NULL, *value;    int st_n_filetypes, writebuf_len, write_sz;    ADIO_Offset fwr_size = 0, new_fwr_size, st_fwr_size;    int new_bwr_size, err_flag = 0, info_flag, max_bufsize;    static char myname[] = "ADIOI_NFS_WRITESTRIDED";    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size_x(fd->filetype, &filetype_size);    if (!filetype_size) {#ifdef HAVE_STATUS_SET_BYTES        MPIR_Status_set_bytes(status, datatype, 0);#endif        *error_code = MPI_SUCCESS;        return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size_x(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;    bufsize = buftype_size * count;/* get max_bufsize from the info object. */    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL + 1) * sizeof(char));    ADIOI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value, &info_flag);    max_bufsize = atoi(value);    ADIOI_Free(value);    if (!buftype_is_contig && filetype_is_contig) {/* noncontiguous in memory, contiguous in file. */        flat_buf = ADIOI_Flatten_and_find(datatype);        off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : fd->disp + etype_size * offset;        start_off = off;        end_offset = off + bufsize - 1;        writebuf_off = off;        writebuf = (char *) ADIOI_Malloc(max_bufsize);        writebuf_len = (int) (MPL_MIN(max_bufsize, end_offset - writebuf_off + 1));/* if atomicity is true, lock the region to be accessed */        if (fd->atomicity)            ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset - start_off + 1);        for (j = 0; j < count; j++)            for (i = 0; i < flat_buf->count; i++) {                userbuf_off = j * buftype_extent + flat_buf->indices[i];                req_off = off;                req_len = flat_buf->blocklens[i];                ADIOI_BUFFERED_WRITE_WITHOUT_READ off += flat_buf->blocklens[i];            }        /* write the buffer out finally */#ifdef ADIOI_MPE_LOGGING        MPE_Log_event(ADIOI_MPE_lseek_a, 0, NULL);#endif        lseek(fd->fd_sys, writebuf_off, SEEK_SET);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event(ADIOI_MPE_lseek_b, 0, NULL);#endif        if (!(fd->atomicity))            ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event(ADIOI_MPE_write_a, 0, NULL);#endif        err = write(fd->fd_sys, writebuf, writebuf_len);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event(ADIOI_MPE_write_b, 0, NULL);#endif        if (!(fd->atomicity))            ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len);        if (err == -1)            err_flag = 1;//.........这里部分代码省略.........
开发者ID:ParaStation,项目名称:psmpi2,代码行数:101,


示例9: ADIOI_NFS_ReadStrided

void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,                       MPI_Datatype datatype, int file_ptr_type,                       ADIO_Offset offset, ADIO_Status *status, int                       *error_code){/* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int i, j, k, err=-1, brd_size, st_index=0;    int num, size, sum, n_etypes_in_filetype, size_in_filetype;    MPI_Count bufsize;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int req_len, partial_read;    MPI_Count filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off;    ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off;    char *readbuf, *tmp_buf, *value;    int st_n_filetypes, readbuf_len;    ADIO_Offset frd_size=0, new_frd_size, st_frd_size;    int new_brd_size, err_flag=0, info_flag, max_bufsize;    static char myname[] = "ADIOI_NFS_READSTRIDED";    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size_x(fd->filetype, &filetype_size);    if ( ! filetype_size ) {#ifdef HAVE_STATUS_SET_BYTES	MPIR_Status_set_bytes(status, datatype, 0);#endif	*error_code = MPI_SUCCESS;	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size_x(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;    bufsize = buftype_size * count;/* get max_bufsize from the info object. */    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));    ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value,                 &info_flag);    max_bufsize = atoi(value);    ADIOI_Free(value);    if (!buftype_is_contig && filetype_is_contig) {/* noncontiguous in memory, contiguous in file. */	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype) flat_buf = flat_buf->next;        off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :                 fd->disp + etype_size * offset;	start_off = off;	end_offset = off + bufsize - 1;        readbuf_off = off;        readbuf = (char *) ADIOI_Malloc(max_bufsize);        readbuf_len = (int) (ADIOI_MIN(max_bufsize, end_offset-readbuf_off+1));/* if atomicity is true, lock (exclusive) the region to be accessed */        if (fd->atomicity)            ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event( ADIOI_MPE_lseek_a, 0, NULL );#endif	lseek(fd->fd_sys, readbuf_off, SEEK_SET);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event( ADIOI_MPE_lseek_b, 0, NULL );#endif        if (!(fd->atomicity)) ADIOI_READ_LOCK(fd, readbuf_off, SEEK_SET, readbuf_len);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event( ADIOI_MPE_read_a, 0, NULL );#endif        err = read(fd->fd_sys, readbuf, readbuf_len);#ifdef ADIOI_MPE_LOGGING        MPE_Log_event( ADIOI_MPE_read_b, 0, NULL );#endif        if (!(fd->atomicity)) ADIOI_UNLOCK(fd, readbuf_off, SEEK_SET, readbuf_len);        if (err == -1) err_flag = 1;        for (j=0; j<count; j++)            for (i=0; i<flat_buf->count; i++) {                userbuf_off = j*buftype_extent + flat_buf->indices[i];		req_off = off;		req_len = flat_buf->blocklens[i];		ADIOI_BUFFERED_READ                off += flat_buf->blocklens[i];            }//.........这里部分代码省略.........
开发者ID:anandhis,项目名称:ompi,代码行数:101,


示例10: ADIOI_GEN_ReadStrided_naive

void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,                       MPI_Datatype buftype, int file_ptr_type,                       ADIO_Offset offset, ADIO_Status *status, int                       *error_code){    /* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int brd_size, frd_size=0, b_index;    int bufsize, size, sum, n_etypes_in_filetype, size_in_filetype;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size, req_len;    MPI_Aint filetype_extent, buftype_extent;     int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off;    ADIO_Offset off, req_off, disp, end_offset=0, start_off;    ADIO_Status status1;    *error_code = MPI_SUCCESS;  /* changed below if error */    ADIOI_Datatype_iscontig(buftype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size(fd->filetype, &filetype_size);    if ( ! filetype_size ) {	*error_code = MPI_SUCCESS; 	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(buftype, &buftype_size);    MPI_Type_extent(buftype, &buftype_extent);    etype_size = fd->etype_size;    bufsize = buftype_size * count;    /* contiguous in buftype and filetype is handled elsewhere */    if (!buftype_is_contig && filetype_is_contig) {    	int b_count;	/* noncontiguous in memory, contiguous in file. */	ADIOI_Flatten_datatype(buftype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != buftype) flat_buf = flat_buf->next;        off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :               fd->disp + etype_size * offset;	start_off = off;	end_offset = off + bufsize - 1;	/* if atomicity is true, lock (exclusive) the region to be accessed */        if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && 	   (fd->file_system != ADIO_PVFS))	{            ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);	}	/* for each region in the buffer, grab the data and put it in	 * place	 */        for (b_count=0; b_count < count; b_count++) {            for (b_index=0; b_index < flat_buf->count; b_index++) {                userbuf_off = b_count*buftype_extent + 		              flat_buf->indices[b_index];		req_off = off;		req_len = flat_buf->blocklens[b_index];		ADIO_ReadContig(fd, 				(char *) buf + userbuf_off,				req_len, 				MPI_BYTE, 		    		ADIO_EXPLICIT_OFFSET,				req_off,				&status1,				error_code);		if (*error_code != MPI_SUCCESS) return;		/* off is (potentially) used to save the final offset later */                off += flat_buf->blocklens[b_index];            }	}        if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && 	   (fd->file_system != ADIO_PVFS))	{            ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);	}        if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;    }    else {  /* noncontiguous in file */    	int f_index, st_frd_size, st_index = 0, st_n_filetypes;	int flag;        /* First we're going to calculate a set of values for use in all//.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich-cce,代码行数:101,


示例11: ADIOI_PVFS_WriteStridedListIO

void ADIOI_PVFS_WriteStridedListIO(ADIO_File fd, void *buf, int count,                       MPI_Datatype datatype, int file_ptr_type,                       ADIO_Offset offset, ADIO_Status *status, int                       *error_code) {/* Since PVFS does not support file locking, can't do buffered writes   as on Unix *//* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0;    int bufsize, size, sum, n_etypes_in_filetype, size_in_filetype;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off;    ADIO_Offset off, disp, start_off;    int flag, st_fwr_size, st_n_filetypes;    int new_bwr_size, new_fwr_size, err_flag=0;    int mem_list_count, file_list_count;    char ** mem_offsets;    int64_t *file_offsets;    int *mem_lengths;    int32_t *file_lengths;    int total_blks_to_write;    int max_mem_list, max_file_list;    int b_blks_wrote;    int f_data_wrote;    int size_wrote=0, n_write_lists, extra_blks;    int end_bwr_size, end_fwr_size;    int start_k, start_j, new_file_write, new_buffer_write;    int start_mem_offset;#define MAX_ARRAY_SIZE 1024    static char myname[] = "ADIOI_PVFS_WRITESTRIDED";/* PFS file pointer modes are not relevant here, because PFS does   not support strided accesses. */    /* --BEGIN ERROR HANDLING-- */    if (fd->atomicity) {	*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,					   myname, __LINE__,					   MPI_ERR_INTERN,					   "Atomic mode set in PVFS I/O function", 0);	return;    }    /* --END ERROR HANDLING-- */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size(fd->filetype, &filetype_size);    if ( ! filetype_size ) {	*error_code = MPI_SUCCESS; 	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;        bufsize = buftype_size * count;    if (!buftype_is_contig && filetype_is_contig) {/* noncontiguous in memory, contiguous in file.  */        int64_t file_offsets;	int32_t file_lengths;	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype) flat_buf = flat_buf->next;		if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {	    off = fd->disp + etype_size * offset;	    pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET);	}	else off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET);	file_list_count = 1;	file_offsets = off;	file_lengths = 0;	total_blks_to_write = count*flat_buf->count;	b_blks_wrote = 0;	/* allocate arrays according to max usage */	if (total_blks_to_write > MAX_ARRAY_SIZE)	    mem_list_count = MAX_ARRAY_SIZE;	else mem_list_count = total_blks_to_write;	mem_offsets = (char**)ADIOI_Malloc(mem_list_count*sizeof(char*));	mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int));//.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich-cce,代码行数:101,


示例12: ADIOI_GEN_WriteStridedColl

void ADIOI_GEN_WriteStridedColl(ADIO_File fd, const void *buf, int count,                                MPI_Datatype datatype, int file_ptr_type,                                ADIO_Offset offset, ADIO_Status * status, int                                *error_code){/* Uses a generalized version of the extended two-phase method described   in "An Extended Two-Phase Method for Accessing Sections of   Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary,   Scientific Programming, (5)4:301--317, Winter 1996.   http://www.mcs.anl.gov/home/thakur/ext2ph.ps */    ADIOI_Access *my_req;    /* array of nprocs access structures, one for each other process in     * whose file domain this process's request lies */    ADIOI_Access *others_req;    /* array of nprocs access structures, one for each other process     * whose request lies in this process's file domain. */    int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank;    int contig_access_count = 0, interleave_count = 0, buftype_is_contig;    int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs;    ADIO_Offset orig_fp, start_offset, end_offset, fd_size, min_st_offset, off;    ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL,        *fd_end = NULL, *end_offsets = NULL;    MPI_Aint *buf_idx = NULL;    ADIO_Offset *len_list = NULL;    int old_error, tmp_error;    if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) {        /* Cast away const'ness as the below function is used for read         * and write */        ADIOI_IOStridedColl(fd, (char *) buf, count, ADIOI_WRITE, datatype,                            file_ptr_type, offset, status, error_code);        return;    }    MPI_Comm_size(fd->comm, &nprocs);    MPI_Comm_rank(fd->comm, &myrank);/* the number of processes that actually perform I/O, nprocs_for_coll, * is stored in the hints off the ADIO_File structure */    nprocs_for_coll = fd->hints->cb_nodes;    orig_fp = fd->fp_ind;    /* only check for interleaving if cb_write isn't disabled */    if (fd->hints->cb_write != ADIOI_HINT_DISABLE) {        /* For this process's request, calculate the list of offsets and         * lengths in the file and determine the start and end offsets. */        /* Note: end_offset points to the last byte-offset that will be accessed.         * e.g., if start_offset=0 and 100 bytes to be read, end_offset=99 */        ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset,                              &offset_list, &len_list, &start_offset,                              &end_offset, &contig_access_count);        /* each process communicates its start and end offsets to other         * processes. The result is an array each of start and end offsets stored         * in order of process rank. */        st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs * 2 * sizeof(ADIO_Offset));        end_offsets = st_offsets + nprocs;        MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1, ADIO_OFFSET, fd->comm);        MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1, ADIO_OFFSET, fd->comm);        /* are the accesses of different processes interleaved? */        for (i = 1; i < nprocs; i++)            if ((st_offsets[i] < end_offsets[i - 1]) && (st_offsets[i] <= end_offsets[i]))                interleave_count++;        /* This is a rudimentary check for interleaving, but should suffice         * for the moment. */    }    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    if (fd->hints->cb_write == ADIOI_HINT_DISABLE ||        (!interleave_count && (fd->hints->cb_write == ADIOI_HINT_AUTO))) {        /* use independent accesses */        if (fd->hints->cb_write != ADIOI_HINT_DISABLE) {            ADIOI_Free(offset_list);            ADIOI_Free(st_offsets);        }        fd->fp_ind = orig_fp;        ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);        if (buftype_is_contig && filetype_is_contig) {            if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {                off = fd->disp + (ADIO_Offset) (fd->etype_size) * offset;                ADIO_WriteContig(fd, buf, count, datatype,                                 ADIO_EXPLICIT_OFFSET, off, status, error_code);            } else                ADIO_WriteContig(fd, buf, count, datatype, ADIO_INDIVIDUAL, 0, status, error_code);        } else            ADIO_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, status, error_code);        return;//.........这里部分代码省略.........
开发者ID:jeffhammond,项目名称:mpich,代码行数:101,


示例13: ADIOI_GEN_SeekIndividual

ADIO_Offset ADIOI_GEN_SeekIndividual(ADIO_File fd, ADIO_Offset offset, 				     int whence, int *error_code){/* implemented for whence=SEEK_SET only. SEEK_CUR and SEEK_END must   be converted to the equivalent with SEEK_SET before calling this    routine. *//* offset is in units of etype relative to the filetype */    ADIO_Offset off;    ADIOI_Flatlist_node *flat_file;    int i;    ADIO_Offset n_etypes_in_filetype, n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    ADIO_Offset size_in_filetype, sum;    unsigned filetype_size;    int etype_size, filetype_is_contig;    MPI_Aint filetype_extent;    ADIOI_UNREFERENCED_ARG(whence);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    etype_size = fd->etype_size;    if (filetype_is_contig) off = fd->disp + (ADIO_Offset)etype_size * offset;    else {        flat_file = ADIOI_Flatlist;        while (flat_file->type != fd->filetype) flat_file = flat_file->next;	MPI_Type_extent(fd->filetype, &filetype_extent);	MPI_Type_size(fd->filetype, (int*)&filetype_size);	if ( ! filetype_size ) {	    /* Since offset relative to the filetype size, we can't	       do compute the offset when that result is zero.	       Return zero for the offset for now */	    *error_code = MPI_SUCCESS; 	    return 0;	}	n_etypes_in_filetype = filetype_size/etype_size;	n_filetypes = offset / n_etypes_in_filetype;	etype_in_filetype = offset % n_etypes_in_filetype;	size_in_filetype = etype_in_filetype * etype_size; 	sum = 0;	for (i=0; i<flat_file->count; i++) {	    sum += flat_file->blocklens[i];	    if (sum > size_in_filetype) {		abs_off_in_filetype = flat_file->indices[i] +		    size_in_filetype - (sum - flat_file->blocklens[i]);		break;	    }	}	/* abs. offset in bytes in the file */	off = fd->disp + n_filetypes * filetype_extent +                abs_off_in_filetype;    }/* * we used to call lseek here and update both fp_ind and fp_sys_posn, but now * we don't seek and only update fp_ind (ROMIO's idea of where we are in the * file).  We leave the system file descriptor and fp_sys_posn alone.  * The fs-specifc ReadContig and WriteContig will seek to the correct place in * the file before reading/writing if the 'offset' parameter doesn't match * fp_sys_posn */    fd->fp_ind = off;    *error_code = MPI_SUCCESS;    return off;}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:73,


示例14: ADIOI_Get_eof_offset

void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset){    unsigned filetype_size;    int error_code, filetype_is_contig, etype_size;    ADIO_Offset fsize, disp, sum=0, size_in_file, n_filetypes, rem;    int flag, i;    ADIO_Fcntl_t *fcntl_struct;    MPI_Aint filetype_extent;    ADIOI_Flatlist_node *flat_file;    /* find the eof in bytes */    fcntl_struct = (ADIO_Fcntl_t *) ADIOI_Malloc(sizeof(ADIO_Fcntl_t));    ADIO_Fcntl(fd, ADIO_FCNTL_GET_FSIZE, fcntl_struct, &error_code);    fsize = fcntl_struct->fsize;    ADIOI_Free(fcntl_struct);	    /* Find the offset in etype units corresponding to eof.       The eof could lie in a hole in the current view, or in the        middle of an etype. In that case the offset will be the offset       corresponding to the start of the next etype in the current view.*/    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    etype_size = fd->etype_size;    if (filetype_is_contig) 	*eof_offset = (fsize - fd->disp + etype_size - 1)/etype_size;    /* ceiling division in case fsize is not a multiple of etype_size;*/    else {	/* filetype already flattened in ADIO_Open */	flat_file = ADIOI_Flatlist;	while (flat_file->type != fd->filetype) 	    flat_file = flat_file->next;		MPI_Type_size(fd->filetype, (int*)&filetype_size);	MPI_Type_extent(fd->filetype, &filetype_extent);	disp = fd->disp;	n_filetypes = -1;	flag = 0;	while (!flag) {	    sum = 0;	    n_filetypes++;	    for (i=0; i<flat_file->count; i++) {		sum += flat_file->blocklens[i];		if (disp + flat_file->indices[i] + 		    n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent + 		       flat_file->blocklens[i] >= fsize) {		    if (disp + flat_file->indices[i] + 			   n_filetypes * ADIOI_AINT_CAST_TO_OFFSET filetype_extent >= fsize)			sum -= flat_file->blocklens[i];		    else {			rem = (disp + flat_file->indices[i] + 				n_filetypes* ADIOI_AINT_CAST_TO_OFFSET filetype_extent				+ flat_file->blocklens[i] - fsize);			sum -= rem;		    }		    flag = 1;		    break;		}	    }	}	size_in_file = n_filetypes*(ADIO_Offset)filetype_size + sum;	*eof_offset = (size_in_file+etype_size-1)/etype_size; /* ceiling division */    }}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:65,


示例15: handle

/*@    MPI_File_write - Write using individual file pointerInput Parameters:. fh - file handle (handle). buf - initial address of buffer (choice). count - number of elements in buffer (nonnegative integer). datatype - datatype of each buffer element (handle)Output Parameters:. status - status object (Status).N fortran@*/int MPI_File_write(MPI_File fh, void *buf, int count,                    MPI_Datatype datatype, MPI_Status *status){    int error_code, bufsize, buftype_is_contig, filetype_is_contig;#ifndef PRINT_ERR_MSG    static char myname[] = "MPI_FILE_WRITE";#endif    int datatype_size;    ADIO_Offset off;#ifdef MPI_hpux    int fl_xmpi;    HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITE, TRDTBLOCK, fh, datatype, count);#endif /* MPI_hpux */#ifdef PRINT_ERR_MSG    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {	FPRINTF(stderr, "MPI_File_write: Invalid file handle/n");	MPI_Abort(MPI_COMM_WORLD, 1);    }#else    ADIOI_TEST_FILE_HANDLE(fh, myname);#endif    if (count < 0) {#ifdef PRINT_ERR_MSG	FPRINTF(stderr, "MPI_File_write: Invalid count argument/n");	MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,				     myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);#endif    }    if (datatype == MPI_DATATYPE_NULL) {#ifdef PRINT_ERR_MSG        FPRINTF(stderr, "MPI_File_write: Invalid datatype/n");        MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,				     myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);	    #endif    }    MPI_Type_size(datatype, &datatype_size);    if (count*datatype_size == 0) {#ifdef MPI_hpux	HPMP_IO_END(fl_xmpi, fh, datatype, count);#endif /* MPI_hpux */	return MPI_SUCCESS;    }    if ((count*datatype_size) % fh->etype_size != 0) {#ifdef PRINT_ERR_MSG        FPRINTF(stderr, "MPI_File_write: Only an integral number of etypes can be accessed/n");        MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,				     myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);	    #endif    }    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {#ifdef PRINT_ERR_MSG	FPRINTF(stderr, "MPI_File_write: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL/n");	MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION,                         MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);#endif    }    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);    /* contiguous or strided? */    if (buftype_is_contig && filetype_is_contig) {	bufsize = datatype_size * count;        /* if atomic mode requested, lock (exclusive) the region, because there           could be a concurrent noncontiguous request. Locking doesn't            work on PIOFS and PVFS, and on NFS it is done in the ADIO_WriteContig.*///.........这里部分代码省略.........
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,


示例16: ADIOI_GEN_ReadStridedColl

void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count,			       MPI_Datatype datatype, int file_ptr_type,			       ADIO_Offset offset, ADIO_Status *status, int			       *error_code){/* Uses a generalized version of the extended two-phase method described   in "An Extended Two-Phase Method for Accessing Sections of    Out-of-Core Arrays", Rajeev Thakur and Alok Choudhary,   Scientific Programming, (5)4:301--317, Winter 1996.    http://www.mcs.anl.gov/home/thakur/ext2ph.ps */    ADIOI_Access *my_req;     /* array of nprocs structures, one for each other process in       whose file domain this process's request lies */        ADIOI_Access *others_req;    /* array of nprocs structures, one for each other process       whose request lies in this process's file domain. */    int i, filetype_is_contig, nprocs, nprocs_for_coll, myrank;    int contig_access_count=0, interleave_count = 0, buftype_is_contig;    int *count_my_req_per_proc, count_my_req_procs, count_others_req_procs;    ADIO_Offset start_offset, end_offset, orig_fp, fd_size, min_st_offset, off;    ADIO_Offset *offset_list = NULL, *st_offsets = NULL, *fd_start = NULL,	*fd_end = NULL, *end_offsets = NULL;    ADIO_Offset *len_list = NULL;    int *buf_idx = NULL;#ifdef HAVE_STATUS_SET_BYTES    MPI_Count bufsize, size;#endif    if (fd->hints->cb_pfr != ADIOI_HINT_DISABLE) {        ADIOI_IOStridedColl (fd, buf, count, ADIOI_READ, datatype, 			file_ptr_type, offset, status, error_code);        return;    }    MPI_Comm_size(fd->comm, &nprocs);    MPI_Comm_rank(fd->comm, &myrank);    /* number of aggregators, cb_nodes, is stored in the hints */    nprocs_for_coll = fd->hints->cb_nodes;    orig_fp = fd->fp_ind;    /* only check for interleaving if cb_read isn't disabled */    if (fd->hints->cb_read != ADIOI_HINT_DISABLE) {    /* For this process's request, calculate the list of offsets and       lengths in the file and determine the start and end offsets. */    /* Note: end_offset points to the last byte-offset that will be accessed.       e.g., if start_offset=0 and 100 bytes to be read, end_offset=99*/	ADIOI_Calc_my_off_len(fd, count, datatype, file_ptr_type, offset,			      &offset_list, &len_list, &start_offset,			      &end_offset, &contig_access_count);     #ifdef RDCOLL_DEBUG    for (i=0; i<contig_access_count; i++) {	      DBG_FPRINTF(stderr, "rank %d  off %lld  len %lld/n", 			      myrank, offset_list[i], len_list[i]);	      }#endif	/* each process communicates its start and end offsets to other 	   processes. The result is an array each of start and end offsets	   stored in order of process rank. */     	st_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset));	end_offsets = (ADIO_Offset *) ADIOI_Malloc(nprocs*sizeof(ADIO_Offset));	MPI_Allgather(&start_offset, 1, ADIO_OFFSET, st_offsets, 1,		      ADIO_OFFSET, fd->comm);	MPI_Allgather(&end_offset, 1, ADIO_OFFSET, end_offsets, 1,		      ADIO_OFFSET, fd->comm);	/* are the accesses of different processes interleaved? */	for (i=1; i<nprocs; i++)	    if ((st_offsets[i] < end_offsets[i-1]) &&                 (st_offsets[i] <= end_offsets[i]))                interleave_count++;	/* This is a rudimentary check for interleaving, but should suffice	   for the moment. */    }    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    if (fd->hints->cb_read == ADIOI_HINT_DISABLE	|| (!interleave_count && (fd->hints->cb_read == ADIOI_HINT_AUTO)))     {	/* don't do aggregation */	if (fd->hints->cb_read != ADIOI_HINT_DISABLE) {	    ADIOI_Free(offset_list);	    ADIOI_Free(len_list);	    ADIOI_Free(st_offsets);	    ADIOI_Free(end_offsets);	}	fd->fp_ind = orig_fp;//.........这里部分代码省略.........
开发者ID:ORNL,项目名称:ompi,代码行数:101,


示例17: ADIOI_Read_and_exch

//.........这里部分代码省略.........    }    MPI_Allreduce(&ntimes, &max_ntimes, 1, MPI_INT, MPI_MAX, fd->comm);     read_buf = fd->io_buf;  /* Allocated at open time */    curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs, sizeof(int));     /* its use is explained below. calloc initializes to 0. */    count = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* to store count of how many off-len pairs per proc are satisfied       in an iteration. */    partial_send = (int *) ADIOI_Calloc(nprocs, sizeof(int));    /* if only a portion of the last off-len pair is sent to a process        in a particular iteration, the length sent is stored here.       calloc initializes to 0. */    send_size = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* total size of data to be sent to each proc. in an iteration */    recv_size = (int *) ADIOI_Malloc(nprocs * sizeof(int));    /* total size of data to be recd. from each proc. in an iteration.       Of size nprocs so that I can use MPI_Alltoall later. */    recd_from_proc = (int *) ADIOI_Calloc(nprocs, sizeof(int));    /* amount of data recd. so far from each proc. Used in       ADIOI_Fill_user_buffer. initialized to 0 here. */    start_pos = (int *) ADIOI_Malloc(nprocs*sizeof(int));    /* used to store the starting value of curr_offlen_ptr[i] in        this iteration */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    if (!buftype_is_contig) {	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;        while (flat_buf->type != datatype) flat_buf = flat_buf->next;    }    MPI_Type_extent(datatype, &buftype_extent);    done = 0;    off = st_loc;    for_curr_iter = for_next_iter = 0;    MPI_Comm_rank(fd->comm, &rank);    for (m=0; m<ntimes; m++) {       /* read buf of size coll_bufsize (or less) */       /* go through all others_req and check if any are satisfied          by the current read */       /* since MPI guarantees that displacements in filetypes are in           monotonically nondecreasing order, I can maintain a pointer	  (curr_offlen_ptr) to           current off-len pair for each process in others_req and scan          further only from there. There is still a problem of filetypes          such as:  (1, 2, 3 are not process nos. They are just numbers for          three chunks of data, specified by a filetype.)                   1  -------!--                   2    -----!----                   3       --!-----          where ! indicates where the current read_size limitation cuts           through the filetype.  I resolve this by reading up to !, but
开发者ID:ORNL,项目名称:ompi,代码行数:67,


示例18: ADIOI_Calc_my_off_len

void ADIOI_Calc_my_off_len(ADIO_File fd, int bufcount, MPI_Datatype			    datatype, int file_ptr_type, ADIO_Offset			    offset, ADIO_Offset **offset_list_ptr, ADIO_Offset			    **len_list_ptr, ADIO_Offset *start_offset_ptr,			    ADIO_Offset *end_offset_ptr, int			   *contig_access_count_ptr){    MPI_Count filetype_size, etype_size;    MPI_Count buftype_size;    int i, j, k;    ADIO_Offset i_offset;    ADIO_Offset frd_size=0, old_frd_size=0;    int st_index=0;    ADIO_Offset n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    ADIO_Offset bufsize;    ADIO_Offset sum, n_etypes_in_filetype, size_in_filetype;    int contig_access_count, filetype_is_contig;    ADIO_Offset *len_list;    MPI_Aint filetype_extent, filetype_lb;    ADIOI_Flatlist_node *flat_file;    ADIO_Offset *offset_list, off, end_offset=0, disp;#ifdef AGGREGATION_PROFILE    MPE_Log_event (5028, 0, NULL);#endif    /* For this process's request, calculate the list of offsets and   lengths in the file and determine the start and end offsets. */    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size_x(fd->filetype, &filetype_size);    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_lb(fd->filetype, &filetype_lb);    MPI_Type_size_x(datatype, &buftype_size);    etype_size = fd->etype_size;    if ( ! filetype_size ) {	*contig_access_count_ptr = 0;	*offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset));	*len_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset));        /* 2 is for consistency. everywhere I malloc one more than needed */	offset_list = *offset_list_ptr;	len_list = *len_list_ptr;        offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :                  fd->disp + (ADIO_Offset)etype_size * offset;	len_list[0] = 0;	*start_offset_ptr = offset_list[0];	*end_offset_ptr = offset_list[0] + len_list[0] - 1;		return;    }    if (filetype_is_contig) {	*contig_access_count_ptr = 1;        	*offset_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset));	*len_list_ptr = (ADIO_Offset *) ADIOI_Malloc(2*sizeof(ADIO_Offset));        /* 2 is for consistency. everywhere I malloc one more than needed */	offset_list = *offset_list_ptr;	len_list = *len_list_ptr;        offset_list[0] = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :                  fd->disp + (ADIO_Offset)etype_size * offset;	len_list[0] = (ADIO_Offset)bufcount * (ADIO_Offset)buftype_size;	*start_offset_ptr = offset_list[0];	*end_offset_ptr = offset_list[0] + len_list[0] - 1;	/* update file pointer */	if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = *end_offset_ptr + 1;    }    else {       /* First calculate what size of offset_list and len_list to allocate */          /* filetype already flattened in ADIO_Open or ADIO_Fcntl */	flat_file = ADIOI_Flatlist;	while (flat_file->type != fd->filetype) flat_file = flat_file->next;	disp = fd->disp;#ifdef RDCOLL_DEBUG         {            int ii;            DBG_FPRINTF(stderr, "flattened %3lld : ", flat_file->count );            for (ii=0; ii<flat_file->count; ii++) {                DBG_FPRINTF(stderr, "%16lld:%-16lld", flat_file->indices[ii], flat_file->blocklens[ii] );            }            DBG_FPRINTF(stderr, "/n" );        }#endif	if (file_ptr_type == ADIO_INDIVIDUAL) {           /* Wei-keng reworked type processing to be a bit more efficient */            offset       = fd->fp_ind - disp;            n_filetypes  = (offset - flat_file->indices[0]) / filetype_extent;             offset     -= (ADIO_Offset)n_filetypes * filetype_extent;	     	/* now offset is local to this extent */             /* find the block where offset is located, skip blocklens[i]==0 *///.........这里部分代码省略.........
开发者ID:ORNL,项目名称:ompi,代码行数:101,


示例19: ADIOI_PIOFS_WriteStrided

void ADIOI_PIOFS_WriteStrided(ADIO_File fd, void *buf, int count,                       MPI_Datatype datatype, int file_ptr_type,                       ADIO_Offset offset, ADIO_Status *status, int                       *error_code){/* Since PIOFS does not support file locking, can't do buffered writes   as on Unix *//* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    struct iovec *iov;    int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0;    int bufsize, num, size, sum, n_etypes_in_filetype, size_in_filetype;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent, indx;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset off, disp;    int flag, new_bwr_size, new_fwr_size, err_flag=0;#ifndef PRINT_ERR_MSG    static char myname[] = "ADIOI_PIOFS_WRITESTRIDED";#endif    if (fd->atomicity) {	FPRINTF(stderr, "ROMIO cannot guarantee atomicity of noncontiguous accesses in atomic mode, as PIOFS doesn't support file locking. Use nonatomic mode and its associated semantics./n");	MPI_Abort(MPI_COMM_WORLD, 1);    }    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size(fd->filetype, &filetype_size);    if ( ! filetype_size ) {	*error_code = MPI_SUCCESS; 	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;        bufsize = buftype_size * count;    if (!buftype_is_contig && filetype_is_contig) {/* noncontiguous in memory, contiguous in file. use writev */	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype) flat_buf = flat_buf->next;/* There is a limit of 16 on the number of iovecs for readv/writev! */	iov = (struct iovec *) ADIOI_Malloc(16*sizeof(struct iovec));	if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {	    off = fd->disp + etype_size * offset;	    llseek(fd->fd_sys, off, SEEK_SET);	}	else off = llseek(fd->fd_sys, fd->fp_ind, SEEK_SET);	k = 0;	for (j=0; j<count; j++) 	    for (i=0; i<flat_buf->count; i++) {		iov[k].iov_base = ((char *) buf) + j*buftype_extent +		    flat_buf->indices[i]; 		iov[k].iov_len = flat_buf->blocklens[i];		/*FPRINTF(stderr, "%d %d/n", iov[k].iov_base, iov[k].iov_len);*/		off += flat_buf->blocklens[i];		k = (k+1)%16;		if (!k) {		    err = writev(fd->fd_sys, iov, 16);		    if (err == -1) err_flag = 1;		}	    }	if (k) {	    err = writev(fd->fd_sys, iov, k);	    if (err == -1) err_flag = 1;	}	if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;	ADIOI_Free(iov);	if (err_flag) {#ifdef MPICH2	    *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",		"**io %s", strerror(errno));#elif defined(PRINT_ERR_MSG) 	    *error_code =  MPI_ERR_UNKNOWN;#else /* MPICH-1 */	    *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,			      myname, "I/O Error", "%s", strerror(errno));	    ADIOI_Error(fd, *error_code, myname);#endif//.........这里部分代码省略.........
开发者ID:aosm,项目名称:openmpi,代码行数:101,


示例20: MPIOI_File_iwrite

int MPIOI_File_iwrite(MPI_File mpi_fh,		      MPI_Offset offset,		      int file_ptr_type,		      void *buf,		      int count,		      MPI_Datatype datatype,		      char *myname,		      MPI_Request *request){    int error_code, bufsize, buftype_is_contig, filetype_is_contig;    int datatype_size;    ADIO_Status status;    ADIO_Offset off;    ADIO_File fh;    MPI_Offset nbytes=0;    fh = MPIO_File_resolve(mpi_fh);    /* --BEGIN ERROR HANDLING-- */    MPIO_CHECK_FILE_HANDLE(fh, myname, error_code);    MPIO_CHECK_COUNT(fh, count, myname, error_code);    MPIO_CHECK_DATATYPE(fh, datatype, myname, error_code);    if (file_ptr_type == ADIO_EXPLICIT_OFFSET && offset < 0) {	error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,					  myname, __LINE__, MPI_ERR_ARG,					  "**iobadoffset", 0);	error_code = MPIO_Err_return_file(fh, error_code);	goto fn_exit;    }    /* --END ERROR HANDLING-- */    MPI_Type_size(datatype, &datatype_size);    /* --BEGIN ERROR HANDLING-- */    MPIO_CHECK_INTEGRAL_ETYPE(fh, count, datatype_size, myname, error_code);    MPIO_CHECK_WRITABLE(fh, myname, error_code);    MPIO_CHECK_NOT_SEQUENTIAL_MODE(fh, myname, error_code);    MPIO_CHECK_COUNT_SIZE(fh, count, datatype_size, myname, error_code);    /* --END ERROR HANDLING-- */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);        ADIOI_TEST_DEFERRED(fh, myname, &error_code);    if (buftype_is_contig && filetype_is_contig) {	/* convert sizes to bytes */	bufsize = datatype_size * count;	if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {	    off = fh->disp + fh->etype_size * offset;	}	else {	    off = fh->fp_ind;	}        if (!(fh->atomicity)) {	    ADIO_IwriteContig(fh, buf, count, datatype, file_ptr_type,			      off, request, &error_code);	}	else {            /* to maintain strict atomicity semantics with other concurrent              operations, lock (exclusive) and call blocking routine */	    if (ADIO_Feature(fh, ADIO_LOCKS) )	    {                ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize);	    }            ADIO_WriteContig(fh, buf, count, datatype, file_ptr_type, off, 			     &status, &error_code);  	    if (ADIO_Feature(fh, ADIO_LOCKS) )	    {                ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);	    }	    if (error_code == MPI_SUCCESS) {		nbytes = count * datatype_size;	    }	    	    MPIO_Completed_request_create(&fh, nbytes, &error_code, request);	}    }    else {	ADIO_IwriteStrided(fh, buf, count, datatype, file_ptr_type,			   offset, request, &error_code);    }fn_exit:    return error_code;}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:89,


示例21: ADIOI_Exch_and_write

//.........这里部分代码省略.........    curr_offlen_ptr = (int *) ADIOI_Calloc(nprocs * 10, sizeof(int));    /* its use is explained below. calloc initializes to 0. */    count = curr_offlen_ptr + nprocs;    /* to store count of how many off-len pairs per proc are satisfied     * in an iteration. */    partial_recv = count + nprocs;    /* if only a portion of the last off-len pair is recd. from a process     * in a particular iteration, the length recd. is stored here.     * calloc initializes to 0. */    send_size = partial_recv + nprocs;    /* total size of data to be sent to each proc. in an iteration.     * Of size nprocs so that I can use MPI_Alltoall later. */    recv_size = send_size + nprocs;    /* total size of data to be recd. from each proc. in an iteration. */    sent_to_proc = recv_size + nprocs;    /* amount of data sent to each proc so far. Used in     * ADIOI_Fill_send_buffer. initialized to 0 here. */    send_buf_idx = sent_to_proc + nprocs;    curr_to_proc = send_buf_idx + nprocs;    done_to_proc = curr_to_proc + nprocs;    /* Above three are used in ADIOI_Fill_send_buffer */    start_pos = done_to_proc + nprocs;    /* used to store the starting value of curr_offlen_ptr[i] in     * this iteration */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    if (!buftype_is_contig) {        flat_buf = ADIOI_Flatten_and_find(datatype);    }    MPI_Type_extent(datatype, &buftype_extent);/* I need to check if there are any outstanding nonblocking writes to   the file, which could potentially interfere with the writes taking   place in this collective write call. Since this is not likely to be   common, let me do the simplest thing possible here: Each process   completes all pending nonblocking operations before completing. */    /*ADIOI_Complete_async(error_code);     * if (*error_code != MPI_SUCCESS) return;     * MPI_Barrier(fd->comm);     */    done = 0;    off = st_loc;    for (m = 0; m < ntimes; m++) {        /* go through all others_req and check which will be satisfied         * by the current write */        /* Note that MPI guarantees that displacements in filetypes are in         * monotonically nondecreasing order and that, for writes, the         * filetypes cannot specify overlapping regions in the file. This         * simplifies implementation a bit compared to reads. */        /* off = start offset in the file for the data to be written in         * this iteration         * size = size of data written (bytes) corresponding to off
开发者ID:jeffhammond,项目名称:mpich,代码行数:67,


示例22: handle

/*@    MPI_File_read_shared - Read using shared file pointerInput Parameters:. fh - file handle (handle). count - number of elements in buffer (nonnegative integer). datatype - datatype of each buffer element (handle)Output Parameters:. buf - initial address of buffer (choice). status - status object (Status).N fortran@*/int MPI_File_read_shared(MPI_File fh, void *buf, int count,                   MPI_Datatype datatype, MPI_Status *status){    int error_code, bufsize, buftype_is_contig, filetype_is_contig;#ifndef PRINT_ERR_MSG    static char myname[] = "MPI_FILE_READ_SHARED";#endif    int datatype_size, incr;    ADIO_Offset off, shared_fp;#ifdef PRINT_ERR_MSG    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {	FPRINTF(stderr, "MPI_File_read_shared: Invalid file handle/n");	MPI_Abort(MPI_COMM_WORLD, 1);    }#else    ADIOI_TEST_FILE_HANDLE(fh, myname);#endif    if (count < 0) {#ifdef PRINT_ERR_MSG	FPRINTF(stderr, "MPI_File_read_shared: Invalid count argument/n");	MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,				     myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);#endif    }    if (datatype == MPI_DATATYPE_NULL) {#ifdef PRINT_ERR_MSG        FPRINTF(stderr, "MPI_File_read_shared: Invalid datatype/n");        MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,				     myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);	    #endif    }    MPI_Type_size(datatype, &datatype_size);    if (count*datatype_size == 0) return MPI_SUCCESS;    if ((count*datatype_size) % fh->etype_size != 0) {#ifdef PRINT_ERR_MSG	FPRINTF(stderr, "MPI_File_read_shared: Only an integral number of etypes can be accessed/n");	MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,				     myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);	    #endif    }    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)) {#ifdef PRINT_ERR_MSG	FPRINTF(stderr, "MPI_File_read_shared: Shared file pointer not supported on PIOFS and PVFS/n");	MPI_Abort(MPI_COMM_WORLD, 1);#else	error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION,                     MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);	return ADIOI_Error(fh, error_code, myname);#endif    }    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);    incr = (count*datatype_size)/fh->etype_size;    ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);    if (error_code != MPI_SUCCESS) {	FPRINTF(stderr, "MPI_File_read_shared: Error! Could not access shared file pointer./n");	MPI_Abort(MPI_COMM_WORLD, 1);    }    /* contiguous or strided? */    if (buftype_is_contig && filetype_is_contig) {	/* convert count and shared_fp to bytes */        bufsize = datatype_size * count;        off = fh->disp + fh->etype_size * shared_fp;        /* if atomic mode requested, lock (exclusive) the region, because there           could be a concurrent noncontiguous request. On NFS, locking            is done in the ADIO_ReadContig.*///.........这里部分代码省略.........
开发者ID:davidheryanto,项目名称:sc14,代码行数:101,


示例23: ADIOI_LUSTRE_WriteStrided

void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, void *buf, int count,			       MPI_Datatype datatype, int file_ptr_type,			       ADIO_Offset offset, ADIO_Status * status,			       int *error_code){    /* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    ADIO_Offset i_offset, sum, size_in_filetype;    int i, j, k, st_index=0;    int n_etypes_in_filetype;    ADIO_Offset num, size, n_filetypes, etype_in_filetype, st_n_filetypes;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off;    ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off;    char *writebuf;    unsigned bufsize, writebuf_len, write_sz;    ADIO_Status status1;    ADIO_Offset new_bwr_size, new_fwr_size, st_fwr_size, fwr_size=0, bwr_size, req_len;    int stripe_size;    static char myname[] = "ADIOI_LUSTRE_WriteStrided";    if (fd->hints->ds_write == ADIOI_HINT_DISABLE) {	/* if user has disabled data sieving on writes, use naive	 * approach instead.	 */	ADIOI_GEN_WriteStrided_naive(fd,				     buf,				     count,				     datatype,				     file_ptr_type,				     offset, status, error_code);	return;    }    *error_code = MPI_SUCCESS;	/* changed below if error */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size(fd->filetype, &filetype_size);    if (!filetype_size) {#ifdef HAVE_STATUS_SET_BYTES	MPIR_Status_set_bytes(status, datatype, 0);#endif	*error_code = MPI_SUCCESS;	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;    ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(unsigned)buftype_size * (ADIO_Offset)count));    bufsize = buftype_size * count;    /* get striping info */    stripe_size = fd->hints->striping_unit;    /* Different buftype to different filetype */    if (!buftype_is_contig && filetype_is_contig) {        /* noncontiguous in memory, contiguous in file. */	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype)	    flat_buf = flat_buf->next;	off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :            fd->disp + (ADIO_Offset)etype_size * offset;	start_off = off;	end_offset = start_off + bufsize - 1;        /* write stripe size buffer each time */	writebuf = (char *) ADIOI_Malloc(ADIOI_MIN(bufsize, stripe_size));        writebuf_off = 0;        writebuf_len = 0;        /* if atomicity is true, lock the region to be accessed */	if (fd->atomicity)	    ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, bufsize);	for (j = 0; j < count; j++) {	    for (i = 0; i < flat_buf->count; i++) {                userbuf_off = (ADIO_Offset)j * (ADIO_Offset)buftype_extent +                    flat_buf->indices[i];		req_off = off;		req_len = flat_buf->blocklens[i];		ADIOI_BUFFERED_WRITE_WITHOUT_READ		off += flat_buf->blocklens[i];	    }        }	/* write the buffer out finally */	ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE,			 ADIO_EXPLICIT_OFFSET, writebuf_off, &status1,			 error_code);//.........这里部分代码省略.........
开发者ID:Dissolubilis,项目名称:ompi-svn-mirror,代码行数:101,


示例24: ADIOI_NFS_WriteStrided

void ADIOI_NFS_WriteStrided(ADIO_File fd, void *buf, int count,                       MPI_Datatype datatype, int file_ptr_type,                       ADIO_Offset offset, ADIO_Status *status, int                       *error_code){/* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0;    int bufsize, num, size, sum, n_etypes_in_filetype, size_in_filetype;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size, req_len;    MPI_Aint filetype_extent, buftype_extent;     int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off;    ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off;    char *writebuf, *value;    int flag, st_fwr_size, st_n_filetypes, writebuf_len, write_sz;    int new_bwr_size, new_fwr_size, err_flag=0, info_flag, max_bufsize;    static char myname[] = "ADIOI_NFS_WRITESTRIDED";    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size(fd->filetype, &filetype_size);    if ( ! filetype_size ) {	*error_code = MPI_SUCCESS; 	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;    bufsize = buftype_size * count;/* get max_bufsize from the info object. */    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));    MPI_Info_get(fd->info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, value,                  &info_flag);    max_bufsize = atoi(value);    ADIOI_Free(value);    if (!buftype_is_contig && filetype_is_contig) {/* noncontiguous in memory, contiguous in file. */	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype) flat_buf = flat_buf->next;        off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :                  fd->disp + etype_size * offset;        start_off = off;	end_offset = off + bufsize - 1;        writebuf_off = off;        writebuf = (char *) ADIOI_Malloc(max_bufsize);        writebuf_len = (int) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));/* if atomicity is true, lock the region to be accessed */        if (fd->atomicity)             ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);        for (j=0; j<count; j++)             for (i=0; i<flat_buf->count; i++) {                userbuf_off = j*buftype_extent + flat_buf->indices[i];		req_off = off;		req_len = flat_buf->blocklens[i];		ADIOI_BUFFERED_WRITE_WITHOUT_READ                off += flat_buf->blocklens[i];            }        /* write the buffer out finally */	lseek(fd->fd_sys, writebuf_off, SEEK_SET); 	if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len);	err = write(fd->fd_sys, writebuf, writebuf_len);         if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len);        if (err == -1) err_flag = 1;         if (fd->atomicity)             ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);	ADIOI_Free(writebuf); /* malloced in the buffered_write macro */        if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;	if (err_flag) {	    *error_code = MPIO_Err_create_code(MPI_SUCCESS,					       MPIR_ERR_RECOVERABLE, myname,					       __LINE__, MPI_ERR_IO, "**io",					       "**io %s", strerror(errno));	}	else *error_code = MPI_SUCCESS;    }    else {  /* noncontiguous in file *///.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich-cce,代码行数:101,


示例25: ADIOI_PVFS_WriteStrided

void ADIOI_PVFS_WriteStrided(ADIO_File fd, void *buf, int count,			     MPI_Datatype datatype, int file_ptr_type,			     ADIO_Offset offset, ADIO_Status *status, int			     *error_code){/* Since PVFS does not support file locking, can't do buffered writes   as on Unix *//* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int i, j, k, err=-1, bwr_size, fwr_size=0, st_index=0;    int bufsize, num, size, sum, n_etypes_in_filetype, size_in_filetype;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent, indx;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset off, disp;    int flag, new_bwr_size, new_fwr_size, err_flag=0;    static char myname[] = "ADIOI_PVFS_WRITESTRIDED";#ifdef HAVE_PVFS_LISTIO    if ( fd->hints->fs_hints.pvfs.listio_write == ADIOI_HINT_ENABLE ) {	    ADIOI_PVFS_WriteStridedListIO(fd, buf, count, datatype, 			    file_ptr_type, offset, status, error_code);	    return;    }#endif    /* if hint set to DISABLE or AUTOMATIC, don't use listio */    /* --BEGIN ERROR HANDLING-- */    if (fd->atomicity) {	*error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,					   myname, __LINE__,					   MPI_ERR_INTERN,					   "Atomic mode set in PVFS I/O function", 0);	return;    }    /* --END ERROR HANDLING-- */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size(fd->filetype, &filetype_size);    if ( ! filetype_size ) {	*error_code = MPI_SUCCESS; 	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;        bufsize = buftype_size * count;    if (!buftype_is_contig && filetype_is_contig) {	char *combine_buf, *combine_buf_ptr;	ADIO_Offset combine_buf_remain;/* noncontiguous in memory, contiguous in file. use writev */	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype) flat_buf = flat_buf->next;	/* allocate our "combine buffer" to pack data into before writing */	combine_buf = (char *) ADIOI_Malloc(fd->hints->ind_wr_buffer_size);	combine_buf_ptr = combine_buf;	combine_buf_remain = fd->hints->ind_wr_buffer_size;	/* seek to the right spot in the file */	if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {	    off = fd->disp + etype_size * offset;	    pvfs_lseek64(fd->fd_sys, off, SEEK_SET);	}	else off = pvfs_lseek64(fd->fd_sys, fd->fp_ind, SEEK_SET);	/* loop through all the flattened pieces.  combine into buffer until	 * no more will fit, then write.	 *	 * special case of a given piece being bigger than the combine buffer	 * is also handled.	 */	for (j=0; j<count; j++) {	    for (i=0; i<flat_buf->count; i++) {		if (flat_buf->blocklens[i] > combine_buf_remain && combine_buf != combine_buf_ptr) {		    /* there is data in the buffer; write out the buffer so far */		    err = pvfs_write(fd->fd_sys,				     combine_buf,				     fd->hints->ind_wr_buffer_size - combine_buf_remain);		    if (err == -1) err_flag = 1;		    /* reset our buffer info */		    combine_buf_ptr = combine_buf;		    combine_buf_remain = fd->hints->ind_wr_buffer_size;		}		/* TODO: heuristic for when to not bother to use combine buffer? */		if (flat_buf->blocklens[i] >= combine_buf_remain) {//.........这里部分代码省略.........
开发者ID:hpc,项目名称:mvapich-cce,代码行数:101,


示例26: ADIO_Set_view

/* this used to be implemented in every file system as an fcntl.  It makes * deferred open easier if we know ADIO_Fcntl will always need a file to really * be open. set_view doesn't modify anything related to the open files. */void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype, 		MPI_Datatype filetype, MPI_Info info,  int *error_code) {	int combiner, i, j, k, err, filetype_is_contig;	MPI_Datatype copy_etype, copy_filetype;	ADIOI_Flatlist_node *flat_file;	/* free copies of old etypes and filetypes and delete flattened        version of filetype if necessary */	MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);	if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));	ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);	if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);	MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);	if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));	/* set new info */	ADIO_SetInfo(fd, info, &err);        /* set new etypes and filetypes */	MPI_Type_get_envelope(etype, &i, &j, &k, &combiner);	if (combiner == MPI_COMBINER_NAMED) fd->etype = etype;	else {	    MPI_Type_contiguous(1, etype, &copy_etype);	    MPI_Type_commit(&copy_etype);	    fd->etype = copy_etype;	}	MPI_Type_get_envelope(filetype, &i, &j, &k, &combiner);	if (combiner == MPI_COMBINER_NAMED) 	    fd->filetype = filetype;	else {	    MPI_Type_contiguous(1, filetype, &copy_filetype);	    MPI_Type_commit(&copy_filetype);	    fd->filetype = copy_filetype;	    ADIOI_Flatten_datatype(fd->filetype);            /* this function will not flatten the filetype if it turns out               to be all contiguous. */	}	MPI_Type_size(fd->etype, &(fd->etype_size));	fd->disp = disp;        /* reset MPI-IO file pointer to point to the first byte that can           be accessed in this view. */        ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);	if (filetype_is_contig) fd->fp_ind = disp;	else {	    flat_file = ADIOI_Flatlist;	    while (flat_file->type != fd->filetype) 		flat_file = flat_file->next;	    for (i=0; i<flat_file->count; i++) {		if (flat_file->blocklens[i]) {		    fd->fp_ind = disp + flat_file->indices[i];		    break;		}	    }	}	*error_code = MPI_SUCCESS;}
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:67,


示例27: ADIOI_PVFS_Fcntl

void ADIOI_PVFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code){    MPI_Datatype copy_etype, copy_filetype;    int combiner, i, j, k, filetype_is_contig, ntimes, err;    ADIOI_Flatlist_node *flat_file;    ADIO_Offset curr_fsize, alloc_size, size, len, done;    ADIO_Status status;    char *buf;#ifndef PRINT_ERR_MSG    static char myname[] = "ADIOI_PVFS_FCNTL";#endif    switch(flag) {    case ADIO_FCNTL_SET_VIEW:        /* free copies of old etypes and filetypes and delete flattened            version of filetype if necessary */	MPI_Type_get_envelope(fd->etype, &i, &j, &k, &combiner);	if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->etype));	ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);	if (!filetype_is_contig) ADIOI_Delete_flattened(fd->filetype);	MPI_Type_get_envelope(fd->filetype, &i, &j, &k, &combiner);	if (combiner != MPI_COMBINER_NAMED) MPI_Type_free(&(fd->filetype));	/* set new info */	ADIO_SetInfo(fd, fcntl_struct->info, &err);        /* set new etypes and filetypes */	MPI_Type_get_envelope(fcntl_struct->etype, &i, &j, &k, &combiner);	if (combiner == MPI_COMBINER_NAMED) fd->etype = fcntl_struct->etype;	else {	    MPI_Type_contiguous(1, fcntl_struct->etype, &copy_etype);	    MPI_Type_commit(&copy_etype);	    fd->etype = copy_etype;	}	MPI_Type_get_envelope(fcntl_struct->filetype, &i, &j, &k, &combiner);	if (combiner == MPI_COMBINER_NAMED) 	    fd->filetype = fcntl_struct->filetype;	else {	    MPI_Type_contiguous(1, fcntl_struct->filetype, &copy_filetype);	    MPI_Type_commit(&copy_filetype);	    fd->filetype = copy_filetype;	    ADIOI_Flatten_datatype(fd->filetype);            /* this function will not flatten the filetype if it turns out               to be all contiguous. */	}	MPI_Type_size(fd->etype, &(fd->etype_size));	fd->disp = fcntl_struct->disp;        /* reset MPI-IO file pointer to point to the first byte that can           be accessed in this view. */        ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);	if (filetype_is_contig) fd->fp_ind = fcntl_struct->disp;	else {	    flat_file = ADIOI_Flatlist;	    while (flat_file->type != fd->filetype) 		flat_file = flat_file->next;	    for (i=0; i<flat_file->count; i++) {		if (flat_file->blocklens[i]) {		    fd->fp_ind = fcntl_struct->disp + flat_file->indices[i];		    break;		}	    }	}	*error_code = MPI_SUCCESS;	break;    case ADIO_FCNTL_GET_FSIZE:	fcntl_struct->fsize = pvfs_lseek(fd->fd_sys, 0, SEEK_END);	if (fd->fp_sys_posn != -1) 	     pvfs_lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);#ifdef PRINT_ERR_MSG	*error_code = (fcntl_struct->fsize == -1) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;#else	if (fcntl_struct->fsize == -1) {	    *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,			      myname, "I/O Error", "%s", strerror(errno));	    ADIOI_Error(fd, *error_code, myname);	    	}	else *error_code = MPI_SUCCESS;#endif	break;    case ADIO_FCNTL_SET_DISKSPACE:	/* will be called by one process only */	/* On file systems with no preallocation function, I have to            explicitly write            to allocate space. Since there could be holes in the file,            I need to read up to the current file size, write it back,            and then write beyond that depending on how much            preallocation is needed.           read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */	curr_fsize = pvfs_lseek(fd->fd_sys, 0, SEEK_END);	alloc_size = fcntl_struct->diskspace;//.........这里部分代码省略.........
开发者ID:carsten-clauss,项目名称:MP-MPICH,代码行数:101,


示例28: handle

/*@    MPI_File_iread_shared - Nonblocking read using shared file pointerInput Parameters:. fh - file handle (handle). count - number of elements in buffer (nonnegative integer). datatype - datatype of each buffer element (handle)Output Parameters:. buf - initial address of buffer (choice). request - request object (handle).N fortran@*/int MPI_File_iread_shared(MPI_File fh, void *buf, int count,                          MPI_Datatype datatype, MPI_Request *request){    int error_code, buftype_is_contig, filetype_is_contig;    ADIO_Offset bufsize;    ADIO_File adio_fh;    static char myname[] = "MPI_FILE_IREAD_SHARED";    MPI_Count datatype_size, incr;    MPI_Status status;    ADIO_Offset off, shared_fp;    MPI_Offset nbytes=0;    MPIU_THREAD_CS_ENTER(ALLFUNC,);    adio_fh = MPIO_File_resolve(fh);    /* --BEGIN ERROR HANDLING-- */    MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);    MPIO_CHECK_COUNT(adio_fh, count, myname, error_code);    MPIO_CHECK_DATATYPE(adio_fh, datatype, myname, error_code);    /* --END ERROR HANDLING-- */    MPI_Type_size_x(datatype, &datatype_size);    /* --BEGIN ERROR HANDLING-- */    MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);    MPIO_CHECK_FS_SUPPORTS_SHARED(adio_fh, myname, error_code);    MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);    /* --END ERROR HANDLING-- */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(adio_fh->filetype, &filetype_is_contig);    ADIOI_TEST_DEFERRED(adio_fh, myname, &error_code);    incr = (count*datatype_size)/adio_fh->etype_size;    ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code);    /* --BEGIN ERROR HANDLING-- */    if (error_code != MPI_SUCCESS)    {	/* note: ADIO_Get_shared_fp should have set up error code already? */	MPIO_Err_return_file(adio_fh, error_code);    }    /* --END ERROR HANDLING-- */    if (buftype_is_contig && filetype_is_contig)    {    /* convert count and shared_fp to bytes */	bufsize = datatype_size * count;	off = adio_fh->disp + adio_fh->etype_size * shared_fp;        if (!(adio_fh->atomicity))	{	    ADIO_IreadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,			off, request, &error_code);	}        else	{            /* to maintain strict atomicity semantics with other concurrent              operations, lock (exclusive) and call blocking routine */            if (adio_fh->file_system != ADIO_NFS)	    {                ADIOI_WRITE_LOCK(adio_fh, off, SEEK_SET, bufsize);	    }            ADIO_ReadContig(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,			    off, &status, &error_code);              if (adio_fh->file_system != ADIO_NFS)	    {                ADIOI_UNLOCK(adio_fh, off, SEEK_SET, bufsize);	    }	    if (error_code == MPI_SUCCESS){		    nbytes = count * datatype_size;	    }	    MPIO_Completed_request_create(&adio_fh, nbytes, &error_code, request);        }    }    else    {	ADIO_IreadStrided(adio_fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,			   shared_fp, request, &error_code);    }    /* --BEGIN ERROR HANDLING-- *///.........这里部分代码省略.........
开发者ID:ORNL,项目名称:ompi,代码行数:101,


示例29: ADIOI_GEN_ReadStrided

void ADIOI_GEN_ReadStrided(ADIO_File fd, void *buf, int count,                           MPI_Datatype datatype, int file_ptr_type,                           ADIO_Offset offset, ADIO_Status *status, int                           *error_code){    /* offset is in units of etype relative to the filetype. */    ADIOI_Flatlist_node *flat_buf, *flat_file;    ADIO_Offset i_offset, new_brd_size, brd_size, size;    int i, j, k, st_index=0;    MPI_Count num, bufsize;    int n_etypes_in_filetype;    ADIO_Offset n_filetypes, etype_in_filetype, st_n_filetypes, size_in_filetype;    ADIO_Offset abs_off_in_filetype=0, new_frd_size, frd_size=0, st_frd_size;    MPI_Count filetype_size, etype_size, buftype_size, partial_read;    MPI_Aint filetype_extent, buftype_extent;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset userbuf_off, req_len, sum;    ADIO_Offset off, req_off, disp, end_offset=0, readbuf_off, start_off;    char *readbuf, *tmp_buf, *value;    int info_flag;    unsigned max_bufsize, readbuf_len;    ADIO_Status status1;    if (fd->hints->ds_read == ADIOI_HINT_DISABLE) {        /* if user has disabled data sieving on reads, use naive        * approach instead.        */        ADIOI_GEN_ReadStrided_naive(fd,                                    buf,                                    count,                                    datatype,                                    file_ptr_type,                                    offset,                                    status,                                    error_code);        return;    }    *error_code = MPI_SUCCESS;  /* changed below if error */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    MPI_Type_size_x(fd->filetype, &filetype_size);    if ( ! filetype_size ) {#ifdef HAVE_STATUS_SET_BYTES        MPIR_Status_set_bytes(status, datatype, 0);#endif        *error_code = MPI_SUCCESS;        return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size_x(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;    ADIOI_Assert((buftype_size * count) == ((ADIO_Offset)(MPI_Count)buftype_size * (ADIO_Offset)count));    bufsize = buftype_size * count;    /* get max_bufsize from the info object. */    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));    ADIOI_Info_get(fd->info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, value,                   &info_flag);    max_bufsize = atoi(value);    ADIOI_Free(value);    if (!buftype_is_contig && filetype_is_contig) {        /* noncontiguous in memory, contiguous in file. */        flat_buf = ADIOI_Flatten_and_find(datatype);        off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind :              fd->disp + (ADIO_Offset)etype_size * offset;        start_off = off;        end_offset = off + bufsize - 1;        readbuf_off = off;        readbuf = (char *) ADIOI_Malloc(max_bufsize);        readbuf_len = (unsigned) (MPL_MIN(max_bufsize, end_offset-readbuf_off+1));        /* if atomicity is true, lock (exclusive) the region to be accessed */        if ((fd->atomicity) && ADIO_Feature(fd, ADIO_LOCKS))            ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);        ADIO_ReadContig(fd, readbuf, readbuf_len, MPI_BYTE,                        ADIO_EXPLICIT_OFFSET, readbuf_off, &status1, error_code);        if (*error_code != MPI_SUCCESS) return;        for (j=0; j<count; j++)        {            for (i=0; i<flat_buf->count; i++) {                userbuf_off = (ADIO_Offset)j*(ADIO_Offset)buftype_extent + flat_buf->indices[i];                req_off = off;//.........这里部分代码省略.........
开发者ID:jeffhammond,项目名称:mpich,代码行数:101,


示例30: ADIOI_ZOIDFS_WriteStrided

/* Copied from ADIOI_PVFS2_OldWriteStrided.  It would be good to have fewer * copies of this code... */void ADIOI_ZOIDFS_WriteStrided(ADIO_File fd, void *buf, int count,			MPI_Datatype datatype, int file_ptr_type,			ADIO_Offset offset, ADIO_Status *status,			int *error_code){    /* as with all the other WriteStrided functions, offset is in units of     * etype relative to the filetype */    /* Since zoidfs does not support file locking, can't do buffered writes       as on Unix */    ADIOI_Flatlist_node *flat_buf, *flat_file;    int i, j, k, bwr_size, fwr_size=0, st_index=0;    int bufsize, sum, n_etypes_in_filetype, size_in_filetype;    int n_filetypes, etype_in_filetype;    ADIO_Offset abs_off_in_filetype=0;    int filetype_size, etype_size, buftype_size;    MPI_Aint filetype_extent, buftype_extent;    int buf_count, buftype_is_contig, filetype_is_contig;    ADIO_Offset off, disp, start_off, initial_off;    int flag, st_fwr_size, st_n_filetypes;    int err_flag=0;    size_t mem_list_count, file_list_count;    const void ** mem_offsets;    uint64_t *file_offsets;    size_t *mem_lengths;    uint64_t *file_lengths;    int total_blks_to_write;    int max_mem_list, max_file_list;    int b_blks_wrote;    int f_data_wrote;    int size_wrote=0, n_write_lists, extra_blks;    int end_bwr_size, end_fwr_size;    int start_k, start_j, new_file_write, new_buffer_write;    int start_mem_offset;    ADIOI_ZOIDFS_object *zoidfs_obj_ptr;    MPI_Offset total_bytes_written=0;    static char myname[] = "ADIOI_ZOIDFS_WRITESTRIDED";    /* note: I don't know what zoidfs will do if you pass it a super-long list,     * so let's keep with the PVFS limit for now */#define MAX_ARRAY_SIZE 64    /* --BEGIN ERROR HANDLING-- */    if (fd->atomicity) {	*error_code = MPIO_Err_create_code(MPI_SUCCESS,					   MPIR_ERR_RECOVERABLE,					   myname, __LINE__,					   MPI_ERR_ARG,					   "Atomic noncontiguous writes are not supported by ZOIDFS", 0);	return;    }    /* --END ERROR HANDLING-- */    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);    /* the HDF5 tests showed a bug in this list processing code (see many many     * lines down below).  We added a workaround, but common HDF5 file types     * are actually contiguous and do not need the expensive workarond */    if (!filetype_is_contig) {	flat_file = ADIOI_Flatlist;	while (flat_file->type != fd->filetype) flat_file = flat_file->next;	if (flat_file->count == 1 && !buftype_is_contig)	    filetype_is_contig = 1;    }    MPI_Type_size(fd->filetype, &filetype_size);    if ( ! filetype_size ) {	*error_code = MPI_SUCCESS; 	return;    }    MPI_Type_extent(fd->filetype, &filetype_extent);    MPI_Type_size(datatype, &buftype_size);    MPI_Type_extent(datatype, &buftype_extent);    etype_size = fd->etype_size;        bufsize = buftype_size * count;    zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr;    if (!buftype_is_contig && filetype_is_contig) {/* noncontiguous in memory, contiguous in file.  */        uint64_t file_offsets;	uint64_t file_lengths;	ADIOI_Flatten_datatype(datatype);	flat_buf = ADIOI_Flatlist;	while (flat_buf->type != datatype) flat_buf = flat_buf->next;		if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {	    off = fd->disp + etype_size * offset;//.........这里部分代码省略.........
开发者ID:315234,项目名称:OpenFOAM-2.2.x-OSX,代码行数:101,



注:本文中的ADIOI_Datatype_iscontig函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ADIOI_Free函数代码示例
C++ ADD_U_INT32函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。