File: datarep.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 (107 lines) | stat: -rw-r--r-- 3,845 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
/*
 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  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) 2007-2012 Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2015      Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

/**
 * @file
 *
 * This file does two things:
 *
 * 1. Provides typedef for the Fortran versions of the callbacks
 * registered by MPI_REGISTER_DATAREP.  These typedefs are needed for
 * the Fortran MPI API.
 *
 * 2. Provides the sentinel value functions/function pointers for
 * Fortran's version of MPI_CONVERSION_FN_NULL, and some helpful
 * macros for testing whether an argument passed to a Fortran MPI API
 * function is that sentinel value or not.
 */

#ifndef OMPI_FORTRAN_BASE_DATAREP_H
#define OMPI_FORTRAN_BASE_DATAREP_H

#include "ompi_config.h"

#include "mpi.h"

BEGIN_C_DECLS

/**
 * Function typedef for the conversion function pointer in
 * MPI_REGISTER_DATAREP */
typedef void (ompi_mpi2_fortran_datarep_conversion_fn_t)
    (char *userbuf, MPI_Fint *datatype, MPI_Fint *count, char *filebuf,
     MPI_Offset *position, MPI_Aint *extra_state, MPI_Fint *ierr);

/**
 * Function typedef for the extent function pointer in
 * MPI_REGISTER_DATAREP */
typedef void (ompi_mpi2_fortran_datarep_extent_fn_t)
    (MPI_Fint *datatype, MPI_Aint *extent, MPI_Aint *extra_state,
     MPI_Fint *ierr);

/**
 * Macro for declaring each of the 5 back-end Fortran functions for
 * MPI_CONVERSION_FN_NULL.  We need the 4 fortran compiler conversions
 * and 1 for the "real" back-end function (even though these functions
 * are never invoked -- they're only used as sentinel values -- it's
 * simpler to use the same kind of code structure that we use for the
 * Fortran MPI API bindings and other callback functions).
 */
#define OMPI_DATAREP_FORTRAN_DECLARE(lower_name, upper_name, args) \
  OMPI_DECLSPEC void lower_name##_f args;    \
  OMPI_DECLSPEC void lower_name args;        \
  OMPI_DECLSPEC void lower_name##_ args;     \
  OMPI_DECLSPEC void lower_name##__ args;    \
  OMPI_DECLSPEC void upper_name args;

/*
 * Declare the 5 functions.
 */
OMPI_DATAREP_FORTRAN_DECLARE(mpi_conversion_fn_null, MPI_CONVERSION_FN_NULL, (char *userbuf, MPI_Fint *datatype, MPI_Fint *count, char *filebuf, MPI_Offset *position, MPI_Aint *extra_state, MPI_Fint *ierr))

/* Be social and remove this private macro from the global header file
   space */
#undef OMPI_DATAREP_FORTRAN_DECLARE

/**
 * Declare the test macro in all of its forms.  This macro provides a
 * convenient way to check whether an argument is the sentinel value
 * MPI_CONVERSION_FN_NULL.
 */
#if OMPI_FORTRAN_CAPS
#define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  (MPI_CONVERSION_FN_NULL == addr)
#elif OMPI_FORTRAN_PLAIN
#define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  (mpi_conversion_fn_null == addr)
#elif OMPI_FORTRAN_SINGLE_UNDERSCORE
#define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  (mpi_conversion_fn_null_ == addr)
#elif OMPI_FORTRAN_DOUBLE_UNDERSCORE
#define OMPI_IS_FORTRAN_CONVERSION_FN_NULL(addr) \
  (mpi_conversion_fn_null__ == addr)
#else
#error Unrecognized Fortran name mangling scheme
#endif

END_C_DECLS

#endif