root/ompi/mca/io/romio321/romio/adio/common/ad_iread_fake.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ADIOI_FAKE_IreadContig
  2. ADIOI_FAKE_IreadStrided

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *
   4  *   Copyright (C) 2004 University of Chicago. 
   5  *   See COPYRIGHT notice in top-level directory.
   6  */
   7 
   8 #include "adio.h"
   9 #include "mpiu_greq.h"
  10 
  11 /* Generic implementation of IreadContig calls the blocking ReadContig
  12  * immediately.
  13  */
  14 void ADIOI_FAKE_IreadContig(ADIO_File fd, void *buf, int count, 
  15                            MPI_Datatype datatype, int file_ptr_type,
  16                            ADIO_Offset offset, ADIO_Request *request,
  17                            int *error_code)  
  18 {
  19     ADIO_Status status;
  20     MPI_Count typesize;
  21     MPI_Offset len;
  22 
  23     MPI_Type_size_x(datatype, &typesize);
  24     len = (MPI_Offset)count * (MPI_Offset)typesize;
  25 
  26     /* Call the blocking function.  It will create an error code
  27      * if necessary.
  28      */
  29     ADIOI_Assert(len == (int) len); /* the count is an int parm */
  30     ADIO_ReadContig(fd, buf, (int)len, MPI_BYTE, file_ptr_type, offset, 
  31                     &status, error_code);  
  32     if (*error_code != MPI_SUCCESS) {
  33             len=0;
  34     }
  35     MPIO_Completed_request_create(&fd, len, error_code, request);
  36 }
  37 
  38 
  39 /* Generic implementation of IreadStrided calls the blocking ReadStrided
  40  * immediately.
  41  */
  42 void ADIOI_FAKE_IreadStrided(ADIO_File fd, void *buf, int count, 
  43                             MPI_Datatype datatype, int file_ptr_type,
  44                             ADIO_Offset offset, ADIO_Request *request,
  45                             int *error_code)
  46 {
  47     ADIO_Status status;
  48     MPI_Count typesize;
  49     MPI_Offset nbytes=0;
  50 
  51     /* Call the blocking function.  It will create an error code
  52      * if necessary.
  53      */
  54     ADIO_ReadStrided(fd, buf, count, datatype, file_ptr_type, 
  55                      offset, &status, error_code);  
  56     if (*error_code == MPI_SUCCESS) {
  57         MPI_Type_size_x(datatype, &typesize);
  58         nbytes = (MPI_Offset)count*(MPI_Offset)typesize;
  59     }
  60     MPIO_Completed_request_create(&fd, nbytes, error_code, request);
  61 }

/* [<][>][^][v][top][bottom][index][help] */