00001 
00002 
00003 
00004 
00005 
00006 
00007 #include "ad_testfs.h"
00008 #include "adioi.h"
00009 
00010 void ADIOI_TESTFS_ReadContig(ADIO_File fd, void *buf, int count, 
00011                  MPI_Datatype datatype, int file_ptr_type,
00012                  ADIO_Offset offset, ADIO_Status *status, int
00013                  *error_code)
00014 {
00015     int myrank, nprocs, datatype_size;
00016 
00017     *error_code = MPI_SUCCESS;
00018 
00019     MPI_Comm_size(fd->comm, &nprocs);
00020     MPI_Comm_rank(fd->comm, &myrank);
00021     MPI_Type_size(datatype, &datatype_size);
00022     FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadContig called on %s\n", myrank, 
00023         nprocs, fd->filename);
00024     if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
00025     {
00026     offset = fd->fp_ind;
00027     fd->fp_ind += datatype_size * count;
00028     fd->fp_sys_posn = fd->fp_ind;
00029     }
00030     else {
00031     fd->fp_sys_posn = offset + datatype_size * count;
00032     }
00033 
00034     FPRINTF(stdout, "[%d/%d]    reading (buf = %p, loc = %lld, sz = %lld)\n",
00035         myrank, nprocs, buf, (long long) offset, 
00036         (long long) datatype_size * count);
00037 
00038 #ifdef HAVE_STATUS_SET_BYTES
00039     MPIR_Status_set_bytes(status, datatype, datatype_size * count);
00040 #endif
00041 }
00042 
00043 void ADIOI_TESTFS_ReadStrided(ADIO_File fd, void *buf, int count,
00044                   MPI_Datatype datatype, int file_ptr_type,
00045                   ADIO_Offset offset, ADIO_Status *status, int
00046                   *error_code)
00047 {
00048     int myrank, nprocs;
00049 
00050     *error_code = MPI_SUCCESS;
00051 
00052     MPI_Comm_size(fd->comm, &nprocs);
00053     MPI_Comm_rank(fd->comm, &myrank);
00054     FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_ReadStrided called on %s\n", myrank, 
00055         nprocs, fd->filename);
00056     FPRINTF(stdout, "[%d/%d]    calling ADIOI_GEN_ReadStrided\n", myrank, 
00057         nprocs);
00058 
00059     ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type, offset,
00060               status, error_code);
00061 }