1 /* -*- Mode: C; c-basic-offset:4 ; -*- */
2 
3 /*
4  *  (C) 2001 by Argonne National Laboratory.
5  *      See COPYRIGHT in top-level directory.
6  */
7 
8 #ifndef MPID_DATALOOP_H
9 #define MPID_DATALOOP_H
10 
11 #include <mpi.h>
12 
13 /* Note: this is where you define the prefix that will be prepended on
14  * all externally visible generic dataloop and segment functions.
15  */
16 #define PREPEND_PREFIX(fn) MPID_ ## fn
17 
18 /* These following dataloop-specific types will be used throughout the DLOOP
19  * instance:
20  */
21 #define DLOOP_Offset     MPI_Aint
22 #define DLOOP_Count      int
23 #define DLOOP_Handle     MPI_Datatype
24 #define DLOOP_Type       MPI_Datatype
25 #define DLOOP_Buffer     void *
26 #define DLOOP_VECTOR     MPID_IOV
27 #define DLOOP_VECTOR_LEN MPID_IOV_LEN
28 #define DLOOP_VECTOR_BUF MPID_IOV_BUF
29 
30 /* The following accessor functions must also be defined:
31  *
32  * DLOOP_Handle_extent()
33  * DLOOP_Handle_size()
34  * DLOOP_Handle_loopptr()
35  * DLOOP_Handle_loopdepth()
36  * DLOOP_Handle_hasloop()
37  *
38  */
39 
40 /* USE THE NOTATION THAT BILL USED IN MPIIMPL.H AND MAKE THESE MACROS */
41 
42 /* NOTE: put get size into mpiimpl.h; the others go here until such time
43  * as we see that we need them elsewhere.
44  */
45 #define DLOOP_Handle_get_loopdepth_macro(handle_,depth_,flag_) \
46     MPID_Datatype_get_loopdepth_macro(handle_,depth_,flag_)
47 
48 #define DLOOP_Handle_get_loopsize_macro(handle_,size_,flag_) \
49     MPID_Datatype_get_loopsize_macro(handle_,size_,flag_)
50 
51 #define DLOOP_Handle_set_loopptr_macro(handle_,lptr_,flag_) \
52     MPID_Datatype_set_loopptr_macro(handle_,lptr_,flag_)
53 
54 #define DLOOP_Handle_set_loopdepth_macro(handle_,depth_,flag_) \
55     MPID_Datatype_set_loopdepth_macro(handle_,depth_,flag_)
56 
57 #define DLOOP_Handle_set_loopsize_macro(handle_,size_,flag_) \
58     MPID_Datatype_set_loopsize_macro(handle_,size_,flag_)
59 
60 #define DLOOP_Handle_get_loopptr_macro(handle_,lptr_,flag_) \
61     MPID_Datatype_get_loopptr_macro(handle_,lptr_,flag_)
62 
63 #define DLOOP_Handle_get_size_macro(handle_,size_) \
64     MPID_Datatype_get_size_macro(handle_,size_)
65 
66 #define DLOOP_Handle_get_basic_type_macro(handle_,eltype_) \
67     MPID_Datatype_get_basic_type(handle_, eltype_)
68 
69 #define DLOOP_Handle_get_extent_macro(handle_,extent_) \
70     MPID_Datatype_get_extent_macro(handle_,extent_)
71 
72 #define DLOOP_Handle_hasloop_macro(handle_)                           \
73     ((HANDLE_GET_KIND(handle_) == HANDLE_KIND_BUILTIN) ? 0 : 1)
74 
75 #define DLOOP_Ensure_Offset_fits_in_pointer(value_) \
76     MPID_Ensure_Aint_fits_in_pointer(value_)
77 
78 /* allocate and free functions must also be defined. */
79 #define DLOOP_Malloc MPIU_Malloc
80 #define DLOOP_Free   MPIU_Free
81 
82 /* debugging output function */
83 #define DLOOP_dbg_printf MPIU_dbg_printf
84 
85 /* assert function */
86 #define DLOOP_Assert MPIU_Assert
87 
88 /* memory copy function */
89 #define DLOOP_Memcpy MPIU_Memcpy
90 
91 /* casting macros */
92 #define DLOOP_OFFSET_CAST_TO_VOID_PTR MPI_AINT_CAST_TO_VOID_PTR
93 #define DLOOP_VOID_PTR_CAST_TO_OFFSET MPI_VOID_PTR_CAST_TO_MPI_AINT
94 #define DLOOP_PTR_DISP_CAST_TO_OFFSET MPI_PTR_DISP_CAST_TO_MPI_AINT
95 
96 /* printing macros */
97 #define DLOOP_OFFSET_FMT_DEC_SPEC MPI_AINT_FMT_DEC_SPEC
98 #define DLOOP_OFFSET_FMT_HEX_SPEC MPI_AINT_FMT_HEX_SPEC
99 
100 /* Include dataloop_parts.h at the end to get the rest of the prototypes
101  * and defines, in terms of the prefixes and types above.
102  */
103 #include "dataloop/dataloop_parts.h"
104 #include "dataloop/dataloop_create.h"
105 
106 /* These values are defined by DLOOP code.
107  *
108  * Note: DLOOP_DATALOOP_ALL_BYTES is used only when the device
109  * defines MPID_NEEDS_DLOOP_ALL_BYTES.
110  */
111 #define MPID_DATALOOP_HETEROGENEOUS DLOOP_DATALOOP_HETEROGENEOUS
112 #define MPID_DATALOOP_HOMOGENEOUS   DLOOP_DATALOOP_HOMOGENEOUS
113 #define MPID_DATALOOP_ALL_BYTES     DLOOP_DATALOOP_ALL_BYTES
114 
115 #include <mpiimpl.h>
116 
117 #endif
118