OpenMPI  0.1.1
sharedfp.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3  * University Research and Technology
4  * Corporation. All rights reserved.
5  * Copyright (c) 2004-2005 The University of Tennessee and The University
6  * of Tennessee Research Foundation. All rights
7  * reserved.
8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9  * University of Stuttgart. All rights reserved.
10  * Copyright (c) 2004-2005 The Regents of the University of California.
11  * All rights reserved.
12  * Copyright (c) 2008-2011 University of Houston. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef OMPI_MCA_SHAREDFP_H
21 #define OMPI_MCA_SHAREDFP_H
22 
23 #include "ompi_config.h"
24 #include "mpi.h"
25 #include "opal/mca/mca.h"
26 #include "opal/mca/base/base.h"
27 
28 BEGIN_C_DECLS
29 
30 struct mca_io_ompio_file_t;
31 
32 /*
33  * Macro for use in components that are of type coll
34  */
35 #define MCA_SHAREDFP_BASE_VERSION_2_0_0 \
36  MCA_BASE_VERSION_2_0_0, \
37  "sharedfp", 2, 0, 0
38 
39 /*
40  * This framework abstracts out operations of the shared filepointer
41  * in MPI I/O. It is initialized by the OMPIO module whenever a file is
42  * opened.
43  *
44  * These are the component function prototypes. These function pointers
45  * go into the component structure. These functions (query() and finalize()
46  * are called during sharedfp_base_select(). Each component is query() ied
47  * and subsequently, all the unselected components are finalize() 'ed
48  * so that any *stuff* they did during query() can be undone. By
49  * similar logic, finalize() is also called on the component which
50  * was selected when the communicator is being destroyed.
51  *
52  * So, to sum it up, every component carries 4 functions:
53  * 1. open() - called during MPI_INIT
54  * 2. close() - called during MPI_FINALIZE
55  * 3. query() - called to select a particular component
56  * 4. finalize() - called when actions taken during query have
57  * to be undone
58  * In addition, two functions, namely updating the value of a shared
59  * file pointer and moving the shared file pointer (seek) have to be provided
60  * by every module.
61  */
62 
63 /*
64  * **************** component struct *******************************
65  * *********** These functions go in the component struct **********
66  * **************** component struct *******************************
67  */
68 
69 typedef int (*mca_sharedfp_base_component_init_query_1_0_0_fn_t)
70  (bool enable_progress_threads,
71  bool enable_mpi_threads);
72 
73 typedef struct mca_sharedfp_base_module_1_0_0_t *
74 (*mca_sharedfp_base_component_file_query_1_0_0_fn_t) (int *priority);
75 
76 typedef int (*mca_sharedfp_base_component_file_unquery_1_0_0_fn_t)
77  (struct mca_io_ompio_file_t *file);
78 
79 /*
80  * ****************** component struct ******************************
81  * Structure for sharedfp v2.0.0 components.This is chained to MCA v2.0.0
82  * ****************** component struct ******************************
83  */
85  mca_base_component_t sharedfpm_version;
86  mca_base_component_data_t sharedfpm_data;
87 
88  mca_sharedfp_base_component_init_query_1_0_0_fn_t sharedfpm_init_query;
89  mca_sharedfp_base_component_file_query_1_0_0_fn_t sharedfpm_file_query;
90  mca_sharedfp_base_component_file_unquery_1_0_0_fn_t sharedfpm_file_unquery;
91 };
94 
95 /*
96  * ***********************************************************************
97  * ************************ Interface function definitions **************
98  * These are the typedesharedfp for the function pointers to various sharedfp
99  * backend functions which will be used by the various sharedfp components
100  * ***********************************************************************
101  */
102 
103 typedef int (*mca_sharedfp_base_module_init_1_0_0_fn_t)
104 (struct mca_io_ompio_file_t *file);
105 
106 typedef int (*mca_sharedfp_base_module_finalize_1_0_0_fn_t)
107 (struct mca_io_ompio_file_t *file);
108 
109 typedef int (*mca_sharedfp_base_module_update_fn_t)(
110  struct mca_io_ompio_file_t *fh, int num_bytes,
111  OMPI_MPI_OFFSET_TYPE current_position);
112 typedef int (*mca_sharedfp_base_module_seek_fn_t)(
113  struct mca_io_ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE position);
114 
115 /*
116  * ***********************************************************************
117  * *************************** module structure *************************
118  * ***********************************************************************
119  */
121  /*
122  * Per-file initialization function. This is called only
123  * on the module which is selected. The finalize corresponding to
124  * this function is present on the component struct above
125  */
126  mca_sharedfp_base_module_init_1_0_0_fn_t sharedfp_module_init;
127  mca_sharedfp_base_module_finalize_1_0_0_fn_t sharedfp_module_finalize;
128 
129  /* SHAREDFP function pointers */
130  mca_sharedfp_base_module_update_fn_t sharedfp_update;
131  mca_sharedfp_base_module_seek_fn_t sharedfp_seek;
132 };
135 
136 END_C_DECLS
137 
138 #endif /* OMPI_MCA_SHAREDFP_H */
Common type for all MCA components.
Definition: mca.h:250
Definition: sharedfp.h:84
Top-level interface for all MCA components.
Back-end structure for MPI_File.
Definition: io_ompio.h:121
Meta data for MCA v2.0.0 components.
Definition: mca.h:309
Definition: sharedfp.h:120