File: osc_base_obj_convert.h

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (129 lines) | stat: -rw-r--r-- 4,541 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Copyright (c) 2004-2005 The Trustees of Indiana University.
 *                         All rights reserved.
 * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
 *                         All rights reserved.
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * Copyright (c) 2015      Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

/**
 * @file
 *
 * Utility functions for Open MPI object manipulation by the One-sided code
 *
 * Utility functions for creating / finding handles for Open MPI
 * objects, usually based on indexes sent from remote peers.
 */

#include "ompi_config.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/proc/proc.h"
#include "ompi/op/op.h"

BEGIN_C_DECLS

/**
 * Create datatype based on packed payload
 *
 * Create a usable MPI datatype based on its packed description.
 * The datatype is owned by the calling process and must be
 * OBJ_RELEASEd when no longer in use.
 *
 * @param remote_proc The ompi_proc_t pointer for the remote process
 * @param payload     A pointer to the pointer to the payload.  The
 *                    pointer to the payload will be moved past the
 *                    datatype information upon successful return.
 *
 * @retval NULL       A failure occurred
 * @retval non-NULL   A fully operational datatype
 */
static inline
struct ompi_datatype_t*
ompi_osc_base_datatype_create(ompi_proc_t *remote_proc,  void **payload)
{
    struct ompi_datatype_t *datatype =
        ompi_datatype_create_from_packed_description(payload, remote_proc);
    if (NULL == datatype) return NULL;
    return datatype;
}


/**
 * Create operation based on Fortran Index
 *
 * Create a usable MPI operation based on its Fortran index, which is
 * globally the same for predefined operations.  The op handle is
 * owned by the calling process and must be OBJ_RELEASEd when no
 * longer in use.
 *
 * @param op_id       The fortran index for the operation
 *
 * @retval NULL       A failure occurred
 * @retval non-NULL   An op handle
 */
static inline
ompi_op_t *
ompi_osc_base_op_create(int op_id)
{
    ompi_op_t *op = PMPI_Op_f2c(op_id);
    OBJ_RETAIN(op);
    return op;
}


/**
 * Get the primitive datatype information for a legal one-sided accumulate datatype
 *
 * Get the primitive datatype information for a legal one-sided
 * accumulate datatype.  This includes the primitive datatype used to
 * build the datatype (there can be only one) and the number of
 * instances of that primitive datatype in the datatype (there can be
 * many).
 *
 * @param datatype      legal one-sided datatype
 * @param prim_datatype The primitive datatype used to build datatype
 * @param prim_count    Number of instances of prim_datattpe in datatype
 *
 * @retval OMPI_SUCCESS Success
 */
OMPI_DECLSPEC int ompi_osc_base_get_primitive_type_info(ompi_datatype_t *datatype,
                                                        ompi_datatype_t **prim_datatype,
                                                        uint32_t *prim_count);


/**
 * Apply the operation specified from inbuf to outbuf
 *
 * Apply the specified reduction operation from inbuf to outbuf.
 * inbuf must contain count instances of datatype, in the local
 * process's binary mode.
 *
 * @retval OMPI_SUCCESS           Success
 * @retval OMPI_ERR_NOT_SUPPORTED Called with op == ompi_mpi_op_replace
 */
OMPI_DECLSPEC int ompi_osc_base_process_op(void *outbuf,
                                           void *inbuf,
                                           size_t inbuflen,
                                           struct ompi_datatype_t *datatype,
                                           int count,
                                           ompi_op_t *op);

OMPI_DECLSPEC int ompi_osc_base_sndrcv_op(const void *origin,
                                          int32_t origin_count,
                                          struct ompi_datatype_t *origin_dt,
                                          void *target,
                                          int32_t target_count,
                                          struct ompi_datatype_t *target_dt,
                                          ompi_op_t *op);

END_C_DECLS