root/ompi/mca/io/romio321/romio/mpi-io/mpir-mpioinit.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPIR_MPIOInit

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
   2 /*
   3  *  (C) 2009 UChicago/Argonne LLC
   4  *      See COPYRIGHT in top-level directory.
   5  */
   6 #include "mpioimpl.h"
   7 #include <string.h>
   8 
   9 #ifdef HAVE_WEAK_SYMBOLS
  10 /* Include mapping from MPI->PMPI */
  11 #define MPIO_BUILD_PROFILING
  12 #include "mpioprof.h"
  13 #endif
  14 
  15 extern int ADIO_Init_keyval;
  16 
  17 /* common code to stuff an attribute on a communicator for the purpose of
  18  * cleaning up in MPI_Finalize() */
  19 
  20 void MPIR_MPIOInit(int * error_code) {
  21 
  22     int flag;
  23     char myname[] = "MPIR_MPIOInit";
  24 
  25     /* first check if ADIO has been initialized. If not, initialize it */
  26     if (ADIO_Init_keyval == MPI_KEYVAL_INVALID) {
  27         MPI_Initialized(&flag);
  28 
  29         /* --BEGIN ERROR HANDLING-- */
  30         if (!flag) {
  31             *error_code = MPIO_Err_create_code(MPI_SUCCESS, 
  32                     MPIR_ERR_RECOVERABLE, myname, __LINE__, 
  33                     MPI_ERR_OTHER, "**initialized", 0);
  34             *error_code = MPIO_Err_return_file(MPI_FILE_NULL, *error_code);
  35             return;
  36         }
  37         /* --END ERROR HANDLING-- */
  38 
  39         MPI_Comm_create_keyval (MPI_COMM_NULL_COPY_FN, ADIOI_End_call, &ADIO_Init_keyval,
  40                                 (void *) 0);  
  41 
  42         /* put a dummy attribute on MPI_COMM_SELF, because we want the delete
  43            function to be called when MPI_COMM_SELF is freed. Clarified
  44            in MPI-2 section 4.8, the standard mandates that attributes on
  45            MPI_COMM_SELF get cleaned up early in MPI_Finalize */
  46 
  47         MPI_Comm_set_attr (MPI_COMM_SELF, ADIO_Init_keyval, (void *) 0);
  48 
  49         /* initialize ADIO */
  50         ADIO_Init( (int *)0, (char ***)0, error_code);
  51     }
  52     *error_code = MPI_SUCCESS;
  53 }
  54 /* 
  55  * vim: ts=8 sts=4 sw=4 noexpandtab 
  56  */

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