Skip to content

Commit c7b4322

Browse files
committed
datatype: cleanup usage of internal types
Use configure defined _CTYPE and _ALIGN macros for switching cases of internal types.
1 parent d3e8ca5 commit c7b4322

File tree

3 files changed

+58
-190
lines changed

3 files changed

+58
-190
lines changed

src/mpi/datatype/typerep/src/typerep_yaksa_pack_external.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ typedef struct {
7575
} while (0)
7676

7777
/* long double */
78-
#ifdef HAVE_FLOAT128
79-
#define EXTERNAL_LONG_DOUBLE_TYPE __float128
78+
#ifdef MPIR_FLOAT128_CTYPE
79+
#define EXTERNAL_LONG_DOUBLE_TYPE MPIR_FLOAT128_CTYPE
8080
#else
8181
#define EXTERNAL_LONG_DOUBLE_TYPE long double
8282
#endif

src/mpi/datatype/typeutil.c

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,48 +164,60 @@ int MPIR_Datatype_builtintype_alignment(MPI_Datatype type)
164164
case MPIR_FIXED8:
165165
case MPIR_INT8:
166166
case MPIR_UINT8:
167-
case MPIR_FLOAT8:
168167
case MPIR_COMPLEX8:
169168
case MPIR_FORTRAN_LOGICAL8:
170-
return ALIGNOF_INT8_T;
169+
return MPIR_INT8_ALIGN;
171170
case MPIR_FIXED16:
172171
case MPIR_INT16:
173172
case MPIR_UINT16:
174-
case MPIR_FLOAT16:
175-
case MPIR_COMPLEX16:
176-
case MPIR_BFLOAT16:
177173
case MPIR_FORTRAN_LOGICAL16:
178-
return ALIGNOF_INT16_T;
174+
return MPIR_INT16_ALIGN;
179175
case MPIR_FIXED32:
180176
case MPIR_INT32:
181177
case MPIR_UINT32:
182178
case MPIR_FORTRAN_LOGICAL32:
183-
return ALIGNOF_INT32_T;
179+
return MPIR_INT32_ALIGN;
184180
case MPIR_FIXED64:
185181
case MPIR_INT64:
186182
case MPIR_UINT64:
187183
case MPIR_FORTRAN_LOGICAL64:
188-
return ALIGNOF_INT64_T;
184+
return MPIR_INT64_ALIGN;
185+
#ifdef MPIR_INT128_ALIGN
189186
case MPIR_FIXED128:
190187
case MPIR_INT128:
191188
case MPIR_UINT128:
192189
case MPIR_FORTRAN_LOGICAL128:
193-
return MAX_ALIGNMENT; /* ALIGNOF_INT128_T */
190+
return MPIR_INT128_ALIGN;
191+
#endif
192+
#ifdef MPIR_FLOAT16_ALIGN
193+
case MPIR_FLOAT16:
194+
case MPIR_COMPLEX16:
195+
case MPIR_BFLOAT16:
196+
return MPIR_FLOAT16_ALIGN;
197+
#endif
194198
case MPIR_FLOAT32:
195199
case MPIR_COMPLEX32:
196-
return ALIGNOF_FLOAT;
200+
return MPIR_FLOAT32_ALIGN;
197201
case MPIR_FLOAT64:
198202
case MPIR_COMPLEX64:
199-
return ALIGNOF_DOUBLE;
203+
return MPIR_FLOAT64_ALIGN;
204+
#ifdef MPIR_FLOAT128_ALIGN
200205
case MPIR_FLOAT128:
201206
case MPIR_COMPLEX128:
202-
return MAX_ALIGNMENT; /* ALIGNOF_FLOAT128_T */
207+
return MPIR_FLOAT128_ALIGN;
208+
#endif
209+
#ifdef MPIR_ALT_FLOAT96_ALIGN
203210
case MPIR_ALT_FLOAT96:
204-
case MPIR_ALT_FLOAT128:
205211
case MPIR_ALT_COMPLEX96:
212+
return MPIR_ALT_FLOAT96_ALIGN;
213+
#endif
214+
#ifdef MPIR_ALT_FLOAT128_ALIGN
206215
case MPIR_ALT_COMPLEX128:
207-
return ALIGNOF_LONG_DOUBLE;
216+
case MPIR_ALT_FLOAT128:
217+
return MPIR_ALT_FLOAT128_ALIGN;
218+
#endif
208219
default:
220+
/* FIXME: throw error */
209221
MPIR_Assert(0);
210222
return 1;
211223
}

src/mpid/ch3/include/mpid_rma_shm.h

Lines changed: 30 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -44,184 +44,40 @@ static inline int shm_copy(const void *src, int scount, MPI_Datatype stype,
4444
/* The below list of datatypes is based on those specified in the MPI-3
4545
* standard on page 665. */
4646
switch (stype) {
47-
case MPI_CHAR:
48-
ASSIGN_COPY(src, dest, scount, char);
49-
50-
case MPI_SHORT:
51-
ASSIGN_COPY(src, dest, scount, signed short int);
52-
53-
case MPI_INT:
54-
ASSIGN_COPY(src, dest, scount, signed int);
55-
56-
case MPI_LONG:
57-
ASSIGN_COPY(src, dest, scount, signed long int);
58-
59-
case MPI_LONG_LONG_INT: /* covers MPI_LONG_LONG too */
60-
ASSIGN_COPY(src, dest, scount, signed long long int);
61-
62-
case MPI_SIGNED_CHAR:
63-
ASSIGN_COPY(src, dest, scount, signed char);
64-
65-
case MPI_UNSIGNED_CHAR:
66-
ASSIGN_COPY(src, dest, scount, unsigned char);
67-
68-
case MPI_UNSIGNED_SHORT:
69-
ASSIGN_COPY(src, dest, scount, unsigned short int);
70-
71-
case MPI_UNSIGNED:
72-
ASSIGN_COPY(src, dest, scount, unsigned int);
73-
74-
case MPI_UNSIGNED_LONG:
75-
ASSIGN_COPY(src, dest, scount, unsigned long int);
76-
77-
case MPI_UNSIGNED_LONG_LONG:
78-
ASSIGN_COPY(src, dest, scount, unsigned long long int);
79-
80-
case MPI_FLOAT:
81-
ASSIGN_COPY(src, dest, scount, float);
82-
83-
case MPI_DOUBLE:
84-
ASSIGN_COPY(src, dest, scount, double);
85-
86-
case MPI_LONG_DOUBLE:
87-
ASSIGN_COPY(src, dest, scount, long double);
88-
89-
#if 0
90-
/* FIXME: we need a configure check to define HAVE_WCHAR_T before
91-
* this can be enabled */
92-
case MPI_WCHAR:
93-
ASSIGN_COPY(src, dest, scount, wchar_t);
47+
case MPIR_INT8:
48+
case MPIR_UINT8:
49+
ASSIGN_COPY(src, dest, scount, MPIR_INT8_CTYPE);
50+
case MPIR_INT16:
51+
case MPIR_UINT16:
52+
ASSIGN_COPY(src, dest, scount, MPIR_INT16_CTYPE);
53+
case MPIR_INT32:
54+
case MPIR_UINT32:
55+
ASSIGN_COPY(src, dest, scount, MPIR_INT32_CTYPE);
56+
case MPIR_INT64:
57+
case MPIR_UINT64:
58+
ASSIGN_COPY(src, dest, scount, MPIR_INT64_CTYPE);
59+
#ifdef MPIR_INT128_CTYPE
60+
case MPIR_INT128:
61+
case MPIR_UINT128:
62+
ASSIGN_COPY(src, dest, scount, MPIR_INT128_CTYPE);
9463
#endif
95-
96-
#if 0
97-
/* FIXME: we need a configure check to define HAVE_C_BOOL before
98-
* this can be enabled */
99-
case MPI_C_BOOL:
100-
ASSIGN_COPY(src, dest, scount, _Bool);
64+
#ifdef MPIR_FLOAT16_CTYPE
65+
case MPIR_FLOAT16:
66+
ASSIGN_COPY(src, dest, scount, MPIR_FLOAT16_CTYPE);
10167
#endif
102-
103-
#if HAVE_INT8_T
104-
case MPI_INT8_T:
105-
ASSIGN_COPY(src, dest, scount, int8_t);
106-
#endif /* HAVE_INT8_T */
107-
108-
#if HAVE_INT16_T
109-
case MPI_INT16_T:
110-
ASSIGN_COPY(src, dest, scount, int16_t);
111-
#endif /* HAVE_INT16_T */
112-
113-
#if HAVE_INT32_T
114-
case MPI_INT32_T:
115-
ASSIGN_COPY(src, dest, scount, int32_t);
116-
#endif /* HAVE_INT32_T */
117-
118-
#if HAVE_INT64_T
119-
case MPI_INT64_T:
120-
ASSIGN_COPY(src, dest, scount, int64_t);
121-
#endif /* HAVE_INT64_T */
122-
123-
#if HAVE_UINT8_T
124-
case MPI_UINT8_T:
125-
ASSIGN_COPY(src, dest, scount, uint8_t);
126-
#endif /* HAVE_UINT8_T */
127-
128-
#if HAVE_UINT16_T
129-
case MPI_UINT16_T:
130-
ASSIGN_COPY(src, dest, scount, uint16_t);
131-
#endif /* HAVE_UINT16_T */
132-
133-
#if HAVE_UINT32_T
134-
case MPI_UINT32_T:
135-
ASSIGN_COPY(src, dest, scount, uint32_t);
136-
#endif /* HAVE_UINT32_T */
137-
138-
#if HAVE_UINT64_T
139-
case MPI_UINT64_T:
140-
ASSIGN_COPY(src, dest, scount, uint64_t);
141-
#endif /* HAVE_UINT64_T */
142-
143-
case MPI_AINT:
144-
ASSIGN_COPY(src, dest, scount, MPI_Aint);
145-
146-
case MPI_COUNT:
147-
ASSIGN_COPY(src, dest, scount, MPI_Count);
148-
149-
case MPI_OFFSET:
150-
ASSIGN_COPY(src, dest, scount, MPI_Offset);
151-
152-
#if 0
153-
/* FIXME: we need a configure check to define HAVE_C_COMPLEX before
154-
* this can be enabled */
155-
case MPI_C_COMPLEX: /* covers MPI_C_FLOAT_COMPLEX as well */
156-
ASSIGN_COPY(src, dest, scount, float _Complex);
157-
#endif
158-
159-
#if 0
160-
/* FIXME: we need a configure check to define HAVE_C_DOUPLE_COMPLEX
161-
* before this can be enabled */
162-
case MPI_C_DOUBLE_COMPLEX:
163-
ASSIGN_COPY(src, dest, scount, double _Complex);
164-
#endif
165-
166-
#if 0
167-
/* FIXME: we need a configure check to define
168-
* HAVE_C_LONG_DOUPLE_COMPLEX before this can be enabled */
169-
case MPI_C_LONG_DOUBLE_COMPLEX:
170-
ASSIGN_COPY(src, dest, scount, long double _Complex);
171-
#endif
172-
173-
#if 0
174-
/* Types that don't have a direct equivalent */
175-
case MPI_BYTE:
176-
case MPI_PACKED:
177-
#endif
178-
179-
#if 0 /* Fortran types */
180-
case MPI_INTEGER:
181-
case MPI_REAL:
182-
case MPI_DOUBLE_PRECISION:
183-
case MPI_COMPLEX:
184-
case MPI_LOGICAL:
185-
case MPI_CHARACTER:
186-
#endif
187-
188-
#if 0 /* C++ types */
189-
case MPI_CXX_BOOL:
190-
case MPI_CXX_FLOAT_COMPLEX:
191-
case MPI_CXX_DOUBLE_COMPLEX:
192-
case MPI_CXX_LONG_DOUBLE_COMPLEX:
193-
#endif
194-
195-
#if 0 /* Optional Fortran types */
196-
case MPI_DOUBLE_COMPLEX:
197-
case MPI_INTEGER1:
198-
case MPI_INTEGER2:
199-
case MPI_INTEGER4:
200-
case MPI_INTEGER8:
201-
case MPI_INTEGER16:
202-
case MPI_REAL2:
203-
case MPI_REAL4:
204-
case MPI_REAL8:
205-
case MPI_REAL16:
206-
case MPI_COMPLEX4:
207-
case MPI_COMPLEX8:
208-
case MPI_COMPLEX16:
209-
case MPI_COMPLEX32:
210-
#endif
211-
212-
#if 0 /* C datatypes for reduction functions */
213-
case MPI_FLOAT_INT:
214-
case MPI_DOUBLE_INT:
215-
case MPI_LONG_INT:
216-
case MPI_2INT:
217-
case MPI_LONG_DOUBLE_INT:
68+
case MPIR_FLOAT32:
69+
ASSIGN_COPY(src, dest, scount, MPIR_FLOAT32_CTYPE);
70+
case MPIR_FLOAT64:
71+
ASSIGN_COPY(src, dest, scount, MPIR_FLOAT64_CTYPE);
72+
#ifdef MPIR_FLOAT128_CTYPE
73+
case MPIR_FLOAT128:
74+
ASSIGN_COPY(src, dest, scount, MPIR_FLOAT128_CTYPE);
21875
#endif
76+
case MPIR_ALT_FLOAT96:
77+
case MPIR_ALT_FLOAT128:
78+
ASSIGN_COPY(src, dest, scount, long double);
21979

220-
#if 0 /* Fortran datatypes for reduction functions */
221-
case MPI_2REAL:
222-
case MPI_2DOUBLE_PRECISION:
223-
case MPI_2INTEGER:
224-
#endif
80+
/* FIXME: native complex types */
22581

22682
default:
22783
/* Just to make sure the switch statement is not empty */

0 commit comments

Comments
 (0)