diff --git a/.github/workflows/macos-checks.yaml b/.github/workflows/macos-checks.yaml index 0b90adeb9a3..f207f536070 100644 --- a/.github/workflows/macos-checks.yaml +++ b/.github/workflows/macos-checks.yaml @@ -40,6 +40,7 @@ jobs: pushd examples make popd - - name: Test ring + - name: Test ring and sessions sanity check run: | mpirun --map-by ppr:1:core examples/ring_c + mpirun --map-by ppr:1:core examples/hello_sessions_c diff --git a/examples/Makefile b/examples/Makefile index 2f22d2163b4..269ed954175 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -65,14 +65,15 @@ EXAMPLES = \ oshmem_max_reduction \ oshmem_strided_puts \ oshmem_symmetric_data \ - spc_example + spc_example \ + hello_sessions_c # Default target. Always build the C MPI examples. Only build the # others if we have the appropriate Open MPI / OpenSHMEM language # bindings. -all: hello_c ring_c connectivity_c spc_example +all: hello_c ring_c connectivity_c spc_example hello_sessions_c @ if which ompi_info >/dev/null 2>&1 ; then \ $(MAKE) mpi; \ fi @@ -129,6 +130,8 @@ connectivity_c: connectivity_c.c $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ spc_example: spc_example.c $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ +hello_sessions_c: hello_sessions_c.c + $(MPICC) $(CFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ hello_mpifh: hello_mpifh.f $(MPIFC) $(FCFLAGS) $(LDFLAGS) $? $(LDLIBS) -o $@ diff --git a/examples/hello_sessions_c.c b/examples/hello_sessions_c.c new file mode 100644 index 00000000000..8d84c39ba6b --- /dev/null +++ b/examples/hello_sessions_c.c @@ -0,0 +1,21 @@ +#include "mpi.h" +#include + +/* + * Simple test to demonstrate several aspects of MPI 4 Sessions and related + * functionality. See sections 11.3 and 11.4 of the MPI 4 standard for more + * details. + */ + +int main(int argc, char** argv) { + MPI_Info info; + MPI_Session s1, s2; + + MPI_Info_create(&info); + MPI_Session_init(MPI_INFO_NULL, MPI_ERRORS_RETURN, &s1); + MPI_Session_finalize(&s1); + MPI_Session_init(MPI_INFO_NULL, MPI_ERRORS_RETURN, &s2); + MPI_Session_finalize(&s2); + MPI_Info_free(&info); + return 0; +} diff --git a/ompi/instance/instance.c b/ompi/instance/instance.c index 78b7429f449..b93c949240d 100644 --- a/ompi/instance/instance.c +++ b/ompi/instance/instance.c @@ -954,13 +954,6 @@ static int ompi_mpi_instance_finalize_common (void) ompi_mpi_instance_release (); - if (0 == opal_initialized) { - /* if there is no MPI_T_init_thread that has been MPI_T_finalize'd, - * then be gentle to the app and release all the memory now (instead - * of the opal library destructor */ - opal_class_finalize (); - } - return OMPI_SUCCESS; }