1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
3 * (C) 2012 by Argonne National Laboratory.
4 * See COPYRIGHT in top-level directory.
12 /* Some MPI implementations should not support MPI_LONG_DOUBLE because it has
13 * different representations/sizes among several concurrently supported
14 * compilers. For example, a 16-byte GCC implementation and an 8-byte Cray
15 * compiler implementation.
17 * This test ensures that simplistic build logic/configuration did not result in
18 * a defined, yet incorrectly sized, MPI predefined datatype for long double and
19 * long double _Complex. See tt#1671 for more info.
21 * Based on a test suggested by Jim Hoekstra @ Iowa State University. */
23 int main(int argc, char *argv[])
25 int rank, size, type_size;
28 MPI_Init(&argc, &argv);
30 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
31 MPI_Comm_size(MPI_COMM_WORLD, &size);
34 #ifdef HAVE_LONG_DOUBLE
35 if (MPI_LONG_DOUBLE != MPI_DATATYPE_NULL) {
36 MPI_Type_size(MPI_LONG_DOUBLE, &type_size);
37 if (type_size != sizeof(long double)) {
38 printf("type_size != sizeof(long double) : (%d != %zd)\n",
39 type_size, sizeof(long double));
44 #if defined(HAVE_LONG_DOUBLE__COMPLEX) && defined(USE_LONG_DOUBLE_COMPLEX)
45 if (MPI_C_LONG_DOUBLE_COMPLEX != MPI_DATATYPE_NULL) {
46 MPI_Type_size(MPI_C_LONG_DOUBLE_COMPLEX, &type_size);
47 if (type_size != sizeof(long double _Complex)) {
48 printf("type_size != sizeof(long double _Complex) : (%d != %zd)\n",
49 type_size, sizeof(long double _Complex));
55 printf("found %d errors\n", errs);
58 printf(" No errors\n");