00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ad_testfs.h"
00010 #include "adioi.h"
00011
00012
00013
00014
00015
00016 void ADIOI_TESTFS_IwriteContig(ADIO_File fd, void *buf, int count,
00017 MPI_Datatype datatype, int file_ptr_type,
00018 ADIO_Offset offset, ADIO_Request *request, int
00019 *error_code)
00020 {
00021 ADIO_Status status;
00022 int myrank, nprocs, typesize, len;
00023
00024 *error_code = MPI_SUCCESS;
00025
00026 *request = ADIOI_Malloc_request();
00027 (*request)->optype = ADIOI_WRITE;
00028 (*request)->fd = fd;
00029 (*request)->queued = 0;
00030 (*request)->datatype = datatype;
00031
00032 MPI_Type_size(datatype, &typesize);
00033 MPI_Comm_size(fd->comm, &nprocs);
00034 MPI_Comm_rank(fd->comm, &myrank);
00035 FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteContig called on %s\n",
00036 myrank, nprocs, fd->filename);
00037 FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteContig\n",
00038 myrank, nprocs);
00039
00040 len = count * typesize;
00041 ADIOI_TESTFS_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type,
00042 offset, &status, error_code);
00043
00044 #ifdef HAVE_STATUS_SET_BYTES
00045 if (*error_code == MPI_SUCCESS) {
00046 MPI_Get_elements(&status, MPI_BYTE, &len);
00047 (*request)->nbytes = len;
00048 }
00049 #endif
00050 fd->async_count++;
00051 }
00052
00053 void ADIOI_TESTFS_IwriteStrided(ADIO_File fd, void *buf, int count,
00054 MPI_Datatype datatype, int file_ptr_type,
00055 ADIO_Offset offset, ADIO_Request *request, int
00056 *error_code)
00057 {
00058 ADIO_Status status;
00059 int myrank, nprocs;
00060 #ifdef HAVE_STATUS_SET_BYTES
00061 int typesize;
00062 #endif
00063
00064 *error_code = MPI_SUCCESS;
00065
00066 *request = ADIOI_Malloc_request();
00067 (*request)->optype = ADIOI_WRITE;
00068 (*request)->fd = fd;
00069 (*request)->queued = 0;
00070 (*request)->datatype = datatype;
00071
00072 MPI_Comm_size(fd->comm, &nprocs);
00073 MPI_Comm_rank(fd->comm, &myrank);
00074 FPRINTF(stdout, "[%d/%d] ADIOI_TESTFS_IwriteStrided called on %s\n",
00075 myrank, nprocs, fd->filename);
00076 FPRINTF(stdout, "[%d/%d] calling ADIOI_TESTFS_WriteStrided\n",
00077 myrank, nprocs);
00078
00079 ADIOI_TESTFS_WriteStrided(fd, buf, count, datatype, file_ptr_type,
00080 offset, &status, error_code);
00081
00082 #ifdef HAVE_STATUS_SET_BYTES
00083 if (*error_code == MPI_SUCCESS) {
00084 MPI_Type_size(datatype, &typesize);
00085 (*request)->nbytes = count * typesize;
00086 }
00087 #endif
00088 fd->async_count++;
00089 }