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

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

DEFINITIONS

This source file includes following definitions.
  1. ADIO_End
  2. ADIOI_End_call

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /* 
   3  *   Copyright (C) 1997 University of Chicago. 
   4  *   See COPYRIGHT notice in top-level directory.
   5  */
   6 
   7 #include "adio.h"
   8 #include "adio_extern.h"
   9 
  10 void ADIO_End(int *error_code)
  11 {
  12     ADIOI_Flatlist_node *curr, *next;
  13     ADIOI_Datarep *datarep, *datarep_next;
  14     
  15 /*    FPRINTF(stderr, "reached end\n"); */
  16 
  17     /* if a default errhandler was set on MPI_FILE_NULL then we need to ensure
  18      * that our reference to that errhandler is released */
  19 /* Open MPI: The call to PMPI_File_set_errhandler has to be done in romio/src/io_romio_file_open.c
  20    in routine mca_io_romio_file_close()
  21 */
  22 #if 0
  23     PMPI_File_set_errhandler(MPI_FILE_NULL, MPI_ERRORS_RETURN);
  24 #endif
  25 
  26 /* delete the flattened datatype list */
  27     curr = ADIOI_Flatlist;
  28     while (curr) {
  29         if (curr->blocklens) ADIOI_Free(curr->blocklens);
  30         if (curr->indices) ADIOI_Free(curr->indices);
  31         next = curr->next;
  32         ADIOI_Free(curr);
  33         curr = next;
  34     }
  35     ADIOI_Flatlist = NULL;
  36 
  37 /* free file and info tables used for Fortran interface */
  38     if (ADIOI_Ftable) ADIOI_Free(ADIOI_Ftable);
  39 #ifndef HAVE_MPI_INFO
  40     if (MPIR_Infotable) ADIOI_Free(MPIR_Infotable);
  41 #endif
  42 
  43 
  44 /* free the memory allocated for a new data representation, if any */
  45     datarep = ADIOI_Datarep_head;
  46     while (datarep) {
  47         datarep_next = datarep->next;
  48         ADIOI_Free(datarep->name);
  49         ADIOI_Free(datarep);
  50         datarep = datarep_next;
  51     }
  52 
  53     if( ADIOI_syshints != MPI_INFO_NULL)
  54             MPI_Info_free(&ADIOI_syshints);
  55 
  56     MPI_Op_free(&ADIO_same_amode);
  57 
  58     *error_code = MPI_SUCCESS;
  59 }
  60 
  61 
  62 
  63 /* This is the delete callback function associated with
  64    ADIO_Init_keyval when MPI_COMM_SELF is freed */
  65 
  66 int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void
  67                   *extra_state)
  68 {
  69     int error_code;
  70 
  71     ADIOI_UNREFERENCED_ARG(comm);
  72     ADIOI_UNREFERENCED_ARG(attribute_val);
  73     ADIOI_UNREFERENCED_ARG(extra_state);
  74 
  75     MPI_Comm_free_keyval (&keyval);
  76 
  77     /* The end call will be called after all possible uses of this keyval, even
  78      * if a file was opened with MPI_COMM_SELF.  Note, this assumes LIFO
  79      * MPI_COMM_SELF attribute destruction behavior mandated by MPI-2.2. */
  80     if (ADIOI_cb_config_list_keyval != MPI_KEYVAL_INVALID)
  81         MPI_Comm_free_keyval (&ADIOI_cb_config_list_keyval);
  82 
  83     ADIO_End(&error_code);
  84     return error_code;
  85 }

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