Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions environ-mgmt/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2025 UT-Battelle, LLC. All rights reserved
#
# $COPYRIGHT$
#

SUBDIRS = src
63 changes: 63 additions & 0 deletions environ-mgmt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Environ Management Tests
------------------------

Tests for items in the "MPI Environmental Management" chapter.

These are begin created in the ompi-tests-public repository
to ensure they are easy to access.

Using autotools to detect if we have the MPI-4.1 remove error code
functionality, otherwise skips.

Usage
-----
- Ensure MPI `mpicc` in `PATH`
- Run autogen/configure/make to build test

```
cd environ-mgmt/
./autogen.sh && ./configure && make
```

- Run test(s)

```
mpirun -np 1 ./src/test_add_del_err_codes
```

Example Output
--------------

- On MPI 3.x
```
laptop:$ mpirun -np 1 ./src/test_add_del_err_codes
TEST: Success creating error class/code/string (last=92, newlast=94)
==== Adds done ====
==== Remove estring ====
Warning: MPI_Remove_error_xxx code/class/string NOT available!
==== Remove ecode ====
Warning: MPI_Remove_error_xxx code/class/string NOT available!
==== Remove eclass ====
Warning: MPI_Remove_error_xxx code/class/string NOT available!
DONE: Success
laptop$ echo $?
0
laptop$
```

- On MPI 4.1 or later
```
laptop:$ mpirun -np 1 ./src/test_add_del_err_codes
TEST: Success creating error class/code/string (last=92, newlast=94)
==== Adds done ====
==== Remove estring ====
==== Remove ecode ====
TEST: Success reomved error code (oldlast=94, newlast=93)
==== Remove eclass ====
TEST: Success reomved error class (oldlast=93, newlast=92)
DONE: Success
laptop$ echo $?
0
laptop$
```

4 changes: 4 additions & 0 deletions environ-mgmt/autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

autoreconf --install

124 changes: 124 additions & 0 deletions environ-mgmt/configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# -*- shell-script -*-
#
# Copyright (c) 2012-2020 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2025 UT-Battelle, LLC. All rights reserved.
#
# $COPYRIGHT$
#

dnl
dnl Init autoconf
dnl

AC_PREREQ([2.67])
AC_INIT([mpi-environmgmt-test], [1.0], [http://www.open-mpi.org])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([.])

echo "Configuring Environmental Management test"

AM_INIT_AUTOMAKE([1.11 foreign -Wall -Werror])

# If Automake supports silent rules, enable them.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AH_TOP([/* -*- c -*-
*
* Environmental Management test suite configuation header file.
* See the top-level LICENSE file for license and copyright
* information.
*/

#ifndef MPI_ENVIRONMGMT_TEST_CONFIG_H
#define MPI_ENVIRONMGMT_TEST_CONFIG_H
])
AH_BOTTOM([#endif /* MPI_ENVIRONMGMT_TEST_CONFIG_H */])

dnl
dnl Make automake clean emacs ~ files for "make clean"
dnl

CLEANFILES="*~"
AC_SUBST(CLEANFILES)

dnl
dnl Get various programs
dnl Bias towards mpicc/mpic++/mpif77
dnl C compiler
dnl

if test "$CC" != ""; then
BASE="`basename $CC`"
else
BASE=
fi
if test "$BASE" = "" -o "$BASE" = "." -o "$BASE" = "cc" -o \
"$BASE" = "gcc" -o "$BASE" = "xlc" -o "$BASE" = "pgcc" -o \
"$BASE" = "icc"; then
AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no)
if test "$HAVE_MPICC" = "yes"; then
CC=mpicc
export CC
fi
fi

CFLAGS_save=$CFLAGS
AC_PROG_CC
CFLAGS=$CFLAGS_save

dnl
dnl Because these are meant to be used for debugging, after all
dnl

if test -z "$CFLAGS"; then
CFLAGS="-g"
fi

dnl
dnl Ensure that we can compile and link a C MPI program
dnl

AC_LANG_PUSH([C])
AC_CHECK_HEADERS(mpi.h)

AC_MSG_CHECKING([if linking MPI program works])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mpi.h>
]],
[[MPI_Comm a = MPI_COMM_WORLD]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_WARN([Simple MPI program fails to link])
AC_MSG_ERROR([Cannot continue])
])

AC_CHECK_LIB([mpi], [MPI_Add_error_code],
[AC_DEFINE([HAVE_MPI_ADD_ERROR_CODE], [1], [Define if have MPI_Add_error_code])],
[AC_MSG_WARN([MPI_Add_error_code not found; disable related features])])


AC_CHECK_LIB([mpi], [MPI_Remove_error_code],
[AC_DEFINE([HAVE_MPI_REMOVE_ERROR_CODE], [1], [Define if have MPI_Remove_error_code])],
[AC_MSG_WARN([MPI_Remove_error_code not found; disable related features])])

AC_CHECK_LIB([mpi], [MPI_Remove_error_class],
[AC_DEFINE([HAVE_MPI_REMOVE_ERROR_CLASS], [1], [Define if have MPI_Remove_error_class])],
[AC_MSG_WARN([MPI_Remove_error_class not found; disable related features])])

AC_CHECK_LIB([mpi], [MPI_Remove_error_string],
[AC_DEFINE([HAVE_MPI_REMOVE_ERROR_STRING], [1], [Define if have MPI_Remove_error_string])],
[AC_MSG_WARN([MPI_Remove_error_string not found; disable related features])])

AC_SUBST([MPI_LIBS])

AC_LANG_POP([C])

dnl
dnl Party on
dnl

AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
12 changes: 12 additions & 0 deletions environ-mgmt/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2025 UT-Battelle, LLC. All rights reserved
#
#
# $COPYRIGHT$
#

noinst_PROGRAMS = test_add_del_err_codes

test_add_del_err_codes_SOURCES = \
test_add_del_err_codes.c
Loading