本文整理汇总了C++中ADIOI_Free函数的典型用法代码示例。如果您正苦于以下问题:C++ ADIOI_Free函数的具体用法?C++ ADIOI_Free怎么用?C++ ADIOI_Free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ADIOI_Free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: convert_mpi_pvfs2_dtype
int convert_mpi_pvfs2_dtype(MPI_Datatype *mpi_dtype,
PVFS_Request *pvfs_dtype)
{
int num_int = -1, num_addr = -1, num_dtype = -1,
combiner = -1, i = -1, ret = -1, leaf = -1;
int *arr_int = NULL;
MPI_Aint *arr_addr = NULL;
MPI_Datatype *arr_dtype = NULL;
PVFS_Request *old_pvfs_dtype = NULL;
PVFS_Request *old_pvfs_dtype_arr = NULL;
int arr_count = -1;
PVFS_size *pvfs_arr_disp = NULL;
int *pvfs_arr_len = NULL;
MPI_Type_get_envelope(*mpi_dtype,
&num_int,
&num_addr,
&num_dtype,
&combiner);
/* Depending on type of datatype do the following
* operations */
if (combiner == MPI_COMBINER_NAMED)
{
convert_named(mpi_dtype, pvfs_dtype, combiner);
return 1;
}
/* Allocate space for the arrays necessary for
* MPI_Type_get_contents */
if ((arr_int = ADIOI_Malloc(sizeof(int)*num_int)) == NULL)
{
fprintf(stderr, "Failed to allocate array_int\n");
return -1;
}
if ((arr_addr = ADIOI_Malloc(sizeof(int)*num_addr)) == NULL)
{
ADIOI_Free(arr_int);
fprintf(stderr, "Failed to allocate array_addr\n");
return -1;
}
if ((arr_dtype = ADIOI_Malloc(sizeof(MPI_Datatype)*num_dtype)) == NULL)
{
ADIOI_Free(arr_int);
ADIOI_Free(arr_addr);
fprintf(stderr, "Failed to allocate array_dtypes\n");
return -1;
}
MPI_Type_get_contents(*mpi_dtype,
num_int,
num_addr,
num_dtype,
arr_int,
arr_addr,
arr_dtype);
/* If it's not a predefined datatype, it is either a
* derived datatype or a structured datatype */
if (combiner != MPI_COMBINER_STRUCT)
{
if ((old_pvfs_dtype = ADIOI_Malloc(sizeof(PVFS_Request))) == NULL)
fprintf(stderr, "convert_mpi_pvfs2_dtype: "
"Failed to allocate PVFS_Request\n");
switch (combiner)
{
case MPI_COMBINER_CONTIGUOUS:
leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
ret = PVFS_Request_contiguous(arr_int[0],
*old_pvfs_dtype, pvfs_dtype);
break;
case MPI_COMBINER_VECTOR:
leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
ret = PVFS_Request_vector(arr_int[0], arr_int[1],
arr_int[2], *old_pvfs_dtype,
pvfs_dtype);
break;
case MPI_COMBINER_HVECTOR:
leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
ret = PVFS_Request_hvector(arr_int[0], arr_int[1],
arr_addr[0], *old_pvfs_dtype,
pvfs_dtype);
break;
/* Both INDEXED and HINDEXED types require PVFS_size
* address arrays. Therefore, we need to copy and
* convert the data from MPI_get_contents() into
* a PVFS_size buffer */
case MPI_COMBINER_INDEXED:
leaf = convert_mpi_pvfs2_dtype(&arr_dtype[0], old_pvfs_dtype);
if ((pvfs_arr_disp =
ADIOI_Malloc(arr_int[0]*sizeof(PVFS_size))) == 0)
{
fprintf(stderr, "convert_mpi_pvfs2_dtype: "
"Failed to allocate pvfs_arr_disp\n");
}
for (i = 0; i < arr_int[0]; i++)
{
//.........这里部分代码省略.........
开发者ID:00datman,项目名称:ompi,代码行数:101,代码来源:ad_pvfs2_io_dtype.c
示例2: 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;
ADIO_Offset i_offset, new_brd_size, brd_size, size;
int i, j, k, err, err_flag, 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;
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;
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 + 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)
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 = (ADIO_Offset)j*buftype_extent + flat_buf->indices[i];
req_off = off;
req_len = flat_buf->blocklens[i];
ADIOI_BUFFERED_READ
off += flat_buf->blocklens[i];
}
if (fd->atomicity)
//.........这里部分代码省略.........
开发者ID:NexMirror,项目名称:MPICH,代码行数:101,代码来源:ad_nfs_read.c
示例3: handle
//.........这里部分代码省略.........
. buf - initial address of buffer (choice)
.N fortran
@*/
int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
MPI_Datatype datatype)
{
int error_code, nprocs, myrank;
MPI_Count datatype_size;
int source, dest;
ADIO_Offset shared_fp, incr;
ADIO_File adio_fh;
static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN";
void *xbuf=NULL, *e32_buf=NULL;
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);
if (adio_fh->split_coll_count)
{
error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**iosplitcoll", 0);
error_code = MPIO_Err_return_file(adio_fh, error_code);
goto fn_exit;
}
/* --END ERROR HANDLING-- */
adio_fh->split_coll_count = 1;
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_TEST_DEFERRED(adio_fh, myname, &error_code);
MPI_Comm_size(adio_fh->comm, &nprocs);
MPI_Comm_rank(adio_fh->comm, &myrank);
incr = (count*datatype_size)/adio_fh->etype_size;
/* Use a message as a 'token' to order the operations */
source = myrank - 1;
dest = myrank + 1;
if (source < 0) source = MPI_PROC_NULL;
if (dest >= nprocs) dest = MPI_PROC_NULL;
MPI_Recv(NULL, 0, MPI_BYTE, source, 0, adio_fh->comm, MPI_STATUS_IGNORE);
ADIO_Get_shared_fp(adio_fh, incr, &shared_fp, &error_code);
/* --BEGIN ERROR HANDLING-- */
if (error_code != MPI_SUCCESS)
{
error_code = MPIO_Err_return_file(adio_fh, error_code);
goto fn_exit;
}
/* --END ERROR HANDLING-- */
MPI_Send(NULL, 0, MPI_BYTE, dest, 0, adio_fh->comm);
xbuf = buf;
if (adio_fh->is_external32)
{
MPI_Aint e32_size = 0;
error_code = MPIU_datatype_full_size(datatype, &e32_size);
if (error_code != MPI_SUCCESS)
goto fn_exit;
e32_buf = ADIOI_Malloc(e32_size*count);
xbuf = e32_buf;
}
ADIO_ReadStridedColl(adio_fh, xbuf, count, datatype, ADIO_EXPLICIT_OFFSET,
shared_fp, &adio_fh->split_status, &error_code);
/* --BEGIN ERROR HANDLING-- */
if (error_code != MPI_SUCCESS)
error_code = MPIO_Err_return_file(adio_fh, error_code);
/* --END ERROR HANDLING-- */
if (e32_buf != NULL) {
error_code = MPIU_read_external32_conversion_fn(xbuf, datatype,
count, e32_buf);
ADIOI_Free(e32_buf);
}
fn_exit:
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return error_code;
}
开发者ID:ORNL,项目名称:ompi,代码行数:101,代码来源:read_ordb.c
示例4: 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, 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 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_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_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. */
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 */
#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;
if (fd->atomicity)
//.........这里部分代码省略.........
开发者ID:ORNL,项目名称:ompi,代码行数:101,代码来源:ad_nfs_write.c
示例5: 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, 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;
#ifndef PRINT_ERR_MSG
static char myname[] = "ADIOI_NFS_WRITESTRIDED";
#endif
ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
MPI_Type_size(fd->filetype, &filetype_size);
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;
#ifdef PRINT_ERR_MSG
*error_code = (err_flag) ? MPI_ERR_UNKNOWN : MPI_SUCCESS;
#else
if (err_flag) {
*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
}
else { /* noncontiguous in file */
//.........这里部分代码省略.........
开发者ID:carsten-clauss,项目名称:MP-MPICH,代码行数:101,代码来源:ad_nfs_write.c
示例6: 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
示例7: ADIOI_Exch_file_views
//.........这里部分代码省略.........
send_count_arr[tmp_agg_idx].count = flat_file_p->count;
send_count_arr[tmp_agg_idx].fp_ind = disp_off_sz_ext_typesz[0];
send_count_arr[tmp_agg_idx].disp = disp_off_sz_ext_typesz[1];
send_count_arr[tmp_agg_idx].byte_off = disp_off_sz_ext_typesz[2];
send_count_arr[tmp_agg_idx].sz = disp_off_sz_ext_typesz[3];
send_count_arr[tmp_agg_idx].ext = disp_off_sz_ext_typesz[4];
send_count_arr[tmp_agg_idx].type_sz = disp_off_sz_ext_typesz[5];
}
}
#ifdef DEBUG2
fprintf(stderr, "my own flattened memtype: ");
ADIOI_Print_flatlist_node(flat_mem_p);
fprintf(stderr, "my own flattened filetype: ");
ADIOI_Print_flatlist_node(flat_file_p);
#endif
if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) {
ret = MPI_Alltoall(send_count_arr, sizeof(amount_and_extra_data_t),
MPI_BYTE,
recv_count_arr, sizeof(amount_and_extra_data_t), MPI_BYTE, fd->comm);
if (ret != MPI_SUCCESS) {
fprintf(stderr, "ADIOI_Exchange_file_views: MPI_Alltoall failed " "with error %d", ret);
return;
}
} else {
#ifdef MPI_STATUSES_IGNORE
statuses = MPI_STATUSES_IGNORE;
#else
statuses = (MPI_Status *) ADIOI_Malloc(1 + nprocs * sizeof(MPI_Status));
#endif
if (fd->is_agg) {
MPI_Waitall(nprocs, recv_req_arr, statuses);
ADIOI_Free(recv_req_arr);
}
MPI_Waitall(fd->hints->cb_nodes, send_req_arr, statuses);
#ifndef MPI_STATUSES_IGNORE
ADIOI_Free(statuses);
#endif
ADIOI_Free(send_req_arr);
}
#ifdef DEBUG2
if (fd->hints->cb_alltoall != ADIOI_HINT_DISABLE) {
fprintf(stderr, "send_count_arr:");
for (i = 0; i < nprocs; i++) {
fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count);
}
fprintf(stderr, "\n");
fprintf(stderr, "recv_count_arr:");
for (i = 0; i < nprocs; i++) {
fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count);
}
fprintf(stderr, "\n");
} else {
fprintf(stderr, "send_count_arr:");
for (i = 0; i < fd->hints->cb_nodes; i++) {
fprintf(stderr, "[%d]=%d ", i, send_count_arr[i].count);
}
fprintf(stderr, "\n");
if (fd->is_agg) {
fprintf(stderr, "recv_count_arr:");
for (i = 0; i < nprocs; i++) {
fprintf(stderr, "[%d]=%d ", i, recv_count_arr[i].count);
}
fprintf(stderr, "\n");
}
开发者ID:jeffhammond,项目名称:mpich,代码行数:67,代码来源:ad_coll_exch_new.c
示例8: ADIOI_LUSTRE_Open
//.........这里部分代码省略.........
MPI_MAX_INFO_VAL, value, &flag);
if (flag)
start_iodev=atoll(value);
}
if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0))
set_layout = 1;
/* if hints were set, we need to delay creation of any lustre objects.
* However, if we open the file with O_LOV_DELAY_CREATE and don't call the
* follow-up ioctl, subsequent writes will fail */
if (myrank == 0 && set_layout)
amode = amode | O_LOV_DELAY_CREATE;
fd->fd_sys = open(fd->filename, amode, perm);
if (fd->fd_sys == -1) goto fn_exit;
/* we can only set these hints on new files */
/* It was strange and buggy to open the file in the hint path. Instead,
* we'll apply the file tunings at open time */
if ((amode & O_CREAT) && set_layout ) {
/* if user has specified striping info, first aggregator tries to set
* it */
if (myrank == fd->hints->ranklist[0] || fd->comm == MPI_COMM_SELF) {
lum->lmm_magic = LOV_USER_MAGIC;
lum->lmm_pattern = 0;
/* crude check for overflow of lustre internal datatypes.
* Silently cap to large value if user provides a value
* larger than lustre supports */
if (str_unit > UINT_MAX)
lum->lmm_stripe_size = UINT_MAX;
else
lum->lmm_stripe_size = str_unit;
if (str_factor > USHRT_MAX)
lum->lmm_stripe_count = USHRT_MAX;
else
lum->lmm_stripe_count = str_factor;
if (start_iodev > USHRT_MAX)
lum->lmm_stripe_offset = USHRT_MAX;
else
lum->lmm_stripe_offset = start_iodev;
err = ioctl(fd->fd_sys, LL_IOC_LOV_SETSTRIPE, lum);
if (err == -1 && errno != EEXIST) {
fprintf(stderr, "Failure to set stripe info %s \n", strerror(errno));
/* not a fatal error, but user might care to know */
}
} /* End of striping parameters validation */
}
/* Pascal Deveze reports that, even though we pass a
* "GETSTRIPE" (read) flag to the ioctl, if some of the values of this
* struct are uninitialzed, the call can give an error. zero it out in case
* there are other members that must be initialized and in case
* lov_user_md struct changes in future */
memset(lum, 0, lumlen);
lum->lmm_magic = LOV_USER_MAGIC;
err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *)lum);
if (!err) {
fd->hints->striping_unit = lum->lmm_stripe_size;
MPL_snprintf(value, value_sz, "%d", lum->lmm_stripe_size);
ADIOI_Info_set(fd->info, "striping_unit", value);
fd->hints->striping_factor = lum->lmm_stripe_count;
MPL_snprintf(value, value_sz, "%d", lum->lmm_stripe_count);
ADIOI_Info_set(fd->info, "striping_factor", value);
fd->hints->start_iodevice = lum->lmm_stripe_offset;
MPL_snprintf(value, value_sz, "%d", lum->lmm_stripe_offset);
ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value);
}
if (fd->access_mode & ADIO_APPEND)
fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
fd->fd_direct = -1;
if (fd->direct_write || fd->direct_read) {
fd->fd_direct = open(fd->filename, amode_direct, perm);
if (fd->fd_direct != -1) {
fd->d_mem = fd->d_miniosz = (1<<12);
} else {
perror("cannot open file with O_Direct");
fd->direct_write = fd->direct_read = 0;
}
}
fn_exit:
ADIOI_Free(lum);
ADIOI_Free(value);
/* --BEGIN ERROR HANDLING-- */
if (fd->fd_sys == -1 || ((fd->fd_direct == -1) &&
(fd->direct_write || fd->direct_read))) {
*error_code = ADIOI_Err_create_code(myname, fd->filename, errno);
}
/* --END ERROR HANDLING-- */
else *error_code = MPI_SUCCESS;
}
开发者ID:NexMirror,项目名称:MPICH,代码行数:101,代码来源:ad_lustre_open.c
示例9: 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,代码来源:io_romio_ad_piofs_write.c
示例10: ADIOI_GPFS_SetInfo
void ADIOI_GPFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
{
/* if fd->info is null, create a new info object.
Initialize fd->info to default values.
Initialize fd->hints to default values.
Examine the info object passed by the user. If it contains values that
ROMIO understands, override the default. */
MPI_Info info;
char *value;
int flag, intval, nprocs=0, nprocs_is_valid = 0;
static char myname[] = "ADIOI_GPFS_SETINFO";
int did_anything = 0;
if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info));
info = fd->info;
/* Note that fd->hints is allocated at file open time; thus it is
* not necessary to allocate it, or check for allocation, here.
*/
value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
ADIOI_Assert ((value != NULL));
/* initialize info and hints to default values if they haven't been
* previously initialized
*/
if (!fd->hints->initialized) {
ad_get_env_vars();
ad_gpfs_get_env_vars();
did_anything = 1;
/* buffer size for collective I/O */
ADIOI_Info_set(info, "cb_buffer_size", ADIOI_GPFS_CB_BUFFER_SIZE_DFLT);
fd->hints->cb_buffer_size = atoi(ADIOI_GPFS_CB_BUFFER_SIZE_DFLT);
/* default is to let romio automatically decide when to use
* collective buffering
*/
ADIOI_Info_set(info, "romio_cb_read", "enable");
fd->hints->cb_read = ADIOI_HINT_ENABLE;
ADIOI_Info_set(info, "romio_cb_write", "enable");
fd->hints->cb_write = ADIOI_HINT_ENABLE;
if ( fd->hints->cb_config_list != NULL ) ADIOI_Free (fd->hints->cb_config_list);
fd->hints->cb_config_list = NULL;
/* number of processes that perform I/O in collective I/O */
MPI_Comm_size(fd->comm, &nprocs);
nprocs_is_valid = 1;
MPL_snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
ADIOI_Info_set(info, "cb_nodes", value);
fd->hints->cb_nodes = -1;
/* hint indicating that no indep. I/O will be performed on this file */
ADIOI_Info_set(info, "romio_no_indep_rw", "false");
fd->hints->no_indep_rw = 0;
/* gpfs is not implementing file realms (ADIOI_IOStridedColl),
initialize to disabled it. */
/* hint instructing the use of persistent file realms */
ADIOI_Info_set(info, "romio_cb_pfr", "disable");
fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
/* hint guiding the assignment of persistent file realms */
ADIOI_Info_set(info, "romio_cb_fr_types", "aar");
fd->hints->cb_fr_type = ADIOI_FR_AAR;
/* hint to align file realms with a certain byte value */
ADIOI_Info_set(info, "romio_cb_fr_alignment", "1");
fd->hints->cb_fr_alignment = 1;
/* hint to set a threshold percentage for a datatype's size/extent at
* which data sieving should be done in collective I/O */
ADIOI_Info_set(info, "romio_cb_ds_threshold", "0");
fd->hints->cb_ds_threshold = 0;
/* hint to switch between point-to-point or all-to-all for two-phase */
ADIOI_Info_set(info, "romio_cb_alltoall", "automatic");
fd->hints->cb_alltoall = ADIOI_HINT_AUTO;
/* deferred_open derived from no_indep_rw and cb_{read,write} */
fd->hints->deferred_open = 0;
/* buffer size for data sieving in independent reads */
ADIOI_Info_set(info, "ind_rd_buffer_size", ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT);
fd->hints->ind_rd_buffer_size = atoi(ADIOI_GPFS_IND_RD_BUFFER_SIZE_DFLT);
/* buffer size for data sieving in independent writes */
ADIOI_Info_set(info, "ind_wr_buffer_size", ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT);
fd->hints->ind_wr_buffer_size = atoi(ADIOI_GPFS_IND_WR_BUFFER_SIZE_DFLT);
ADIOI_Info_set(info, "romio_ds_read", "automatic");
fd->hints->ds_read = ADIOI_HINT_AUTO;
ADIOI_Info_set(info, "romio_ds_write", "automatic");
fd->hints->ds_write = ADIOI_HINT_AUTO;
//.........这里部分代码省略.........
开发者ID:NexMirror,项目名称:MPICH,代码行数:101,代码来源:ad_gpfs_hints.c
示例11: MPIOI_File_write_all_begin
int MPIOI_File_write_all_begin(MPI_File fh,
MPI_Offset offset,
int file_ptr_type,
const void *buf,
int count,
MPI_Datatype datatype,
char *myname)
{
int error_code;
MPI_Count datatype_size;
ADIO_File adio_fh;
void *e32buf=NULL;
const void *xbuf=NULL;
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);
MPIO_CHECK_NOT_SEQUENTIAL_MODE(adio_fh, 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(adio_fh, error_code);
goto fn_exit;
}
if (adio_fh->split_coll_count)
{
error_code = MPIO_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE,
myname, __LINE__, MPI_ERR_IO,
"**iosplitcoll", 0);
error_code = MPIO_Err_return_file(adio_fh, error_code);
goto fn_exit;
}
/* --END ERROR HANDLING-- */
adio_fh->split_coll_count = 1;
MPI_Type_size_x(datatype, &datatype_size);
/* --BEGIN ERROR HANDLING-- */
MPIO_CHECK_INTEGRAL_ETYPE(adio_fh, count, datatype_size, myname, error_code);
MPIO_CHECK_COUNT_SIZE(adio_fh, count, datatype_size, myname, error_code);
/* --END ERROR HANDLING-- */
xbuf = buf;
if (adio_fh->is_external32) {
error_code = MPIU_external32_buffer_setup(buf, count, datatype, &e32buf);
if (error_code != MPI_SUCCESS)
goto fn_exit;
xbuf = e32buf;
}
adio_fh->split_datatype = datatype;
ADIO_WriteStridedColl(adio_fh, xbuf, count, datatype, file_ptr_type,
offset, &adio_fh->split_status, &error_code);
/* --BEGIN ERROR HANDLING-- */
if (error_code != MPI_SUCCESS)
error_code = MPIO_Err_return_file(adio_fh, error_code);
/* --END ERROR HANDLING-- */
fn_exit:
if ( e32buf != NULL) ADIOI_Free(e32buf);
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return error_code;
}
开发者ID:abhinavvishnu,项目名称:matex,代码行数:76,代码来源:write_allb.c
示例12: handle
/*@
MPI_File_close - Closes a file
Input Parameters:
. fh - file handle (handle)
.N fortran
@*/
int MPI_File_close(MPI_File *fh)
{
int error_code;
ADIO_File adio_fh;
static char myname[] = "MPI_FILE_CLOSE";
#ifdef MPI_hpux
int fl_xmpi;
HPMP_IO_WSTART(fl_xmpi, BLKMPIFILECLOSE, TRDTBLOCK, *adio_fh);
#endif /* MPI_hpux */
MPIU_THREAD_CS_ENTER(ALLFUNC,);
adio_fh = MPIO_File_resolve(*fh);
/* --BEGIN ERROR HANDLING-- */
MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code);
/* --END ERROR HANDLING-- */
if (ADIO_Feature(adio_fh, ADIO_SHARED_FP))
{
ADIOI_Free((adio_fh)->shared_fp_fname);
/* POSIX semantics say a deleted file remains available until all
* processes close the file. But since when was NFS posix-compliant?
*/
if (!ADIO_Feature(adio_fh, ADIO_UNLINK_AFTER_CLOSE)) {
MPI_Barrier((adio_fh)->comm);
}
if ((adio_fh)->shared_fp_fd != ADIO_FILE_NULL) {
MPI_File *fh_shared = &(adio_fh->shared_fp_fd);
ADIO_Close((adio_fh)->shared_fp_fd, &error_code);
MPIO_File_free(fh_shared);
/* --BEGIN ERROR HANDLING-- */
if (error_code != MPI_SUCCESS) goto fn_fail;
/* --END ERROR HANDLING-- */
}
}
/* Because ROMIO expects the MPI library to provide error handler management
* routines but it doesn't ever participate in MPI_File_close, we have to
* somehow inform the MPI library that we no longer hold a reference to any
* user defined error handler. We do this by setting the errhandler at this
* point to MPI_ERRORS_RETURN. */
error_code = PMPI_File_set_errhandler(*fh, MPI_ERRORS_RETURN);
if (error_code != MPI_SUCCESS) goto fn_fail;
ADIO_Close(adio_fh, &error_code);
MPIO_File_free(fh);
/* --BEGIN ERROR HANDLING-- */
if (error_code != MPI_SUCCESS) goto fn_fail;
/* --END ERROR HANDLING-- */
#ifdef MPI_hpux
HPMP_IO_WEND(fl_xmpi);
#endif /* MPI_hpux */
fn_exit:
MPIU_THREAD_CS_EXIT(ALLFUNC,);
return error_code;
fn_fail:
/* --BEGIN ERROR HANDLING-- */
error_code = MPIO_Err_return_file(adio_fh, error_code);
goto fn_exit;
/* --END ERROR HANDLING-- */
}
开发者ID:mpifl,项目名称:mpich3newforfile,代码行数:73,代码来源:close.c
示例13: ADIOI_HFS_Fcntl
//.........这里部分代码省略.........
case ADIO_FCNTL_SET_DISKSPACE:
/* will be called by one process only */
#ifdef SPPUX
/* SPPUX has no prealloc64. therefore, use prealloc
if size < (2GB - 1), otherwise use long method. */
if (fcntl_struct->diskspace <= 2147483647) {
err = prealloc(fd->fd_sys, (off_t) fcntl_struct->diskspace);
if (err && (errno != ENOTEMPTY)) {
#ifdef PRINT_ERR_MSG
*error_code = MPI_ERR_UNKNOWN;
#else
*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
return;
}
}
if ((fcntl_struct->diskspace > 2147483647) ||
(err && (errno == ENOTEMPTY))) {
#endif
/* 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 = lseek64(fd->fd_sys, 0, SEEK_END);
alloc_size = fcntl_struct->diskspace;
size = ADIOI_MIN(curr_fsize, alloc_size);
ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
done = 0;
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) {
#ifdef PRINT_ERR_MSG
FPRINTF(stderr, "ADIOI_HFS_Fcntl: To preallocate disk space, ROMIO needs to read the file and write it back, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n");
MPI_Abort(MPI_COMM_WORLD, 1);
#else
*error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_PREALLOC_PERM,
myname, (char *) 0, (char *) 0);
ADIOI_Error(fd, *error_code, myname);
return;
#endif
}
ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
if (alloc_size > curr_fsize) {
memset(buf, 0, ADIOI_PREALLOC_BUFSZ);
size = alloc_size - curr_fsize;
ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
if (*error_code != MPI_SUCCESS) return;
done += len;
}
}
ADIOI_Free(buf);
#ifdef SPPUX
}
#endif
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_IOMODE:
/* for implementing PFS I/O modes. will not occur in MPI-IO
implementation.*/
if (fd->iomode != fcntl_struct->iomode) {
fd->iomode = fcntl_struct->iomode;
MPI_Barrier(MPI_COMM_WORLD);
}
*error_code = MPI_SUCCESS;
break;
case ADIO_FCNTL_SET_ATOMICITY:
fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
*error_code = MPI_SUCCESS;
break;
default:
FPRINTF(stderr, "Unknown flag passed to ADIOI_HFS_Fcntl\n");
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
开发者ID:quinoacomputing,项目名称:quinoa,代码行数:101,代码来源:ad_hfs_fcntl.c
示例14: ADIOI_LUSTRE_WriteStrided
//.........这里部分代码省略.........
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);
if (fd->atomicity)
ADIOI_UNLOCK(fd, start_off, SEEK_SET, bufsize);
if (*error_code != MPI_SUCCESS) {
ADIOI_Free(writebuf);
return;
}
ADIOI_Free(writebuf);
if (file_ptr_type == ADIO_INDIVIDUAL)
fd->fp_ind = off;
} else {
/* noncontiguous in file */
/* filetype already flattened in ADIO_Open */
flat_file = ADIOI_Flatlist;
while (flat_file->type != fd->filetype)
flat_file = flat_file->next;
disp = fd->disp;
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 */
for (i=0; i<flat_file->count; i++) {
ADIO_Offset dist;
if (flat_file->blocklens[i] == 0) continue;
dist = flat_file->indices[i] + flat_file->blocklens[i] - offset;
/* fwr_size is from offset to the end of block i */
if (dist == 0) {
i++;
offset = flat_
|
请发表评论