Skip to content

Commit 37c10f1

Browse files
committed
temp: builtin alignment
1 parent 9315365 commit 37c10f1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/mpi/datatype/typeutil.c

+25
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,31 @@ int MPIR_Datatype_builtintype_alignment(MPI_Datatype type)
234234
if (type == MPI_DATATYPE_NULL)
235235
return 1;
236236

237+
/* FIXME: set these alignment in configure */
238+
switch (type) {
239+
case MPIR_SIGNED_INT1:
240+
case MPIR_UNSIGNED_INT1:
241+
return ALIGNOF_INT8_T;
242+
case MPIR_SIGNED_INT2:
243+
case MPIR_UNSIGNED_INT2:
244+
return ALIGNOF_INT16_T;
245+
case MPIR_SIGNED_INT4:
246+
case MPIR_UNSIGNED_INT4:
247+
return ALIGNOF_INT32_T;
248+
case MPIR_SIGNED_INT8:
249+
case MPIR_UNSIGNED_INT8:
250+
return ALIGNOF_INT64_T;
251+
case MPIR_FLOAT4:
252+
return ALIGNOF_FLOAT;
253+
case MPIR_FLOAT8:
254+
return ALIGNOF_DOUBLE;
255+
case MPIR_FLOAT16:
256+
return ALIGNOF_LONG_DOUBLE;
257+
default:
258+
/* handle error cases? */
259+
return 1;
260+
}
261+
237262
int size = MPIR_Datatype_get_basic_size(type);
238263

239264
if (type == MPI_CHAR || type == MPI_UNSIGNED_CHAR || type == MPI_SIGNED_CHAR) {

0 commit comments

Comments
 (0)