From 9109c33bb4bfa6d7788e2add651f192a678b1334 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 18 Oct 2024 12:01:52 -0600 Subject: [PATCH] sessions: add smoke test and add to mac os github CI Signed-off-by: Howard Pritchard --- .github/workflows/macos-checks.yaml | 3 ++- examples/Makefile | 7 +++++-- examples/hello_sessions_c.c | 24 ++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 examples/hello_sessions_c.c 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..863aaa1269e --- /dev/null +++ b/examples/hello_sessions_c.c @@ -0,0 +1,24 @@ +#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; + +#if 0 +/* need PR https://github.com/open-mpi/ompi/pull/12868 to be merged in + * before this can be uncommented. + */ + MPI_Info_create(&info); +#endif + 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); +}