Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove warning
[simgrid.git] / src / smpi / smpi_mpi_dt_private.h
1 /* smpi_mpi_dt_private.h -- functions of smpi_mpi_dt.c that are exported to other SMPI modules. */
2
3 /* Copyright (c) 2009, 2010. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7   * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifndef SMPI_DT_PRIVATE_H
10 #define SMPI_DT_PRIVATE_H
11
12 #include "private.h"
13
14 #define DT_FLAG_DESTROYED     0x0001  /**< user destroyed but some other layers still have a reference */
15 #define DT_FLAG_COMMITED      0x0002  /**< ready to be used for a send/recv operation */
16 #define DT_FLAG_CONTIGUOUS    0x0004  /**< contiguous datatype */
17 #define DT_FLAG_OVERLAP       0x0008  /**< datatype is unpropper for a recv operation */
18 #define DT_FLAG_USER_LB       0x0010  /**< has a user defined LB */
19 #define DT_FLAG_USER_UB       0x0020  /**< has a user defined UB */
20 #define DT_FLAG_PREDEFINED    0x0040  /**< cannot be removed: initial and predefined datatypes */
21 #define DT_FLAG_NO_GAPS       0x0080  /**< no gaps around the datatype */
22 #define DT_FLAG_DATA          0x0100  /**< data or control structure */
23 #define DT_FLAG_ONE_SIDED     0x0200  /**< datatype can be used for one sided operations */
24 #define DT_FLAG_UNAVAILABLE   0x0400  /**< datatypes unavailable on the build (OS or compiler dependant) */
25 #define DT_FLAG_VECTOR        0x0800  /**< valid only for loops. The loop contain only one element
26                                        **< without extent. It correspond to the vector type. */
27 /*
28  * We should make the difference here between the predefined contiguous and non contiguous
29  * datatypes. The DT_FLAG_BASIC is held by all predefined contiguous datatypes.
30  */
31 #define DT_FLAG_BASIC         (DT_FLAG_PREDEFINED | DT_FLAG_CONTIGUOUS | DT_FLAG_NO_GAPS | DT_FLAG_DATA | DT_FLAG_COMMITED)
32
33 extern MPI_Datatype MPI_PTR;
34
35
36 //*****************************************************************************************
37
38 /* 
39   These are the structures that handle complex data type information, 
40   used for serialization/unserialization of messages
41 */
42
43 typedef struct s_smpi_mpi_vector{
44   s_smpi_subtype_t base;
45   MPI_Datatype old_type;
46   size_t size_oldtype;
47   size_t block_stride;
48   size_t block_length;
49   size_t block_count;
50 } s_smpi_mpi_vector_t;
51
52 typedef struct s_smpi_mpi_hvector{
53   s_smpi_subtype_t base;
54   MPI_Datatype old_type;
55   size_t size_oldtype;
56   MPI_Aint block_stride;
57   size_t block_length;
58   size_t block_count;
59 } s_smpi_mpi_hvector_t;
60
61 typedef struct s_smpi_mpi_indexed{
62   s_smpi_subtype_t base;
63   MPI_Datatype old_type;
64   size_t size_oldtype;
65   int* block_lengths;
66   int* block_indices;
67   size_t block_count;
68 } s_smpi_mpi_indexed_t;
69
70 typedef struct s_smpi_mpi_hindexed{
71   s_smpi_subtype_t base;
72   MPI_Datatype old_type;
73   size_t size_oldtype;
74   int* block_lengths;
75   MPI_Aint* block_indices;
76   size_t block_count;
77 } s_smpi_mpi_hindexed_t;
78
79 typedef struct s_smpi_mpi_struct{
80   s_smpi_subtype_t base;
81   MPI_Datatype old_type;
82   size_t size_oldtype;
83   int* block_lengths;
84   MPI_Aint* block_indices;
85   size_t block_count;
86   MPI_Datatype* old_types;
87 } s_smpi_mpi_struct_t;
88
89 /*
90   Functions to handle serialization/unserialization of messages, 3 for each type of MPI_Type
91   One for creating the substructure to handle, one for serialization, one for unserialization
92 */
93
94 void unserialize_vector( const void *contiguous_vector,
95                          void *noncontiguous_vector,
96                          size_t count,
97                          void *type);
98
99 void serialize_vector( const void *noncontiguous_vector,
100                        void *contiguous_vector,
101                        size_t count,
102                        void *type);
103
104 void free_vector(MPI_Datatype* type);
105
106 s_smpi_mpi_vector_t* smpi_datatype_vector_create( int block_stride,
107                                                   int block_length,
108                                                   int block_count,
109                                                   MPI_Datatype old_type,
110                                                   int size_oldtype);
111
112 void unserialize_hvector( const void *contiguous_vector,
113                          void *noncontiguous_vector,
114                          size_t count,
115                          void *type);
116
117 void serialize_hvector( const void *noncontiguous_vector,
118                        void *contiguous_vector,
119                        size_t count,
120                        void *type);
121
122 void free_hvector(MPI_Datatype* type);
123
124 s_smpi_mpi_hvector_t* smpi_datatype_hvector_create( MPI_Aint block_stride,
125                                                   int block_length,
126                                                   int block_count,
127                                                   MPI_Datatype old_type,
128                                                   int size_oldtype);
129
130
131 void unserialize_indexed( const void *contiguous_indexed,
132                          void *noncontiguous_indexed,
133                          size_t count,
134                          void *type);
135
136 void serialize_indexed( const void *noncontiguous_vector,
137                        void *contiguous_vector,
138                        size_t count,
139                        void *type);
140
141 void free_indexed(MPI_Datatype* type);
142
143 s_smpi_mpi_indexed_t* smpi_datatype_indexed_create(int* block_lengths,
144                                                   int* block_indices,
145                                                   int block_count,
146                                                   MPI_Datatype old_type,
147                                                   int size_oldtype);
148
149 void unserialize_hindexed( const void *contiguous_indexed,
150                          void *noncontiguous_indexed,
151                          size_t count,
152                          void *type);
153
154 void serialize_hindexed( const void *noncontiguous_vector,
155                        void *contiguous_vector,
156                        size_t count,
157                        void *type);
158
159 void free_hindexed(MPI_Datatype* type);
160
161 s_smpi_mpi_hindexed_t* smpi_datatype_hindexed_create(int* block_lengths,
162                                                   MPI_Aint* block_indices,
163                                                   int block_count,
164                                                   MPI_Datatype old_type,
165                                                   int size_oldtype);
166
167 void unserialize_struct( const void *contiguous_indexed,
168                          void *noncontiguous_indexed,
169                          size_t count,
170                          void *type);
171
172 void serialize_struct( const void *noncontiguous_vector,
173                        void *contiguous_vector,
174                        size_t count,
175                        void *type);
176
177 void free_struct(MPI_Datatype* type);
178
179 s_smpi_mpi_struct_t* smpi_datatype_struct_create(int* block_lengths,
180                                                   MPI_Aint* block_indices,
181                                                   int block_count,
182                                                   MPI_Datatype* old_types);
183
184 #endif