
00001 /* -*- Mode: C; c-basic-offset:4 ; -*- */ 00002 /* 00003 * $Id$ 00004 * 00005 * Copyright (C) 1997 University of Chicago. 00006 * See COPYRIGHT notice in top-level directory. 00007 */ 00008 00009 #include "adio.h" 00010 #include "adio_extern.h" 00011 00012 void ADIO_End(int *error_code) 00013 { 00014 ADIOI_Flatlist_node *curr, *next; 00015 ADIOI_Malloc_async *tmp; 00016 ADIOI_Malloc_req *tmp1; 00017 00018 /* FPRINTF(stderr, "reached end\n"); */ 00019 00020 /* delete the flattened datatype list */ 00021 curr = ADIOI_Flatlist; 00022 while (curr) { 00023 if (curr->blocklens) ADIOI_Free(curr->blocklens); 00024 if (curr->indices) ADIOI_Free(curr->indices); 00025 next = curr->next; 00026 ADIOI_Free(curr); 00027 curr = next; 00028 } 00029 ADIOI_Flatlist = NULL; 00030 00031 if (ADIOI_Async_list_head) { 00032 FPRINTF(stderr, "ADIO_End: Error! There are outstanding nonblocking I/O operations!\n"); 00033 MPI_Abort(MPI_COMM_WORLD, 1); 00034 } 00035 00036 /* free list of available ADIOI_Async_nodes. */ 00037 while (ADIOI_Malloc_async_head) { 00038 ADIOI_Free(ADIOI_Malloc_async_head->ptr); 00039 tmp = ADIOI_Malloc_async_head; 00040 ADIOI_Malloc_async_head = ADIOI_Malloc_async_head->next; 00041 ADIOI_Free(tmp); 00042 } 00043 ADIOI_Async_avail_head = ADIOI_Async_avail_tail = NULL; 00044 ADIOI_Malloc_async_head = ADIOI_Malloc_async_tail = NULL; 00045 00046 /* free all available request objects */ 00047 while (ADIOI_Malloc_req_head) { 00048 ADIOI_Free(ADIOI_Malloc_req_head->ptr); 00049 tmp1 = ADIOI_Malloc_req_head; 00050 ADIOI_Malloc_req_head = ADIOI_Malloc_req_head->next; 00051 ADIOI_Free(tmp1); 00052 } 00053 ADIOI_Malloc_req_head = ADIOI_Malloc_req_tail = NULL; 00054 00055 /* free file, request, and info tables used for Fortran interface */ 00056 if (ADIOI_Ftable) ADIOI_Free(ADIOI_Ftable); 00057 if (ADIOI_Reqtable) ADIOI_Free(ADIOI_Reqtable); 00058 #ifndef HAVE_MPI_INFO 00059 if (MPIR_Infotable) ADIOI_Free(MPIR_Infotable); 00060 #endif 00061 00062 *error_code = MPI_SUCCESS; 00063 } 00064 00065 00066 00067 /* This is the delete callback function associated with 00068 ADIO_Init_keyval when MPI_COMM_WORLD is freed */ 00069 00070 int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void 00071 *extra_state) 00072 { 00073 int error_code; 00074 00075 ADIO_End(&error_code); 00076 return error_code; 00077 }
1.5.5