本文整理汇总了C++中ADIOI_Datatype_iscontig函数的典型用法代码示例。如果您正苦于以下问题:C++ ADIOI_Datatype_iscontig函数的具体用法?C++ ADIOI_Datatype_iscontig怎么用?C++ ADIOI_Datatype_iscontig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADIOI_Datatype_iscontig函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:mpiu_external32.c
示例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,代码来源:get_fp_posn.c
示例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,代码来源:get_fp_posn.c
示例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,代码来源:io_romio_iscontig.c
示例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,代码来源:byte_offset.c
示例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,代码来源:ad_lustre_wrcoll.c
示例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,代码来源:ad_lustre_wrcoll.c
示例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,代码来源:ad_nfs_write.c
示例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,代码来源:ad_nfs_read.c
示例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,代码来源:ad_read_str_naive.c
示例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,代码来源:ad_pvfs_write.c
示例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,代码来源:ad_write_coll.c
示例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,代码来源:ad_seek.c
示例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,代码来源:eof_offset.c
示例15: handle
/*@
MPI_File_write - Write using individual file pointer
Input 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,代码来源:write.c
示例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;
|
请发表评论