46#ifndef XT_MPI_DDT_WRAP_H
47#define XT_MPI_DDT_WRAP_H
53#ifdef XT_MPI_TYPE_CREATE_INDEXED_BLOCK_CONST_DISP
54# define Xt_Type_create_indexed_block(count, blocklength, disp, \
55 oldtype, newtype, comm) \
56 xt_mpi_call(MPI_Type_create_indexed_block(count, blocklength, disp, \
57 oldtype, newtype), comm)
59# define Xt_Type_create_indexed_block(count, blocklength, disp, \
60 oldtype, newtype, comm) \
61 xt_mpi_call(MPI_Type_create_indexed_block(count, blocklength, \
62 (int *)(intptr_t)disp, \
63 oldtype, newtype), comm)
69 const MPI_Aint array_of_displacements[],
70 MPI_Datatype oldtype, MPI_Datatype *newtype)
72 size_t count_ = count > 0 ? (size_t)count : 0;
73 enum { bl_auto_max = 32 };
74 int blocklengths_auto[bl_auto_max];
75 int *restrict blocklengths
76 = count_ > bl_auto_max
77 ?
xmalloc(count_ *
sizeof (*blocklengths))
79 for (
size_t i = 0; i < count_; ++i)
80 blocklengths[i] = blocklength;
82 CAST_MPI_SEND_BUF(array_of_displacements),
84 if (count_ > bl_auto_max)
89# define MPI_Type_create_hindexed_block XtMPI_Type_create_hindexed_block
90# define XT_MPI_TYPE_CREATE_HINDEXED_BLOCK_CONST_DISP
91# define Xt_Type_create_hindexed_block(count, blocklength, \
92 array_of_displacements, \
93 oldtype, newtype, comm) \
94 xt_mpi_call(XtMPI_Type_create_hindexed_block(count, blocklength, \
95 array_of_displacements, \
96 oldtype, newtype), comm)
98#elif defined XT_MPI_TYPE_CREATE_HINDEXED_BLOCK_CONST_DISP
99# define Xt_Type_create_hindexed_block(count, blocklength, \
100 array_of_displacements, \
101 oldtype, newtype, comm) \
102 xt_mpi_call(MPI_Type_create_hindexed_block(count, blocklength, \
103 array_of_displacements, \
104 oldtype, newtype), comm)
106# define Xt_Type_create_hindexed_block(count, blocklength, \
107 array_of_displacements, \
108 oldtype, newtype, comm) \
109 xt_mpi_call(MPI_Type_create_hindexed_block( \
110 count, blocklength, \
111 (MPI_Aint *)(intptr_t)array_of_displacements, \
112 oldtype, newtype), comm)
115#ifdef XT_MPI_TYPE_INDEXED_CONST_ARRAY_ARGS
116# define Xt_Type_indexed(count, blocklength, disp, oldtype, newtype, \
118 xt_mpi_call(MPI_Type_indexed(count, blocklength, \
119 disp, oldtype, newtype), comm)
121# define Xt_Type_indexed(count, blocklength, disp, oldtype, newtype, \
123 xt_mpi_call(MPI_Type_indexed(count, (int *)(intptr_t)blocklength, \
124 (int *)(intptr_t)disp, oldtype, \
128#ifdef XT_MPI_TYPE_CREATE_HINDEXED_CONST_ARRAY_ARGS
129# define Xt_Type_create_hindexed(count, blocklength, disp, oldtype, \
131 xt_mpi_call(MPI_Type_create_hindexed(count, blocklength, \
132 disp, oldtype, newtype), comm)
134# define Xt_Type_create_hindexed(count, blocklength, disp, oldtype, \
136 xt_mpi_call(MPI_Type_create_hindexed(count, \
137 (int *)(intptr_t)blocklength, \
138 (MPI_Aint *)(intptr_t)disp, \
139 oldtype, newtype), comm)
142#ifdef XT_MPI_TYPE_CREATE_STRUCT_CONST_ARRAY_ARGS
143# define Xt_Type_create_struct(count, array_of_blocklengths, \
144 array_of_displacements, \
147 xt_mpi_call(MPI_Type_create_struct( \
148 count, array_of_blocklengths, \
149 array_of_displacements, \
153# define Xt_Type_create_struct(count, array_of_blocklengths, \
154 array_of_displacements, \
157 xt_mpi_call(MPI_Type_create_struct( \
158 count, (int *)(intptr_t)array_of_blocklengths, \
159 (MPI_Aint*)(intptr_t)array_of_displacements, \
160 (MPI_Datatype *)(intptr_t)array_of_types, \
164#ifdef XT_MPI_TYPE_INDEXED_CONST_ARRAY_ARGS
165# define Xt_Type_create_subarray(ndims, array_of_sizes, \
166 array_of_subsizes, array_of_starts, \
167 order, oldtype, newtype, comm) \
168 xt_mpi_call(MPI_Type_create_subarray(ndims, array_of_sizes, \
171 order, oldtype, newtype), comm)
173# define Xt_Type_create_subarray(ndims, array_of_sizes, \
174 array_of_subsizes, array_of_starts, \
175 order, oldtype, newtype, comm) \
176 xt_mpi_call(MPI_Type_create_subarray( \
177 ndims, (int *)(intptr_t)array_of_sizes, \
178 (int *)(intptr_t)array_of_subsizes, \
179 (int *)(intptr_t)array_of_starts, \
180 order, oldtype, newtype), comm)
int MPI_Type_create_hindexed(int count, XT_MPI2_CONST int array_of_blocklengths[], XT_MPI2_CONST MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype)
@ MPI_COMBINER_HINDEXED_BLOCK
static int XtMPI_Type_create_hindexed_block(int count, int blocklength, const MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype)