Skip to content

Commit 4b2fcc0

Browse files
committed
MPI_Status test
Test all permutations of MPI_Status conversion functions. See MPI-4:18.2.5 for a handy diagram that explains all the MPI_Status conversion functions and what they need to do. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent 445ab56 commit 4b2fcc0

File tree

8 files changed

+973
-0
lines changed

8 files changed

+973
-0
lines changed

status/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Makefile
2+
Makefile.in
3+
aclocal.m4
4+
autom4te.cache
5+
config.log
6+
config.status
7+
config
8+
configure
9+
10+
.deps
11+
.libs
12+
13+
*.o
14+
15+
src/status_test

status/Makefile.am

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
3+
#
4+
# $COPYRIGHT$
5+
#
6+
7+
SUBDIRS = src

status/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Test MPI_Status conversion functions
2+
3+
MPI-4:18.2.5 has a good diagram showing all the possible conversion
4+
functions for an MPI_Status. We need to test each edge in that
5+
diagram.
6+
7+
```
8+
MPI_Status
9+
/ ^ \ ^
10+
C types and / / \ \
11+
functions / / \ \
12+
(1)/ /(2) (3)\ \(4)
13+
/ / (5) \ \
14+
/ / <-------- ' \
15+
MPI_F08_status ' --------------> \ MPI_Fint array
16+
(6)
17+
18+
(7)
19+
TYPE(MPI_Status) <-------------- INTEGER array of size
20+
--------------> MPI_STATUS_SIZE (in Fortran)
21+
(8)
22+
23+
```
24+
25+
1. MPI_Status_c2f08()
26+
1. MPI_Status_f082c()
27+
1. MPI_Status_c2f()
28+
1. MPI_Status_f2c()
29+
1. MPI_Status_f2f08() (in C)
30+
1. MPI_Status_f082f() (in C)
31+
1. MPI_Status_f2f08() (in Fortran)
32+
1. In the `mpi` module
33+
1. In the `mpi_f08` module
34+
1. MPI_Status_f082f() (in Fortran)
35+
1. In the `mpi` module
36+
1. In the `mpi_f08` module
37+
38+
By transitive property, if we test each leg in the above diagram, then
39+
we effectively certify the conversion journey of a status across any
40+
combination of the legs in the diagram (i.e., any possible correct
41+
status conversion).

status/autogen.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:
2+
autoreconf -ivf

status/configure.ac

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved.
4+
#
5+
# $COPYRIGHT$
6+
#
7+
8+
dnl
9+
dnl Init autoconf
10+
dnl
11+
12+
AC_PREREQ([2.67])
13+
AC_INIT([mpi-status-test], [1.0], [http://www.open-mpi.org])
14+
AC_CONFIG_AUX_DIR([config])
15+
AC_CONFIG_MACRO_DIR([config])
16+
AC_CONFIG_SRCDIR([.])
17+
18+
echo "Configuring MPI_Status test"
19+
20+
AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror])
21+
22+
# If Automake supports silent rules, enable them.
23+
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
24+
25+
AH_TOP([/* -*- c -*-
26+
*
27+
* MPI_Status test suite configuation header file.
28+
* See the top-level LICENSE file for license and copyright
29+
* information.
30+
*/
31+
32+
#ifndef MPI_STATUS_TEST_CONFIG_H
33+
#define MPI_STATUS_TEST_CONFIG_H
34+
])
35+
AH_BOTTOM([#endif /* MPI_STATUS_TEST_CONFIG_H */])
36+
37+
dnl
38+
dnl Make automake clean emacs ~ files for "make clean"
39+
dnl
40+
41+
CLEANFILES="*~"
42+
AC_SUBST(CLEANFILES)
43+
44+
dnl
45+
dnl Get various programs
46+
dnl Bias towards mpicc/mpic++/mpif77
47+
dnl C compiler
48+
dnl
49+
50+
if test "$CC" != ""; then
51+
BASE="`basename $CC`"
52+
else
53+
BASE=
54+
fi
55+
if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "cc" -o \
56+
"$BASE" = "gcc" -o "$BASE" = "xlc" -o "$BASE" = "pgcc" -o \
57+
"$BASE" = "icc"; then
58+
AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no)
59+
if test "$HAVE_MPICC" = "yes"; then
60+
CC=mpicc
61+
export CC
62+
fi
63+
fi
64+
65+
CFLAGS_save=$CFLAGS
66+
AC_PROG_CC
67+
CFLAGS=$CFLAGS_save
68+
69+
dnl
70+
dnl Fortran compiler
71+
dnl
72+
73+
if test "$FC" != ""; then
74+
BASE="`basename $FC`"
75+
else
76+
BASE=
77+
fi
78+
if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "f77" -o \
79+
"$BASE" = "g77" -o "$BASE" = "f90" -o "$BASE" = "g90" -o \
80+
"$BASE" = "xlf" -o "$BASE" = "ifc" -o "$BASE" = "pgf77"; then
81+
AC_CHECK_PROG(HAVE_MPIFORT, mpifort, yes, no)
82+
AS_IF([test "$HAVE_MPIFORT" = "yes"],
83+
[FC=mpifort],
84+
[AC_CHECK_PROG([HAVE_MPIF90], mpif90, yes, no)
85+
AS_IF([test "$HAVE_MPIF90" = "yes"],
86+
[FC=mpif90],
87+
[AC_CHECK_PROG([HAVE_MPIF77], mpif77, yes, no)
88+
AS_IF([test "$HAVE_MPIF77" = "yes"],
89+
[FC=mpif77],
90+
[AC_MSG_WARN([Cannot find a suitable MPI compiler])
91+
AC_MSG_ERROR([Cannot continue])
92+
])
93+
])
94+
])
95+
export FC
96+
fi
97+
98+
FCFLAGS_save=$FCFLAGS
99+
AC_PROG_FC
100+
FCFLAGS=$FCFLAGS_save
101+
102+
dnl
103+
dnl Because these are meant to be used for debugging, after all
104+
dnl
105+
106+
if test -z "$CFLAGS"; then
107+
CFLAGS="-g"
108+
fi
109+
if test -z "$FCFLAGS"; then
110+
FCFLAGS="-g";
111+
fi
112+
AC_SUBST(FCFLAGS)
113+
if test -z "$FFLAGS"; then
114+
FFLAGS="-g";
115+
fi
116+
AC_SUBST(FFLAGS)
117+
118+
dnl
119+
dnl Ensure that we can compile and link a C MPI program
120+
dnl
121+
122+
AC_LANG_PUSH([C])
123+
AC_CHECK_HEADERS(mpi.h)
124+
125+
AC_MSG_CHECKING([if linking MPI program works])
126+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>
127+
]],
128+
[[MPI_Comm a = MPI_COMM_WORLD]])],
129+
[AC_MSG_RESULT([yes])],
130+
[AC_MSG_RESULT([no])
131+
AC_MSG_WARN([Simple MPI program fails to link])
132+
AC_MSG_ERROR([Cannot continue])
133+
])
134+
AC_LANG_POP([C])
135+
136+
dnl
137+
dnl Make sure we have the C type MPI_F08_status
138+
dnl
139+
140+
AC_CHECK_TYPES([MPI_F08_status], [],
141+
[AC_MSG_WARN([Cannot find MPI_F08_status type])
142+
AC_MSG_ERROR([Cannot continue])],
143+
[#include <mpi.h>])
144+
145+
dnl
146+
dnl Check for the different Fortran bindings
147+
dnl
148+
149+
AC_LANG_PUSH([Fortran])
150+
151+
AC_MSG_CHECKING([for mpif.h])
152+
AC_LINK_IFELSE([AC_LANG_PROGRAM(,
153+
[[ include 'mpif.h'
154+
integer a
155+
a = MPI_COMM_WORLD]])],
156+
[AC_MSG_RESULT([yes])],
157+
[AC_MSG_RESULT([no])
158+
AC_MSG_WARN([Cannot compile an mpif.h program])
159+
AC_MSG_ERROR([Cannot continue])
160+
])
161+
162+
AC_MSG_CHECKING([for mpi module])
163+
AC_LINK_IFELSE([AC_LANG_PROGRAM(,
164+
[[ use mpi
165+
integer a
166+
a = MPI_COMM_WORLD]])],
167+
[AC_MSG_RESULT([yes])],
168+
[AC_MSG_RESULT([no])
169+
AC_MSG_WARN([Cannot compile a 'use mpi' program])
170+
AC_MSG_ERROR([Cannot continue])
171+
])
172+
173+
AC_MSG_CHECKING([for mpi_f08 module])
174+
AC_LINK_IFELSE([AC_LANG_PROGRAM(,
175+
[[ use mpi_f08
176+
Type(MPI_Comm) :: a
177+
a = MPI_COMM_WORLD]])],
178+
[AC_MSG_RESULT([yes])],
179+
[AC_MSG_RESULT([no])
180+
AC_MSG_WARN([Cannot compile a 'use mpi_f08' program])
181+
AC_MSG_ERROR([Cannot continue])
182+
])
183+
184+
AC_LANG_POP([Fortran])
185+
186+
dnl
187+
dnl Party on
188+
dnl
189+
190+
AC_CONFIG_FILES([
191+
Makefile
192+
src/Makefile
193+
])
194+
AC_OUTPUT

status/src/Makefile.am

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
3+
#
4+
# $COPYRIGHT$
5+
#
6+
7+
noinst_PROGRAMS = status_test
8+
9+
status_test_SOURCES = \
10+
status_fortran.F90 \
11+
status_c.c

0 commit comments

Comments
 (0)