Skip to content

Commit 5289deb

Browse files
committed
envmgmt: error class/code/string test
Tests for MPI_Remove_error_{class,code,string} added in MPI 4.1 Notes: - autotooling to dynamically check for MPI_Remove_error_* fns Note: auto-tooling is mostly copy/paste from Jeff's status test - if symbols not found, skips. However, if we detect we have a new enough MPI >= 4.1, we will print msg that these should exist. Signed-off-by: Thomas Naughton <[email protected]>
1 parent 338c54c commit 5289deb

File tree

6 files changed

+473
-0
lines changed

6 files changed

+473
-0
lines changed

environ-mgmt/Makefile.am

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

environ-mgmt/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Environ Management Tests
2+
------------------------
3+
4+
Tests for items in the "MPI Environmental Management" chapter.
5+
6+
These are begin created in the ompi-tests-public repository
7+
to ensure they are easy to access.
8+
9+
Using autotools to detect if we have the MPI-4.1 remove error code
10+
functionality, otherwise skips.
11+
12+
Usage
13+
-----
14+
- Ensure MPI `mpicc` in `PATH`
15+
- Run autogen/configure/make to build test
16+
17+
```
18+
cd environ-mgmt/
19+
./autogen.sh && ./configure && make
20+
```
21+
22+
- Run test(s)
23+
24+
```
25+
mpirun -np 1 ./src/test_add_del_err_codes
26+
```
27+
28+
Example Output
29+
--------------
30+
31+
- On MPI 3.x
32+
```
33+
laptop:$ mpirun -np 1 ./src/test_add_del_err_codes
34+
TEST: Success creating error class/code/string (last=92, newlast=94)
35+
==== Adds done ====
36+
==== Remove estring ====
37+
Warning: MPI_Remove_error_xxx code/class/string NOT available!
38+
==== Remove ecode ====
39+
Warning: MPI_Remove_error_xxx code/class/string NOT available!
40+
==== Remove eclass ====
41+
Warning: MPI_Remove_error_xxx code/class/string NOT available!
42+
DONE: Success
43+
laptop$ echo $?
44+
0
45+
laptop$
46+
```
47+
48+
- On MPI 4.1 or later
49+
```
50+
laptop:$ mpirun -np 1 ./src/test_add_del_err_codes
51+
TEST: Success creating error class/code/string (last=92, newlast=94)
52+
==== Adds done ====
53+
==== Remove estring ====
54+
==== Remove ecode ====
55+
TEST: Success reomved error code (oldlast=94, newlast=93)
56+
==== Remove eclass ====
57+
TEST: Success reomved error class (oldlast=93, newlast=92)
58+
DONE: Success
59+
laptop$ echo $?
60+
0
61+
laptop$
62+
```
63+

environ-mgmt/autogen.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
#
3+
# Note: Use './autogen.sh clean' to delete autotool droppings,
4+
# otherwise just runs 'autoreconf' by default.
5+
#
6+
7+
if [ "$1" = "clean" ] ; then
8+
9+
#
10+
# Run 'make clean' (if possible)
11+
#
12+
if [ -f "Makefile" ] ; then
13+
make clean
14+
fi
15+
16+
#
17+
# Delete files
18+
#
19+
delete_files=`find . -name Makefile \
20+
-o -name Makefile.in \
21+
-o -name configure \
22+
-o -name depcomp \
23+
-o -name install-sh \
24+
-o -name compile \
25+
-o -name missing \
26+
-o -name aclocal.m4 \
27+
-o -name missing \
28+
-o -name stamp-h1 \
29+
-o -name "config.*"`
30+
31+
for file in ${delete_files} ; do
32+
echo "Remove: $file"
33+
rm -f $file
34+
done
35+
36+
#
37+
# Delete directories
38+
#
39+
delete_dirs=`find . -name .deps`
40+
delete_dirs="${delete_dirs} autom4te.cache"
41+
42+
for dir in ${delete_dirs} ; do
43+
echo "Remove: $dir"
44+
rm -rf $dir
45+
done
46+
47+
else
48+
#
49+
# Run configure setup utilities...
50+
#
51+
autoreconf --install
52+
fi
53+
54+
exit 0

environ-mgmt/configure.ac

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved.
4+
# Copyright (c) 2025 UT-Battelle, LLC. All rights reserved.
5+
#
6+
# $COPYRIGHT$
7+
#
8+
9+
dnl
10+
dnl Init autoconf
11+
dnl
12+
13+
AC_PREREQ([2.67])
14+
AC_INIT([mpi-environmgmt-test], [1.0], [http://www.open-mpi.org])
15+
AC_CONFIG_AUX_DIR([config])
16+
AC_CONFIG_MACRO_DIR([config])
17+
AC_CONFIG_SRCDIR([.])
18+
19+
echo "Configuring Environmental Management test"
20+
21+
AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror])
22+
23+
# If Automake supports silent rules, enable them.
24+
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
25+
26+
AH_TOP([/* -*- c -*-
27+
*
28+
* Environmental Management test suite configuation header file.
29+
* See the top-level LICENSE file for license and copyright
30+
* information.
31+
*/
32+
33+
#ifndef MPI_ENVIRONMGMT_TEST_CONFIG_H
34+
#define MPI_ENVIRONMGMT_TEST_CONFIG_H
35+
])
36+
AH_BOTTOM([#endif /* MPI_ENVIRONMGMT_TEST_CONFIG_H */])
37+
38+
dnl
39+
dnl Make automake clean emacs ~ files for "make clean"
40+
dnl
41+
42+
CLEANFILES="*~"
43+
AC_SUBST(CLEANFILES)
44+
45+
dnl
46+
dnl Get various programs
47+
dnl Bias towards mpicc/mpic++/mpif77
48+
dnl C compiler
49+
dnl
50+
51+
if test "$CC" != ""; then
52+
BASE="`basename $CC`"
53+
else
54+
BASE=
55+
fi
56+
if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "cc" -o \
57+
"$BASE" = "gcc" -o "$BASE" = "xlc" -o "$BASE" = "pgcc" -o \
58+
"$BASE" = "icc"; then
59+
AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no)
60+
if test "$HAVE_MPICC" = "yes"; then
61+
CC=mpicc
62+
export CC
63+
fi
64+
fi
65+
66+
CFLAGS_save=$CFLAGS
67+
AC_PROG_CC
68+
CFLAGS=$CFLAGS_save
69+
70+
dnl
71+
dnl Because these are meant to be used for debugging, after all
72+
dnl
73+
74+
if test -z "$CFLAGS"; then
75+
CFLAGS="-g"
76+
fi
77+
78+
dnl
79+
dnl Ensure that we can compile and link a C MPI program
80+
dnl
81+
82+
AC_LANG_PUSH([C])
83+
AC_CHECK_HEADERS(mpi.h)
84+
85+
AC_MSG_CHECKING([if linking MPI program works])
86+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>
87+
]],
88+
[[MPI_Comm a = MPI_COMM_WORLD]])],
89+
[AC_MSG_RESULT([yes])],
90+
[AC_MSG_RESULT([no])
91+
AC_MSG_WARN([Simple MPI program fails to link])
92+
AC_MSG_ERROR([Cannot continue])
93+
])
94+
95+
AC_CHECK_LIB([mpi], [MPI_Add_error_code],
96+
[AC_DEFINE([HAVE_MPI_ADD_ERROR_CODE], [1], [Define if have MPI_Add_error_code])],
97+
[AC_MSG_WARN([MPI_Add_error_code not found; disable related features])])
98+
99+
100+
AC_CHECK_LIB([mpi], [MPI_Remove_error_code],
101+
[AC_DEFINE([HAVE_MPI_REMOVE_ERROR_CODE], [1], [Define if have MPI_Remove_error_code])],
102+
[AC_MSG_WARN([MPI_Remove_error_code not found; disable related features])])
103+
104+
AC_CHECK_LIB([mpi], [MPI_Remove_error_class],
105+
[AC_DEFINE([HAVE_MPI_REMOVE_ERROR_CLASS], [1], [Define if have MPI_Remove_error_class])],
106+
[AC_MSG_WARN([MPI_Remove_error_class not found; disable related features])])
107+
108+
AC_CHECK_LIB([mpi], [MPI_Remove_error_string],
109+
[AC_DEFINE([HAVE_MPI_REMOVE_ERROR_STRING], [1], [Define if have MPI_Remove_error_string])],
110+
[AC_MSG_WARN([MPI_Remove_error_string not found; disable related features])])
111+
112+
AC_SUBST([MPI_LIBS])
113+
114+
AC_LANG_POP([C])
115+
116+
dnl
117+
dnl Party on
118+
dnl
119+
120+
AC_CONFIG_FILES([
121+
Makefile
122+
src/Makefile
123+
])
124+
AC_OUTPUT

environ-mgmt/src/Makefile.am

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#
2+
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
3+
# Copyright (c) 2025 UT-Battelle, LLC. All rights reserved
4+
#
5+
#
6+
# $COPYRIGHT$
7+
#
8+
9+
noinst_PROGRAMS = test_add_del_err_codes
10+
11+
test_add_del_err_codes_SOURCES = \
12+
test_add_del_err_codes.c

0 commit comments

Comments
 (0)