ad_piofs_read.c

来自「fortran并行计算包」· C语言 代码 · 共 57 行

C
57
字号
/* -*- Mode: C; c-basic-offset:4 ; -*- *//*  * *   Copyright (C) 1997 University of Chicago.  *   See COPYRIGHT notice in top-level directory. */#include "ad_piofs.h"void ADIOI_PIOFS_ReadContig(ADIO_File fd, void *buf, int count,                      MPI_Datatype datatype, int file_ptr_type,		     ADIO_Offset offset, ADIO_Status *status, int *error_code){    int err=-1, datatype_size, len;#ifndef PRINT_ERR_MSG    static char myname[] = "ADIOI_PIOFS_READCONTIG";#endif    MPI_Type_size(datatype, &datatype_size);    len = datatype_size * count;    if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {	if (fd->fp_sys_posn != offset) {	    llseek(fd->fd_sys, offset, SEEK_SET);	}	err = read(fd->fd_sys, buf, len);	fd->fp_sys_posn = offset + err;         /* individual file pointer not updated */            }    else {  /* read from curr. location of ind. file pointer */	if (fd->fp_sys_posn != fd->fp_ind) {	    llseek(fd->fd_sys, fd->fp_ind, SEEK_SET);	}	err = read(fd->fd_sys, buf, len);	fd->fp_ind += err; 	fd->fp_sys_posn = fd->fp_ind;    }         #ifdef HAVE_STATUS_SET_BYTES    if (err != -1) MPIR_Status_set_bytes(status, datatype, err);#endif    if (err == -1) {#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	*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    }    else *error_code = MPI_SUCCESS;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?