00001 
00002 
00003 
00004 
00005 
00006 
00007 #include "ad_testfs.h"
00008 #include "adioi.h"
00009 
00010 void ADIOI_TESTFS_WriteContig(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_WriteContig called on %s\n", myrank, 
00023         nprocs, fd->filename);
00024     FPRINTF(stdout, "[%d/%d]    writing (buf = %p, loc = %lld, sz = %lld)\n",
00025         myrank, nprocs, buf, (long long) offset, 
00026         (long long)datatype_size * (long long)count);
00027 
00028     if (file_ptr_type != ADIO_EXPLICIT_OFFSET)
00029     {
00030     fd->fp_ind += datatype_size * count;
00031     fd->fp_sys_posn = fd->fp_ind;
00032     FPRINTF(stdout, "[%d/%d]    new file position is %lld\n", myrank, 
00033         nprocs, (long long) fd->fp_ind);
00034     }
00035     else {
00036     fd->fp_sys_posn = offset + datatype_size * count;
00037     }
00038 
00039 #ifdef HAVE_STATUS_SET_BYTES
00040     MPIR_Status_set_bytes(status, datatype, datatype_size * count);
00041 #endif
00042 }
00043 
00044 void ADIOI_TESTFS_WriteStrided(ADIO_File fd, void *buf, int count,
00045                    MPI_Datatype datatype, int file_ptr_type,
00046                    ADIO_Offset offset, ADIO_Status *status,
00047                    int *error_code)
00048 {
00049     int myrank, nprocs;
00050 
00051     *error_code = MPI_SUCCESS;
00052 
00053     MPI_Comm_size(fd->comm, &nprocs);
00054     MPI_Comm_rank(fd->comm, &myrank);
00055     FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_WriteStrided called on %s\n", 
00056         myrank, nprocs, fd->filename);
00057     FPRINTF(stdout, "[%d/%d]    calling ADIOI_GEN_WriteStrided\n", 
00058         myrank, nprocs);
00059 
00060     ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type, offset, 
00061                status, error_code);
00062 }