OpenMPI  0.1.1
op_example.h
1 /*
2  * Copyright (c) 2004-2008 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-2009 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef MCA_OP_EXAMPLE_EXPORT_H
21 #define MCA_OP_EXAMPLE_EXPORT_H
22 
23 #include "ompi_config.h"
24 
25 #include "opal/mca/mca.h"
26 #include "opal/class/opal_object.h"
27 
28 #include "ompi/mca/op/op.h"
29 
30 BEGIN_C_DECLS
31 
32 /**
33  * Derive a struct from the base op component struct, allowing us to
34  * cache some component-specific information on our well-known
35  * component struct.
36  */
37 typedef struct {
38  /** The base op component struct */
40 
41  /* What follows is example-component-specific cached information. We
42  tend to use this scheme (caching information on the example
43  component itself) instead of lots of individual global
44  variables for the component. The following data fields are
45  examples; replace them with whatever is relevant for your
46  component. */
47 
48  /** A simple boolean indicating that the hardware is available. */
50 
51  /** A simple boolean indicating whether double precision is
52  supported. */
55 
56 /**
57  * Derive a struct from the base op module struct, allowing us to
58  * cache some module-specific information for BXOR. Note that
59  * information that should be shared across all modules should be put
60  * on the example component.
61  */
62 typedef struct {
64 
65  /* Just like the ompi_op_example_component_t, this struct is meant to
66  cache information on a per-module basis. What follows are
67  examples; replace them with whatever is relevant for your
68  component/module. Keep in mind that there will be one distinct
69  module for each MPI_Op; you may want to have different data
70  cached on the module, depending on the MPI_Op that it is
71  supporting. */
72  double some_bxor_data;
74 
75 /**
76  * To use OMPI's OBJ system, you have to declare each "class".
77  */
79 
80 /**
81  * Globally exported variable. Note that it is a *example* component
82  * (defined above), which has the ompi_op_base_component_t as its
83  * first member. Hence, the MCA/op framework will find the data that
84  * it expects in the first memory locations, but then the component
85  * itself can cache additional information after that that can be used
86  * by both the component and modules.
87  */
88 OMPI_DECLSPEC extern ompi_op_example_component_t
90 
91 /**
92  * Setup for MPI_MAX and return a module.
93  */
94 OMPI_DECLSPEC ompi_op_base_module_t *
96 
97 /**
98  * Setup for MPI_BXOR and return a module.
99  */
100 OMPI_DECLSPEC ompi_op_base_module_t *
102 
103 END_C_DECLS
104 
105 #endif /* MCA_OP_EXAMPLE_EXPORT_H */
Module struct.
Definition: op.h:355
bool hardware_available
A simple boolean indicating that the hardware is available.
Definition: op_example.h:49
bool double_supported
A simple boolean indicating whether double precision is supported.
Definition: op_example.h:53
Derive a struct from the base op module struct, allowing us to cache some module-specific information...
Definition: op_example.h:62
Op component interface.
Definition: op.h:324
ompi_op_base_component_1_0_0_t super
The base op component struct.
Definition: op_example.h:39
ompi_op_base_module_t * ompi_op_example_setup_bxor(ompi_op_t *op)
Setup function for MPI_BXOR.
Definition: op_example_module_bxor.c:183
Top-level interface for all MCA components.
ompi_op_example_component_t mca_op_example_component
Globally exported variable.
Definition: op_example_component.c:46
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
Back-end type of MPI_Op.
Definition: op.h:100
MPI_Op back-end operation framework.
Derive a struct from the base op component struct, allowing us to cache some component-specific infor...
Definition: op_example.h:37
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
ompi_op_base_module_t * ompi_op_example_setup_max(ompi_op_t *op)
Setup function for MPI_MAX.
Definition: op_example_module_max.c:203