00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include "adio.h"
00009 
00010 #ifdef HAVE_UNISTD_H
00011 #include <unistd.h>
00012 #endif
00013 #ifdef HAVE_SIGNAL_H
00014 #include <signal.h>
00015 #endif
00016 #ifdef HAVE_SYS_TYPES_H
00017 #include <sys/types.h>
00018 #endif
00019 #ifdef HAVE_AIO_H
00020 #include <aio.h>
00021 #endif
00022 #ifdef HAVE_SYS_AIO_H
00023 #include <sys/aio.h>
00024 #endif
00025 
00026 #include "mpiu_greq.h"
00027 
00028 #ifdef ROMIO_HAVE_WORKING_AIO
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 void ADIOI_GEN_IreadContig(ADIO_File fd, void *buf, int count, 
00039                MPI_Datatype datatype, int file_ptr_type,
00040                ADIO_Offset offset, MPI_Request *request,
00041                int *error_code)  
00042 {
00043     int len, typesize;
00044     int aio_errno = 0;
00045     static char myname[] = "ADIOI_GEN_IREADCONTIG";
00046 
00047     MPI_Type_size(datatype, &typesize);
00048     ADIOI_Assert((count * typesize) == ((ADIO_Offset)(unsigned)count * (ADIO_Offset)typesize));
00049     len = count * typesize;
00050 
00051     if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
00052     aio_errno = ADIOI_GEN_aio(fd, buf, len, offset, 0, request);
00053     if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
00054 
00055     fd->fp_sys_posn = -1;
00056 
00057     
00058     if (aio_errno != 0) {
00059     MPIO_ERR_CREATE_CODE_ERRNO(myname, aio_errno, error_code);
00060     return;
00061     }
00062     
00063     
00064     *error_code = MPI_SUCCESS;
00065 }
00066 #endif
00067 
00068 
00069 
00070 
00071 void ADIOI_GEN_IreadStrided(ADIO_File fd, void *buf, int count, 
00072                 MPI_Datatype datatype, int file_ptr_type,
00073                 ADIO_Offset offset, ADIO_Request *request,
00074                 int *error_code)
00075 {
00076     ADIO_Status status;
00077     int typesize;
00078     MPI_Offset nbytes=0;
00079 
00080     
00081 
00082 
00083     ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, 
00084              offset, &status, error_code);  
00085 
00086     if (*error_code == MPI_SUCCESS) {
00087     MPI_Type_size(datatype, &typesize);
00088     nbytes = (MPI_Offset)count*(MPI_Offset)typesize;
00089     }
00090     MPIO_Completed_request_create(&fd, nbytes, error_code, request);
00091 }