From be86f87b9279b16850df83c47e72475dbe880a58 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Fri, 30 Oct 2020 13:14:37 -0500 Subject: [PATCH 1/2] Update Internal PMIx to OpenPMIx v3.2.1rc1 Signed-off-by: Joshua Hursey --- opal/mca/pmix/pmix3x/pmix/HACKING | 274 ++++ opal/mca/pmix/pmix3x/pmix/Makefile.am | 7 +- opal/mca/pmix/pmix3x/pmix/Makefile.pmix-rules | 42 + opal/mca/pmix/pmix3x/pmix/NEWS | 115 +- opal/mca/pmix/pmix3x/pmix/README | 79 +- opal/mca/pmix/pmix3x/pmix/VERSION | 19 +- opal/mca/pmix/pmix3x/pmix/autogen.pl | 4 +- opal/mca/pmix/pmix3x/pmix/config/Makefile.am | 6 +- opal/mca/pmix/pmix3x/pmix/config/md2nroff.pl | 136 ++ opal/mca/pmix/pmix3x/pmix/config/pmix.m4 | 85 +- .../pmix3x/pmix/config/pmix_check_psm2.m4 | 89 -- .../pmix3x/pmix/config/pmix_config_asm.m4 | 368 +---- .../pmix/pmix3x/pmix/config/pmix_functions.m4 | 6 +- .../pmix3x/pmix/config/pmix_load_platform.m4 | 111 +- opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 | 45 - .../pmix/pmix3x/pmix/config/pmix_setup_cc.m4 | 30 +- .../pmix/pmix3x/pmix/config/pmix_setup_cli.m4 | 6 +- .../pmix3x/pmix/config/pmix_setup_hwloc.m4 | 22 +- .../pmix3x/pmix/config/pmix_setup_libev.m4 | 16 +- .../pmix3x/pmix/config/pmix_setup_libevent.m4 | 40 +- .../pmix/config/pmix_setup_man_pages.m4 | 91 ++ .../pmix3x/pmix/config/pmix_setup_zlib.m4 | 2 +- .../pmix/pmix3x/pmix/config/pmix_summary.m4 | 2 +- opal/mca/pmix/pmix3x/pmix/configure.ac | 53 +- opal/mca/pmix/pmix3x/pmix/contrib/Makefile.am | 15 +- .../pmix3x/pmix/contrib/make_dist_tarball | 2 +- .../pmix/pmix3x/pmix/contrib/make_manpage.pl | 56 + opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 4 +- .../pmix/pmix3x/pmix/contrib/pmix_jenkins.sh | 14 +- opal/mca/pmix/pmix3x/pmix/etc/Makefile.am | 44 +- opal/mca/pmix/pmix3x/pmix/examples/alloc.c | 9 +- opal/mca/pmix/pmix3x/pmix/examples/client.c | 15 +- opal/mca/pmix/pmix3x/pmix/examples/client2.c | 5 +- .../mca/pmix/pmix3x/pmix/examples/debuggerd.c | 1 - opal/mca/pmix/pmix3x/pmix/examples/dmodex.c | 41 +- opal/mca/pmix/pmix3x/pmix/examples/dynamic.c | 19 +- opal/mca/pmix/pmix3x/pmix/examples/fault.c | 16 +- opal/mca/pmix/pmix3x/pmix/examples/jctrl.c | 9 +- opal/mca/pmix/pmix3x/pmix/examples/pub.c | 9 +- opal/mca/pmix/pmix3x/pmix/examples/pubi.c | 9 +- opal/mca/pmix/pmix3x/pmix/examples/server.c | 23 +- opal/mca/pmix/pmix3x/pmix/include/Makefile.am | 7 +- opal/mca/pmix/pmix3x/pmix/include/pmix.h | 14 +- .../pmix/pmix3x/pmix/include/pmix_common.h.in | 140 +- .../pmix/pmix3x/pmix/include/pmix_extend.h | 6 +- .../pmix/pmix3x/pmix/include/pmix_rename.h.in | 618 --------- .../pmix/pmix3x/pmix/include/pmix_server.h | 56 +- opal/mca/pmix/pmix3x/pmix/include/pmix_tool.h | 2 +- .../pmix3x/pmix/include/pmix_version.h.in | 2 +- opal/mca/pmix/pmix3x/pmix/maint/pmix.pc.in | 12 + opal/mca/pmix/pmix3x/pmix/src/Makefile.am | 9 +- .../pmix/src/atomics/sys/Makefile.include | 4 +- .../pmix/src/atomics/sys/architecture.h | 13 +- .../pmix/pmix3x/pmix/src/atomics/sys/atomic.h | 16 +- .../pmix3x/pmix/src/atomics/sys/atomic_stdc.h | 1 + .../pmix/pmix3x/pmix/src/atomics/sys/cma.h | 32 +- .../src/atomics/sys/sparcv9/Makefile.include | 24 - .../pmix/src/atomics/sys/sparcv9/atomic.h | 203 --- .../pmix/src/atomics/sys/sparcv9/timer.h | 67 - .../atomics/sys/sync_builtin/Makefile.include | 24 - .../src/atomics/sys/sync_builtin/atomic.h | 166 --- .../pmix/pmix3x/pmix/src/atomics/sys/timer.h | 10 +- .../pmix/pmix3x/pmix/src/class/pmix_bitmap.c | 6 +- .../pmix/pmix3x/pmix/src/class/pmix_bitmap.h | 4 +- .../pmix3x/pmix/src/class/pmix_hash_table.c | 4 +- .../pmix3x/pmix/src/class/pmix_hash_table.h | 8 +- .../pmix/pmix3x/pmix/src/class/pmix_hotel.c | 6 +- .../pmix/pmix3x/pmix/src/class/pmix_hotel.h | 12 +- .../pmix/pmix3x/pmix/src/class/pmix_list.c | 6 +- .../pmix/pmix3x/pmix/src/class/pmix_list.h | 21 +- .../pmix/pmix3x/pmix/src/class/pmix_object.c | 4 +- .../pmix/pmix3x/pmix/src/class/pmix_object.h | 21 +- .../pmix/src/class/pmix_pointer_array.c | 4 +- .../pmix3x/pmix/src/class/pmix_ring_buffer.c | 6 +- .../pmix3x/pmix/src/class/pmix_ring_buffer.h | 4 +- .../pmix3x/pmix/src/class/pmix_value_array.c | 4 +- .../pmix3x/pmix/src/class/pmix_value_array.h | 6 +- .../pmix3x/pmix/src/client/Makefile.include | 4 +- opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c | 10 +- opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c | 14 +- .../pmix/pmix3x/pmix/src/client/pmix_client.c | 144 +- .../pmix/src/client/pmix_client_connect.c | 14 +- .../pmix/src/client/pmix_client_fence.c | 10 +- .../pmix3x/pmix/src/client/pmix_client_get.c | 430 +++--- .../pmix3x/pmix/src/client/pmix_client_ops.h | 4 +- .../pmix3x/pmix/src/client/pmix_client_pub.c | 10 +- .../pmix/src/client/pmix_client_spawn.c | 87 +- .../pmix3x/pmix/src/common/Makefile.include | 2 +- .../pmix3x/pmix/src/common/pmix_control.c | 27 +- .../pmix/pmix3x/pmix/src/common/pmix_data.c | 13 +- .../pmix/pmix3x/pmix/src/common/pmix_iof.c | 429 ++++-- .../pmix/pmix3x/pmix/src/common/pmix_iof.h | 56 +- .../pmix/pmix3x/pmix/src/common/pmix_log.c | 23 +- .../pmix/pmix3x/pmix/src/common/pmix_query.c | 397 +++--- .../pmix3x/pmix/src/common/pmix_security.c | 18 +- .../pmix3x/pmix/src/common/pmix_strings.c | 17 +- .../pmix/pmix3x/pmix/src/event/pmix_event.h | 41 +- .../pmix/src/event/pmix_event_notification.c | 122 +- .../pmix/src/event/pmix_event_registration.c | 350 +++-- .../pmix3x/pmix/src/hwloc/hwloc-internal.h | 8 +- opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c | 6 +- .../pmix3x/pmix/src/include/Makefile.include | 7 +- .../pmix/src/include/pmix_config_bottom.h | 6 +- .../pmix3x/pmix/src/include/pmix_globals.c | 85 +- .../pmix3x/pmix/src/include/pmix_globals.h | 112 +- .../pmix/pmix3x/pmix/src/include/prefetch.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/include/types.h | 6 +- opal/mca/pmix/pmix3x/pmix/src/mca/base/base.h | 4 +- .../pmix/src/mca/base/pmix_mca_base_close.c | 6 +- .../src/mca/base/pmix_mca_base_cmd_line.c | 4 +- .../base/pmix_mca_base_component_compare.c | 4 +- .../mca/base/pmix_mca_base_component_find.c | 6 +- .../base/pmix_mca_base_component_repository.c | 35 +- .../base/pmix_mca_base_component_repository.h | 4 +- .../mca/base/pmix_mca_base_components_close.c | 6 +- .../mca/base/pmix_mca_base_components_open.c | 6 +- .../base/pmix_mca_base_components_register.c | 6 +- .../base/pmix_mca_base_components_select.c | 6 +- .../src/mca/base/pmix_mca_base_framework.c | 6 +- .../src/mca/base/pmix_mca_base_framework.h | 4 +- .../pmix/src/mca/base/pmix_mca_base_list.c | 4 +- .../pmix/src/mca/base/pmix_mca_base_open.c | 17 +- .../mca/base/pmix_mca_base_parse_paramfile.c | 4 +- .../pmix/src/mca/base/pmix_mca_base_var.c | 25 +- .../pmix/src/mca/base/pmix_mca_base_var.h | 4 +- .../src/mca/base/pmix_mca_base_var_enum.c | 11 +- .../src/mca/base/pmix_mca_base_var_enum.h | 6 +- .../src/mca/base/pmix_mca_base_var_group.c | 6 +- .../pmix/src/mca/base/pmix_mca_base_vari.h | 26 +- .../pmix3x/pmix/src/mca/bfrops/base/base.h | 348 +++-- .../src/mca/bfrops/base/bfrop_base_copy.c | 61 +- .../pmix/src/mca/bfrops/base/bfrop_base_fns.c | 64 +- .../src/mca/bfrops/base/bfrop_base_frame.c | 28 +- .../src/mca/bfrops/base/bfrop_base_pack.c | 1012 +++++++------- .../src/mca/bfrops/base/bfrop_base_print.c | 170 ++- .../src/mca/bfrops/base/bfrop_base_select.c | 14 +- .../src/mca/bfrops/base/bfrop_base_stubs.c | 103 +- .../src/mca/bfrops/base/bfrop_base_unpack.c | 1037 +++++++------- .../pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h | 8 +- .../pmix3x/pmix/src/mca/bfrops/bfrops_types.h | 8 +- .../pmix/src/mca/bfrops/v12/bfrop_v12.c | 17 +- .../src/mca/bfrops/v12/bfrop_v12_component.c | 6 +- .../pmix3x/pmix/src/mca/bfrops/v12/copy.c | 4 +- .../pmix3x/pmix/src/mca/bfrops/v12/internal.h | 359 +++-- .../pmix3x/pmix/src/mca/bfrops/v12/pack.c | 369 ++--- .../pmix3x/pmix/src/mca/bfrops/v12/print.c | 6 +- .../pmix3x/pmix/src/mca/bfrops/v12/unpack.c | 431 +++--- .../pmix/src/mca/bfrops/v20/bfrop_pmix20.c | 16 +- .../mca/bfrops/v20/bfrop_pmix20_component.c | 6 +- .../pmix3x/pmix/src/mca/bfrops/v20/copy.c | 4 +- .../pmix3x/pmix/src/mca/bfrops/v20/internal.h | 270 ++-- .../pmix3x/pmix/src/mca/bfrops/v20/pack.c | 449 +++--- .../pmix3x/pmix/src/mca/bfrops/v20/print.c | 6 +- .../pmix3x/pmix/src/mca/bfrops/v20/unpack.c | 492 +++---- .../pmix/src/mca/bfrops/v21/bfrop_pmix21.c | 54 +- .../mca/bfrops/v21/bfrop_pmix21_component.c | 6 +- .../pmix/src/mca/bfrops/v3/bfrop_pmix3.c | 46 +- .../src/mca/bfrops/v3/bfrop_pmix3_component.c | 6 +- .../pmix/src/mca/common/dstore/dstore_base.c | 273 ++-- .../pmix/src/mca/common/dstore/dstore_base.h | 6 +- .../src/mca/common/dstore/dstore_common.h | 13 +- .../src/mca/common/dstore/dstore_segment.c | 6 +- .../src/mca/common/dstore/dstore_segment.h | 6 +- .../pmix/pmix3x/pmix/src/mca/gds/base/base.h | 56 +- .../pmix/src/mca/gds/base/gds_base_fns.c | 272 +++- .../pmix/src/mca/gds/base/gds_base_frame.c | 11 +- .../pmix/src/mca/gds/base/gds_base_select.c | 14 +- .../pmix/src/mca/gds/ds12/gds_ds12_base.c | 21 +- .../src/mca/gds/ds12/gds_ds12_component.c | 6 +- .../pmix/src/mca/gds/ds12/gds_ds12_file.c | 3 +- .../pmix/src/mca/gds/ds12/gds_ds12_file.h | 5 +- .../pmix/src/mca/gds/ds12/gds_ds12_lock.c | 5 +- .../pmix/src/mca/gds/ds12/gds_ds12_lock.h | 5 +- .../src/mca/gds/ds12/gds_ds12_lock_fcntl.c | 6 +- .../src/mca/gds/ds12/gds_ds12_lock_pthread.c | 4 +- .../pmix/src/mca/gds/ds12/gds_ds20_file.c | 3 +- .../pmix/src/mca/gds/ds21/gds_ds21_base.c | 21 +- .../src/mca/gds/ds21/gds_ds21_component.c | 6 +- .../pmix/src/mca/gds/ds21/gds_ds21_file.c | 3 +- .../pmix/src/mca/gds/ds21/gds_ds21_file.h | 5 +- .../pmix/src/mca/gds/ds21/gds_ds21_lock.c | 5 +- .../pmix/src/mca/gds/ds21/gds_ds21_lock.h | 5 +- .../src/mca/gds/ds21/gds_ds21_lock_pthread.c | 9 +- opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h | 31 +- .../pmix3x/pmix/src/mca/gds/hash/gds_hash.c | 437 ++++-- .../pmix3x/pmix/src/mca/gds/hash/gds_hash.h | 4 +- .../src/mca/gds/hash/gds_hash_component.c | 6 +- opal/mca/pmix/pmix3x/pmix/src/mca/mca.h | 4 +- .../pmix3x/pmix/src/mca/pcompress/Makefile.am | 37 + .../pmix/src/mca/pcompress/base/Makefile.am | 19 + .../pmix3x/pmix/src/mca/pcompress/base/base.h | 83 ++ .../mca/pcompress/base/pcompress_base_frame.c | 97 ++ .../pcompress/base/pcompress_base_select.c | 63 + .../pmix3x/pmix/src/mca/pcompress/pcompress.h | 155 +++ .../pmix/src/mca/pcompress/zlib/Makefile.am | 45 + .../pcompress/zlib/compress_zlib.c} | 95 +- .../src/mca/pcompress/zlib/compress_zlib.h | 55 + .../pcompress/zlib/compress_zlib_component.c | 88 ++ .../pmix/src/mca/pcompress/zlib/configure.m4 | 107 ++ .../pmix/pmix3x/pmix/src/mca/pdl/base/base.h | 4 +- .../pmix/src/mca/pdl/base/pdl_base_close.c | 4 +- .../pmix/src/mca/pdl/base/pdl_base_fns.c | 6 +- .../pmix/src/mca/pdl/base/pdl_base_open.c | 4 +- .../pmix/src/mca/pdl/base/pdl_base_select.c | 5 +- opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdl.h | 3 +- .../pmix/src/mca/pdl/pdlopen/pdl_pdlopen.h | 4 +- .../mca/pdl/pdlopen/pdl_pdlopen_component.c | 5 +- .../src/mca/pdl/pdlopen/pdl_pdlopen_module.c | 16 +- .../mca/pdl/plibltdl/pdl_libltdl_component.c | 4 +- .../src/mca/pdl/plibltdl/pdl_libltdl_module.c | 6 +- .../pmix/pmix3x/pmix/src/mca/pif/Makefile.am | 3 +- .../src/mca/pif/base/pif_base_components.c | 5 +- .../pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c | 4 +- .../src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c | 4 +- .../src/mca/pif/linux_ipv6/pif_linux_ipv6.c | 4 +- .../pmix/src/mca/pif/posix_ipv4/pif_posix.c | 4 +- .../mca/pif/solaris_ipv6/pif_solaris_ipv6.c | 4 +- .../pmix/src/mca/pinstalldirs/base/base.h | 8 +- .../base/pinstalldirs_base_components.c | 21 +- .../base/pinstalldirs_base_expand.c | 4 +- .../config/pmix_pinstalldirs_config.c | 4 +- .../pinstalldirs/env/pmix_pinstalldirs_env.c | 36 +- .../pmix/src/mca/pinstalldirs/pinstalldirs.h | 13 +- .../pmix/pmix3x/pmix/src/mca/plog/base/base.h | 9 +- .../pmix/src/mca/plog/base/plog_base_frame.c | 10 +- .../pmix/src/mca/plog/base/plog_base_select.c | 14 +- .../pmix/src/mca/plog/base/plog_base_stubs.c | 6 +- .../pmix/src/mca/plog/default/plog_default.c | 4 +- .../mca/plog/default/plog_default_component.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/mca/plog/plog.h | 6 +- .../pmix/src/mca/plog/stdfd/plog_stdfd.c | 4 +- .../src/mca/plog/stdfd/plog_stdfd_component.c | 4 +- .../pmix/src/mca/plog/syslog/plog_syslog.c | 4 +- .../mca/plog/syslog/plog_syslog_component.c | 4 +- .../pmix/pmix3x/pmix/src/mca/pnet/base/base.h | 24 +- .../pmix/src/mca/pnet/base/pnet_base_fns.c | 150 +-- .../pmix/src/mca/pnet/base/pnet_base_frame.c | 30 +- .../pmix/src/mca/pnet/base/pnet_base_select.c | 14 +- .../pmix3x/pmix/src/mca/pnet/opa/Makefile.am | 59 - .../pmix3x/pmix/src/mca/pnet/opa/configure.m4 | 110 -- .../pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c | 738 ---------- .../pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h | 41 - .../src/mca/pnet/opa/pnet_opa_component.c | 118 -- opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h | 13 +- .../pmix3x/pmix/src/mca/pnet/tcp/Makefile.am | 59 - .../pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c | 1198 ----------------- .../pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h | 37 - .../src/mca/pnet/tcp/pnet_tcp_component.c | 130 -- .../pmix3x/pmix/src/mca/pnet/test/pnet_test.c | 483 ------- .../pmix3x/pmix/src/mca/pnet/test/pnet_test.h | 36 - .../src/mca/pnet/test/pnet_test_component.c | 101 -- .../pmix/pmix3x/pmix/src/mca/preg/base/base.h | 18 +- .../pmix/src/mca/preg/base/preg_base_frame.c | 16 +- .../pmix/src/mca/preg/base/preg_base_select.c | 14 +- .../pmix/src/mca/preg/base/preg_base_stubs.c | 67 +- .../{pnet/test => preg/compress}/Makefile.am | 24 +- .../src/mca/preg/compress/preg_compress.c | 324 +++++ .../src/mca/preg/compress/preg_compress.h | 27 + .../preg/compress/preg_compress_component.c | 82 ++ .../pmix/src/mca/preg/native/preg_native.c | 214 +-- .../pmix/src/mca/preg/native/preg_native.h | 4 +- .../mca/preg/native/preg_native_component.c | 9 +- opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg.h | 19 +- .../pmix3x/pmix/src/mca/preg/preg_types.h | 4 +- .../pmix/pmix3x/pmix/src/mca/psec/Makefile.am | 4 +- .../pmix/pmix3x/pmix/src/mca/psec/base/base.h | 11 +- .../pmix/src/mca/psec/base/psec_base_fns.c | 6 +- .../pmix/src/mca/psec/base/psec_base_frame.c | 11 +- .../pmix/src/mca/psec/base/psec_base_select.c | 14 +- .../dummy_handshake/psec_dummy_handshake.c | 5 +- .../dummy_handshake/psec_dummy_handshake.h | 3 +- .../psec_dummy_handshake_component.c | 5 +- .../pmix/src/mca/psec/munge/psec_munge.c | 6 +- .../pmix/src/mca/psec/munge/psec_munge.h | 4 +- .../src/mca/psec/munge/psec_munge_component.c | 6 +- .../pmix/src/mca/psec/native/psec_native.c | 8 +- .../pmix/src/mca/psec/native/psec_native.h | 4 +- .../mca/psec/native/psec_native_component.c | 6 +- .../pmix3x/pmix/src/mca/psec/none/psec_none.c | 6 +- .../pmix3x/pmix/src/mca/psec/none/psec_none.h | 4 +- .../src/mca/psec/none/psec_none_component.c | 6 +- opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h | 4 +- .../pmix3x/pmix/src/mca/psensor/base/base.h | 8 +- .../src/mca/psensor/base/psensor_base_frame.c | 11 +- .../mca/psensor/base/psensor_base_select.c | 14 +- .../src/mca/psensor/base/psensor_base_stubs.c | 6 +- .../pmix/src/mca/psensor/file/psensor_file.c | 10 +- .../pmix/src/mca/psensor/file/psensor_file.h | 4 +- .../mca/psensor/file/psensor_file_component.c | 6 +- .../mca/psensor/heartbeat/psensor_heartbeat.c | 6 +- .../mca/psensor/heartbeat/psensor_heartbeat.h | 6 +- .../heartbeat/psensor_heartbeat_component.c | 6 +- .../pmix3x/pmix/src/mca/psensor/psensor.h | 4 +- .../pmix3x/pmix/src/mca/pshmem/base/base.h | 14 +- .../src/mca/pshmem/base/pshmem_base_frame.c | 22 +- .../src/mca/pshmem/base/pshmem_base_select.c | 14 +- .../pmix/src/mca/pshmem/mmap/pshmem_mmap.c | 32 +- .../pmix/src/mca/pshmem/mmap/pshmem_mmap.h | 6 +- .../mca/pshmem/mmap/pshmem_mmap_component.c | 8 +- .../pmix/pmix3x/pmix/src/mca/pshmem/pshmem.h | 6 +- .../pmix3x/pmix/src/mca/psquash/Makefile.am | 45 + .../src/mca/psquash/base/Makefile.include | 19 + .../pmix3x/pmix/src/mca/psquash/base/base.h | 83 ++ .../src/mca/psquash/base/psquash_base_frame.c | 75 ++ .../mca/psquash/base/psquash_base_select.c | 104 ++ .../pmix/src/mca/psquash/flex128/Makefile.am | 43 + .../src/mca/psquash/flex128/psquash_flex128.c | 384 ++++++ .../src/mca/psquash/flex128/psquash_flex128.h | 27 + .../flex128/psquash_flex128_component.c | 67 + .../pmix/src/mca/psquash/native/Makefile.am | 46 + .../src/mca/psquash/native/psquash_native.c | 188 +++ .../src/mca/psquash/native/psquash_native.h | 30 + .../psquash/native/psquash_native_component.c | 70 + .../pmix3x/pmix/src/mca/psquash/psquash.h | 121 ++ .../pmix/pmix3x/pmix/src/mca/ptl/base/base.h | 9 +- .../pmix/src/mca/ptl/base/ptl_base_connect.c | 4 +- .../pmix/src/mca/ptl/base/ptl_base_frame.c | 12 +- .../pmix/src/mca/ptl/base/ptl_base_listener.c | 16 +- .../pmix/src/mca/ptl/base/ptl_base_select.c | 14 +- .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 98 +- .../pmix/src/mca/ptl/base/ptl_base_stubs.c | 10 +- opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h | 11 +- .../pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h | 13 +- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 355 +++-- .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 317 ++++- .../pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c | 6 +- .../src/mca/ptl/usock/ptl_usock_component.c | 18 +- .../pmix3x/pmix/src/runtime/pmix_finalize.c | 17 +- .../pmix/pmix3x/pmix/src/runtime/pmix_init.c | 111 +- .../pmix3x/pmix/src/runtime/pmix_params.c | 13 +- .../pmix/src/runtime/pmix_progress_threads.c | 51 +- .../pmix/src/runtime/pmix_progress_threads.h | 14 +- .../pmix/pmix3x/pmix/src/runtime/pmix_rte.h | 20 +- .../pmix3x/pmix/src/server/Makefile.include | 2 +- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 189 +-- .../pmix3x/pmix/src/server/pmix_server_get.c | 866 ++++++------ .../pmix3x/pmix/src/server/pmix_server_ops.c | 614 ++++++--- .../pmix3x/pmix/src/server/pmix_server_ops.h | 228 ++-- .../pmix3x/pmix/src/threads/Makefile.include | 4 +- .../pmix/pmix3x/pmix/src/threads/mutex_unix.h | 10 +- .../mca/pmix/pmix3x/pmix/src/threads/thread.c | 4 +- .../pmix3x/pmix/src/threads/thread_usage.h | 12 +- .../pmix/pmix3x/pmix/src/threads/threads.h | 3 +- opal/mca/pmix/pmix3x/pmix/src/threads/tsd.h | 4 +- .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 283 +++- .../pmix3x/pmix/src/tools/Makefile.include | 2 +- .../pmix3x/pmix/src/tools/pevent/pevent.c | 11 +- .../pmix3x/pmix/src/tools/plookup/plookup.c | 9 +- .../pmix/src/tools/pmix_info/pmix_info.c | 7 +- .../pmix3x/pmix/src/tools/pmix_info/support.c | 5 +- opal/mca/pmix/pmix3x/pmix/src/tools/pps/pps.c | 13 +- .../pmix3x/pmix/src/util/Makefile.include | 12 +- opal/mca/pmix/pmix3x/pmix/src/util/alfg.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/alfg.h | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/argv.c | 32 +- opal/mca/pmix/pmix3x/pmix/src/util/argv.h | 35 +- opal/mca/pmix/pmix3x/pmix/src/util/basename.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/basename.h | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/cmd_line.c | 13 +- opal/mca/pmix/pmix3x/pmix/src/util/compress.h | 57 - .../pmix/pmix3x/pmix/src/util/context_fns.c | 104 ++ .../pmix/pmix3x/pmix/src/util/context_fns.h | 38 + opal/mca/pmix/pmix3x/pmix/src/util/crc.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/crc.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/error.c | 13 +- opal/mca/pmix/pmix3x/pmix/src/util/error.h | 8 +- opal/mca/pmix/pmix3x/pmix/src/util/fd.c | 9 +- opal/mca/pmix/pmix3x/pmix/src/util/fd.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/few.c | 84 ++ opal/mca/pmix/pmix3x/pmix/src/util/few.h | 62 + opal/mca/pmix/pmix3x/pmix/src/util/getid.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/getid.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/hash.c | 18 +- opal/mca/pmix/pmix3x/pmix/src/util/hash.h | 4 +- .../pmix3x/pmix/src/util/keyval/keyval_lex.h | 4 +- .../pmix3x/pmix/src/util/keyval/keyval_lex.l | 3 +- .../pmix/pmix3x/pmix/src/util/keyval_parse.c | 6 +- .../pmix/pmix3x/pmix/src/util/keyval_parse.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/net.c | 4 +- .../pmix/pmix3x/pmix/src/util/os_dirpath.c | 316 +++++ .../pmix/pmix3x/pmix/src/util/os_dirpath.h | 119 ++ opal/mca/pmix/pmix3x/pmix/src/util/os_path.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/os_path.h | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/output.c | 7 +- opal/mca/pmix/pmix3x/pmix/src/util/output.h | 5 +- .../pmix/pmix3x/pmix/src/util/parse_options.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/path.c | 7 +- opal/mca/pmix/pmix3x/pmix/src/util/path.h | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/pif.c | 12 +- opal/mca/pmix/pmix3x/pmix/src/util/pif.h | 4 +- .../pmix/pmix3x/pmix/src/util/pmix_environ.c | 110 +- .../pmix/pmix3x/pmix/src/util/pmix_environ.h | 19 +- opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.c | 262 ++++ opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.h | 56 + opal/mca/pmix/pmix3x/pmix/src/util/printf.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/printf.h | 6 +- .../mca/pmix/pmix3x/pmix/src/util/show_help.c | 38 +- .../mca/pmix/pmix3x/pmix/src/util/show_help.h | 16 +- .../pmix/pmix3x/pmix/src/util/show_help_lex.h | 19 +- .../pmix/pmix3x/pmix/src/util/show_help_lex.l | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/strnlen.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/timings.c | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/timings.h | 4 +- opal/mca/pmix/pmix3x/pmix/test/Makefile.am | 15 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/pmix_client.c | 2 +- .../pmix/pmix3x/pmix/test/run_tests00.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests01.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests02.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests03.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests04.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests05.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests06.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests07.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests08.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests09.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests10.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests11.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests12.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests13.pl.in | 4 +- .../pmix/pmix3x/pmix/test/run_tests14.pl.in | 91 -- .../pmix/pmix3x/pmix/test/run_tests15.pl.in | 91 -- .../pmix/pmix3x/pmix/test/simple/Makefile.am | 32 +- .../pmix/pmix3x/pmix/test/simple/gwclient.c | 7 +- .../mca/pmix/pmix3x/pmix/test/simple/gwtest.c | 6 +- .../pmix3x/pmix/test/simple/quietclient.c | 18 +- .../pmix/pmix3x/pmix/test/simple/simpclient.c | 47 +- .../pmix/pmix3x/pmix/test/simple/simpdie.c | 6 +- .../pmix/pmix3x/pmix/test/simple/simpdmodex.c | 6 +- .../pmix/pmix3x/pmix/test/simple/simpdyn.c | 6 +- .../mca/pmix/pmix3x/pmix/test/simple/simpft.c | 6 +- .../pmix/pmix3x/pmix/test/simple/simpjctrl.c | 4 +- .../pmix/pmix3x/pmix/test/simple/simplegacy.c | 4 +- .../pmix/pmix3x/pmix/test/simple/simppub.c | 6 +- .../pmix/pmix3x/pmix/test/simple/simptest.c | 14 +- .../pmix/pmix3x/pmix/test/simple/simptest.h | 53 - .../pmix3x/pmix/test/simple/simptimeout.c | 6 +- .../pmix/pmix3x/pmix/test/simple/simptool.c | 2 +- .../pmix/pmix3x/pmix/test/simple/stability.c | 8 +- .../pmix/pmix3x/pmix/test/simple/test_pmix.c | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_cd.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_common.c | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_common.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_error.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_fence.h | 2 +- .../mca/pmix/pmix3x/pmix/test/test_internal.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_publish.c | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_publish.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_replace.h | 2 +- .../pmix3x/pmix/test/test_resolve_peers.h | 2 +- opal/mca/pmix/pmix3x/pmix/test/test_spawn.h | 2 +- 453 files changed, 13650 insertions(+), 11470 deletions(-) create mode 100644 opal/mca/pmix/pmix3x/pmix/HACKING create mode 100644 opal/mca/pmix/pmix3x/pmix/Makefile.pmix-rules create mode 100755 opal/mca/pmix/pmix3x/pmix/config/md2nroff.pl delete mode 100644 opal/mca/pmix/pmix3x/pmix/config/pmix_check_psm2.m4 create mode 100644 opal/mca/pmix/pmix3x/pmix/config/pmix_setup_man_pages.m4 create mode 100755 opal/mca/pmix/pmix3x/pmix/contrib/make_manpage.pl mode change 100755 => 100644 opal/mca/pmix/pmix3x/pmix/contrib/pmix_jenkins.sh delete mode 100644 opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in create mode 100644 opal/mca/pmix/pmix3x/pmix/maint/pmix.pc.in delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/Makefile.include delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/timer.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/Makefile.include delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/base.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_frame.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_select.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/pcompress.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/Makefile.am rename opal/mca/pmix/pmix3x/pmix/src/{util/compress.c => mca/pcompress/zlib/compress_zlib.c} (61%) create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib_component.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/configure.m4 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test_component.c rename opal/mca/pmix/pmix3x/pmix/src/mca/{pnet/test => preg/compress}/Makefile.am (70%) create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress_component.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/Makefile.include create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/base.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_frame.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_select.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128_component.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native_component.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psquash/psquash.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/compress.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/context_fns.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/context_fns.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/few.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/few.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.h delete mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in delete mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in delete mode 100644 opal/mca/pmix/pmix3x/pmix/test/simple/simptest.h diff --git a/opal/mca/pmix/pmix3x/pmix/HACKING b/opal/mca/pmix/pmix3x/pmix/HACKING new file mode 100644 index 0000000000..f96d2423a3 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/HACKING @@ -0,0 +1,274 @@ +Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + University Research and Technology + Corporation. All rights reserved. +Copyright (c) 2004-2005 The University of Tennessee and The University + of Tennessee Research Foundation. All rights + reserved. +Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + University of Stuttgart. All rights reserved. +Copyright (c) 2004-2005 The Regents of the University of California. + All rights reserved. +Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved +Copyright (c) 2013-2020 Intel, Inc. All rights reserved. +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Overview +======== + +This file is here for those who are building/exploring PMIx in its +source code form, most likely through a developer's tree (i.e., a Git +checkout). + + +Debugging vs. Optimized Builds +============================== + +**If you are building PMIx from a Git checkout**, the default build +includes a lot of debugging features. This happens automatically when +when configure detects the hidden ".git" Git meta directory (that is +present in all Git checkouts) in your source tree, and therefore +activates a number of developer-only debugging features in the PMIx +code base. + +By definition, debugging builds will perform [much] slower than +optimized builds of PMIx. You should *NOT* conduct timing tests +or try to run production performance numbers with debugging builds. + +**REMEMBER** that you need to add appropriate -O directives +to your CFLAGS so your compiler will optimize the code! Otherwise, +while we will have disabled various debug code paths, the resulting +binary will not have been optimized. + +NOTE: this version of PMIx requires the Libevent package to build +and operate. Any version of Libevent greater than or equal to +2.0.21 is acceptable. It optionally supports the HWLOC package +for providing topology information to both the host environment +(by collecting local inventory for rollup) and local client +processes. Any version of HWLOC greater than 1.10 is supported, +although versions in the 2.x series are recommended. + +If you wish to build an optimized version of PMIx from a +developer's checkout, you have a couple of options: + +1. Manually specify configure options to disable the debugging + option. You'll need to carefully examine the output of + "./configure --help" to see which options to disable. + They are all listed, but some are less obvious than others (they + are not listed here because it is a changing set of flags; by + Murphy's Law, listing them here will pretty much guarantee that + this file will get out of date): + + shell$ ./autogen.pl + shell$ ./configure --disable-debug ... + [...lots of output...] + shell$ make all install + +2. Use a VPATH build. Simply build PMIx from a different + directory than the source tree -- one where the .git subdirectory + is not present. For example: + + shell$ git clone https://github.com/openpmix/openpmix.git pmix + shell$ cd pmix + shell$ ./autogen.pl + shell$ mkdir build + shell$ cd build + shell$ ../configure ... + [...lots of output...] + shell$ make all install + +Note that in both cases you must point configure at the libevent +installation using the --with-libevent= option if it is in +a non-standard location. Similarly, non-standard locations for +the HWLOC package must be specified using the --with-hwloc= +option. In both cases, PMIx will automatically detect these +packages in standard locations and build-in support for them +unless otherwise specified using the respective configure option. + + +Use of GNU Autoconf, Automake, and Libtool (and m4) +=================================================== + +This procedure is *ONLY* necessary if you are building from a +developer's tree. If you have a PMIx distribution tarball, this +procedure is unnecessary -- you can (and should) skip reading this +section. + +If you are building PMIx from a developer's tree, you must first +install fairly recent versions of the GNU tools Autoconf, Automake, +and Libtool (and possibly GNU m4, because recent versions of Autoconf +have specific GNU m4 version requirements). The specific versions +required depend on if you are using the master or a release branch (and +which release branch you are using). The specific versions can be +found at: + + https://pmix.org/code/getting-the-reference-implementation/ + +You can check what versions of the autotools you have installed with +the following: + +shell$ m4 --version +shell$ autoconf --version +shell$ automake --version +shell$ libtoolize --version + +To strengthen the above point: the core PMIx developers typically +use very, very recent versions of the GNU tools. There are known bugs +in older versions of the GNU tools that PMIx no longer compensates +for (it seemed senseless to indefinitely support patches for ancient +versions of Autoconf, for example). You *WILL* have problems if you +do not use recent versions of the GNU tools. + +If you need newer versions, you are *strongly* encouraged to heed the +following advice: + +NOTE: On MacOS/X, the default "libtool" program is different than the + GNU libtool. You must download and install the GNU version + (e.g., via MacPorts, Homebrew, or some other mechanism). + +1. Unless your OS distribution has easy-to-use binary installations, + the sources can be can be downloaded from: + + ftp://ftp.gnu.org/gnu/autoconf/ + ftp://ftp.gnu.org/gnu/automake/ + ftp://ftp.gnu.org/gnu/libtool/ + and if you need it: + ftp://ftp.gnu.org/gnu/m4/ + + NOTE: It is certainly easiest to download/build/install all four of + these tools together. But note that PMIx has no specific m4 + requirements; it is only listed here because Autoconf requires + minimum versions of GNU m4. Hence, you may or may not *need* to + actually install a new version of GNU m4. That being said, if you + are confused or don't know, just install the latest GNU m4 with the + rest of the GNU Autotools and everything will work out fine. + +2. Build and install the tools in the following order: + + 2a. m4 + 2b. Autoconf + 2c. Automake + 2d. Libtool + +3. You MUST install the last three tools (Autoconf, Automake, Libtool) + into the same prefix directory. These three tools are somewhat + inter-related, and if they're going to be used together, they MUST + share a common installation prefix. + + You can install m4 anywhere as long as it can be found in the path; + it may be convenient to install it in the same prefix as the other + three. Or you can use any recent-enough m4 that is in your path. + + 3a. It is *strongly* encouraged that you do not install your new + versions over the OS-installed versions. This could cause + other things on your system to break. Instead, install into + $HOME/local, or /usr/local, or wherever else you tend to + install "local" kinds of software. + 3b. In doing so, be sure to prefix your $path with the directory + where they are installed. For example, if you install into + $HOME/local, you may want to edit your shell startup file + (.bashrc, .cshrc, .tcshrc, etc.) to have something like: + + # For bash/sh: + export PATH=$HOME/local/bin:$PATH + # For csh/tcsh: + set path = ($HOME/local/bin $path) + + 3c. Ensure to set your $path *BEFORE* you configure/build/install + the four packages. + +4. All four packages require two simple commands to build and + install (where PREFIX is the prefix discussed in 3, above). + + shell$ cd m4-1.4.13 + shell$ ./configure --prefix=PREFIX + shell$ make; make install + + --> If you are using the csh or tcsh shells, be sure to run the + "rehash" command after you install each package. + + shell$ cd ../autoconf-2.68 + shell$ ./configure --prefix=PREFIX + shell$ make; make install + + --> If you are using the csh or tcsh shells, be sure to run the + "rehash" command after you install each package. + + shell$ cd ../automake-1.11.1 + shell$ ./configure --prefix=PREFIX + shell$ make; make install + + --> If you are using the csh or tcsh shells, be sure to run the + "rehash" command after you install each package. + + shell$ cd ../libtool-2.2.8 + shell$ ./configure --prefix=PREFIX + shell$ make; make install + + --> If you are using the csh or tcsh shells, be sure to run the + "rehash" command after you install each package. + + m4, Autoconf and Automake build and install very quickly; Libtool will + take a minute or two. + +5. You can now run PMIx’s top-level "autogen.pl" script. This script + will invoke the GNU Autoconf, Automake, and Libtool commands in the + proper order and setup to run PMIx's top-level "configure" script. + + 5a. You generally need to run autogen.pl only when the top-level + file "configure.ac" changes, or any files in the config/ or + /config/ directories change (these directories are + where a lot of "include" files for PMI’xs configure script + live). + + 5b. You do *NOT* need to re-run autogen.pl if you modify a + Makefile.am. + +Use of Flex +=========== + +Flex may be used during the compilation of a developer's checkout (it is +not used to build official distribution tarballs). Other flavors of +lex are *not* supported: given the choice of making parsing code +portable between all flavors of lex and doing more interesting work on +PMIx, we greatly prefer the latter. + +Note that no testing has been performed to see what the minimum +version of Flex is required by PMIx. We suggest that you use +v2.5.35 at the earliest. + +Note that the flex-generated code generates some compiler warnings on +some platforms, but the warnings do not seem to be consistent or +uniform on all platforms, compilers, and flex versions. As such, we +have done little to try to remove those warnings. + +If you do not have Flex installed, it can be downloaded from the +following URL: + + https://github.com/westes/flex + +Use of Pandoc +============= + +Similar to prior sections, you need to read/care about this section +*ONLY* if you are building from a developer's tree (i.e., a Git clone +of the Open MPI source tree). If you have an Open MPI distribution +tarball, the contents of this section are optional -- you can (and +probably should) skip reading this section. + +The Pandoc tool is used to generate Open MPI's man pages. +Specifically: Open MPI's man pages are written in Markdown; Pandoc is +the tool that converts that Markdown to nroff (i.e., the format of man +pages). + +You must have Pandoc >=v1.12 when building Open MPI from a developer's +tree. If configure cannot find Pandoc >=v1.12, it will abort. + +If you need to install Pandoc, check your operating system-provided +packages (to include MacOS Homebrew and MacPorts). The Pandoc project +itself also offers binaries for their releases: + + https://pandoc.org/ diff --git a/opal/mca/pmix/pmix3x/pmix/Makefile.am b/opal/mca/pmix/pmix3x/pmix/Makefile.am index 88eda87767..11f9918e98 100644 --- a/opal/mca/pmix/pmix3x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights # reserved. # $COPYRIGHT$ @@ -32,7 +32,7 @@ AM_DISTCHECK_CONFIGURE_FLAGS = --disable-dlopen headers = sources = nodist_headers = -EXTRA_DIST = AUTHORS README INSTALL VERSION LICENSE autogen.pl +EXTRA_DIST = AUTHORS README HACKING INSTALL VERSION LICENSE autogen.pl Makefile.pmix-rules # Only install the valgrind suppressions file and man pages # if we're building in standalone mode @@ -60,3 +60,6 @@ nroff: dist-hook: env LS_COLORS= sh "$(top_srcdir)/config/distscript.sh" "$(top_srcdir)" "$(distdir)" "$(PMIX_VERSION)" "$(PMIX_REPO_REV)" + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = maint/pmix.pc diff --git a/opal/mca/pmix/pmix3x/pmix/Makefile.pmix-rules b/opal/mca/pmix/pmix3x/pmix/Makefile.pmix-rules new file mode 100644 index 0000000000..a841cc5db0 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/Makefile.pmix-rules @@ -0,0 +1,42 @@ +# -*- makefile -*- +# Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +MD2NROFF = $(PMIX_TOP_SRCDIR)/config/md2nroff.pl + +%.1: %.1.md + $(PMIX_V_GEN) $(MD2NROFF) --source=$< --dest=$@ --pandoc=$(PANDOC) + +# It is an error to "configure --disable-man-pages" and then try to +# "make dist". +if !PMIX_ENABLE_MAN_PAGES +dist-hook: + @echo "************************************************************************************" + @echo "ERROR: 'make dist' inoperable when Open PMIx is configured with --disable-man-pages" + @echo "************************************************************************************" + @/bin/false +endif + +# A little verbosity magic; "make" will show the terse output. "make +# V=1" will show the actual commands used (just like the other +# Automake-generated compilation/linker rules). +V=0 + +PMIX_V_LN_S = $(pmix__v_LN_S_$V) +pmix__v_LN_S_ = $(pmix__v_LN_S_$AM_DEFAULT_VERBOSITY) +pmix__v_LN_S_0 = @echo " LN_S " `basename $@`; + +PMIX_V_MKDIR = $(pmix__v_MKDIR_$V) +pmix__v_MKDIR_ = $(pmix__v_MKDIR_$AM_DEFAULT_VERBOSITY) +pmix__v_MKDIR_0 = @echo " MKDIR " $@; + +PMIX_V_GEN = $(pmix__v_GEN_$V) +pmix__v_GEN_ = $(pmix__v_GEN_$AM_DEFAULT_VERBOSITY) +pmix__v_GEN_0 = @echo " GENERATE" $@; diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index ca24124edb..816afe1e65 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -20,11 +20,55 @@ other, a single NEWS-worthy item might apply to different series. For example, a bug might be fixed in the master, and then moved to multiple release branches. +Master (not on release branches yet) +------------------------------------ -3.1.6 -- TBD + +3.2.2 -- TBD ---------------------- +3.2.1 -- 5 Nov 2020 +---------------------- + - PR #1890: + - Fix Issue #1889: Fix symlinks in unit tests to include new timeout + - Fix Issue #1891: Remove pnet/opa component that should not be in v3.2 + - PR #1904: Add more metadata to string generated from preg/compress + + +3.2.0 -- 22 Oct 2020 +---------------------- + - PR #1402/#1403/#1421/#1423: Modex size reductions + - PR #1752: Convert man pages to Markdown (pandoc) + - PR #1766: Move from -levent to -levent_core for linking Libevent + - PR #1832: Sync 3.2 branch with master + - New attributes: + - PMIX_HOSTNAME_ALIASES + - PMIX_HOSTNAME_KEEP_FQDN + - PMIX_GET_REFRESH_CACHE + - PMIX_REQUIRED_KEY + - Removed PMIX_VALUE_COMPRESSED_STRING_UNPACK macro from pmix_common.h + - New frameworks + - PR #1139: pcompress - Compression methods + - PR #1423: psquash - Flexible integer packing + - New components + - PR #1139: preg/compress - regular expression methods + - PR #1422 Modified string representations produced by PMIx_generate_regex + and PMIx_generate_ppn. + - Issue #1586: Fixed dmodex support and PMIx_Get behavior + - PR #1748: Removed --with-pmix-symbol-rename configure option + - PR #1848: Expose PMIX_REGEX constant per v3.2 standard + - PR #1885: Fix immediate flag behavior at the server + + +3.1.6 -- 20 Aug 2020 +---------------------- + - PR #1669: Silence unnecessary error log message + - PR #1776: Fixed crash of dstore locks destructor + - PR #1825: Add option to bypass local-only fence optimization + - PR #1830: Increase timeout in test case + + 3.1.5 -- 14 Feb 2020 ---------------------- NOTE: The signature of the PMIx_Allocation_request has changed @@ -33,7 +77,7 @@ in accordance with an Errata update of the PMIx v3 Standard - PR #1433: Return the correct status from PMIx_Publish - PR #1445: Sync. with master to fix 'get' of data for unknown namespace Includes the following PRs from master - - PR #1382: dstore: fixed truncate key-names while restoring + - PR #1382: dstore: fixed truncate key-names while restoring - PR #1405: Fix xnspace dmodex and add verbose debug - PR #1406: Resolve request for job-level data - PR #1407/#1409/#1411: Fix dmodex across nspaces @@ -58,11 +102,6 @@ in accordance with an Errata update of the PMIx v3 Standard - PR #1613: dstore: Fix cache size calculation - PR #1622: Fix multiple occurrences of unaligned access in pmix tests - PR #1620: Re-address the collective tracker problem -- PR #1625: Fix library triplet -- PR #1630: Fix support for PGI compiler pgcc18 -- PR #1637: Realign behavior of PMIx_Get and PMIx_Get_nb -- PR #1640: Properly handle forwarded output when no handler registered - 3.1.4 -- 9 Aug 2019 @@ -293,6 +332,68 @@ in accordance with an Errata update of the PMIx v3 Standard - Fix several memory and file descriptor leaks +2.2.4 -- 07 Jun 2020 +---------------------- +- PR #1466: Silence spurious error log +- PR #1489: Allow specification of hostname to use by client +- PR #1499/#1512/#1518/#1525/#1528/#1533/#1553: Fix internal tests +- PR #1678: Update "check_vendor" for PGI problem +- PR #1734: Fix resource leaks in ptl/usock component +- PR #1777: Fix crash of dstor locks destructor in ds12 +- PR #1788: Remove unnecessary error logs + + +2.2.3 -- 15 Aug 2019 +---------------------- +- PR #1162: Fix race condition when clients fail while in a PMIx + collective operation +- PR #1163: Fix a compiler warning in atomics on POWER arch +- PR #1165: Add BuildRequires: libevent-devel to spec file +- PR #1180: Remove dependency on C++ compiler for thread detection +- PR #1180: Add detection for Flex when building in non-tarball situations +- PR #1182: configury: use PMIX_ENABLE_DLOPEN_SUPPORT instead of enable_dlopen +- PR #1188: Link libpmix.so to MCA component libraries +- PR #1190: Ensure any cached notifications arrive after reg completes +- PR #1194: Ensure any cached notifications arrive after registration completes +- PR #1209: Update configure logic for clock_gettime +- PR #1213/#1217/#1221: Add configure option "--enable-nonglobal-dlopen" + If the MCA component libraries should link back to libpmix.so +- PR #1231: SPEC: Allow splitting PMIx in pmix and pmix-libpmi packages +- PR #1253: Preserve user-provided CFLAGS to protect autotools +- PR #1267: Correct dmodex example +- PR #1275: IPv6 IF Read: Buffer Overflow +- PR #1295: Fix comment: IPv6 IF_NAMESIZE +- PR #1296: Allow setup_fork to proceed even if gdds and pnet don't contribute +- PR #1296: Allow servers to pass NULL module +- PR #1297: Provide internal blocking ability to the register/deregister fns +- PR #1298: Add dummy handshake component to psec framework for testing +- PR #1303: Allow jobs to not specify proc-level info +- PR #1304: Provide proc data in cases where host does not +- PR #1305: Add some more values that can be computed +- PR #1308: Add missing tool rendezvous file +- PR #1309: Fix potential integer overflow in regex +- PR #1311: Work around memory bug in older gcc compilers +- PR #1329: Add -fPIC to static builds +- PR #1334: Cache only -W CFLAG entries to fix 32-bit builds +- PR #1341: Do not use '==' in m4 test statements +- PR #1342: Fix if_linux_ipv6_open interface filter +- PR #1344: Remove unnecessary libtool init for c++ +- PR #1346: Fix incorrect pointer casts/deref +- PR #1347/#1348: Fix use of gethostname +- PR #1353/#1357: util/environ: use setenv() if available +- PR #1354: Plug a misc memory leak in the pmix_query_caddy_t destructor +- PR #1356: Fix another pointer cast/deref in test suite +- PR #1358: Implement support for class-based info arrays +- PR #1359: Plug misc minor memory leaks +- PR #1369: Fix legacy support for PMI-1 +- PR #1370: Cleanup handling of data requests for different nspaces +- PR #1193: Resolve get of proc-specific job-level info from another nspace +- PR #1377: Skip fastpath/dstore for NULL keys +- PR #1379: Change IF_NAMESIZE to PMIX_IF_NAMESIZE and set to safe size +- PR #1385: Check for EINVAL return from posix_fallocate +- PR #1389: Plug misc memory leaks in configure + + 2.2.2 -- 24 Jan 2019 ---------------------- - Fix a bug in macro identifying system events diff --git a/opal/mca/pmix/pmix3x/pmix/README b/opal/mca/pmix/pmix3x/pmix/README index fa96176b7e..f26ae456d2 100644 --- a/opal/mca/pmix/pmix3x/pmix/README +++ b/opal/mca/pmix/pmix3x/pmix/README @@ -8,14 +8,14 @@ Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2007 The Regents of the University of California. All rights reserved. -Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2007 Myricom, Inc. All rights reserved. Copyright (c) 2008 IBM Corporation. All rights reserved. Copyright (c) 2010 Oak Ridge National Labs. All rights reserved. Copyright (c) 2011 University of Houston. All rights reserved. -Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +Copyright (c) 2013-2017 Intel, Inc. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -25,16 +25,20 @@ $HEADER$ =========================================================================== When submitting questions and problems, be sure to include as much -extra information as possible. The issues template on the -GitHub repo provides directions: +extra information as possible. This web page details all the +information that we request in order to provide assistance: - http://github.com/pmix/pmix/issues + https://pmix.org/support/ The best way to report bugs, send comments, or ask questions is to -open an issue on the repo. Alternatively, you are welcome to sign -up for the developer/user mailing list: +post them on the OpenPMIx GitHub issue tracker: - pmix@googlegroups.com + https://github.com/openpmix/openpmix/issues + +Alternatively, you can sign up on the PMIx mailing list, which is +hosted by Google Groups: + + pmix@googlegroups.com Because of spam, only subscribers are allowed to post to this list (ensure that you subscribe with and post from exactly the same e-mail @@ -43,18 +47,13 @@ joe@mycomputer.example.com!). You can subscribe to the list here: https://groups.google.com/d/forum/pmix -Finally, just to round out all the possible ways to communicate with the -PMIx community, you are invited to join the community's Slack channel: - - pmix-workspace.slack.com - Thanks for your time. =========================================================================== More information is available in the PMIx FAQ: - https://pmix.org/support + https://pmix.org/support/faq/ We are in early days, so please be patient - info will grow as questions are addressed. @@ -69,7 +68,7 @@ General notes - The majority of PMIx's documentation is here in this file, the included man pages, and on the web site FAQ - (https://pmix.org/support). This will eventually be + (https://pmix.org/support/faq/). This will eventually be supplemented with cohesive installation and user documentation files. - Systems that have been tested are: @@ -197,22 +196,21 @@ PMIx's version numbers are the union of several different values: major, minor, release, and an optional quantifier. * Major: The major number is the first integer in the version string - (e.g., v1.2.3) and indicates the corresponding version of the PMIx - Standard. In other words, a PMIx library release starting with "v2" - indicates that the implementation conforms to version 2 of the PMIx - Standard. + (e.g., v1.2.3). Changes in the major number typically indicate a + significant change in the code base and/or end-user + functionality. The major number is always included in the version + number. * Minor: The minor number is the second integer in the version string (e.g., v1.2.3). Changes in the minor number typically indicate a incremental change in the code base and/or end-user - functionality, but not the supported version of the Standard. - The minor number is always included in the version number. + functionality. The minor number is always included in the version + number: * Release: The release number is the third integer in the version string (e.g., v1.2.3). Changes in the release number typically indicate a bug fix in the code base and/or end-user - functionality. The release number is always included in the - version number. + functionality. * Quantifier: PMIx version numbers sometimes have an arbitrary string affixed to the end of the version number. Common strings @@ -299,15 +297,16 @@ Application Binary Interface (ABI) Compatibility ------------------------------------------------ PMIx provides forward ABI compatibility in all versions of a given -feature release series. For example, on a single platform, an pmix +feature release series and its corresponding +super stable series. For example, on a single platform, an pmix application linked against PMIx v1.3.2 shared libraries can be updated to point to the shared libraries in any successive v1.3.x or v1.4 release and still work properly (e.g., via the LD_LIBRARY_PATH environment variable or other operating system mechanism). -PMIx reserves the right to break ABI compatibility at new major +PMIx reserves the right to break ABI compatibility at new feature release series. For example, the same pmix application from above -(linked against PMIx v1.3.2 shared libraries) may *not* work with +(linked against PMIx v1.3.2 shared libraries) will *not* work with PMIx v1.5 shared libraries. =========================================================================== @@ -318,7 +317,7 @@ Common Questions Many common questions about building and using PMIx are answered on the FAQ: - https://pmix.org/support + https://pmix.org/support/faq/ =========================================================================== @@ -329,19 +328,23 @@ Found a bug? Got a question? Want to make a suggestion? Want to contribute to PMIx? Please let us know! When submitting questions and problems, be sure to include as much -extra information as possible. Again, the issues template is your -friend in this regard! +extra information as possible. This web page details all the +information that we request in order to provide assistance: - https://github.com/pmix/pmix/issues + https://pmix.org/support/ -Questions and comments should generally be sent to the PMIx mailing -list (pmix@googlegroups.com). Because of spam, only -subscribers are allowed to post to this list (ensure that you -subscribe with and post from *exactly* the same e-mail address -- -joe@example.com is considered different than -joe@mycomputer.example.com!). Visit this page to subscribe to the -user's list: +Questions and comments should generally be posted to the OpenPMIx +GitHub issue tracker: + + https://github.com/openpmix/openpmix/issues + +Alternatively, question can also be sent to the PMIx mailing list +(pmix@googlegroups.com). Because of spam, only subscribers are +allowed to post to this list (ensure that you subscribe with and post +from *exactly* the same e-mail address -- joe@example.com is +considered different than joe@mycomputer.example.com!). Visit this +page to subscribe to the user's list: https://groups.google.com/d/forum/pmix -Make today a PMIx day! +Make today an PMIx day! diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index ff271b549f..784177bf77 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -6,7 +6,6 @@ # Copyright (c) 2014-2016 Intel, Inc. All rights reserved. # Copyright (c) 2020 IBM Corporation. All rights reserved. - # This is the VERSION file for PMIx, describing the precise # version of PMIx in this distribution. The various components of # the version number below are combined to form a single version @@ -16,8 +15,8 @@ # ... major=3 -minor=1 -release=5 +minor=2 +release=1 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -25,14 +24,14 @@ release=5 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek= +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=gitedebb24 +repo_rev=git1063ca6 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -46,7 +45,7 @@ tarball_version= # The date when this release was created -date="Feb 19, 2020" +date="Oct 30, 2020" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -77,13 +76,13 @@ date="Feb 19, 2020" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:25:2 +libpmix_so_version=4:31:2 libpmi_so_version=1:1:0 libpmi2_so_version=1:0:0 # "Common" components install standalone libraries that are run-time -# linked by one or more components. So they need to be versioned as -# well. Yuck; this somewhat breaks the -# components-don't-affect-the-build-system abstraction. +# # linked by one or more components. So they need to be versioned as +# # well. Yuck; this somewhat breaks the +# # components-don't-affect-the-build-system abstraction. # libmca_common_dstore_so_version=1:2:0 diff --git a/opal/mca/pmix/pmix3x/pmix/autogen.pl b/opal/mca/pmix/pmix3x/pmix/autogen.pl index 9d365783c8..9bd6596f06 100755 --- a/opal/mca/pmix/pmix3x/pmix/autogen.pl +++ b/opal/mca/pmix/pmix3x/pmix/autogen.pl @@ -4,7 +4,7 @@ # Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2015 IBM Corporation. All rights reserved. @@ -275,7 +275,7 @@ sub mca_generate_framework_header(\$\@) { #ifndef $ifdef_string #define $ifdef_string -#include +#include \"src/mca/base/pmix_mca_base_framework.h\" $framework_decl_output static pmix_mca_base_framework_t *pmix_frameworks[] = { diff --git a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am index ffe2937060..9890e6ac5c 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am @@ -1,7 +1,7 @@ -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. @@ -27,6 +27,7 @@ EXTRA_DIST = \ c_get_alignment.m4 \ pmix_get_version.sh \ distscript.sh \ + md2nroff.pl \ pmix_check_attributes.m4 \ pmix_check_broken_qsort.m4 \ pmix_check_compiler_version.m4 \ @@ -42,7 +43,6 @@ EXTRA_DIST = \ pmix.m4 \ pmix_search_libs.m4 \ pmix_setup_cc.m4 \ - pmix_setup_zlib.m4 \ pmix_setup_libevent.m4 \ pmix_mca_priority_sort.pl \ mca_library_paths.txt diff --git a/opal/mca/pmix/pmix3x/pmix/config/md2nroff.pl b/opal/mca/pmix/pmix3x/pmix/config/md2nroff.pl new file mode 100755 index 0000000000..7c943c0f21 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/config/md2nroff.pl @@ -0,0 +1,136 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This script is friendly to both Python 2 and Python 3. + +use strict; + +use IPC::Open3; +use File::Basename; +use Getopt::Long; + +#-------------------------------------------------------------------------- + +my $source_arg; +my $dest_arg; +my $pandoc_arg = "pandoc"; +my $help_arg; +my $verbose_arg; + +my $ok = Getopt::Long::GetOptions("source=s" => \$source_arg, + "dest=s" => \$dest_arg, + "pandoc=s" => \$pandoc_arg, + "help" => \$help_arg, + "verbose" => \$verbose_arg); + +if (!$source_arg || !$dest_arg) { + print("Must specify --source and --dest\n"); + $ok = 0; +} + +if (!$ok || $help_arg) { + print "Invalid command line argument.\n\n" + if (!$ok); + print "Options: + --source FILE Source Markdown filename + --dest FILE Destination nroff file + --pandoc FILE Location of pandoc executable + --help This help list + --verbose Be verbose when running\n"; + exit($ok ? 0 : 1); +} + +#-------------------------------------------------------------------------- + +# If the destination exists, read it in +my $dest_content; +if (-f $dest_arg) { + open(FILE, $dest_arg) || + die "Can't open $dest_arg"; + $dest_content .= $_ + while(); + close(FILE); +} + +#-------------------------------------------------------------------------- + +# Read in the source +die "Error: $source_arg does not exist" + if (! -f $source_arg); + +my $source_content; +open(FILE, $source_arg) || + die "Can't open $source_arg"; +$source_content .= $_ + while(); +close(FILE); + +#-------------------------------------------------------------------------- + +# Figure out the section of man page +die "Cannot figure out man page section from source filename" + if (!($source_arg =~ m/(\d+).md$/)); +my $man_section = $1; + +my $shortfile = basename($source_arg); +$shortfile =~ s/\.$man_section\.md$//; + +#-------------------------------------------------------------------------- + +my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(); +my $today = sprintf("%04d-%02d-%02d", ($year+1900), $mon, $mday); + +# Run opal_get_version.sh to get the OMPI version. +my $config_dir = dirname($0); +my $get_version = "$config_dir/opal_get_version.sh"; +my $VERSION_file = "$config_dir/../VERSION"; +my $out = `$get_version $VERSION_file --full`; +chomp($out); + +# Pandoc does not handle markdown links in output nroff properly, so +# just remove all links. Specifically: some versions of Pandoc ignore +# the links, but others handle it badly. +$source_content =~ s/\[(.+)\]\((.+)\)/\1/g; + +# Add the pandoc header +$source_content = "--- +section: $man_section +title: $shortfile +header: Open PMIx +footer: $today +--- + +$source_content"; + +#-------------------------------------------------------------------------- + +print("*** Processing: $source_arg --> $dest_arg\n") + if ($verbose_arg); + +# Run Pandoc +my $pid = open3(my $child_stdin, my $child_stdout, my $child_stderr, + "$pandoc_arg -s --from=markdown --to=man"); +print $child_stdin $source_content; +close($child_stdin); +my $pandoc_rendered; +$pandoc_rendered .= $_ + while(<$child_stdout>); +close($child_stdout); +close($child_stderr) + if ($child_stderr); +waitpid($pid, 0); + +# Write the output to the target file +open(FILE, ">$dest_arg") || + die "Can't open $dest_arg for writing"; +print FILE $pandoc_rendered; +close(FILE); + +exit(0); diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index b057aa91a6..f021571a0f 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -43,6 +43,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[ AC_REQUIRE([AM_PROG_CC_C_O]) + # initialize + PMIX_EMBEDDED_LDFLAGS= + PMIX_EMBEDDED_LIBS= + PMIX_EMBEDDED_CPPFLAGS= + # If no prefix was defined, set a good value m4_ifval([$1], [m4_define([pmix_config_prefix],[$1/])], @@ -168,22 +173,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[ # replaced, not the entire file. AC_CONFIG_HEADERS(pmix_config_prefix[src/include/pmix_config.h]) - # Rename symbols? - AC_ARG_WITH([pmix-symbol-rename], - AC_HELP_STRING([--with-pmix-symbol-rename=PREFIX], - [Provide a prefix to rename PMIx symbols])) - AC_MSG_CHECKING([for symbol rename]) - AS_IF([test ! -z "$with_pmix_symbol_rename" && test "$with_pmix_symbol_rename" != "yes"], - [AC_MSG_RESULT([$with_pmix_symbol_rename]) - pmix_symbol_rename="$with_pmix_symbol_rename" - PMIX_RENAME=$with_pmix_symbol_rename], - [AC_MSG_RESULT([no]) - pmix_symbol_rename="" - PMIX_RENAME=]) - AC_DEFINE_UNQUOTED(PMIX_SYMBOL_RENAME, [$pmix_symbol_rename], - [The pmix symbol rename include directive]) - AC_SUBST(PMIX_RENAME) - AC_CONFIG_FILES(pmix_config_prefix[include/pmix_rename.h]) # Add any extra lib? AC_ARG_WITH([pmix-extra-lib], @@ -416,9 +405,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[ time.h unistd.h dirent.h \ crt_externs.h signal.h \ ioLib.h sockLib.h hostLib.h limits.h \ - sys/statfs.h sys/statvfs.h \ + sys/fcntl.h sys/statfs.h sys/statvfs.h \ netdb.h ucred.h zlib.h sys/auxv.h \ - sys/sysctl.h]) + sys/sysctl.h termio.h termios.h pty.h \ + libutil.h util.h grp.h sys/cdefs.h utmp.h stropts.h \ + sys/utsname.h]) AC_CHECK_HEADERS([sys/mount.h], [], [], [AC_INCLUDES_DEFAULT @@ -663,7 +654,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[ # -lrt might be needed for clock_gettime PMIX_SEARCH_LIBS_CORE([clock_gettime], [rt]) - AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp setpgid ptsname openpty setenv]) + AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp setpgid ptsname openpty setenv fork execve waitpid]) # On some hosts, htonl is a define, so the AC_CHECK_FUNC will get # confused. On others, it's in the standard library, but stubbed with @@ -752,7 +743,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[ ################################## # Libevent ################################## - pmix_show_title "Libevent" + pmix_show_title "Event libraries" PMIX_LIBEV_CONFIG PMIX_LIBEVENT_CONFIG @@ -779,12 +770,13 @@ AC_DEFUN([PMIX_SETUP_CORE],[ ################################## - # ZLIB COMPRESSION + # ZLIB ################################## pmix_show_title "ZLIB" PMIX_ZLIB_CONFIG + ################################## # Dstore Locking ################################## @@ -813,15 +805,19 @@ AC_DEFUN([PMIX_SETUP_CORE],[ MCA-variable-setting mechansism). This MCA variable controls whether warnings are displayed when an MCA component fails to load at run time due to an error. - (default: enabled, meaning that + (default: enabled in --enable-debug builds, meaning that mca_base_component_show_load_errors is enabled - by default])]) + by default when configured with --enable-debug])]) if test "$enable_show_load_errors_by_default" = "no" ; then PMIX_SHOW_LOAD_ERRORS_DEFAULT=0 AC_MSG_RESULT([disabled by default]) else - PMIX_SHOW_LOAD_ERRORS_DEFAULT=1 - AC_MSG_RESULT([enabled by default]) + PMIX_SHOW_LOAD_ERRORS_DEFAULT=$WANT_DEBUG + if test "$WANT_DEBUG" = "1"; then + AC_MSG_RESULT([enabled by default]) + else + AC_MSG_RESULT([disabled by default]) + fi fi AC_DEFINE_UNQUOTED(PMIX_SHOW_LOAD_ERRORS_DEFAULT, $PMIX_SHOW_LOAD_ERRORS_DEFAULT, [Default value for mca_base_component_show_load_errors MCA variable]) @@ -854,11 +850,16 @@ AC_DEFUN([PMIX_SETUP_CORE],[ # rather than have successive assignments to these shell # variables, lest the $(foo) names try to get evaluated here. # Yuck! - CPPFLAGS="-I$PMIX_top_builddir -I$PMIX_top_srcdir -I$PMIX_top_srcdir/src -I$PMIX_top_builddir/include -I$PMIX_top_srcdir/include $CPPFLAGS" + cpp_includes="$PMIX_top_builddir $PMIX_top_srcdir $PMIX_top_srcdir/src $PMIX_top_builddir/include" else - CPPFLAGS="-I$PMIX_top_srcdir -I$PMIX_top_srcdir/src -I$PMIX_top_srcdir/include $CPPFLAGS" + cpp_includes="$PMIX_top_srcdir $PMIX_top_srcdir/src" fi + CPP_INCLUDES="$(echo $cpp_includes | $SED 's/[[^ \]]* */'"$pmix_cc_iquote"'&/g')" + CPPFLAGS="$CPP_INCLUDES -I$PMIX_top_srcdir/include $CPPFLAGS $PMIX_FINAL_CPPFLAGS" + LDFLAGS="$LDFLAGS $PMIX_FINAL_LDFLAGS" + LIBS="$LIBS $PMIX_FINAL_LIBS" + ############################################################################ # pmixdatadir, pmixlibdir, and pmixinclude are essentially the same as # pkg*dir, but will always be */pmix. pmixdatadir='${datadir}/pmix' @@ -891,8 +892,15 @@ AC_DEFUN([PMIX_SETUP_CORE],[ AC_CONFIG_FILES(pmix_config_prefix[test/run_tests11.pl], [chmod +x test/run_tests11.pl]) AC_CONFIG_FILES(pmix_config_prefix[test/run_tests12.pl], [chmod +x test/run_tests12.pl]) AC_CONFIG_FILES(pmix_config_prefix[test/run_tests13.pl], [chmod +x test/run_tests13.pl]) - AC_CONFIG_FILES(pmix_config_prefix[test/run_tests14.pl], [chmod +x test/run_tests14.pl]) - AC_CONFIG_FILES(pmix_config_prefix[test/run_tests15.pl], [chmod +x test/run_tests15.pl]) +# AC_CONFIG_FILES(pmix_config_prefix[test/run_tests14.pl], [chmod +x test/run_tests14.pl]) +# AC_CONFIG_FILES(pmix_config_prefix[test/run_tests15.pl], [chmod +x test/run_tests15.pl]) + + + ############################################################################ + # Check for building man pages + ############################################################################ + pmix_show_subtitle "Man page setup" + PMIX_SETUP_MAN_PAGES ############################################################################ # final output @@ -1194,7 +1202,6 @@ fi AM_CONDITIONAL([PMIX_INSTALL_BINARIES], [test $WANT_PMIX_BINARIES -eq 1]) - # see if they want to disable non-RTLD_GLOBAL dlopen AC_MSG_CHECKING([if want to support dlopen of non-global namespaces]) AC_ARG_ENABLE([nonglobal-dlopen], @@ -1213,6 +1220,24 @@ fi AS_IF([test -z "$enable_nonglobal_dlopen" && test "x$pmix_mode" = "xembedded" && test $WANT_INSTALL_HEADERS -eq 0 && test $pmix_need_libpmix -eq 1], [pmix_need_libpmix=0]) +# +# Do we want PTY support? +# + +AC_MSG_CHECKING([if want pty support]) +AC_ARG_ENABLE(pty-support, + AC_HELP_STRING([--enable-pty-support], + [Enable/disable PTY support for STDIO forwarding. (default: enabled)])) +if test "$enable_pty_support" = "no" ; then + AC_MSG_RESULT([no]) + PMIX_ENABLE_PTY_SUPPORT=0 +else + AC_MSG_RESULT([yes]) + PMIX_ENABLE_PTY_SUPPORT=1 +fi +AC_DEFINE_UNQUOTED([PMIX_ENABLE_PTY_SUPPORT], [$PMIX_ENABLE_PTY_SUPPORT], + [Whether user wants PTY support or not]) + # # psec/dummy_handshake # diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_psm2.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_psm2.m4 deleted file mode 100644 index b2c291fae4..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_psm2.m4 +++ /dev/null @@ -1,89 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2006 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2006 QLogic Corp. All rights reserved. -# Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016-2017 Intel, Inc. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# Copyright (c) 2016 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# PMIX_CHECK_PSM2(prefix, [action-if-found], [action-if-not-found]) -# -------------------------------------------------------- -# check if PSM2 support can be found. sets prefix_{CPPFLAGS, -# LDFLAGS, LIBS} as needed and runs action-if-found if there is -# support, otherwise executes action-if-not-found -AC_DEFUN([PMIX_CHECK_PSM2],[ - if test -z "$pmix_check_psm2_happy" ; then - AC_ARG_WITH([psm2], - [AC_HELP_STRING([--with-psm2(=DIR)], - [Build PSM2 (Intel PSM2) support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])]) - PMIX_CHECK_WITHDIR([psm2], [$with_psm2], [include/psm2.h]) - AC_ARG_WITH([psm2-libdir], - [AC_HELP_STRING([--with-psm2-libdir=DIR], - [Search for PSM (Intel PSM2) libraries in DIR])]) - PMIX_CHECK_WITHDIR([psm2-libdir], [$with_psm2_libdir], [libpsm2.*]) - - pmix_check_psm2_$1_save_CPPFLAGS="$CPPFLAGS" - pmix_check_psm2_$1_save_LDFLAGS="$LDFLAGS" - pmix_check_psm2_$1_save_LIBS="$LIBS" - - AS_IF([test "$with_psm2" != "no"], - [AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "yes"], - [pmix_check_psm2_dir="$with_psm2"]) - AS_IF([test ! -z "$with_psm2_libdir" && test "$with_psm2_libdir" != "yes"], - [pmix_check_psm2_libdir="$with_psm2_libdir"]) - - PMIX_CHECK_PACKAGE([pmix_check_psm2], - [psm2.h], - [psm2], - [psm2_mq_irecv2], - [], - [$pmix_check_psm2_dir], - [$pmix_check_psm2_libdir], - [pmix_check_psm2_happy="yes"], - [pmix_check_psm2_happy="no"])], - [pmix_check_psm2_happy="no"]) - - CPPFLAGS="$pmix_check_psm2_$1_save_CPPFLAGS" - LDFLAGS="$pmix_check_psm2_$1_save_LDFLAGS" - LIBS="$pmix_check_psm2_$1_save_LIBS" - - AS_IF([test "$pmix_check_psm2_happy" = "yes" && test "$enable_progress_threads" = "yes"], - [AC_MSG_WARN([PSM2 driver does not currently support progress threads. Disabling MTL.]) - pmix_check_psm2_happy="no"]) - - AS_IF([test "$pmix_check_psm2_happy" = "yes"], - [AC_CHECK_HEADERS( - glob.h, - [], - [AC_MSG_WARN([glob.h not found. Can not build component.]) - pmix_check_psm2_happy="no"])]) - - fi - - AS_IF([test "$pmix_check_psm2_happy" = "yes"], - [$1_LDFLAGS="[$]$1_LDFLAGS $pmix_check_psm2_LDFLAGS" - $1_CPPFLAGS="[$]$1_CPPFLAGS $pmix_check_psm2_CPPFLAGS" - $1_LIBS="[$]$1_LIBS $pmix_check_psm2_LIBS" - $2], - [AS_IF([test ! -z "$with_psm2" && test "$with_psm2" != "no"], - [AC_MSG_ERROR([PSM2 support requested but not found. Aborting])]) - $3]) -]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 index a46b73ad4d..64e286cbe4 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 @@ -11,13 +11,14 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. -dnl Copyright (c) 2015-2017 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2015-2018 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights dnl reserved. -dnl Copyright (c) 2018-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2020 Google, LLC. All rights reserved. +dnl Copyright (c) 2020 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -32,12 +33,10 @@ AC_DEFUN([PMIX_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE],[[ #include #include #include - typedef union { uint64_t fake@<:@2@:>@; __int128 real; } pmix128; - static void test1(void) { // As of Aug 2018, we could not figure out a way to assign 128-bit @@ -53,7 +52,6 @@ static void test1(void) exit(1); } } - static void test2(void) { pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; @@ -66,7 +64,6 @@ static void test2(void) exit(2); } } - int main(int argc, char** argv) { test1(); @@ -84,12 +81,10 @@ AC_DEFUN([PMIX_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE],[[ #include #include #include - typedef union { uint64_t fake@<:@2@:>@; __int128 real; } pmix128; - static void test1(void) { // As of Aug 2018, we could not figure out a way to assign 128-bit @@ -103,7 +98,6 @@ static void test1(void) exit(1); } } - static void test2(void) { pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; @@ -114,7 +108,6 @@ static void test2(void) exit(2); } } - int main(int argc, char** argv) { test1(); @@ -131,12 +124,11 @@ AC_DEFUN([PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_TEST_SOURCE],[[ #include #include #include - typedef union { uint64_t fake@<:@2@:>@; _Atomic __int128 real; + __int128 real2; } pmix128; - static void test1(void) { // As of Aug 2018, we could not figure out a way to assign 128-bit @@ -145,27 +137,23 @@ static void test1(void) pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; pmix128 expected = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }}; pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; - bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real, - desired.real, true, - atomic_relaxed, atomic_relaxed); + bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real2, + desired.real); if ( !(r == false && ptr.real == expected.real)) { exit(1); } } - static void test2(void) { pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; pmix128 expected = ptr; pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; - bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real, - desired.real, true, - atomic_relaxed, atomic_relaxed); + bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real2, + desired.real); if (!(r == true && ptr.real == desired.real)) { exit(2); } } - int main(int argc, char** argv) { test1(); @@ -206,10 +194,8 @@ dnl #4: action if all of 1, 2, and 3 fail dnl AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[ PMIX_VAR_SCOPE_PUSH([pmix_asm_check_func_happy pmix_asm_check_func_CFLAGS_save pmix_asm_check_func_LIBS_save]) - pmix_asm_check_func_CFLAGS_save=$CFLAGS pmix_asm_check_func_LIBS_save=$LIBS - dnl Check with no compiler/linker flags AC_MSG_CHECKING([for $1]) AC_LINK_IFELSE([$2], @@ -217,7 +203,6 @@ AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[ AC_MSG_RESULT([yes])], [pmix_asm_check_func_happy=0 AC_MSG_RESULT([no])]) - dnl If that didn't work, try again with CFLAGS+=mcx16 AS_IF([test $pmix_asm_check_func_happy -eq 0], [AC_MSG_CHECKING([for $1 with -mcx16]) @@ -229,7 +214,6 @@ AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[ CFLAGS=$pmix_asm_check_func_CFLAGS_save AC_MSG_RESULT([no])]) ]) - dnl If that didn't work, try again with LIBS+=-latomic AS_IF([test $pmix_asm_check_func_happy -eq 0], [AC_MSG_CHECKING([for $1 with -latomic]) @@ -241,7 +225,6 @@ AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[ LIBS=$pmix_asm_check_func_LIBS_save AC_MSG_RESULT([no])]) ]) - dnl If we have it, try it and make sure it gives a correct result. dnl As of Aug 2018, we know that it links but does *not* work on clang dnl 6 on ARM64. @@ -253,15 +236,12 @@ AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[ AC_MSG_RESULT([no])], [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) ]) - dnl If we were unsuccessful, restore CFLAGS/LIBS AS_IF([test $pmix_asm_check_func_happy -eq 0], [CFLAGS=$pmix_asm_check_func_CFLAGS_save LIBS=$pmix_asm_check_func_LIBS_save]) - dnl Run the user actions AS_IF([test $pmix_asm_check_func_happy -eq 1], [$3], [$4]) - PMIX_VAR_SCOPE_POP ]) @@ -269,7 +249,6 @@ dnl ------------------------------------------------------------------ AC_DEFUN([PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128], [ PMIX_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result]) - # Do we have __sync_bool_compare_and_swap? # Use a special macro because we need to check with a few different # CFLAGS/LIBS. @@ -277,51 +256,16 @@ AC_DEFUN([PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128], [ [AC_LANG_SOURCE(PMIX_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE)], [sync_bool_compare_and_swap_128_result=1], [sync_bool_compare_and_swap_128_result=0]) - AC_DEFINE_UNQUOTED([PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128], [$sync_bool_compare_and_swap_128_result], [Whether the __sync builtin atomic compare and swap supports 128-bit values]) - PMIX_VAR_SCOPE_POP ]) -AC_DEFUN([PMIX_CHECK_SYNC_BUILTINS], [ - AC_MSG_CHECKING([for __sync builtin atomics]) - - AC_TRY_LINK([long tmp;], [__sync_synchronize(); -__sync_bool_compare_and_swap(&tmp, 0, 1); -__sync_add_and_fetch(&tmp, 1);], - [AC_MSG_RESULT([yes]) - $1], - [AC_MSG_RESULT([no]) - $2]) - - AC_MSG_CHECKING([for 64-bit __sync builtin atomics]) - - AC_TRY_LINK([ -#include -uint64_t tmp;], [ -__sync_bool_compare_and_swap(&tmp, 0, 1); -__sync_add_and_fetch(&tmp, 1);], - [AC_MSG_RESULT([yes]) - pmix_asm_sync_have_64bit=1], - [AC_MSG_RESULT([no]) - pmix_asm_sync_have_64bit=0]) - - AC_DEFINE_UNQUOTED([PMIX_ASM_SYNC_HAVE_64BIT],[$pmix_asm_sync_have_64bit], - [Whether 64-bit is supported by the __sync builtin atomics]) - - # Check for 128-bit support - PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128 -]) - - AC_DEFUN([PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128], [ PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result atomic_compare_exchange_n_128_CFLAGS_save atomic_compare_exchange_n_128_LIBS_save]) - atomic_compare_exchange_n_128_CFLAGS_save=$CFLAGS atomic_compare_exchange_n_128_LIBS_save=$LIBS - # Do we have __sync_bool_compare_and_swap? # Use a special macro because we need to check with a few different # CFLAGS/LIBS. @@ -329,7 +273,6 @@ AC_DEFUN([PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128], [ [AC_LANG_SOURCE(PMIX_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE)], [atomic_compare_exchange_n_128_result=1], [atomic_compare_exchange_n_128_result=0]) - # If we have it and it works, check to make sure it is always lock # free. AS_IF([test $atomic_compare_exchange_n_128_result -eq 1], @@ -347,23 +290,20 @@ AC_DEFUN([PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128], [ AC_MSG_RESULT([no])], [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) ]) - AC_DEFINE_UNQUOTED([PMIX_HAVE_GCC_BUILTIN_CSWAP_INT128], [$atomic_compare_exchange_n_128_result], [Whether the __atomic builtin atomic compare swap is both supported and lock-free on 128-bit values]) - dnl If we could not find decent support for 128-bits __atomic let's dnl try the GCC _sync AS_IF([test $atomic_compare_exchange_n_128_result -eq 0], [PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128]) - PMIX_VAR_SCOPE_POP ]) AC_DEFUN([PMIX_CHECK_GCC_ATOMIC_BUILTINS], [ - AC_MSG_CHECKING([for __atomic builtin atomics]) - - AC_TRY_LINK([ + if test -z "$pmix_cv_have___atomic" ; then + AC_MSG_CHECKING([for 32-bit GCC built-in atomics]) + AC_TRY_LINK([ #include uint32_t tmp, old = 0; uint64_t tmp64, old64 = 0;], [ @@ -372,21 +312,39 @@ __atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED __atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED); __atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); __atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);], - [AC_MSG_RESULT([yes]) - $1], - [AC_MSG_RESULT([no]) - $2]) - - # Check for 128-bit support - PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128 + [pmix_cv_have___atomic=yes], + [pmix_cv_have___atomic=no]) + AC_MSG_RESULT([$pmix_cv_have___atomic]) + if test $pmix_cv_have___atomic = "yes" ; then + AC_MSG_CHECKING([for 64-bit GCC built-in atomics]) + AC_TRY_LINK([ +#include +uint64_t tmp64, old64 = 0;], [ +__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); +__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);], + [pmix_cv_have___atomic_64=yes], + [pmix_cv_have___atomic_64=no]) + AC_MSG_RESULT([$pmix_cv_have___atomic_64]) + if test $pmix_cv_have___atomic_64 = "yes" ; then + AC_MSG_CHECKING([if 64-bit GCC built-in atomics are lock-free]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_is_lock_free (8, 0)) { return 1; }])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + pmix_cv_have___atomic_64=no], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + fi + else + pmix_cv_have___atomic_64=no + fi + # Check for 128-bit support + PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128 + fi ]) AC_DEFUN([PMIX_CHECK_C11_CSWAP_INT128], [ PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_result atomic_compare_exchange_CFLAGS_save atomic_compare_exchange_LIBS_save]) - atomic_compare_exchange_CFLAGS_save=$CFLAGS atomic_compare_exchange_LIBS_save=$LIBS - # Do we have C11 atomics on 128-bit integers? # Use a special macro because we need to check with a few different # CFLAGS/LIBS. @@ -394,7 +352,6 @@ AC_DEFUN([PMIX_CHECK_C11_CSWAP_INT128], [ [AC_LANG_SOURCE(PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_TEST_SOURCE)], [atomic_compare_exchange_result=1], [atomic_compare_exchange_result=0]) - # If we have it and it works, check to make sure it is always lock # free. AS_IF([test $atomic_compare_exchange_result -eq 1], @@ -412,41 +369,16 @@ AC_DEFUN([PMIX_CHECK_C11_CSWAP_INT128], [ AC_MSG_RESULT([no])], [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) ]) - AC_DEFINE_UNQUOTED([PMIX_HAVE_C11_CSWAP_INT128], [$atomic_compare_exchange_result], [Whether C11 atomic compare swap is both supported and lock-free on 128-bit values]) - dnl If we could not find decent support for 128-bits atomic let's dnl try the GCC _sync AS_IF([test $atomic_compare_exchange_result -eq 0], [PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128]) - PMIX_VAR_SCOPE_POP ]) -AC_DEFUN([PMIX_CHECK_GCC_ATOMIC_BUILTINS], [ - AC_MSG_CHECKING([for __atomic builtin atomics]) - - AC_TRY_LINK([ -#include -uint32_t tmp, old = 0; -uint64_t tmp64, old64 = 0;], [ -__atomic_thread_fence(__ATOMIC_SEQ_CST); -__atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); -__atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED); -__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); -__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);], - [AC_MSG_RESULT([yes]) - $1], - [AC_MSG_RESULT([no]) - $2]) - - # Check for 128-bit support - PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128 -]) - - dnl ################################################################# dnl dnl PMIX_CHECK_ASM_TEXT @@ -526,9 +458,7 @@ dnl ################################################################# # --------------------------------------- AC_DEFUN([_PMIX_CHECK_ASM_LSYM],[ AC_REQUIRE([AC_PROG_GREP]) - $1="L" - for sym in L .L $ L$ ; do asm_result=0 echo "configure: trying $sym" >&AC_FD_CC @@ -565,7 +495,6 @@ ${sym}mytestlabel$pmix_cv_asm_label_suffix], # --------------------- AC_DEFUN([PMIX_CHECK_ASM_LSYM],[ AC_REQUIRE([AC_PROG_NM]) - AC_CACHE_CHECK([prefix for lsym labels], [pmix_cv_asm_lsym], [_PMIX_CHECK_ASM_LSYM([pmix_cv_asm_lsym])]) @@ -593,7 +522,6 @@ mysym: .endp mysym], [pmix_cv_asm_need_proc="yes"]) rm -f conftest.out]) - if test "$pmix_cv_asm_need_proc" = "yes" ; then pmix_cv_asm_proc=".proc" pmix_cv_asm_endproc=".endp" @@ -616,21 +544,17 @@ AC_DEFUN([PMIX_CHECK_ASM_GSYM],[ AC_CACHE_CHECK([prefix for global symbol labels], [pmix_cv_asm_gsym], [_PMIX_CHECK_ASM_GSYM]) - if test "$pmix_cv_asm_gsym" = "none" ; then AC_MSG_ERROR([Could not determine global symbol label prefix]) fi - AC_DEFINE_UNQUOTED([PMIX_ASM_GSYM], ["$pmix_cv_asm_gsym"], [Assembly prefix for gsym labels]) PMIX_ASM_GSYM="$pmix_cv_asm_gsym" AC_SUBST(PMIX_ASM_GSYM) - ]) AC_DEFUN([_PMIX_CHECK_ASM_GSYM],[ pmix_cv_asm_gsym="none" - for sym in "_" "" "." ; do asm_result=0 echo "configure: trying $sym" >&AC_FD_CC @@ -727,7 +651,6 @@ dnl ################################################################# AC_DEFUN([PMIX_CHECK_ASM_ALIGN_LOG],[ AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_PROG_GREP]) - AC_CACHE_CHECK([if .align directive takes logarithmic value], [pmix_cv_asm_align_log], [ PMIX_TRY_ASSEMBLE([ $pmix_cv_asm_text @@ -746,17 +669,14 @@ foo$pmix_cv_asm_label_suffix else pmix_cv_asm_align_log="no" fi]) - if test "$pmix_cv_asm_align_log" = "yes" || test "$pmix_cv_asm_align_log" = "1" ; then pmix_asm_align_log_result=1 else pmix_asm_align_log_result=0 fi - AC_DEFINE_UNQUOTED([PMIX_ASM_ALIGN_LOG], [$asm_align_log_result], [Assembly align directive expects logarithmic value]) - unset omp_asm_addr asm_result ])dnl @@ -777,7 +697,6 @@ AC_DEFUN([PMIX_CHECK_ASM_TYPE],[ AC_CACHE_CHECK([prefix for function in .type], [pmix_cv_asm_type], [_PMIX_CHECK_ASM_TYPE]) - AC_DEFINE_UNQUOTED([PMIX_ASM_TYPE], ["$pmix_cv_asm_type"], [How to set function type in .type directive]) PMIX_ASM_TYPE="$pmix_cv_asm_type" @@ -786,7 +705,6 @@ AC_DEFUN([PMIX_CHECK_ASM_TYPE],[ AC_DEFUN([_PMIX_CHECK_ASM_TYPE],[ pmix_cv_asm_type="" - case "${host}" in *-sun-solaris*) # GCC on solaris seems to accept just about anything, not @@ -809,7 +727,6 @@ mysym:], ;; esac rm -f conftest.out - unset asm_result type ])dnl @@ -829,13 +746,11 @@ AC_DEFUN([PMIX_CHECK_ASM_SIZE],[ PMIX_TRY_ASSEMBLE([ .size mysym, 1], [pmix_cv_asm_need_size="yes"]) rm -f conftest.out]) - if test "$pmix_cv_asm_need_size" = "yes" ; then pmix_asm_size=1 else pmix_asm_size=0 fi - AC_DEFINE_UNQUOTED([PMIX_ASM_SIZE], ["$pmix_asm_size"], [Do we need to give a .size directive]) PMIX_ASM_SIZE="$pmix_asm_size" @@ -850,7 +765,6 @@ AC_DEFUN([PMIX_CHECK_ASM_SIZE],[ # disable execable stacks with GAS AC_DEFUN([PMIX_CHECK_ASM_GNU_STACKEXEC], [ AC_REQUIRE([AC_PROG_GREP]) - AC_CHECK_PROG([OBJDUMP], [objdump], [objdump]) AC_CACHE_CHECK([if .note.GNU-stack is needed], [pmix_cv_asm_gnu_stack_result], @@ -860,7 +774,7 @@ AC_DEFUN([PMIX_CHECK_ASM_GNU_STACKEXEC], [ int testfunc() {return 0; } EOF PMIX_LOG_COMMAND([$CC $CFLAGS -c conftest.c -o conftest.$OBJEXT], - [$OBJDUMP -x conftest.$OBJEXT | $GREP '\.note\.GNU-stack' > /dev/null && pmix_cv_asm_gnu_stack_result=yes], + [$OBJDUMP -x conftest.$OBJEXT 2>&1 | $GREP '\.note\.GNU-stack' &> /dev/null && pmix_cv_asm_gnu_stack_result=yes], [PMIX_LOG_MSG([the failed program was:], 1) PMIX_LOG_FILE([conftest.c]) pmix_cv_asm_gnu_stack_result=no]) @@ -899,7 +813,6 @@ AC_DEFUN([PMIX_CHECK_POWERPC_REG],[ else AC_MSG_RESULT([no]) fi - AC_DEFINE_UNQUOTED([PMIX_POWERPC_R_REGISTERS], [$pmix_cv_asm_powerpc_r_reg], [Whether r notation is used for ppc registers]) @@ -939,7 +852,6 @@ AC_DEFUN([PMIX_CHECK_POWERPC_64BIT],[ ppc64_result=0 ;; esac - if test "$ppc64_result" = "1" ; then AC_MSG_RESULT([yes]) ifelse([$1],,:,[$1]) @@ -947,34 +859,10 @@ AC_DEFUN([PMIX_CHECK_POWERPC_64BIT],[ AC_MSG_RESULT([no]) ifelse([$2],,:,[$2]) fi - unset ppc64_result ldarx_asm ])dnl -dnl ################################################################# -dnl -dnl PMIX_CHECK_SPARCV8PLUS -dnl -dnl ################################################################# -AC_DEFUN([PMIX_CHECK_SPARCV8PLUS],[ - AC_MSG_CHECKING([if have Sparc v8+/v9 support]) - sparc_result=0 - PMIX_TRY_ASSEMBLE([$pmix_cv_asm_text - casa [%o0] 0x80, %o1, %o2], - [sparc_result=1], - [sparc_result=0]) - if test "$sparc_result" = "1" ; then - AC_MSG_RESULT([yes]) - ifelse([$1],,:,[$1]) - else - AC_MSG_RESULT([no]) - ifelse([$2],,:,[$2]) - fi - - unset sparc_result -])dnl - dnl ################################################################# dnl dnl PMIX_CHECK_CMPXCHG16B @@ -983,7 +871,6 @@ dnl ################################################################# AC_DEFUN([PMIX_CMPXCHG16B_TEST_SOURCE],[[ #include #include - union pmix_counted_pointer_t { struct { uint64_t counter; @@ -996,17 +883,13 @@ union pmix_counted_pointer_t { #endif }; typedef union pmix_counted_pointer_t pmix_counted_pointer_t; - int main(int argc, char* argv) { volatile pmix_counted_pointer_t a; pmix_counted_pointer_t b; - a.data.counter = 0; a.data.item = 0x1234567890ABCDEF; - b.data.counter = a.data.counter; b.data.item = a.data.item; - /* bozo checks */ assert(16 == sizeof(pmix_counted_pointer_t)); assert(a.data.counter == b.data.counter); @@ -1029,7 +912,6 @@ int main(int argc, char* argv) { AC_DEFUN([PMIX_CHECK_CMPXCHG16B],[ PMIX_VAR_SCOPE_PUSH([cmpxchg16b_result]) - PMIX_ASM_CHECK_ATOMIC_FUNC([cmpxchg16b], [AC_LANG_PROGRAM([[unsigned char tmp[16];]], [[__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])], @@ -1044,7 +926,6 @@ AC_DEFUN([PMIX_CHECK_CMPXCHG16B],[ AC_MSG_RESULT([no])], [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) ]) - AC_DEFINE_UNQUOTED([PMIX_HAVE_CMPXCHG16B], [$cmpxchg16b_result], [Whether the processor supports the cmpxchg16b instruction]) PMIX_VAR_SCOPE_POP @@ -1079,9 +960,7 @@ dnl ################################################################# AC_DEFUN([PMIX_CHECK_INLINE_C_GCC],[ assembly="$1" asm_result="unknown" - AC_MSG_CHECKING([if $CC supports GCC inline assembly]) - if test ! "$assembly" = "" ; then AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[ int ret = 1; @@ -1094,7 +973,6 @@ return ret; else assembly="test skipped - assuming no" fi - # if we're cross compiling, just try to compile and figure good enough if test "$asm_result" = "unknown" ; then AC_LINK_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],[[ @@ -1105,20 +983,16 @@ return ret; ]])], [asm_result="yes"], [asm_result="no"]) fi - AC_MSG_RESULT([$asm_result]) - if test "$asm_result" = "yes" ; then PMIX_C_GCC_INLINE_ASSEMBLY=1 pmix_cv_asm_inline_supported="yes" else PMIX_C_GCC_INLINE_ASSEMBLY=0 fi - AC_DEFINE_UNQUOTED([PMIX_C_GCC_INLINE_ASSEMBLY], [$PMIX_C_GCC_INLINE_ASSEMBLY], [Whether C compiler supports GCC style inline assembly]) - unset PMIX_C_GCC_INLINE_ASSEMBLY assembly asm_result ])dnl @@ -1136,32 +1010,28 @@ dnl ################################################################# AC_DEFUN([PMIX_CONFIG_ASM],[ AC_REQUIRE([PMIX_SETUP_CC]) AC_REQUIRE([AM_PROG_AS]) - AC_ARG_ENABLE([c11-atomics],[AC_HELP_STRING([--enable-c11-atomics], [Enable use of C11 atomics if available (default: enabled)])]) - AC_ARG_ENABLE([builtin-atomics], [AC_HELP_STRING([--enable-builtin-atomics], - [Enable use of __sync builtin atomics (default: disabled)])]) - + [Enable use of GCC built-in atomics (default: autodetect)])]) PMIX_CHECK_C11_CSWAP_INT128 - + pmix_cv_asm_builtin="BUILTIN_NO" + PMIX_CHECK_GCC_ATOMIC_BUILTINS if test "x$enable_c11_atomics" != "xno" && test "$pmix_cv_c11_supported" = "yes" ; then pmix_cv_asm_builtin="BUILTIN_C11" PMIX_CHECK_C11_CSWAP_INT128 elif test "x$enable_c11_atomics" = "xyes"; then AC_MSG_WARN([C11 atomics were requested but are not supported]) AC_MSG_ERROR([Cannot continue]) + elif test "$enable_builtin_atomics" = "yes" ; then + if test $pmix_cv_have___atomic = "yes" ; then + pmix_cv_asm_builtin="BUILTIN_GCC" else - pmix_cv_asm_builtin="BUILTIN_NO" - AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], - [PMIX_CHECK_GCC_ATOMIC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_GCC"], [])]) - AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], - [PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], [])]) - AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], - [AC_MSG_ERROR([__sync builtin atomics requested but not found.])]) + AC_MSG_WARN([GCC built-in atomics requested but not found.]) + AC_MSG_ERROR([Cannot continue]) + fi fi - PMIX_CHECK_ASM_PROC PMIX_CHECK_ASM_TEXT PMIX_CHECK_ASM_GLOBAL @@ -1172,11 +1042,14 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ PMIX_CHECK_ASM_TYPE PMIX_CHECK_ASM_SIZE PMIX_CHECK_ASM_ALIGN_LOG - # find our architecture for purposes of assembly stuff pmix_cv_asm_arch="UNSUPPORTED" PMIX_GCC_INLINE_ASSIGN="" + if test "$pmix_cv_have___atomic_64" ; then + PMIX_ASM_SUPPORT_64BIT=1 + else PMIX_ASM_SUPPORT_64BIT=0 + fi case "${host}" in x86_64-*x32) pmix_cv_asm_arch="X86_64" @@ -1193,60 +1066,29 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ PMIX_GCC_INLINE_ASSIGN='"xaddl %1,%0" : "=m"(ret), "+r"(negone) : "m"(ret)' PMIX_CHECK_CMPXCHG16B ;; - - ia64-*) - pmix_cv_asm_arch="IA64" - PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) - ;; aarch64*) pmix_cv_asm_arch="ARM64" PMIX_ASM_SUPPORT_64BIT=1 PMIX_ASM_ARM_VERSION=8 - AC_DEFINE_UNQUOTED([PMIX_ASM_ARM_VERSION], [$PMIX_ASM_ARM_VERSION], - [What ARM assembly version to use]) PMIX_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)' ;; - armv7*|arm-*-linux-gnueabihf) pmix_cv_asm_arch="ARM" PMIX_ASM_SUPPORT_64BIT=1 PMIX_ASM_ARM_VERSION=7 - AC_DEFINE_UNQUOTED([PMIX_ASM_ARM_VERSION], [$PMIX_ASM_ARM_VERSION], - [What ARM assembly version to use]) PMIX_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)' ;; - armv6*) pmix_cv_asm_arch="ARM" PMIX_ASM_SUPPORT_64BIT=0 PMIX_ASM_ARM_VERSION=6 CCASFLAGS="$CCASFLAGS -march=armv7-a" - AC_DEFINE_UNQUOTED([PMIX_ASM_ARM_VERSION], [$PMIX_ASM_ARM_VERSION], - [What ARM assembly version to use]) PMIX_GCC_INLINE_ASSIGN='"mov %0, #0" : "=&r"(ret)' ;; - - armv5*linux*|armv4*linux*|arm-*-linux-gnueabi) - # uses Linux kernel helpers for some atomic operations - pmix_cv_asm_arch="ARM" - PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) - ;; - - mips-*|mips64*) - # Should really find some way to make sure that we are on - # a MIPS III machine (r4000 and later) - pmix_cv_asm_arch="MIPS" - PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) - ;; - powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*) PMIX_CHECK_POWERPC_REG if test "$ac_cv_sizeof_long" = "4" ; then pmix_cv_asm_arch="POWERPC32" - # Note that on some platforms (Apple G5), even if we are # compiling in 32 bit mode (and therefore should assume # sizeof(long) == 4), we can use the 64 bit test and set @@ -1260,87 +1102,32 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ fi PMIX_GCC_INLINE_ASSIGN='"1: li %0,0" : "=&r"(ret)' ;; - # There is no current difference between s390 and s390x - # But use two different defines in case some come later - # as s390 is 31bits while s390x is 64bits - s390-*) - pmix_cv_asm_arch="S390" - PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) - ;; - s390x-*) - pmix_cv_asm_arch="S390X" - PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) - ;; - sparc*-*) - # SPARC v9 (and above) are the only ones with 64bit support - # if compiling 32 bit, see if we are v9 (aka v8plus) or - # earlier (casa is v8+/v9). - if test "$ac_cv_sizeof_long" = "4" ; then - have_v8plus=0 - PMIX_CHECK_SPARCV8PLUS([have_v8plus=1]) - if test "$have_v8plus" = "0" ; then - PMIX_ASM_SUPPORT_64BIT=0 - pmix_cv_asm_arch="SPARC" -AC_MSG_WARN([Sparc v8 target is not supported in this release of Open MPI.]) -AC_MSG_WARN([You must specify the target architecture v8plus to compile]) -AC_MSG_WARN([Open MPI in 32 bit mode on Sparc processors (see the README).]) -AC_MSG_ERROR([Can not continue.]) - else - PMIX_ASM_SUPPORT_64BIT=1 - pmix_cv_asm_arch="SPARCV9_32" - fi - - elif test "$ac_cv_sizeof_long" = "8" ; then - PMIX_ASM_SUPPORT_64BIT=1 - pmix_cv_asm_arch="SPARCV9_64" - else - AC_MSG_ERROR([Could not determine Sparc word size: $ac_cv_sizeof_long]) - fi - PMIX_GCC_INLINE_ASSIGN='"mov 0,%0" : "=&r"(ret)' - ;; - *) - PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) - ;; - esac - - if test "x$PMIX_ASM_SUPPORT_64BIT" = "x1" && test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" && - test "$pmix_asm_sync_have_64bit" = "0" ; then - # __sync builtins exist but do not implement 64-bit support. Fall back on inline asm. - pmix_cv_asm_builtin="BUILTIN_NO" + if test $pmix_cv_have___atomic = "yes" ; then + pmix_cv_asm_builtin="BUILTIN_GCC" + else + AC_MSG_ERROR([No atomic primitives available for $host]) fi - - if test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" || test "$pmix_cv_asm_builtin" = "BUILTIN_GCC" ; then - AC_DEFINE([PMIX_C_GCC_INLINE_ASSEMBLY], [1], - [Whether C compiler supports GCC style inline assembly]) - else - AC_DEFINE_UNQUOTED([PMIX_ASM_SUPPORT_64BIT], - [$PMIX_ASM_SUPPORT_64BIT], - [Whether we can do 64bit assembly operations or not. Should not be used outside of the assembly header files]) - AC_SUBST([PMIX_ASM_SUPPORT_64BIT]) - - # - # figure out if we need any special function start / stop code - # - case $host_os in - aix*) - pmix_asm_arch_config="aix" - ;; - *) - pmix_asm_arch_config="default" - ;; - esac - + ;; + esac + if ! test -z "$PMIX_ASM_ARM_VERSION" ; then + AC_DEFINE_UNQUOTED([PMIX_ASM_ARM_VERSION], [$PMIX_ASM_ARM_VERSION], + [What ARM assembly version to use]) + fi + if test "$pmix_cv_asm_builtin" = "BUILTIN_GCC" ; then + AC_DEFINE([PMIX_C_GCC_INLINE_ASSEMBLY], [1], + [Whether C compiler supports GCC style inline assembly]) + else + AC_DEFINE_UNQUOTED([PMIX_ASM_SUPPORT_64BIT], + [$PMIX_ASM_SUPPORT_64BIT], + [Whether we can do 64bit assembly operations or not. Should not be used outside of the assembly header files]) + AC_SUBST([PMIX_ASM_SUPPORT_64BIT]) pmix_cv_asm_inline_supported="no" # now that we know our architecture, try to inline assemble PMIX_CHECK_INLINE_C_GCC([$PMIX_GCC_INLINE_ASSIGN]) - # format: # config_file-text-global-label_suffix-gsym-lsym-type-size-align_log-ppc_r_reg-64_bit-gnu_stack - asm_format="${pmix_asm_arch_config}" + asm_format="default" asm_format="${asm_format}-${pmix_cv_asm_text}-${pmix_cv_asm_global}" asm_format="${asm_format}-${pmix_cv_asm_label_suffix}-${pmix_cv_asm_gsym}" asm_format="${asm_format}-${pmix_cv_asm_lsym}" @@ -1357,14 +1144,12 @@ AC_MSG_ERROR([Can not continue.]) # this version, but make sure the Makefile gives the right thing # when regenerating the files because the base has been touched. PMIX_ASSEMBLY_FORMAT=`echo "$pmix_cv_asm_format" | sed -e 's/\\\$/\\\$\\\$/'` - AC_MSG_CHECKING([for assembly format]) AC_MSG_RESULT([$pmix_cv_asm_format]) AC_DEFINE_UNQUOTED([PMIX_ASSEMBLY_FORMAT], ["$PMIX_ASSEMBLY_FORMAT"], [Format of assembly file]) AC_SUBST([PMIX_ASSEMBLY_FORMAT]) - fi # if pmix_cv_asm_builtin = BUILTIN_SYNC - + fi # if pmix_cv_asm_builtin = BUILTIN_GCC result="PMIX_$pmix_cv_asm_arch" PMIX_ASSEMBLY_ARCH="$pmix_cv_asm_arch" AC_MSG_CHECKING([for assembly architecture]) @@ -1372,7 +1157,6 @@ AC_MSG_ERROR([Can not continue.]) AC_DEFINE_UNQUOTED([PMIX_ASSEMBLY_ARCH], [$result], [Architecture type of assembly to use for atomic operations and CMA]) AC_SUBST([PMIX_ASSEMBLY_ARCH]) - # Check for RDTSCP support result=0 AS_IF([test "$pmix_cv_asm_arch" = "PMIX_X86_64" || test "$pmix_cv_asm_arch" = "PMIX_IA32"], @@ -1394,7 +1178,6 @@ int main(int argc, char* argv[]) AC_LANG_POP([C])]) AC_DEFINE_UNQUOTED([PMIX_ASSEMBLY_SUPPORTS_RDTSCP], [$result], [Whether we have support for RDTSCP instruction]) - result="PMIX_$pmix_cv_asm_builtin" PMIX_ASSEMBLY_BUILTIN="$pmix_cv_asm_builtin" AC_MSG_CHECKING([for builtin atomics]) @@ -1402,9 +1185,7 @@ int main(int argc, char* argv[]) AC_DEFINE_UNQUOTED([PMIX_ASSEMBLY_BUILTIN], [$result], [Whether to use builtin atomics]) AC_SUBST([PMIX_ASSEMBLY_BUILTIN]) - PMIX_ASM_FIND_FILE - unset result asm_format ])dnl @@ -1420,8 +1201,7 @@ dnl ################################################################# AC_DEFUN([PMIX_ASM_FIND_FILE], [ AC_REQUIRE([AC_PROG_GREP]) AC_REQUIRE([AC_PROG_FGREP]) - -if test "$pmix_cv_asm_arch" != "WINDOWS" && test "$pmix_cv_asm_builtin" != "BUILTIN_SYNC" && test "$pmix_cv_asm_builtin" != "BUILTIN_GCC" && test "$pmix_cv_asm_builtin" != "BUILTIN_OSX" && test "$pmix_cv_asm_inline_arch" = "no" ; then +if test "$pmix_cv_asm_arch" != "WINDOWS" && test "$pmix_cv_asm_builtin" != "BUILTIN_GCC" && test "$pmix_cv_asm_builtin" != "BUILTIN_OSX" && test "$pmix_cv_asm_inline_arch" = "no" ; then AC_MSG_ERROR([no atomic support available. exiting]) else # On windows with VC++, atomics are done with compiler primitives diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 index a75d339b2b..d326c81bb1 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 @@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. @@ -287,7 +287,7 @@ for val in ${$1}; do # Check for special cases where we do want to allow repeated # arguments (per - # http://www.open-mpi.org/community/lists/devel/2012/08/11362.php). + # https://www.open-mpi.org/community/lists/devel/2012/08/11362.php). case $val in -Xclang|-Xg) @@ -373,7 +373,7 @@ AC_DEFUN([PMIX_FLAGS_UNIQ],[ # Check for special cases where we do want to allow repeated # arguments (per - # http://www.open-mpi.org/community/lists/devel/2012/08/11362.php + # https://www.open-mpi.org/community/lists/devel/2012/08/11362.php # and # https://github.com/open-mpi/ompi/issues/324). diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_load_platform.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_load_platform.m4 index 53d4afbf7d..21ce6b1ab6 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_load_platform.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_load_platform.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. -dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2020 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ @@ -23,6 +23,9 @@ dnl # PMIX_LOAD_PLATFORM() # -------------------- AC_DEFUN([PMIX_LOAD_PLATFORM], [ + AC_ARG_WITH([platform-patches-dir], + [AC_HELP_STRING([--with-platform-patches-dir=DIR], + [Location of the platform patches directory. If you use this option, you must also use --with-platform.])]) AC_ARG_WITH([platform], [AC_HELP_STRING([--with-platform=FILE], @@ -30,7 +33,10 @@ AC_DEFUN([PMIX_LOAD_PLATFORM], [ command line not in FILE are used. Options on the command line and in FILE are replaced by what is in FILE.])]) - + m4_ifval([autogen_platform_file], [ + if test "$with_platform" = "" ; then + with_platform=autogen_platform_file + fi]) if test "$with_platform" = "yes" ; then AC_MSG_ERROR([--with-platform argument must include FILE option]) elif test "$with_platform" = "no" ; then @@ -77,5 +83,106 @@ AC_DEFUN([PMIX_LOAD_PLATFORM], [ # return to where we started cd "$platform_savedir" + + # define an alternate default mca param filename + platform_alt_mca_file="`basename $platform_loaded`.conf" + + # look where platform file is located for platform.conf name + if test -r "${platform_file_dir}/${platform_alt_mca_file}" ; then + AC_SUBST(PMIX_DEFAULT_MCA_PARAM_CONF, [$platform_file_dir/$platform_alt_mca_file]) + AC_SUBST(PMIX_PARAM_FROM_PLATFORM, "yes") + # if not, see if a file is there with the default name + elif test -r "${platform_file_dir}/pmix-mca-params.conf" ; then + AC_SUBST(PMIX_DEFAULT_MCA_PARAM_CONF, [$platform_file_dir/pmix-mca-params.conf]) + AC_SUBST(PMIX_PARAM_FROM_PLATFORM, "yes") + # if not, then just use the default + else + AC_SUBST(PMIX_DEFAULT_MCA_PARAM_CONF, [pmix-mca-params.conf]) + AC_SUBST(PMIX_PARAM_FROM_PLATFORM, "no") + fi + + patch_dir="${with_platform}.patches" + if test -n "$with_platform_patches_dir"; then + if test "$with_platform_patches_dir" = "yes"; then + patch_dir="${with_platform}.patches" + elif test "$with_platform_patches_dir" = "no"; then + AC_MSG_NOTICE([Disabling platform patches on user request]) + patch_dir="" + elif test -d "$with_platform_patches_dir"; then + patch_dir=$with_platform_patches_dir + else + AC_MSG_ERROR([User provided patches directory: $with_platform_patches_dir not found]) + fi + fi + + patch_done="${srcdir}/.platform_patches" + patch_found=no + + if test -d "${patch_dir}"; then + if test ! -f "${patch_done}"; then + + AC_MSG_NOTICE([Checking patches from ${patch_dir}/ directory ]) + for one_patch in $patch_dir/*.patch ; do + + AC_MSG_CHECKING([patch: $one_patch for errors ]) + patch -d ${srcdir} -p1 -t -s --dry-run < ${one_patch} + if test "$?" != "0"; then + AC_MSG_RESULT([fail]) + AC_MSG_ERROR([Platform patches failed to apply]) + else + AC_MSG_RESULT([ok]) + fi + + AC_MSG_CHECKING([patch: $one_patch for unsupported configury changes ]) + has_configury_items=$(patch -d ${srcdir} -p1 -t --dry-run < ${one_patch} 2>&1 | egrep "^patching" | egrep '*\.(am|m4)$' | wc -l) + + if test $has_configury_items -ne 0; then + AC_MSG_RESULT([fail]) + AC_MSG_ERROR([Platform patches should not change configury files]) + else + AC_MSG_RESULT([ok]) + fi + done + + + for one_patch in $patch_dir/*.patch ; do + AC_MSG_NOTICE([Applying patch ${one_patch}]) + patch -d ${srcdir} -p1 -t -s < ${one_patch} + if test "$?" != "0"; then + AC_MSG_ERROR([Failed to apply patch ${one_patch}]) + fi + patch_found=yes + done + + if test "$patch_found" = "yes"; then + + platform_root_short="$(basename $platform_base)" + + # If platform file resides under platform/ root folder - use filename as ident + if [ test "$platform_root_short" = "platform" ]; then + platform_ident="$platform_file" + else + platform_ident="$(basename $platform_base)" + fi + + # Set custom ident for platform patched PMIX + if [ test -z "$with_ident_string" ]; then + with_ident_string="Platform: $platform_ident" + fi + + AC_MSG_NOTICE([Platform patches applied, created stamp file ${patch_done}]) + touch ${patch_done} + else + AC_MSG_NOTICE([No platform patches in ${patch_dir}]) + fi + + else + AC_MSG_WARN([Platform patches already applied, skipping. ${patch_done} can be removed to re-apply ]) + fi + elif test -n "${patch_dir}"; then + AC_MSG_NOTICE([No platform patches in ${patch_dir}]) + fi + else + AC_SUBST(PMIX_DEFAULT_MCA_PARAM_CONF, [pmix-mca-params.conf]) fi ]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 index 2978c928b9..2131f85be0 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 @@ -262,11 +262,6 @@ AC_DEFUN([PMIX_MCA],[ [MCA_pmix_]mca_framework[_CONFIG](mca_framework), [MCA_CONFIGURE_FRAMEWORK(mca_framework, 1)])])]) - # note that mca_wrapper_extra_* is a running list, and we take checkpoints at the end of our project - pmix_mca_wrapper_extra_cppflags="$mca_wrapper_extra_cppflags" - pmix_mca_wrapper_extra_ldflags="$mca_wrapper_extra_ldflags" - pmix_mca_wrapper_extra_libs="$mca_wrapper_extra_libs" - AC_SUBST(MCA_pmix_FRAMEWORKS) AC_SUBST(MCA_pmix_FRAMEWORKS_SUBDIRS) AC_SUBST(MCA_pmix_FRAMEWORK_COMPONENT_ALL_SUBDIRS) @@ -622,14 +617,6 @@ AC_DEFUN([MCA_CONFIGURE_ALL_CONFIG_COMPONENTS],[ AC_MSG_WARN([MCA component configure script told me to abort]) AC_MSG_ERROR([cannot continue]) fi - - m4_foreach(flags, [LDFLAGS, LIBS], - [[line="`$GREP WRAPPER_EXTRA_]flags[= $infile | cut -d= -f2-`"] - eval "line=$line" - if test -n "$line"; then - $2[_]$3[_WRAPPER_EXTRA_]flags[="$line"] - fi - ])dnl fi MCA_PROCESS_COMPONENT($1, $component, $2, $3, $4, $5, $compile_mode) @@ -754,38 +741,6 @@ AC_MSG_ERROR([*** $1 component $2 was supposed to be direct-called, but *** Aborting]) fi fi - - # if the component is building, add it's WRAPPER_EXTRA_LDFLAGS and - # WRAPPER_EXTRA_LIBS. If the component doesn't specify it's - # WRAPPER_EXTRA_LIBS and WRAPPER_EXTRA_LDFLAGS, try using LDFLAGS and LIBS if - # component didn't have it's own configure script (in which case, - # we know it didn't set LDFLAGS and LIBS because it can't) Don't - # have to do this if the component is building dynamically, - # because it will link against these (without a dependency from - # libmpi.so to these flags) - if test "$7" = "static"; then - AS_LITERAL_IF([$2], - [m4_foreach(flags, [LDFLAGS, LIBS], - [AS_IF([test "$$1_$2_WRAPPER_EXTRA_]flags[" = ""], - [PMIX_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$1_$2_]flags)], - [PMIX_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$1_$2_WRAPPER_EXTRA_]flags)]) - ])], - [m4_foreach(flags, [LDFLAGS, LIBS], - [[str="line=\$$1_$2_WRAPPER_EXTRA_]flags["] - eval "$str" - PMIX_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$line])])]) - fi - - # if needed, copy over WRAPPER_EXTRA_CPPFLAGS. Since a configure script - # component can never be used in a STOP_AT_FIRST framework, we - # don't have to implement the else clause in the literal check... - AS_LITERAL_IF([$2], - [AS_IF([test "$$1_$2_WRAPPER_EXTRA_CPPFLAGS" != ""], - [m4_if(PMIX_EVAL_ARG([MCA_pmix_$1_CONFIGURE_MODE]), [STOP_AT_FIRST], [stop_at_first=1], [stop_at_first=0]) - AS_IF([test "$7" = "static" && test "$stop_at_first" = "1"], - [AS_IF([test "$with_devel_headers" = "yes"], - [PMIX_FLAGS_APPEND_UNIQ([mca_wrapper_extra_cppflags], [$$1_$2_WRAPPER_EXTRA_CPPFLAGS])])], - [AC_MSG_WARN([ignoring $1_$2_WRAPPER_EXTRA_CPPFLAGS ($$1_$2_WRAPPER_EXTRA_CPPFLAGS): component conditions not met])])])]) ]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cc.m4 index 026c3a800b..d3ed855bb9 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cc.m4 @@ -16,7 +16,7 @@ dnl Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2015-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2018 Intel, Inc. All rights reserved. +dnl Copyright (c) 2018-2020 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -120,6 +120,28 @@ AC_DEFUN([PMIX_PROG_CC_C11],[ ]) +# PMIX_CHECK_CC_IQUOTE() +# ---------------------- +# Check if the compiler supports the -iquote option. This options +# removes the specified directory from the search path when using +# #include <>. This check works around an issue caused by C++20 +# which added a header. This conflicts with the +# VERSION file at the base of our source directory on case- +# insensitive filesystems. +AC_DEFUN([PMIX_CHECK_CC_IQUOTE],[ + PMIX_VAR_SCOPE_PUSH([pmix_check_cc_iquote_CFLAGS_save]) + pmix_check_cc_iquote_CFLAGS_save=${CFLAGS} + CFLAGS="${CFLAGS} -iquote ." + AC_MSG_CHECKING([for $CC option to add a directory only to the search path for the quote form of include]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[])], + [pmix_cc_iquote="-iquote"], + [pmix_cc_iquote="-I"]) + CFLAGS=${pmix_check_cc_iquote_CFLAGS_save} + PMIX_VAR_SCOPE_POP + AC_MSG_RESULT([$pmix_cc_iquote]) +]) + + # PMIX_SETUP_CC() # --------------- # Do everything required to setup the C compiler. Safe to AC_REQUIRE @@ -135,7 +157,13 @@ AC_DEFUN([PMIX_SETUP_CC],[ PMIX_VAR_SCOPE_PUSH([pmix_prog_cc_c11_helper__Thread_local_available pmix_prog_cc_c11_helper_atomic_var_available pmix_prog_cc_c11_helper__Atomic_available pmix_prog_cc_c11_helper__static_assert_available pmix_prog_cc_c11_helper__Generic_available pmix_prog_cc__thread_available pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available]) + # AC_PROG_CC_C99 changes CC (instead of CFLAGS) so save CC (without c99 + # flags) for use in our wrappers. + WRAPPER_CC="$CC" + AC_SUBST([WRAPPER_CC]) + PMIX_PROG_CC_C11 + PMIX_CHECK_CC_IQUOTE if test $pmix_cv_c11_supported = no ; then # It is not currently an error if C11 support is not available. Uncomment the diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 index 043c0c4d44..f3ea6a3c91 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 @@ -2,8 +2,8 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2017-2019 Intel, Inc. All rights reserved. -dnl Copyright (c) 2018 Cisco, Inc. All rights reserved. +dnl Copyright (c) 2017-2018 Intel, Inc. All rights reserved. +dnl Copyright (c) 2018-2020 Cisco, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -24,7 +24,7 @@ AC_DEFUN([PMIX_CAPTURE_CONFIGURE_CLI],[ PMIX_VAR_SCOPE_PUSH([sed_quote_subst arg quoted_arg]) $1= for arg in "$[]@"; do - sed_quote_subst='s/\(@<:@`"$\\@:>@\)/\\\1/g' + sed_quote_subst='s/\(@<:@`"\\@:>@\)/\\\1/g' case "$arg" in *@<:@\\\`\"\$[]@:>@*) quoted_arg=\'`echo "$arg" | sed $sed_quote_subst`\' ;; diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 index a17313259a..7f83952ee1 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -46,7 +46,7 @@ AC_DEFUN([_PMIX_HWLOC_EMBEDDED_MODE],[ ]) AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[ - PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir pmix_hwloc_standard_lib_location pmix_hwloc_standard_header_location]) + PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir pmix_hwloc_standard_lib_location pmix_hwloc_standard_header_location pmix_check_hwloc_save_CPPFLAGS pmix_check_hwloc_save_LDFLAGS pmix_check_hwloc_save_LIBS]) AC_ARG_WITH([hwloc], [AC_HELP_STRING([--with-hwloc=DIR], @@ -57,13 +57,19 @@ AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[ [Search for hwloc libraries in DIR ])]) pmix_hwloc_support=0 + pmix_check_hwloc_save_CPPFLAGS="$CPPFLAGS" + pmix_check_hwloc_save_LDFLAGS="$LDFLAGS" + pmix_check_hwloc_save_LIBS="$LIBS" + pmix_hwloc_standard_header_location=yes + pmix_hwloc_standard_lib_location=yes + AS_IF([test "$with_hwloc" = "internal" || test "$with_hwloc" = "external"], [with_hwloc=]) if test "$with_hwloc" != "no"; then AC_MSG_CHECKING([for hwloc in]) if test ! -z "$with_hwloc" && test "$with_hwloc" != "yes"; then - pmix_hwloc_dir=$with_hwloc + pmix_hwloc_dir=$with_hwloc/include pmix_hwloc_standard_header_location=no pmix_hwloc_standard_lib_location=no AS_IF([test -z "$with_hwloc_libdir" || test "$with_hwloc_libdir" = "yes"], @@ -134,6 +140,10 @@ AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[ AC_MSG_ERROR([Cannot continue])]) fi + CPPFLAGS=$pmix_check_hwloc_save_CPPFLAGS + LDFLAGS=$pmix_check_hwloc_save_LDFLAGS + LIBS=$pmix_check_hwloc_save_LIBS + AC_MSG_CHECKING([will hwloc support be built]) if test "$pmix_hwloc_support" != "1"; then AC_MSG_RESULT([no]) @@ -143,6 +153,12 @@ AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[ AC_MSG_RESULT([yes]) pmix_hwloc_source=$pmix_hwloc_dir pmix_hwloc_support_will_build=yes + AS_IF([test "$pmix_hwloc_standard_header_location" != "yes"], + [PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_CPPFLAGS, $pmix_hwloc_CPPFLAGS)]) + + AS_IF([test "$pmix_hwloc_standard_lib_location" != "yes"], + [PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_LDFLAGS, $pmix_hwloc_LDFLAGS)]) + PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_LIBS, $pmix_hwloc_LIBS) fi # Set output variables diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 index 494cc2a2c3..c25fb83b99 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # Copyright (c) 2017-2019 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -15,7 +15,7 @@ # MCA_libev_CONFIG([action-if-found], [action-if-not-found]) # -------------------------------------------------------------------- AC_DEFUN([PMIX_LIBEV_CONFIG],[ - PMIX_VAR_SCOPE_PUSH([pmix_libev_dir pmix_libev_libdir pmix_libev_standard_header_location pmix_libev_standard_lib_location]) + PMIX_VAR_SCOPE_PUSH([pmix_libev_dir pmix_libev_libdir pmix_libev_standard_header_location pmix_libev_standard_lib_location pmix_check_libev_save_CPPFLAGS pmix_check_libev_save_LDFLAGS pmix_check_libev_save_LIBS]) AC_ARG_WITH([libev], [AC_HELP_STRING([--with-libev=DIR], @@ -61,7 +61,7 @@ AC_DEFUN([PMIX_LIBEV_CONFIG],[ PMIX_CHECK_PACKAGE([pmix_libev], [event.h], [ev], - [event_base_new], + [ev_async_send], [], [$pmix_libev_dir], [$pmix_libev_libdir], @@ -72,12 +72,12 @@ AC_DEFUN([PMIX_LIBEV_CONFIG],[ LIBS="$pmix_check_libev_save_LIBS"]) AS_IF([test $pmix_libev_support -eq 1], - [LIBS="$LIBS $pmix_libev_LIBS" + [PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_LIBS, $pmix_libev_LIBS) AS_IF([test "$pmix_libev_standard_header_location" != "yes"], - [CPPFLAGS="$CPPFLAGS $pmix_libev_CPPFLAGS"]) + [PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_CPPFLAGS, $pmix_libev_CPPFLAGS)]) AS_IF([test "$pmix_libev_standard_lib_location" != "yes"], - [LDFLAGS="$LDFLAGS $pmix_libev_LDFLAGS"])]) + [PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_LDFLAGS, $pmix_libev_LDFLAGS)])]) AC_MSG_CHECKING([will libev support be built]) if test $pmix_libev_support -eq 1; then @@ -88,6 +88,10 @@ AC_DEFUN([PMIX_LIBEV_CONFIG],[ PMIX_SUMMARY_ADD([[External Packages]],[[libev]],[libev],[$pmix_libev_dir]) else AC_MSG_RESULT([no]) + # if they asked us to use it, then this is an error + AS_IF([test -n "$with_libev" && test "$with_libev" != "no"], + [AC_MSG_WARN([LIBEV SUPPORT REQUESTED AND NOT FOUND]) + AC_MSG_ERROR([CANNOT CONTINUE])]) fi AC_DEFINE_UNQUOTED([PMIX_HAVE_LIBEV], [$pmix_libev_support], [Whether we are building against libev]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 index 28e3a41227..858dd7ace5 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 @@ -2,9 +2,10 @@ # # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # Copyright (c) 2017-2019 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2020 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -55,7 +56,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[ ]) AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ - PMIX_VAR_SCOPE_PUSH([pmix_event_dir pmix_event_libdir pmix_event_defaults]) + PMIX_VAR_SCOPE_PUSH([pmix_event_dir pmix_event_libdir pmix_event_defaults pmix_check_libevent_save_CPPFLAGS pmix_check_libevent_save_LDFLAGS pmix_check_libevent_save_LIBS]) AC_ARG_WITH([libevent], [AC_HELP_STRING([--with-libevent=DIR], @@ -68,6 +69,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ pmix_check_libevent_save_CPPFLAGS="$CPPFLAGS" pmix_check_libevent_save_LDFLAGS="$LDFLAGS" pmix_check_libevent_save_LIBS="$LIBS" + pmix_event_defaults=yes # get rid of the trailing slash(es) libevent_prefix=$(echo $with_libevent | sed -e 'sX/*$XXg') @@ -108,14 +110,36 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ PMIX_CHECK_PACKAGE([pmix_libevent], [event.h], - [event], + [event_core], [event_config_new], - [-levent -levent_pthreads], + [-levent_pthreads], [$pmix_event_dir], [$pmix_event_libdir], [pmix_libevent_support=1], [pmix_libevent_support=0]) + # Check to see if the above check failed because it conflicted with LSF's libevent.so + # This can happen if LSF's library is in the LDFLAGS envar or default search + # path. The 'event_getcode4name' function is only defined in LSF's libevent.so and not + # in Libevent's libevent.so + if test $pmix_libevent_support -eq 0; then + AC_CHECK_LIB([event], [event_getcode4name], + [AC_MSG_WARN([===================================================================]) + AC_MSG_WARN([Possible conflicting libevent.so libraries detected on the system.]) + AC_MSG_WARN([]) + AC_MSG_WARN([LSF provides a libevent.so that is not from Libevent in its]) + AC_MSG_WARN([library path. It is possible that you have installed Libevent]) + AC_MSG_WARN([on the system, but the linker is picking up the wrong version.]) + AC_MSG_WARN([]) + AC_MSG_WARN([You will need to address this linker path issue. One way to do so is]) + AC_MSG_WARN([to make sure the libevent system library path occurs before the]) + AC_MSG_WARN([LSF library path.]) + AC_MSG_WARN([===================================================================]) + ]) + fi + + # need to add resulting flags to global ones so we can + # test for thread support AS_IF([test "$pmix_event_defaults" = "no"], [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS) PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)]) @@ -125,7 +149,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ # Ensure that this libevent has the symbol # "evthread_set_lock_callbacks", which will only exist if # libevent was configured with thread support. - AC_CHECK_LIB([event], [evthread_set_lock_callbacks], + AC_CHECK_LIB([event_core], [evthread_set_lock_callbacks], [], [AC_MSG_WARN([External libevent does not have thread support]) AC_MSG_WARN([PMIx requires libevent to be compiled with]) @@ -156,9 +180,9 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ [Location of event.h]) pmix_libevent_source=$pmix_event_dir AS_IF([test "$pmix_event_defaults" = "no"], - [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS) - PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)]) - PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS) + [PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_CPPFLAGS, $pmix_libevent_CPPFLAGS) + PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_LDFLAGS, $pmix_libevent_LDFLAGS)]) + PMIX_FLAGS_APPEND_UNIQ(PMIX_FINAL_LIBS, $pmix_libevent_LIBS) else AC_MSG_RESULT([no]) fi diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_man_pages.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_man_pages.m4 new file mode 100644 index 0000000000..a6b28130a1 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_man_pages.m4 @@ -0,0 +1,91 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. +dnl +dnl Copyright (c) 2020 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +dnl +dnl Just in case someone looks for it here someday, here is a +dnl conveninent reference for what Markdown pandoc supports: +dnl +dnl https://rmarkdown.rstudio.com/authoring_pandoc_markdown.html +dnl + +AC_DEFUN([PMIX_SETUP_MAN_PAGES],[ + AC_ARG_ENABLE(man-pages, + [AC_HELP_STRING([--disable-man-pages], + [Do not generate/install man pages (default: enabled)])]) + + PANDOC= + PMIX_ENABLE_MAN_PAGES=0 + AC_MSG_CHECKING([if want man pages]) + AS_IF([test -z "$enable_man_pages" || test "$enable_man_pages" = "yes"], + [AC_MSG_RESULT([yes]) + PMIX_ENABLE_MAN_PAGES=1 + _PMIX_SETUP_PANDOC], + [AC_MSG_RESULT([no])]) + + AC_SUBST(PANDOC) + AM_CONDITIONAL([PMIX_ENABLE_MAN_PAGES], [test $PMIX_ENABLE_MAN_PAGES -eq 1]) + AC_DEFINE_UNQUOTED([PMIX_ENABLE_MAN_PAGES], [$PMIX_ENABLE_MAN_PAGES], + [Whether or not we will build manpages]) + + AS_IF([test $PMIX_ENABLE_MAN_PAGES -eq 1], + [PMIX_SUMMARY_ADD([[Options]],[[Manpages built]], [pmix_manpages], [yes])], + [PMIX_SUMMARY_ADD([[Options]],[[Manpages built]], [pmix_manpages], [yes])]) + +]) + +dnl Back-end pandoc setup +AC_DEFUN([_PMIX_SETUP_PANDOC],[ + PMIX_VAR_SCOPE_PUSH([min_major_version min_minor_version pandoc_version pandoc_major pandoc_minor]) + + # If we need to generate man pages, we need pandoc >v1.12. + AC_PATH_PROG([PANDOC], [pandoc]) + + # If we found Pandoc, check its version. We need >=v1.12. + # To be clear: I know that v1.12 works, and I know that v1.9 does not + # work. I did not test the versions in between to know exactly what + # the lowest version is that works. Someone is free to update this + # check someday to be more accurate if they wish. + min_major_version=1 + min_minor_version=12 + AS_IF([test -n "$PANDOC"], + [pandoc_version=`pandoc --version | head -n 1 | awk '{ print $[2] }'` + pandoc_major=`echo $pandoc_version | cut -d\. -f1` + pandoc_minor=`echo $pandoc_version | cut -d\. -f2` + AC_MSG_CHECKING([pandoc version]) + AC_MSG_RESULT([major: $pandoc_major, minor: $pandoc_minor]) + + AC_MSG_CHECKING([if pandoc version is >=v$min_major_version.$min_minor_version]) + AS_IF([test $pandoc_major -lt $min_major_version], [PANDOC=]) + AS_IF([test $pandoc_major -eq $min_major_version && test $pandoc_minor -lt $min_minor_version], + [PANDOC=]) + AS_IF([test -n "$PANDOC"], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + ]) + + AS_IF([test -z "$PANDOC" || test -n "`echo $PANDOC | $GREP missing`"], + [AS_IF([test "$PMIX_DEVEL" = "1" && test -z "$enable_man_pages"], + [AC_MSG_CHECKING([man pages will be built]) + AC_MSG_RESULT([no - adequate pandoc installation not found]) + PANDOC= + PMIX_ENABLE_MAN_PAGES=0], + [AS_IF([test ! -f "$srcdir/tools/wrapper/pmix_wrapper.1"], + [AC_MSG_WARN([*** Could not find a suitable pandoc on your system.]) + AC_MSG_WARN([*** You need pandoc >=$min_major_version.$min_minor_version to build OpenPMIx man pages.]) + AC_MSG_WARN([*** See pandoc.org.]) + AC_MSG_WARN([*** NOTE: If you are building from a tarball downloaded from the OpenPMIx GitHub repository, you do not need Pandoc]) + AC_MSG_ERROR([Cannot continue]) + ])]) + ]) + + PMIX_VAR_SCOPE_POP +]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_zlib.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_zlib.m4 index 5440999eb1..3a42c6f28f 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_zlib.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_zlib.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 index 9b9bc9024e..6c9487e55e 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 @@ -5,7 +5,7 @@ dnl reserved. dnl Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved dnl Copyright (c) 2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2018-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2018 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/configure.ac b/opal/mca/pmix/pmix3x/pmix/configure.ac index 4bab86e668..a42a6844be 100644 --- a/opal/mca/pmix/pmix3x/pmix/configure.ac +++ b/opal/mca/pmix/pmix3x/pmix/configure.ac @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights # reserved. @@ -19,7 +19,7 @@ # Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2020 Intel, Inc. All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2016-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -44,7 +44,7 @@ m4_include([config/autogen_found_items.m4]) AC_INIT([pmix], [m4_normalize(esyscmd([config/pmix_get_version.sh VERSION --tarball]))], - [http://pmix.github.io/master], [pmix]) + [https://github.com/pmix/pmix/issues], [pmix]) AC_PREREQ(2.69) AC_CONFIG_AUX_DIR(./config) # Note that this directory must *exactly* match what was specified via @@ -94,7 +94,7 @@ pmix_show_title "Configuring PMIx" AC_CANONICAL_TARGET # Init automake -AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define 1.13.4 -Wall -Werror]) +AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define 1.13.4]) # SILENT_RULES is new in AM 1.11, but we require 1.13.4 or higher via # autogen. Limited testing shows that calling SILENT_RULES directly @@ -143,11 +143,11 @@ AH_TOP([/* -*- c -*- #ifndef PMIX_CONFIG_H #define PMIX_CONFIG_H -#include +#include "src/include/pmix_config_top.h" ]) AH_BOTTOM([ -#include +#include "src/include/pmix_config_bottom.h" #endif /* PMIX_CONFIG_H */ ]) @@ -231,6 +231,7 @@ AS_IF([test ! -z "$PMIX_CFLAGS_cache"], [CFLAGS="$CFLAGS $PMIX_CFLAGS_cache"]) #fi # Cleanup duplicate flags +PMIX_FLAGS_UNIQ(CFLAGS) PMIX_FLAGS_UNIQ(CPPFLAGS) PMIX_FLAGS_UNIQ(LDFLAGS) PMIX_FLAGS_UNIQ(LIBS) @@ -257,6 +258,43 @@ AC_MSG_RESULT([$LDFLAGS]) AC_MSG_CHECKING([final LIBS]) AC_MSG_RESULT([$LIBS]) +#################################################################### +# Setup variables for pkg-config file (maint/pmix.pc.in) +#################################################################### + +# +# Dependencies that themselves have a pkg-config file available. +# +PC_REQUIRES="" +AS_IF([test "$pmix_hwloc_support_will_build" = "yes"], + [PC_REQUIRES="$PC_REQUIRES hwloc"]) +AS_IF([test $pmix_libevent_support -eq 1], + [PC_REQUIRES="$PC_REQUIRES libevent"]) +AS_IF([test "$pmix_zlib_support" = "1"], + [PC_REQUIRES="$PC_REQUIRES zlib"]) +AC_SUBST([PC_REQUIRES], ["$PC_REQUIRES"]) + +# +# Dependencies that don't have a pkg-config file available. +# In this case we need to manually add -L and -l +# to the PC_PRIVATE_LIBS variable. +# +PC_PRIVATE_LIBS="" +AS_IF([test $pmix_libev_support -eq 1], + [PC_PRIVATE_LIBS="$PC_PRIVATE_LIBS $pmix_libev_LDFLAGS $pmix_libev_LIBS"]) +AC_SUBST([PC_PRIVATE_LIBS], ["$PC_PRIVATE_LIBS"]) + +#################################################################### +# -Werror for CI scripts +#################################################################### + +AC_ARG_ENABLE(werror, + AC_HELP_STRING([--enable-werror], + [Treat compiler warnings as errors]), +[ + CFLAGS="$CFLAGS -Werror" +]) + #################################################################### # Version information #################################################################### @@ -275,7 +313,8 @@ AC_SUBST([libmca_common_dstore_so_version]) AC_CONFIG_FILES(pmix_config_prefix[contrib/Makefile] pmix_config_prefix[examples/Makefile] pmix_config_prefix[test/Makefile] - pmix_config_prefix[test/simple/Makefile]) + pmix_config_prefix[test/simple/Makefile] + pmix_config_prefix[maint/pmix.pc]) pmix_show_title "Configuration complete" diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/Makefile.am b/opal/mca/pmix/pmix3x/pmix/contrib/Makefile.am index 2086924a85..13512b0532 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/contrib/Makefile.am @@ -14,7 +14,7 @@ # Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved. # Copyright (c) 2013-2016 Los Alamos National Security, Inc. All rights # reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -25,12 +25,13 @@ EXTRA_DIST = \ make_dist_tarball \ buildrpm.sh \ - platform/optimized \ - pmix_jenkins.sh \ - pmix-release.sh \ - pmix.spec \ - update-my-copyright.pl \ - whitespace-purge.sh + pmix_jenkins.sh \ + pmix-release.sh \ + pmix.spec \ + update-my-copyright.pl \ + whitespace-purge.sh \ + make_manpage.pl \ + platform/optimized include perf_tools/Makefile.include diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball b/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball index f3fc22b5e4..3fb951bf96 100755 --- a/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball +++ b/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball @@ -264,7 +264,7 @@ make_tarball() { # echo "*** Running autogen $autogen_args..." rm -f success - (./autogen.sh $autogen_args 2>&1 && touch success) | tee auto.out + (./autogen.pl $autogen_args 2>&1 && touch success) | tee auto.out if test ! -f success; then echo "Autogen failed. Aborting" exit 1 diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/make_manpage.pl b/opal/mca/pmix/pmix3x/pmix/contrib/make_manpage.pl new file mode 100755 index 0000000000..7a2c2de169 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/contrib/make_manpage.pl @@ -0,0 +1,56 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2016-2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Subroutine to generate a bunch of Fortran declarations and symbols +# + +use strict; + +use Getopt::Long; + +my $package_name; +my $package_version; +my $pmix_date; +my $input; +my $output; +my $help_arg = 0; + +&Getopt::Long::Configure("bundling"); +my $ok = Getopt::Long::GetOptions("package-name=s" => \$package_name, + "package-version=s" => \$package_version, + "pmix-date=s" => \$pmix_date, + "input=s" => \$input, + "output=s" => \$output); + +if ($help_arg || !$ok || + !defined($input) || + !defined($output) || + !defined($package_name) || + !defined($package_version) || + !defined($pmix_date)) { + print "Usage: $0 --package-name= --package-version= --pmix-date= --input= --output=\n"; + exit(1 - $ok); +} + +open(FILE, $input) || + die "Can't open $input"; +my $file; +$file .= $_ + while(); +close(FILE); + +$file =~ s/#PACKAGE_NAME#/$package_name/g; +$file =~ s/#PACKAGE_VERSION#/$package_version/g; +$file =~ s/#PMIX_DATE#/$pmix_date/g; + +open(FILE, ">$output") || + die "Can't open $output"; +print FILE $file; +close(FILE); + +exit(0); diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index e9a263bf01..a1abc960de 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.5 +Version: 3.2.1rc1 Release: 1%{?dist} License: BSD Group: Development/Libraries @@ -493,7 +493,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %if !%{sysconfdir_in_prefix} %{_sysconfdir}/* %endif -# If %{install_in_opt}, then we're installing PMIx to +# If %%{install_in_opt}, then we're installing PMIx to # /opt/pmix. But be sure to also explicitly mention # /opt/pmix so that it can be removed by RPM when everything under # there is also removed. diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix_jenkins.sh b/opal/mca/pmix/pmix3x/pmix/contrib/pmix_jenkins.sh old mode 100755 new mode 100644 index d8445463a0..de87e976c8 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix_jenkins.sh +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix_jenkins.sh @@ -195,19 +195,13 @@ if [ "$jenkins_test_build" = "yes" ]; then tar zxf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable libevent_dir=$PWD/install - ./autogen.sh && ./configure --prefix=$libevent_dir && make && make install + ./autogen.pl && ./configure --prefix=$libevent_dir && make && make install cd $WORKSPACE - if [ -x "autogen.sh" ]; then - autogen_script=./autogen.sh - else - autogen_script=./autogen.pl - fi - configure_args="--with-libevent=$libevent_dir" # build pmix - $autogen_script + ./autogen.pl echo ./configure --prefix=$pmix_dir $configure_args | bash -xeE make $make_opt install jenkins_build_passed=1 @@ -270,7 +264,7 @@ if [ "$jenkins_test_src_rpm" = "yes" ]; then # check distclean make $make_opt distclean - $autogen_script + ./autogen.pl echo ./configure --prefix=$pmix_dir $configure_args | bash -xeE || exit 11 if [ -x /usr/bin/dpkg-buildpackage ]; then @@ -316,7 +310,7 @@ if [ -n "$JENKINS_RUN_TESTS" -a "$JENKINS_RUN_TESTS" -ne "0" ]; then rm -rf $run_tap # build pmix - $autogen_script + ./autogen.pl echo ./configure --prefix=$pmix_dir $configure_args --disable-visibility | bash -xeE make $make_opt install diff --git a/opal/mca/pmix/pmix3x/pmix/etc/Makefile.am b/opal/mca/pmix/pmix3x/pmix/etc/Makefile.am index 8f6fd523e7..e2298c0d80 100644 --- a/opal/mca/pmix/pmix3x/pmix/etc/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/etc/Makefile.am @@ -9,8 +9,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -18,39 +18,39 @@ # $HEADER$ # -pmix_config_files = pmix-mca-params.conf -pmix_file_from_platform = no +pmix_config_files = @PMIX_DEFAULT_MCA_PARAM_CONF@ +pmix_file_from_platform = @PMIX_PARAM_FROM_PLATFORM@ EXTRA_DIST = $(pmix_config_files) # Steal a little trickery from a generated Makefile to only install # files if they do not already exist at the target. Be sure to read # thread starting here -# (http://www.open-mpi.org/community/lists/devel/2008/06/4080.php) for +# (https://www.open-mpi.org/community/lists/devel/2008/06/4080.php) for # details why the mkdir is in install-data-local. install-data-local: $(MKDIR_P) $(DESTDIR)$(sysconfdir) @ p="$(pmix_config_files)"; \ if test "$(pmix_file_from_platform)" = "yes"; then \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(sysconfdir)/pmix-mca-params.conf"; \ - $(INSTALL_DATA) $$d$$p $(DESTDIR)$(sysconfdir)/pmix-mca-params.conf; \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(sysconfdir)/pmix-mca-params.conf"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(sysconfdir)/pmix-mca-params.conf; \ else \ for file in $$p; do \ - if test -f $(DESTDIR)$(sysconfdir)/pmix-mca-params.conf; then \ - echo "******************************* WARNING ************************************"; \ - echo "*** Not installing new $$file over existing file in:"; \ - echo "*** $(DESTDIR)$(sysconfdir)/$$file"; \ - echo "******************************* WARNING ************************************"; \ - else \ - if test -f "$$file"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$file | sed -e 's|^.*/||'`"; \ - echo " $(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f"; \ - $(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f; \ - fi; \ - done \ - fi; + if test -f $(DESTDIR)$(sysconfdir)/pmix-mca-params.conf; then \ + echo "******************************* WARNING ************************************"; \ + echo "*** Not installing new $$file over existing file in:"; \ + echo "*** $(DESTDIR)$(sysconfdir)/$$file"; \ + echo "******************************* WARNING ************************************"; \ + else \ + if test -f "$$file"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$file | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f"; \ + $(INSTALL_DATA) $$d$$file $(DESTDIR)$(sysconfdir)/$$f; \ + fi; \ + done \ + fi; # Only remove if exactly the same as what in our tree @@ -61,7 +61,7 @@ uninstall-local: @ p="$(pmix_config_files)"; \ for file in $$p; do \ if test -f "$(DESTDIR)$(sysconfdir)/$$file"; then \ - if test -f "$$file"; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$file"; then d=; else d="$(srcdir)/"; fi; \ if diff "$(DESTDIR)$(sysconfdir)/$$file" "$$d$$file" > /dev/null 2>&1 ; then \ echo "rm -f $(DESTDIR)$(sysconfdir)/$$file" ; \ rm -f "$(DESTDIR)$(sysconfdir)/$$file" ; \ diff --git a/opal/mca/pmix/pmix3x/pmix/examples/alloc.c b/opal/mca/pmix/pmix3x/pmix/examples/alloc.c index 6984c1e1e9..27d9c74ac3 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/alloc.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/alloc.c @@ -13,8 +13,9 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -153,8 +154,7 @@ int main(int argc, char **argv) { pmix_proc_t myproc; int rc; - pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; pmix_proc_t proc; uint32_t nprocs; pmix_info_t *info; @@ -175,8 +175,7 @@ int main(int argc, char **argv) /* get our universe size */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; diff --git a/opal/mca/pmix/pmix3x/pmix/examples/client.c b/opal/mca/pmix/pmix3x/pmix/examples/client.c index 49e471fb25..76bdf6f892 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/client.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/client.c @@ -13,8 +13,9 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -124,7 +125,7 @@ int main(int argc, char **argv) { pmix_status_t rc; pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; char *tmp; pmix_proc_t proc; uint32_t nprocs, n; @@ -168,8 +169,7 @@ int main(int argc, char **argv) * wildcard rank as it doesn't relate to a specific rank. Setup * a name to retrieve such values */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); /* check to see if we have been instructed to wait for a debugger * to attach to us. We won't get both a stop-in-init AND a @@ -197,6 +197,8 @@ int main(int argc, char **argv) /* wait for debugger release */ DEBUG_WAIT_THREAD(&myrel.lock); DEBUG_DESTRUCT_MYREL(&myrel); + + PMIX_VALUE_RELEASE(val); } /* get our universe size */ @@ -205,6 +207,8 @@ int main(int argc, char **argv) goto done; } fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, val->data.uint32); + PMIX_VALUE_RELEASE(val); + /* get the number of procs in our job - univ size is the total number of allocated * slots, not the number of procs in the job */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { @@ -219,6 +223,7 @@ int main(int argc, char **argv) if (0 > asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank)) { exit(1); } + value.type = PMIX_UINT32; value.data.uint32 = 1234; if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) { @@ -277,6 +282,7 @@ int main(int argc, char **argv) } if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); + free(tmp); goto done; } if (PMIX_UINT64 != val->type) { @@ -299,6 +305,7 @@ int main(int argc, char **argv) } if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); + free(tmp); goto done; } if (PMIX_STRING != val->type) { diff --git a/opal/mca/pmix/pmix3x/pmix/examples/client2.c b/opal/mca/pmix/pmix3x/pmix/examples/client2.c index 4021c15ec7..8c1a7bf282 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/client2.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/client2.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -116,8 +116,7 @@ int main(int argc, char **argv) * wildcard rank as it doesn't relate to a specific rank. Setup * a name to retrieve such values */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); /* get our job size */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { diff --git a/opal/mca/pmix/pmix3x/pmix/examples/debuggerd.c b/opal/mca/pmix/pmix3x/pmix/examples/debuggerd.c index 80f0aeeff7..ce45d5dfd9 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/debuggerd.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/debuggerd.c @@ -41,7 +41,6 @@ typedef struct { } myquery_data_t; -static volatile bool waiting_for_debugger = true; static pmix_proc_t myproc; /* this is a callback function for the PMIx_Query diff --git a/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c b/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c index 8a95a405b7..dc9eeaa9fd 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c @@ -13,8 +13,9 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,8 +24,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "../include/pmix.h" #include #include @@ -38,13 +39,13 @@ int main(int argc, char **argv) { int rc; pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; char *tmp; pmix_proc_t proc; uint32_t n, k, nlocal; - bool local, all_local; + bool local, all_local = false; char **peers; - pmix_rank_t *locals; + pmix_rank_t *locals = NULL; uint8_t j; /* init us */ @@ -55,8 +56,7 @@ int main(int argc, char **argv) fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); /* get our job size */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %s\n", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); @@ -146,36 +146,54 @@ int main(int argc, char **argv) } } if (local) { - (void)asprintf(&tmp, "%s-%d-local", myproc.nspace, n); + if( 0 > asprintf(&tmp, "%s-%d-local", myproc.nspace, n)) { + exit(1); + } proc.rank = n; if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc); + free(tmp); goto done; } if (PMIX_UINT64 != val->type) { fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); goto done; } if (1234 != val->data.uint64) { fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64); + PMIX_VALUE_RELEASE(val); + free(tmp); goto done; } fprintf(stderr, "%s:%d Local value for %s:%d successfully retrieved\n", myproc.nspace, myproc.rank, proc.nspace, proc.rank); + PMIX_VALUE_RELEASE(val); + free(tmp); } else { - (void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, n); + if( 0 > asprintf(&tmp, "%s-%d-remote", myproc.nspace, n)) { + exit(1); + } if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc); + free(tmp); goto done; } if (PMIX_STRING != val->type) { fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); goto done; } if (0 != strcmp(val->data.string, "1234")) { fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string); + PMIX_VALUE_RELEASE(val); + free(tmp); goto done; } fprintf(stderr, "%s:%d Remote value for %s:%d successfully retrieved\n", myproc.nspace, myproc.rank, proc.nspace, proc.rank); + PMIX_VALUE_RELEASE(val); + free(tmp); } /* if this isn't us, then get the ghex key */ if (n != myproc.rank) { @@ -185,13 +203,16 @@ int main(int argc, char **argv) } if (PMIX_BYTE_OBJECT != val->type) { fprintf(stderr, "%s:%d: PMIx_Get ghex returned wrong type: %d\n", myproc.nspace, myproc.rank, val->type); + PMIX_VALUE_RELEASE(val); goto done; } if (128 != val->data.bo.size) { fprintf(stderr, "%s:%d: PMIx_Get ghex returned wrong size: %d\n", myproc.nspace, myproc.rank, (int)val->data.bo.size); + PMIX_VALUE_RELEASE(val); goto done; } fprintf(stderr, "%s:%d Ghex for %s:%d successfully retrieved\n", myproc.nspace, myproc.rank, proc.nspace, proc.rank); + PMIX_VALUE_RELEASE(val); } } diff --git a/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c b/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c index 6b929420b7..b9fa45b16e 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c @@ -13,10 +13,11 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,8 +43,7 @@ static pmix_proc_t myproc; int main(int argc, char **argv) { int rc; - pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; pmix_proc_t proc; uint32_t nprocs; char nsp2[PMIX_MAX_NSLEN+1]; @@ -66,8 +66,7 @@ int main(int argc, char **argv) fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); /* get our job size */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { @@ -79,8 +78,7 @@ int main(int argc, char **argv) fprintf(stderr, "Client %s:%d job size %d\n", myproc.nspace, myproc.rank, nprocs); /* call fence to sync */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; @@ -111,8 +109,7 @@ int main(int argc, char **argv) /* get their universe size */ val = NULL; - (void)strncpy(proc.nspace, nsp2, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, nsp2, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val)) || NULL == val) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d\n", myproc.nspace, myproc.rank, rc); @@ -124,7 +121,6 @@ int main(int argc, char **argv) /* get a proc-specific value */ val = NULL; - (void)strncpy(proc.nspace, nsp2, PMIX_MAX_NSLEN); proc.rank = 1; if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_RANK, NULL, 0, &val)) || NULL == val) { @@ -138,8 +134,7 @@ int main(int argc, char **argv) done: /* call fence to sync */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; diff --git a/opal/mca/pmix/pmix3x/pmix/examples/fault.c b/opal/mca/pmix/pmix3x/pmix/examples/fault.c index abab388681..4df65ab346 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/fault.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/fault.c @@ -13,8 +13,11 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 Triad National Security, LLC. All rights + * reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,7 +48,7 @@ static void notification_fn(size_t evhdlr_registration_id, { myrel_t *lock; bool found; - int exit_code; + int exit_code = 0; size_t n; pmix_proc_t *affected = NULL; @@ -109,8 +112,7 @@ static void evhandler_reg_callbk(pmix_status_t status, int main(int argc, char **argv) { int rc; - pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; pmix_proc_t proc; uint32_t nprocs; pmix_info_t *info; @@ -126,8 +128,7 @@ int main(int argc, char **argv) fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); /* get our universe size */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { @@ -161,8 +162,7 @@ int main(int argc, char **argv) /* call fence to sync */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; diff --git a/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c b/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c index 0dc244b3c6..6a0fcbf490 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c @@ -13,8 +13,9 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -95,8 +96,7 @@ static void infocbfunc(pmix_status_t status, int main(int argc, char **argv) { pmix_status_t rc; - pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; pmix_proc_t proc; uint32_t nprocs, n; pmix_info_t *info, *iptr; @@ -131,8 +131,7 @@ int main(int argc, char **argv) * wildcard rank as it doesn't relate to a specific rank. Setup * a name to retrieve such values */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); /* get our universe size */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { diff --git a/opal/mca/pmix/pmix3x/pmix/examples/pub.c b/opal/mca/pmix/pmix3x/pmix/examples/pub.c index 89589ac08c..3c9f81988e 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/pub.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/pub.c @@ -13,8 +13,9 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,8 +36,7 @@ int main(int argc, char **argv) { pmix_proc_t myproc; int rc; - pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; pmix_proc_t proc; uint32_t nprocs; pmix_info_t *info; @@ -51,8 +51,7 @@ int main(int argc, char **argv) /* get our universe size */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; diff --git a/opal/mca/pmix/pmix3x/pmix/examples/pubi.c b/opal/mca/pmix/pmix3x/pmix/examples/pubi.c index bbb66e6697..7ad1b69903 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/pubi.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/pubi.c @@ -13,8 +13,9 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,8 +36,7 @@ int main(int argc, char **argv) { pmix_proc_t myproc; int rc; - pmix_value_t value; - pmix_value_t *val = &value; + pmix_value_t *val = NULL; pmix_proc_t proc; uint32_t nprocs; pmix_info_t *info; @@ -52,8 +52,7 @@ int main(int argc, char **argv) /* get our universe size */ PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; diff --git a/opal/mca/pmix/pmix3x/pmix/examples/server.c b/opal/mca/pmix/pmix3x/pmix/examples/server.c index a720384f5d..8e1245718d 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/server.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/server.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -25,10 +25,10 @@ * */ -#include -#include -#include -#include +#include "src/include/pmix_config.h" +#include "../include/pmix_server.h" +#include "src/include/types.h" +#include "src/include/pmix_globals.h" #include #include @@ -42,8 +42,6 @@ #include #include -#include PMIX_EVENT_HEADER - #include "src/class/pmix_list.h" #include "src/util/pmix_environ.h" #include "src/util/output.h" @@ -266,9 +264,9 @@ int main(int argc, char **argv) /* setup to see sigchld on the forked tests */ PMIX_CONSTRUCT(&children, pmix_list_t); - event_assign(&handler, pmix_globals.evbase, SIGCHLD, - EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); - event_add(&handler, NULL); + pmix_event_assign(&handler, pmix_globals.evbase, SIGCHLD, + EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); + pmix_event_add(&handler, NULL); /* see if we were passed the number of procs to run or * the executable to use */ @@ -424,7 +422,7 @@ static void set_namespace(int nprocs, char *ranks, char *nspace, char hostname[PMIX_MAXHOSTNAMELEN]; pmix_status_t rc; myxfer_t myxfer; - size_t i; + size_t i = 0; gethostname(hostname, sizeof(hostname)); @@ -486,6 +484,7 @@ static void set_namespace(int nprocs, char *ranks, char *nspace, PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo, cbfunc, x); + } static void errhandler(size_t evhdlr_registration_id, @@ -871,7 +870,7 @@ static void wait_signal_callback(int fd, short event, void *arg) pid_t pid; wait_tracker_t *t2; - if (SIGCHLD != event_get_signal(sig)) { + if (SIGCHLD != pmix_event_get_signal(sig)) { return; } diff --git a/opal/mca/pmix/pmix3x/pmix/include/Makefile.am b/opal/mca/pmix/pmix3x/pmix/include/Makefile.am index 5c0ff27f10..3f625f27b9 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/include/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2020 Intel, Inc. All rights reserved. # # $COPYRIGHT$ # @@ -15,7 +15,7 @@ include_HEADERS = \ pmix.h \ pmix_server.h \ pmix_tool.h \ - pmix_extend.h + pmix_extend.h if WANT_PMI_BACKWARD include_HEADERS += \ @@ -25,7 +25,6 @@ endif nodist_include_HEADERS = \ pmix_common.h \ - pmix_version.h \ - pmix_rename.h + pmix_version.h endif diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix.h b/opal/mca/pmix/pmix3x/pmix/include/pmix.h index 61ce017ca6..4bb22acc02 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * @@ -394,7 +394,8 @@ PMIX_EXPORT pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t * for releasing the array when done with it - the PMIX_PROC_FREE macro is * provided for this purpose. */ -PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const pmix_nspace_t nspace, +PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, + const pmix_nspace_t nspace, pmix_proc_t **procs, size_t *nprocs); @@ -575,7 +576,6 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm PMIX_EXPORT pmix_status_t PMIx_Get_credential(const pmix_info_t info[], size_t ninfo, pmix_credential_cbfunc_t cbfunc, void *cbdata); - /* Request validation of a credential by the PMIx server/SMS * Input values include: * @@ -696,7 +696,7 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, pmix_op_cbfunc_t cbfunc, void *cbdata); /* Push data collected locally (typically from stdin) to - * target recipients. + * stdin of target recipients. * * targets - array of process identifiers to which the data is to be delivered. Note * that a WILDCARD rank indicates that all procs in the given nspace are @@ -714,7 +714,7 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, * * bo - pointer to a byte object containing the stdin data * - * cbfunc - callback function when the data has been forwarded + * cbfunc - callback function when the data has been forwarded. * * cbdata - object to be returned in cbfunc */ @@ -723,6 +723,10 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntar const pmix_info_t directives[], size_t ndirs, pmix_op_cbfunc_t cbfunc, void *cbdata); +/****************************************/ +/**** COMMON SUPPORT FUNCTIONS ****/ +/* Found in pmix_common.h.in in the v3.x and earlier series */ +/****************************************/ #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index 62c4e3e01e..df53cfbe9c 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -1,10 +1,10 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2016-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2020 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,7 +71,6 @@ #endif -#include #include #if defined(c_plusplus) || defined(__cplusplus) @@ -139,17 +138,20 @@ typedef uint32_t pmix_rank_t; #define PMIX_ATTR_UNDEF NULL /* initialization attributes */ -#define PMIX_EVENT_BASE "pmix.evbase" // (struct event_base *) pointer to libevent event_base to use in place - // of the internal progress thread -#define PMIX_SERVER_TOOL_SUPPORT "pmix.srvr.tool" // (bool) The host RM wants to declare itself as willing to - // accept tool connection requests -#define PMIX_SERVER_REMOTE_CONNECTIONS "pmix.srvr.remote" // (bool) Allow connections from remote tools (do not use loopback device) -#define PMIX_SERVER_SYSTEM_SUPPORT "pmix.srvr.sys" // (bool) The host RM wants to declare itself as being the local - // system server for PMIx connection requests +#define PMIX_EVENT_BASE "pmix.evbase" // (struct event_base *) pointer to libevent event_base + // to use in place of the internal progress thread +#define PMIX_SERVER_TOOL_SUPPORT "pmix.srvr.tool" // (bool) The host RM wants to declare itself as willing + // to accept tool connection requests +#define PMIX_SERVER_REMOTE_CONNECTIONS "pmix.srvr.remote" // (bool) Allow connections from remote tools (do not use + // loopback device) +#define PMIX_SERVER_SYSTEM_SUPPORT "pmix.srvr.sys" // (bool) The host RM wants to declare itself as being + // the local system server for PMIx connection + // requests #define PMIX_SERVER_TMPDIR "pmix.srvr.tmpdir" // (char*) temp directory where PMIx server will place // client rendezvous points and contact info #define PMIX_SYSTEM_TMPDIR "pmix.sys.tmpdir" // (char*) temp directory for this system, where PMIx - // server will place tool rendezvous points and contact info + // server will place tool rendezvous points and + // contact info #define PMIX_SERVER_ENABLE_MONITORING "pmix.srv.monitor" // (bool) Enable PMIx internal monitoring by server #define PMIX_SERVER_NSPACE "pmix.srv.nspace" // (char*) Name of the nspace to use for this server #define PMIX_SERVER_RANK "pmix.srv.rank" // (pmix_rank_t) Rank of this server @@ -253,9 +255,11 @@ typedef uint32_t pmix_rank_t; #define PMIX_ALLOCATED_NODELIST "pmix.alist" // (char*) comma-delimited list of all nodes in this allocation regardless of // whether or not they currently host procs. #define PMIX_HOSTNAME "pmix.hname" // (char*) name of the host the specified proc is on +#define PMIX_HOSTNAME_ALIASES "pmix.alias" // (char*) comma-delimited list of names by which this node is known +#define PMIX_HOSTNAME_KEEP_FQDN "pmix.fqdn" // (bool) FQDN hostnames are being retained #define PMIX_NODEID "pmix.nodeid" // (uint32_t) node identifier where the specified proc is located #define PMIX_LOCAL_PEERS "pmix.lpeers" // (char*) comma-delimited string of ranks on this node within the specified nspace -#define PMIX_LOCAL_PROCS "pmix.lprocs" // (pmix_proc_t array) array of pmix_proc_t of procs on the specified node +#define PMIX_LOCAL_PROCS "pmix.lprocs" // (pmix_data_array_t*) array of pmix_proc_t of procs on the specified node #define PMIX_LOCAL_CPUSETS "pmix.lcpus" // (char*) colon-delimited cpusets of local peers within the specified nspace #define PMIX_PROC_URI "pmix.puri" // (char*) URI containing contact info for proc #define PMIX_LOCALITY "pmix.loc" // (uint16_t) relative locality of two procs @@ -263,7 +267,6 @@ typedef uint32_t pmix_rank_t; // to launch this proc's application #define PMIX_EXIT_CODE "pmix.exit.code" // (int) exit code returned when proc terminated - /* size info */ #define PMIX_UNIV_SIZE "pmix.univ.size" // (uint32_t) #procs in this nspace #define PMIX_JOB_SIZE "pmix.job.size" // (uint32_t) #procs in this job @@ -320,10 +323,12 @@ typedef uint32_t pmix_rank_t; // specified operation #define PMIX_JOB_TERM_STATUS "pmix.job.term.status" // (pmix_status_t) status returned upon job termination #define PMIX_PROC_STATE_STATUS "pmix.proc.state" // (pmix_proc_state_t) process state +#define PMIX_GET_REFRESH_CACHE "pmix.get.refresh" // (bool) when retrieving data for a remote process, refresh the existing + // local data cache for the process in case new values have been + // put and committed by it since the last refresh - -/* attributes used by host server to pass data to the server convenience library - the - * data will then be parsed and provided to the local clients */ +/* attributes used by host server to pass data to/from the server convenience library - the + * data will then be parsed and provided to the local clients. Not generally accessible by users */ #define PMIX_REGISTER_NODATA "pmix.reg.nodata" // (bool) Registration is for nspace only, do not copy job data #define PMIX_PROC_DATA "pmix.pdata" // (pmix_data_array_t*) starts with rank, then contains more data #define PMIX_NODE_MAP "pmix.nmap" // (char*) regex of nodes containing procs for this job @@ -331,6 +336,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_ANL_MAP "pmix.anlmap" // (char*) process mapping in ANL notation (used in PMI-1/PMI-2) #define PMIX_APP_MAP_TYPE "pmix.apmap.type" // (char*) type of mapping used to layout the application (e.g., cyclic) #define PMIX_APP_MAP_REGEX "pmix.apmap.regex" // (char*) regex describing the result of the mapping +#define PMIX_REQUIRED_KEY "pmix.req.key" // (char*) key the user needs prior to responding from a dmodex request /* attributes used internally to communicate data from the server to the client */ @@ -400,7 +406,8 @@ typedef uint32_t pmix_rank_t; #define PMIX_TAG_OUTPUT "pmix.tagout" // (bool) tag application output with the ID of the source #define PMIX_TIMESTAMP_OUTPUT "pmix.tsout" // (bool) timestamp output from applications #define PMIX_MERGE_STDERR_STDOUT "pmix.mergeerrout" // (bool) merge stdout and stderr streams from application procs -#define PMIX_OUTPUT_TO_FILE "pmix.outfile" // (char*) output application output to given file +#define PMIX_OUTPUT_TO_FILE "pmix.outfile" // (char*) direct application output into files of form + // ".rank" with both stdout and stderr redirected into it #define PMIX_INDEX_ARGV "pmix.indxargv" // (bool) mark the argv with the rank of the proc #define PMIX_CPUS_PER_PROC "pmix.cpuperproc" // (uint32_t) #cpus to assign to each rank #define PMIX_NO_PROCS_ON_HEAD "pmix.nolocal" // (bool) do not place procs on the head node @@ -426,27 +433,36 @@ typedef uint32_t pmix_rank_t; #define PMIX_QUERY_NAMESPACE_INFO "pmix.qry.nsinfo" // (pmix_data_array_t) request an array of active nspace information - each // element will contain an array including the namespace plus the // command line of the application executing within it -#define PMIX_QUERY_JOB_STATUS "pmix.qry.jst" // (pmix_status_t) status of a specified currently executing job -#define PMIX_QUERY_QUEUE_LIST "pmix.qry.qlst" // (char*) request a comma-delimited list of scheduler queues -#define PMIX_QUERY_QUEUE_STATUS "pmix.qry.qst" // (TBD) status of a specified scheduler queue -#define PMIX_QUERY_PROC_TABLE "pmix.qry.ptable" // (char*) input nspace of job whose info is being requested - // returns (pmix_data_array_t*) an array of pmix_proc_info_t -#define PMIX_QUERY_LOCAL_PROC_TABLE "pmix.qry.lptable" // (char*) input nspace of job whose info is being requested - // returns (pmix_data_array_t*) an array of pmix_proc_info_t for - // procs in job on same node -#define PMIX_QUERY_AUTHORIZATIONS "pmix.qry.auths" // (bool) return operations tool is authorized to perform -#define PMIX_QUERY_SPAWN_SUPPORT "pmix.qry.spawn" // (bool) return a comma-delimited list of supported spawn attributes -#define PMIX_QUERY_DEBUG_SUPPORT "pmix.qry.debug" // (bool) return a comma-delimited list of supported debug attributes -#define PMIX_QUERY_MEMORY_USAGE "pmix.qry.mem" // (bool) return info on memory usage for the procs indicated in the qualifiers +#define PMIX_QUERY_JOB_STATUS "pmix.qry.jst" // (pmix_status_t) returns status of a specified currently executing job + // REQUIRES a PMIX_NSPACE qualifier indicating the nspace being queried +#define PMIX_QUERY_QUEUE_LIST "pmix.qry.qlst" // (char*) request a comma-delimited list of scheduler queues. NO QUALIFIERS +#define PMIX_QUERY_QUEUE_STATUS "pmix.qry.qst" // (pmix_data_array_t*) returns array where each element contains the name and + // status of a scheduler queue + // SUPPORTED QUALIFIERS: PMIX_ALLOC_QUEUE naming specific queue whose status + // is being requested +#define PMIX_QUERY_PROC_TABLE "pmix.qry.ptable" // (pmix_data_array_t*) returns (pmix_data_array_t*) an array of pmix_proc_info_t + // REQUIRES a PMIX_NSPACE qualifier indicating the nspace being queried +#define PMIX_QUERY_LOCAL_PROC_TABLE "pmix.qry.lptable" // (pmix_data_array_t*) returns (pmix_data_array_t*) an array of pmix_proc_info_t + // of pmix_proc_info_t for procs in job on same node + // REQUIRES a PMIX_NSPACE qualifier indicating the nspace being queried +#define PMIX_QUERY_AUTHORIZATIONS "pmix.qry.auths" // (pmix_data_array_t*) return operations tool is authorized to perform. The contents + // of the array elements have not yet been standardized. NO QUALIFIERS +#define PMIX_QUERY_SPAWN_SUPPORT "pmix.qry.spawn" // (char*) return a comma-delimited list of supported spawn attributes. NO QUALIFIERS +#define PMIX_QUERY_DEBUG_SUPPORT "pmix.qry.debug" // (char*) return a comma-delimited list of supported debug attributes. NO QUALIFIERS +#define PMIX_QUERY_MEMORY_USAGE "pmix.qry.mem" // (pmix_data_array_t*) return info on memory usage for the procs indicated in the qualifiers + // SUPPORTED QUALIFIERS: PMIX_NSPACE/PMIX_RANK, or PMIX_PROCID of specific proc(s) + // whose info is being requested #define PMIX_QUERY_LOCAL_ONLY "pmix.qry.local" // (bool) constrain the query to local information only #define PMIX_QUERY_REPORT_AVG "pmix.qry.avg" // (bool) report average values #define PMIX_QUERY_REPORT_MINMAX "pmix.qry.minmax" // (bool) report minimum and maximum value -#define PMIX_QUERY_ALLOC_STATUS "pmix.query.alloc" // (char*) string identifier of the allocation whose status - // is being requested -#define PMIX_TIME_REMAINING "pmix.time.remaining" // (char*) query number of seconds (uint32_t) remaining in allocation - // for the specified nspace +#define PMIX_QUERY_ALLOC_STATUS "pmix.query.alloc" // (char*) return a string reporting status of an allocation request + // REQUIRES a PMIX_ALLOC_ID qualifier indicating the allocation request being queried +#define PMIX_TIME_REMAINING "pmix.time.remaining" // (uint32_t) returns number of seconds remaining in allocation + // for the specified nspace (defaults to allocation containing the caller) + // SUPPORTED QUALIFIERS: PMIX_NSPACE of the nspace whose info is being requested -/* information retrieval attributes */ + +/* PMIx_Get information retrieval attributes */ #define PMIX_SESSION_INFO "pmix.ssn.info" // (bool) Return information about the specified session. If information // about a session other than the one containing the requesting // process is desired, then the attribute array must contain a @@ -471,24 +487,26 @@ typedef uint32_t pmix_rank_t; // then the attribute array must contain either the PMIX_NODEID or // PMIX_HOSTNAME attribute identifying the desired target. + /* information storage attributes */ -#define PMIX_SESSION_INFO_ARRAY "pmix.ssn.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing +#define PMIX_SESSION_INFO_ARRAY "pmix.ssn.arr" // (pmix_data_array_t*) Provide an array of pmix_info_t containing // session-level information. The PMIX_SESSION_ID attribute is required // to be included in the array. -#define PMIX_JOB_INFO_ARRAY "pmix.job.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing job-level +#define PMIX_JOB_INFO_ARRAY "pmix.job.arr" // (pmix_data_array_t*) Provide an array of pmix_info_t containing job-level // information. Information is registered one job (aka namespace) at a time // via the PMIx_server_register_nspace API. Thus, there is no requirement that // the array contain either the PMIX_NSPACE or PMIX_JOBID attributes, though // either or both of them may be included. -#define PMIX_APP_INFO_ARRAY "pmix.app.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing app-level +#define PMIX_APP_INFO_ARRAY "pmix.app.arr" // (pmix_data_array_t*) Provide an array of pmix_info_t containing app-level // information. The PMIX_NSPACE or PMIX_JOBID attributes of the job containing // the appplication, plus its PMIX_APPNUM attribute, are required to be // included in the array. -#define PMIX_NODE_INFO_ARRAY "pmix.node.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing node-level +#define PMIX_NODE_INFO_ARRAY "pmix.node.arr" // (pmix_data_array_t*) Provide an array of pmix_info_t containing node-level // information. At a minimum, either the PMIX_NODEID or PMIX_HOSTNAME // attribute is required to be included in the array, though both may be // included. + /* log attributes */ #define PMIX_LOG_SOURCE "pmix.log.source" // (pmix_proc_t*) ID of source of the log request #define PMIX_LOG_STDERR "pmix.log.stderr" // (char*) log string to stderr @@ -516,7 +534,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_LOG_EMAIL_SERVER "pmix.log.esrvr" // (char*) hostname (or IP addr) of estmp server #define PMIX_LOG_EMAIL_SRVR_PORT "pmix.log.esrvrprt" // (int32_t) port the email server is listening to -#define PMIX_LOG_GLOBAL_DATASTORE "pmix.log.gstore" // (bool) +#define PMIX_LOG_GLOBAL_DATASTORE "pmix.log.gstore" // (bool) log the provided data to a global datastore #define PMIX_LOG_JOB_RECORD "pmix.log.jrec" // (bool) log the provided information to the RM's job record @@ -531,7 +549,6 @@ typedef uint32_t pmix_rank_t; #define PMIX_DEBUG_JOB_DIRECTIVES "pmix.dbg.jdirs" // (pmix_data_array_t*) array of job-level directives #define PMIX_DEBUG_APP_DIRECTIVES "pmix.dbg.adirs" // (pmix_data_array_t*) array of app-level directives - /* Resource Manager identification */ #define PMIX_RM_NAME "pmix.rm.name" // (char*) string name of the resource manager #define PMIX_RM_VERSION "pmix.rm.version" // (char*) RM version string @@ -549,8 +566,9 @@ typedef uint32_t pmix_rank_t; // creating the envar if it doesn't already exist /* attributes relating to allocations */ -#define PMIX_ALLOC_ID "pmix.alloc.id" // (char*) provide a string identifier for this allocation request - // which can later be used to query status of the request +#define PMIX_ALLOC_ID "pmix.alloc.id" // (char*) A string identifier (provided by the host environment) for + // the resulting allocation which can later be used to reference + // the allocated resources in, for example, a call to PMIx_Spawn #define PMIX_ALLOC_NUM_NODES "pmix.alloc.nnodes" // (uint64_t) number of nodes #define PMIX_ALLOC_NODE_LIST "pmix.alloc.nlist" // (char*) regex of specific nodes #define PMIX_ALLOC_NUM_CPUS "pmix.alloc.ncpus" // (uint64_t) number of cpus @@ -605,7 +623,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_JOB_CTRL_CHECKPOINT_EVENT "pmix.jctrl.ckptev" // (bool) use event notification to trigger process checkpoint #define PMIX_JOB_CTRL_CHECKPOINT_SIGNAL "pmix.jctrl.ckptsig" // (int) use the given signal to trigger process checkpoint #define PMIX_JOB_CTRL_CHECKPOINT_TIMEOUT "pmix.jctrl.ckptsig" // (int) time in seconds to wait for checkpoint to complete -#define PMIX_JOB_CTRL_CHECKPOINT_METHOD "pmix.jctrl.ckmethod" // (pmix_data_array_t) array of pmix_info_t declaring each +#define PMIX_JOB_CTRL_CHECKPOINT_METHOD "pmix.jctrl.ckmethod" // (pmix_data_array_t*) array of pmix_info_t declaring each // method and value supported by this application #define PMIX_JOB_CTRL_SIGNAL "pmix.jctrl.sig" // (int) send given signal to specified processes #define PMIX_JOB_CTRL_PROVISION "pmix.jctrl.pvn" // (char*) regex identifying nodes that are to be provisioned @@ -631,8 +649,8 @@ typedef uint32_t pmix_rank_t; // monitoring for this process) #define PMIX_MONITOR_APP_CONTROL "pmix.monitor.appctrl" // (bool) the application desires to control the response to // a monitoring event -#define PMIX_MONITOR_HEARTBEAT "pmix.monitor.mbeat" // (void) register to have the server monitor the requestor for heartbeats -#define PMIX_SEND_HEARTBEAT "pmix.monitor.beat" // (void) send heartbeat to local server +#define PMIX_MONITOR_HEARTBEAT "pmix.monitor.mbeat" // (bool) register to have the server monitor the requestor for heartbeats +#define PMIX_SEND_HEARTBEAT "pmix.monitor.beat" // (bool) send heartbeat to local server #define PMIX_MONITOR_HEARTBEAT_TIME "pmix.monitor.btime" // (uint32_t) time in seconds before declaring heartbeat missed #define PMIX_MONITOR_HEARTBEAT_DROPS "pmix.monitor.bdrop" // (uint32_t) number of heartbeats that can be missed before // generating the event @@ -907,6 +925,7 @@ typedef uint16_t pmix_data_type_t; // Hole left by deprecation/removal of PMIX_INFO_ARRAY #define PMIX_IOF_CHANNEL 45 #define PMIX_ENVAR 46 +#define PMIX_REGEX 49 // numerical ID matches v4 /********************/ /* define a boundary for implementers so they can add their own data types */ @@ -1477,6 +1496,8 @@ typedef struct pmix_value { } \ } while(0) +#if 0 + // This macro is no longer supported in the v3.2 and later series #define PMIX_VALUE_COMPRESSED_STRING_UNPACK(s) \ do { \ char *tmp; \ @@ -1496,6 +1517,7 @@ typedef struct pmix_value { } \ } \ } while(0) +#endif /**** PMIX INFO STRUCT ****/ typedef struct pmix_info { @@ -1830,7 +1852,6 @@ typedef struct pmix_query { * * @param argv Pointer to an argv array. * @param str Pointer to the string to append. - * @param bool Whether or not to overwrite a matching value if found * * @retval PMIX_SUCCESS On success * @retval PMIX_ERROR On failure @@ -1866,7 +1887,7 @@ typedef struct pmix_query { * @retval argv pointer to new argv array on success * @retval NULL on error * - * All strings are insertted into the argv array by value; the + * All strings are inserted into the argv array by value; the * newly-allocated array makes no references to the src_string * argument (i.e., it can be freed after calling this function * without invalidating the output argv). @@ -2160,8 +2181,9 @@ typedef void (*pmix_validation_cbfunc_t)(pmix_status_t status, pmix_info_t info[], size_t ninfo, void *cbdata); - /**** COMMON SUPPORT FUNCTIONS ****/ +/* Note that these are moved to pmix.h in the v4.x series and later */ +/****** EVENT NOTIFICATION SUPPORT ******/ /* Register an event handler to report events. Three types of events * can be reported: * @@ -2194,6 +2216,10 @@ typedef void (*pmix_validation_cbfunc_t)(pmix_status_t status, * deregistering the current evhdlr, and then registering it * using a new set of info values. * + * If cbfunc is NULL, then this is treated as a BLOCKING call - a positive + * return value represents the reference ID for the request, while + * negative values indicate the corresponding error + * * See pmix_common.h for a description of the notification function */ PMIX_EXPORT void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncodes, pmix_info_t info[], size_t ninfo, @@ -2246,6 +2272,9 @@ PMIX_EXPORT void PMIx_Deregister_event_handler(size_t evhdlr_ref, * will have been queued, but may not have been transmitted * by this time. Note that the caller is required to maintain * the input data until the callback function has been executed! + * If cbfunc is NULL, then this is treated as a BLOCKING call and + * the result of the operation is provided in the returned + * status * * cbdata - the caller's provided void* object */ @@ -2255,6 +2284,8 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata); + +/****** PRETTY-PRINT DEFINED VALUE TYPES ******/ /* Provide a string representation for several types of value. Note * that the provided string is statically defined and must NOT be * free'd. Supported value types: @@ -2288,6 +2319,8 @@ PMIX_EXPORT const char* PMIx_Get_version(void); PMIX_EXPORT pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc, const pmix_key_t key, pmix_value_t *val); + +/****** DATA BUFFER PACK/UNPACK SUPPORT ******/ /** * Top-level interface function to pack one or more values into a * buffer. @@ -2516,6 +2549,7 @@ PMIX_EXPORT pmix_status_t PMIx_Data_copy_payload(pmix_data_buffer_t *dest, pmix_data_buffer_t *src); +/******** STANDARD MACROS FOR DARRAY AND VALUE SUPPORT ********/ static inline void pmix_darray_destruct(pmix_data_array_t *m); static inline void pmix_value_destruct(pmix_value_t * m) @@ -2690,7 +2724,9 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) * @param len Size of the dest array - 1 * */ -static inline void pmix_strncpy(char *dest, const char *src, size_t len) +static inline void pmix_strncpy(char *dest, + const char *src, + size_t len) { size_t i, k; char *new_dest = dest; diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h b/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h index f6f320abab..1410fe585e 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h @@ -1,9 +1,9 @@ /* - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Redistribution and use in source and binary forms, with or without diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in deleted file mode 100644 index a06bbfdfde..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in +++ /dev/null @@ -1,618 +0,0 @@ -#define PMI2_Abort @PMIX_RENAME@PMI2_Abort -#define PMI2_Finalize @PMIX_RENAME@PMI2_Finalize -#define PMI2_Info_GetJobAttr @PMIX_RENAME@PMI2_Info_GetJobAttr -#define PMI2_Info_GetJobAttrIntArray @PMIX_RENAME@PMI2_Info_GetJobAttrIntArray -#define PMI2_Info_GetNodeAttr @PMIX_RENAME@PMI2_Info_GetNodeAttr -#define PMI2_Info_GetNodeAttrIntArray @PMIX_RENAME@PMI2_Info_GetNodeAttrIntArray -#define PMI2_Info_GetSize @PMIX_RENAME@PMI2_Info_GetSize -#define PMI2_Info_PutNodeAttr @PMIX_RENAME@PMI2_Info_PutNodeAttr -#define PMI2_Init @PMIX_RENAME@PMI2_Init -#define PMI2_Initialized @PMIX_RENAME@PMI2_Initialized -#define PMI2_Job_Connect @PMIX_RENAME@PMI2_Job_Connect -#define PMI2_Job_Disconnect @PMIX_RENAME@PMI2_Job_Disconnect -#define PMI2_Job_GetId @PMIX_RENAME@PMI2_Job_GetId -#define PMI2_Job_GetRank @PMIX_RENAME@PMI2_Job_GetRank -#define PMI2_Job_Spawn @PMIX_RENAME@PMI2_Job_Spawn -#define PMI2_KVS_Fence @PMIX_RENAME@PMI2_KVS_Fence -#define PMI2_KVS_Get @PMIX_RENAME@PMI2_KVS_Get -#define PMI2_KVS_Put @PMIX_RENAME@PMI2_KVS_Put -#define PMI2_Nameserv_lookup @PMIX_RENAME@PMI2_Nameserv_lookup -#define PMI2_Nameserv_publish @PMIX_RENAME@PMI2_Nameserv_publish -#define PMI2_Nameserv_unpublish @PMIX_RENAME@PMI2_Nameserv_unpublish -#define PMI_Abort @PMIX_RENAME@PMI_Abort -#define PMI_Args_to_keyval @PMIX_RENAME@PMI_Args_to_keyval -#define PMI_Barrier @PMIX_RENAME@PMI_Barrier -#define PMI_Finalize @PMIX_RENAME@PMI_Finalize -#define PMI_Free_keyvals @PMIX_RENAME@PMI_Free_keyvals -#define PMI_Get_appnum @PMIX_RENAME@PMI_Get_appnum -#define PMI_Get_clique_ranks @PMIX_RENAME@PMI_Get_clique_ranks -#define PMI_Get_clique_size @PMIX_RENAME@PMI_Get_clique_size -#define PMI_Get_id @PMIX_RENAME@PMI_Get_id -#define PMI_Get_id_length_max @PMIX_RENAME@PMI_Get_id_length_max -#define PMI_Get_kvs_domain_id @PMIX_RENAME@PMI_Get_kvs_domain_id -#define PMI_Get_options @PMIX_RENAME@PMI_Get_options -#define PMI_Get_rank @PMIX_RENAME@PMI_Get_rank -#define PMI_Get_size @PMIX_RENAME@PMI_Get_size -#define PMI_Get_universe_size @PMIX_RENAME@PMI_Get_universe_size -#define PMI_Init @PMIX_RENAME@PMI_Init -#define PMI_Initialized @PMIX_RENAME@PMI_Initialized -#define PMI_KVS_Commit @PMIX_RENAME@PMI_KVS_Commit -#define PMI_KVS_Create @PMIX_RENAME@PMI_KVS_Create -#define PMI_KVS_Destroy @PMIX_RENAME@PMI_KVS_Destroy -#define PMI_KVS_Get @PMIX_RENAME@PMI_KVS_Get -#define PMI_KVS_Get_key_length_max @PMIX_RENAME@PMI_KVS_Get_key_length_max -#define PMI_KVS_Get_my_name @PMIX_RENAME@PMI_KVS_Get_my_name -#define PMI_KVS_Get_name_length_max @PMIX_RENAME@PMI_KVS_Get_name_length_max -#define PMI_KVS_Get_value_length_max @PMIX_RENAME@PMI_KVS_Get_value_length_max -#define PMI_KVS_Iter_first @PMIX_RENAME@PMI_KVS_Iter_first -#define PMI_KVS_Iter_next @PMIX_RENAME@PMI_KVS_Iter_next -#define PMI_KVS_Put @PMIX_RENAME@PMI_KVS_Put -#define PMI_Lookup_name @PMIX_RENAME@PMI_Lookup_name -#define PMI_Parse_option @PMIX_RENAME@PMI_Parse_option -#define PMI_Publish_name @PMIX_RENAME@PMI_Publish_name -#define PMI_Spawn_multiple @PMIX_RENAME@PMI_Spawn_multiple -#define PMI_Unpublish_name @PMIX_RENAME@PMI_Unpublish_name -#define PMIx_Abort @PMIX_RENAME@PMIx_Abort -#define PMIx_Allocation_request_nb @PMIX_RENAME@PMIx_Allocation_request_nb -#define PMIx_Alloc_directive_string @PMIX_RENAME@PMIx_Alloc_directive_string -#define pmix_argv_append @PMIX_RENAME@pmix_argv_append -#define pmix_argv_append_nosize @PMIX_RENAME@pmix_argv_append_nosize -#define pmix_argv_append_unique_nosize @PMIX_RENAME@pmix_argv_append_unique_nosize -#define pmix_argv_copy @PMIX_RENAME@pmix_argv_copy -#define pmix_argv_count @PMIX_RENAME@pmix_argv_count -#define pmix_argv_delete @PMIX_RENAME@pmix_argv_delete -#define pmix_argv_free @PMIX_RENAME@pmix_argv_free -#define pmix_argv_insert @PMIX_RENAME@pmix_argv_insert -#define pmix_argv_insert_element @PMIX_RENAME@pmix_argv_insert_element -#define pmix_argv_join @PMIX_RENAME@pmix_argv_join -#define pmix_argv_join_range @PMIX_RENAME@pmix_argv_join_range -#define pmix_argv_len @PMIX_RENAME@pmix_argv_len -#define pmix_argv_prepend_nosize @PMIX_RENAME@pmix_argv_prepend_nosize -#define pmix_argv_split @PMIX_RENAME@pmix_argv_split -#define pmix_argv_split_with_empty @PMIX_RENAME@pmix_argv_split_with_empty -#define pmix_asprintf @PMIX_RENAME@pmix_asprintf -#define pmix_basename @PMIX_RENAME@pmix_basename -#define pmix_bfrop_base_copy_persist @PMIX_RENAME@pmix_bfrop_base_copy_persist -#define pmix_bfrop_base_select @PMIX_RENAME@pmix_bfrop_base_select -#define pmix_bfrop_buffer_extend @PMIX_RENAME@pmix_bfrop_buffer_extend -#define pmix_bfrop_get_data_type @PMIX_RENAME@pmix_bfrop_get_data_type -#define pmix_bfrops_base_assign_module @PMIX_RENAME@pmix_bfrops_base_assign_module -#define pmix_bfrops_base_copy @PMIX_RENAME@pmix_bfrops_base_copy -#define pmix_bfrops_base_copy_app @PMIX_RENAME@pmix_bfrops_base_copy_app -#define pmix_bfrops_base_copy_array @PMIX_RENAME@pmix_bfrops_base_copy_array -#define pmix_bfrops_base_copy_bo @PMIX_RENAME@pmix_bfrops_base_copy_bo -#define pmix_bfrops_base_copy_buf @PMIX_RENAME@pmix_bfrops_base_copy_buf -#define pmix_bfrops_base_copy_darray @PMIX_RENAME@pmix_bfrops_base_copy_darray -#define pmix_bfrops_base_copy_info @PMIX_RENAME@pmix_bfrops_base_copy_info -#define pmix_bfrops_base_copy_kval @PMIX_RENAME@pmix_bfrops_base_copy_kval -#define pmix_bfrops_base_copy_modex @PMIX_RENAME@pmix_bfrops_base_copy_modex -#define pmix_bfrops_base_copy_payload @PMIX_RENAME@pmix_bfrops_base_copy_payload -#define pmix_bfrops_base_copy_pdata @PMIX_RENAME@pmix_bfrops_base_copy_pdata -#define pmix_bfrops_base_copy_pinfo @PMIX_RENAME@pmix_bfrops_base_copy_pinfo -#define pmix_bfrops_base_copy_proc @PMIX_RENAME@pmix_bfrops_base_copy_proc -#define pmix_bfrops_base_copy_query @PMIX_RENAME@pmix_bfrops_base_copy_query -#define pmix_bfrops_base_copy_string @PMIX_RENAME@pmix_bfrops_base_copy_string -#define pmix_bfrops_base_copy_value @PMIX_RENAME@pmix_bfrops_base_copy_value -#define pmix_bfrops_base_data_type_string @PMIX_RENAME@pmix_bfrops_base_data_type_string -#define pmix_bfrops_base_framework @PMIX_RENAME@pmix_bfrops_base_framework -#define pmix_bfrops_base_get_available_modules @PMIX_RENAME@pmix_bfrops_base_get_available_modules -#define pmix_bfrops_base_output @PMIX_RENAME@pmix_bfrops_base_output -#define pmix_bfrops_base_pack @PMIX_RENAME@pmix_bfrops_base_pack -#define pmix_bfrops_base_pack_alloc_directive @PMIX_RENAME@pmix_bfrops_base_pack_alloc_directive -#define pmix_bfrops_base_pack_app @PMIX_RENAME@pmix_bfrops_base_pack_app -#define pmix_bfrops_base_pack_array @PMIX_RENAME@pmix_bfrops_base_pack_array -#define pmix_bfrops_base_pack_bo @PMIX_RENAME@pmix_bfrops_base_pack_bo -#define pmix_bfrops_base_pack_bool @PMIX_RENAME@pmix_bfrops_base_pack_bool -#define pmix_bfrops_base_pack_buf @PMIX_RENAME@pmix_bfrops_base_pack_buf -#define pmix_bfrops_base_pack_buffer @PMIX_RENAME@pmix_bfrops_base_pack_buffer -#define pmix_bfrops_base_pack_byte @PMIX_RENAME@pmix_bfrops_base_pack_byte -#define pmix_bfrops_base_pack_cmd @PMIX_RENAME@pmix_bfrops_base_pack_cmd -#define pmix_bfrops_base_pack_darray @PMIX_RENAME@pmix_bfrops_base_pack_darray -#define pmix_bfrops_base_pack_datatype @PMIX_RENAME@pmix_bfrops_base_pack_datatype -#define pmix_bfrops_base_pack_double @PMIX_RENAME@pmix_bfrops_base_pack_double -#define pmix_bfrops_base_pack_float @PMIX_RENAME@pmix_bfrops_base_pack_float -#define pmix_bfrops_base_pack_info @PMIX_RENAME@pmix_bfrops_base_pack_info -#define pmix_bfrops_base_pack_info_directives @PMIX_RENAME@pmix_bfrops_base_pack_info_directives -#define pmix_bfrops_base_pack_int @PMIX_RENAME@pmix_bfrops_base_pack_int -#define pmix_bfrops_base_pack_int16 @PMIX_RENAME@pmix_bfrops_base_pack_int16 -#define pmix_bfrops_base_pack_int32 @PMIX_RENAME@pmix_bfrops_base_pack_int32 -#define pmix_bfrops_base_pack_int64 @PMIX_RENAME@pmix_bfrops_base_pack_int64 -#define pmix_bfrops_base_pack_kval @PMIX_RENAME@pmix_bfrops_base_pack_kval -#define pmix_bfrops_base_pack_modex @PMIX_RENAME@pmix_bfrops_base_pack_modex -#define pmix_bfrops_base_pack_pdata @PMIX_RENAME@pmix_bfrops_base_pack_pdata -#define pmix_bfrops_base_pack_persist @PMIX_RENAME@pmix_bfrops_base_pack_persist -#define pmix_bfrops_base_pack_pid @PMIX_RENAME@pmix_bfrops_base_pack_pid -#define pmix_bfrops_base_pack_pinfo @PMIX_RENAME@pmix_bfrops_base_pack_pinfo -#define pmix_bfrops_base_pack_proc @PMIX_RENAME@pmix_bfrops_base_pack_proc -#define pmix_bfrops_base_pack_pstate @PMIX_RENAME@pmix_bfrops_base_pack_pstate -#define pmix_bfrops_base_pack_ptr @PMIX_RENAME@pmix_bfrops_base_pack_ptr -#define pmix_bfrops_base_pack_query @PMIX_RENAME@pmix_bfrops_base_pack_query -#define pmix_bfrops_base_pack_range @PMIX_RENAME@pmix_bfrops_base_pack_range -#define pmix_bfrops_base_pack_rank @PMIX_RENAME@pmix_bfrops_base_pack_rank -#define pmix_bfrops_base_pack_scope @PMIX_RENAME@pmix_bfrops_base_pack_scope -#define pmix_bfrops_base_pack_sizet @PMIX_RENAME@pmix_bfrops_base_pack_sizet -#define pmix_bfrops_base_pack_status @PMIX_RENAME@pmix_bfrops_base_pack_status -#define pmix_bfrops_base_pack_string @PMIX_RENAME@pmix_bfrops_base_pack_string -#define pmix_bfrops_base_pack_time @PMIX_RENAME@pmix_bfrops_base_pack_time -#define pmix_bfrops_base_pack_timeval @PMIX_RENAME@pmix_bfrops_base_pack_timeval -#define pmix_bfrops_base_pack_val @PMIX_RENAME@pmix_bfrops_base_pack_val -#define pmix_bfrops_base_pack_value @PMIX_RENAME@pmix_bfrops_base_pack_value -#define pmix_bfrops_base_print @PMIX_RENAME@pmix_bfrops_base_print -#define pmix_bfrops_base_print_alloc_directive @PMIX_RENAME@pmix_bfrops_base_print_alloc_directive -#define pmix_bfrops_base_print_app @PMIX_RENAME@pmix_bfrops_base_print_app -#define pmix_bfrops_base_print_array @PMIX_RENAME@pmix_bfrops_base_print_array -#define pmix_bfrops_base_print_bo @PMIX_RENAME@pmix_bfrops_base_print_bo -#define pmix_bfrops_base_print_bool @PMIX_RENAME@pmix_bfrops_base_print_bool -#define pmix_bfrops_base_print_buf @PMIX_RENAME@pmix_bfrops_base_print_buf -#define pmix_bfrops_base_print_byte @PMIX_RENAME@pmix_bfrops_base_print_byte -#define pmix_bfrops_base_print_cmd @PMIX_RENAME@pmix_bfrops_base_print_cmd -#define pmix_bfrops_base_print_darray @PMIX_RENAME@pmix_bfrops_base_print_darray -#define pmix_bfrops_base_print_datatype @PMIX_RENAME@pmix_bfrops_base_print_datatype -#define pmix_bfrops_base_print_double @PMIX_RENAME@pmix_bfrops_base_print_double -#define pmix_bfrops_base_print_float @PMIX_RENAME@pmix_bfrops_base_print_float -#define pmix_bfrops_base_print_info @PMIX_RENAME@pmix_bfrops_base_print_info -#define pmix_bfrops_base_print_info_directives @PMIX_RENAME@pmix_bfrops_base_print_info_directives -#define pmix_bfrops_base_print_int @PMIX_RENAME@pmix_bfrops_base_print_int -#define pmix_bfrops_base_print_int16 @PMIX_RENAME@pmix_bfrops_base_print_int16 -#define pmix_bfrops_base_print_int32 @PMIX_RENAME@pmix_bfrops_base_print_int32 -#define pmix_bfrops_base_print_int64 @PMIX_RENAME@pmix_bfrops_base_print_int64 -#define pmix_bfrops_base_print_int8 @PMIX_RENAME@pmix_bfrops_base_print_int8 -#define pmix_bfrops_base_print_kval @PMIX_RENAME@pmix_bfrops_base_print_kval -#define pmix_bfrops_base_print_modex @PMIX_RENAME@pmix_bfrops_base_print_modex -#define pmix_bfrops_base_print_pdata @PMIX_RENAME@pmix_bfrops_base_print_pdata -#define pmix_bfrops_base_print_persist @PMIX_RENAME@pmix_bfrops_base_print_persist -#define pmix_bfrops_base_print_pid @PMIX_RENAME@pmix_bfrops_base_print_pid -#define pmix_bfrops_base_print_pinfo @PMIX_RENAME@pmix_bfrops_base_print_pinfo -#define pmix_bfrops_base_print_proc @PMIX_RENAME@pmix_bfrops_base_print_proc -#define pmix_bfrops_base_print_pstate @PMIX_RENAME@pmix_bfrops_base_print_pstate -#define pmix_bfrops_base_print_ptr @PMIX_RENAME@pmix_bfrops_base_print_ptr -#define pmix_bfrops_base_print_query @PMIX_RENAME@pmix_bfrops_base_print_query -#define pmix_bfrops_base_print_range @PMIX_RENAME@pmix_bfrops_base_print_range -#define pmix_bfrops_base_print_rank @PMIX_RENAME@pmix_bfrops_base_print_rank -#define pmix_bfrops_base_print_scope @PMIX_RENAME@pmix_bfrops_base_print_scope -#define pmix_bfrops_base_print_size @PMIX_RENAME@pmix_bfrops_base_print_size -#define pmix_bfrops_base_print_status @PMIX_RENAME@pmix_bfrops_base_print_status -#define pmix_bfrops_base_print_string @PMIX_RENAME@pmix_bfrops_base_print_string -#define pmix_bfrops_base_print_time @PMIX_RENAME@pmix_bfrops_base_print_time -#define pmix_bfrops_base_print_timeval @PMIX_RENAME@pmix_bfrops_base_print_timeval -#define pmix_bfrops_base_print_uint @PMIX_RENAME@pmix_bfrops_base_print_uint -#define pmix_bfrops_base_print_uint16 @PMIX_RENAME@pmix_bfrops_base_print_uint16 -#define pmix_bfrops_base_print_uint32 @PMIX_RENAME@pmix_bfrops_base_print_uint32 -#define pmix_bfrops_base_print_uint64 @PMIX_RENAME@pmix_bfrops_base_print_uint64 -#define pmix_bfrops_base_print_uint8 @PMIX_RENAME@pmix_bfrops_base_print_uint8 -#define pmix_bfrops_base_print_value @PMIX_RENAME@pmix_bfrops_base_print_value -#define pmix_bfrops_base_std_copy @PMIX_RENAME@pmix_bfrops_base_std_copy -#define pmix_bfrops_base_unpack @PMIX_RENAME@pmix_bfrops_base_unpack -#define pmix_bfrops_base_unpack_alloc_directive @PMIX_RENAME@pmix_bfrops_base_unpack_alloc_directive -#define pmix_bfrops_base_unpack_app @PMIX_RENAME@pmix_bfrops_base_unpack_app -#define pmix_bfrops_base_unpack_array @PMIX_RENAME@pmix_bfrops_base_unpack_array -#define pmix_bfrops_base_unpack_bo @PMIX_RENAME@pmix_bfrops_base_unpack_bo -#define pmix_bfrops_base_unpack_bool @PMIX_RENAME@pmix_bfrops_base_unpack_bool -#define pmix_bfrops_base_unpack_buf @PMIX_RENAME@pmix_bfrops_base_unpack_buf -#define pmix_bfrops_base_unpack_byte @PMIX_RENAME@pmix_bfrops_base_unpack_byte -#define pmix_bfrops_base_unpack_cmd @PMIX_RENAME@pmix_bfrops_base_unpack_cmd -#define pmix_bfrops_base_unpack_darray @PMIX_RENAME@pmix_bfrops_base_unpack_darray -#define pmix_bfrops_base_unpack_datatype @PMIX_RENAME@pmix_bfrops_base_unpack_datatype -#define pmix_bfrops_base_unpack_double @PMIX_RENAME@pmix_bfrops_base_unpack_double -#define pmix_bfrops_base_unpack_float @PMIX_RENAME@pmix_bfrops_base_unpack_float -#define pmix_bfrops_base_unpack_info @PMIX_RENAME@pmix_bfrops_base_unpack_info -#define pmix_bfrops_base_unpack_info_directives @PMIX_RENAME@pmix_bfrops_base_unpack_info_directives -#define pmix_bfrops_base_unpack_int @PMIX_RENAME@pmix_bfrops_base_unpack_int -#define pmix_bfrops_base_unpack_int16 @PMIX_RENAME@pmix_bfrops_base_unpack_int16 -#define pmix_bfrops_base_unpack_int32 @PMIX_RENAME@pmix_bfrops_base_unpack_int32 -#define pmix_bfrops_base_unpack_int64 @PMIX_RENAME@pmix_bfrops_base_unpack_int64 -#define pmix_bfrops_base_unpack_kval @PMIX_RENAME@pmix_bfrops_base_unpack_kval -#define pmix_bfrops_base_unpack_modex @PMIX_RENAME@pmix_bfrops_base_unpack_modex -#define pmix_bfrops_base_unpack_pdata @PMIX_RENAME@pmix_bfrops_base_unpack_pdata -#define pmix_bfrops_base_unpack_persist @PMIX_RENAME@pmix_bfrops_base_unpack_persist -#define pmix_bfrops_base_unpack_pid @PMIX_RENAME@pmix_bfrops_base_unpack_pid -#define pmix_bfrops_base_unpack_pinfo @PMIX_RENAME@pmix_bfrops_base_unpack_pinfo -#define pmix_bfrops_base_unpack_proc @PMIX_RENAME@pmix_bfrops_base_unpack_proc -#define pmix_bfrops_base_unpack_pstate @PMIX_RENAME@pmix_bfrops_base_unpack_pstate -#define pmix_bfrops_base_unpack_ptr @PMIX_RENAME@pmix_bfrops_base_unpack_ptr -#define pmix_bfrops_base_unpack_query @PMIX_RENAME@pmix_bfrops_base_unpack_query -#define pmix_bfrops_base_unpack_range @PMIX_RENAME@pmix_bfrops_base_unpack_range -#define pmix_bfrops_base_unpack_rank @PMIX_RENAME@pmix_bfrops_base_unpack_rank -#define pmix_bfrops_base_unpack_scope @PMIX_RENAME@pmix_bfrops_base_unpack_scope -#define pmix_bfrops_base_unpack_sizet @PMIX_RENAME@pmix_bfrops_base_unpack_sizet -#define pmix_bfrops_base_unpack_status @PMIX_RENAME@pmix_bfrops_base_unpack_status -#define pmix_bfrops_base_unpack_string @PMIX_RENAME@pmix_bfrops_base_unpack_string -#define pmix_bfrops_base_unpack_time @PMIX_RENAME@pmix_bfrops_base_unpack_time -#define pmix_bfrops_base_unpack_timeval @PMIX_RENAME@pmix_bfrops_base_unpack_timeval -#define pmix_bfrops_base_unpack_val @PMIX_RENAME@pmix_bfrops_base_unpack_val -#define pmix_bfrops_base_unpack_value @PMIX_RENAME@pmix_bfrops_base_unpack_value -#define pmix_bfrops_base_value_cmp @PMIX_RENAME@pmix_bfrops_base_value_cmp -#define pmix_bfrops_base_value_load @PMIX_RENAME@pmix_bfrops_base_value_load -#define pmix_bfrops_base_value_unload @PMIX_RENAME@pmix_bfrops_base_value_unload -#define pmix_bfrops_base_value_xfer @PMIX_RENAME@pmix_bfrops_base_value_xfer -#define pmix_bfrops_globals @PMIX_RENAME@pmix_bfrops_globals -#define pmix_bfrop_store_data_type @PMIX_RENAME@pmix_bfrop_store_data_type -#define pmix_bfrop_too_small @PMIX_RENAME@pmix_bfrop_too_small -#define pmix_bfrop_type_info_t_class @PMIX_RENAME@pmix_bfrop_type_info_t_class -#define pmix_buffer_t_class @PMIX_RENAME@pmix_buffer_t_class -#define pmix_cb_t_class @PMIX_RENAME@pmix_cb_t_class -#define pmix_class_finalize @PMIX_RENAME@pmix_class_finalize -#define pmix_class_init_epoch @PMIX_RENAME@pmix_class_init_epoch -#define pmix_class_initialize @PMIX_RENAME@pmix_class_initialize -#define pmix_client_globals @PMIX_RENAME@pmix_client_globals -#define pmix_cmd_line_add @PMIX_RENAME@pmix_cmd_line_add -#define pmix_cmd_line_create @PMIX_RENAME@pmix_cmd_line_create -#define pmix_cmd_line_get_argc @PMIX_RENAME@pmix_cmd_line_get_argc -#define pmix_cmd_line_get_argv @PMIX_RENAME@pmix_cmd_line_get_argv -#define pmix_cmd_line_get_ninsts @PMIX_RENAME@pmix_cmd_line_get_ninsts -#define pmix_cmd_line_get_param @PMIX_RENAME@pmix_cmd_line_get_param -#define pmix_cmd_line_get_tail @PMIX_RENAME@pmix_cmd_line_get_tail -#define pmix_cmd_line_get_usage_msg @PMIX_RENAME@pmix_cmd_line_get_usage_msg -#define pmix_cmd_line_is_taken @PMIX_RENAME@pmix_cmd_line_is_taken -#define pmix_cmd_line_make_opt3 @PMIX_RENAME@pmix_cmd_line_make_opt3 -#define pmix_cmd_line_make_opt_mca @PMIX_RENAME@pmix_cmd_line_make_opt_mca -#define pmix_cmd_line_parse @PMIX_RENAME@pmix_cmd_line_parse -#define pmix_cmd_line_t_class @PMIX_RENAME@pmix_cmd_line_t_class -#define pmix_command_string @PMIX_RENAME@pmix_command_string -#define PMIx_Commit @PMIX_RENAME@PMIx_Commit -#define PMIx_Connect @PMIX_RENAME@PMIx_Connect -#define PMIx_Connect_nb @PMIX_RENAME@PMIx_Connect_nb -#define PMIx_Data_copy @PMIX_RENAME@PMIx_Data_copy -#define PMIx_Data_copy_payload @PMIX_RENAME@PMIx_Data_copy_payload -#define PMIx_Data_pack @PMIX_RENAME@PMIx_Data_pack -#define PMIx_Data_print @PMIX_RENAME@PMIx_Data_print -#define PMIx_Data_range_string @PMIX_RENAME@PMIx_Data_range_string -#define PMIx_Data_type_string @PMIX_RENAME@PMIx_Data_type_string -#define PMIx_Data_unpack @PMIX_RENAME@PMIx_Data_unpack -#define pmix_debug_threads @PMIX_RENAME@pmix_debug_threads -#define PMIx_Deregister_event_handler @PMIX_RENAME@PMIx_Deregister_event_handler -#define pmix_deregister_params @PMIX_RENAME@pmix_deregister_params -#define pmix_dirname @PMIX_RENAME@pmix_dirname -#define PMIx_Disconnect @PMIX_RENAME@PMIx_Disconnect -#define PMIx_Disconnect_nb @PMIX_RENAME@PMIx_Disconnect_nb -#define pmix_environ_merge @PMIX_RENAME@pmix_environ_merge -#define PMIx_Error_string @PMIX_RENAME@PMIx_Error_string -#define pmix_fd_read @PMIX_RENAME@pmix_fd_read -#define pmix_fd_set_cloexec @PMIX_RENAME@pmix_fd_set_cloexec -#define pmix_fd_write @PMIX_RENAME@pmix_fd_write -#define PMIx_Fence @PMIX_RENAME@PMIx_Fence -#define PMIx_Fence_nb @PMIX_RENAME@PMIx_Fence_nb -#define PMIx_Finalize @PMIX_RENAME@PMIx_Finalize -#define pmix_find_absolute_path @PMIX_RENAME@pmix_find_absolute_path -#define pmix_gds_base_assign_module @PMIX_RENAME@pmix_gds_base_assign_module -#define pmix_gds_base_framework @PMIX_RENAME@pmix_gds_base_framework -#define pmix_gds_base_get_available_modules @PMIX_RENAME@pmix_gds_base_get_available_modules -#define pmix_gds_base_output @PMIX_RENAME@pmix_gds_base_output -#define pmix_gds_base_select @PMIX_RENAME@pmix_gds_base_select -#define pmix_gds_base_setup_fork @PMIX_RENAME@pmix_gds_base_setup_fork -#define pmix_gds_globals @PMIX_RENAME@pmix_gds_globals -#define PMIx_generate_ppn @PMIX_RENAME@PMIx_generate_ppn -#define PMIx_generate_regex @PMIX_RENAME@PMIx_generate_regex -#define PMIx_Get @PMIX_RENAME@PMIx_Get -#define PMIx_Get_nb @PMIX_RENAME@PMIx_Get_nb -#define PMIx_Get_version @PMIX_RENAME@PMIx_Get_version -#define pmix_global_lock @PMIX_RENAME@pmix_global_lock -#define pmix_globals @PMIX_RENAME@pmix_globals -#define pmix_hash_fetch @PMIX_RENAME@pmix_hash_fetch -#define pmix_hash_fetch_by_key @PMIX_RENAME@pmix_hash_fetch_by_key -#define pmix_hash_remove_data @PMIX_RENAME@pmix_hash_remove_data -#define pmix_hash_store @PMIX_RENAME@pmix_hash_store -#define pmix_hash_table_get_first_key_ptr @PMIX_RENAME@pmix_hash_table_get_first_key_ptr -#define pmix_hash_table_get_first_key_uint32 @PMIX_RENAME@pmix_hash_table_get_first_key_uint32 -#define pmix_hash_table_get_first_key_uint64 @PMIX_RENAME@pmix_hash_table_get_first_key_uint64 -#define pmix_hash_table_get_next_key_ptr @PMIX_RENAME@pmix_hash_table_get_next_key_ptr -#define pmix_hash_table_get_next_key_uint32 @PMIX_RENAME@pmix_hash_table_get_next_key_uint32 -#define pmix_hash_table_get_next_key_uint64 @PMIX_RENAME@pmix_hash_table_get_next_key_uint64 -#define pmix_hash_table_get_value_ptr @PMIX_RENAME@pmix_hash_table_get_value_ptr -#define pmix_hash_table_get_value_uint32 @PMIX_RENAME@pmix_hash_table_get_value_uint32 -#define pmix_hash_table_get_value_uint64 @PMIX_RENAME@pmix_hash_table_get_value_uint64 -#define pmix_hash_table_init @PMIX_RENAME@pmix_hash_table_init -#define pmix_hash_table_init2 @PMIX_RENAME@pmix_hash_table_init2 -#define pmix_hash_table_remove_all @PMIX_RENAME@pmix_hash_table_remove_all -#define pmix_hash_table_remove_value_ptr @PMIX_RENAME@pmix_hash_table_remove_value_ptr -#define pmix_hash_table_remove_value_uint32 @PMIX_RENAME@pmix_hash_table_remove_value_uint32 -#define pmix_hash_table_remove_value_uint64 @PMIX_RENAME@pmix_hash_table_remove_value_uint64 -#define pmix_hash_table_set_value_ptr @PMIX_RENAME@pmix_hash_table_set_value_ptr -#define pmix_hash_table_set_value_uint32 @PMIX_RENAME@pmix_hash_table_set_value_uint32 -#define pmix_hash_table_set_value_uint64 @PMIX_RENAME@pmix_hash_table_set_value_uint64 -#define pmix_hash_table_t_class @PMIX_RENAME@pmix_hash_table_t_class -#define pmix_home_directory @PMIX_RENAME@pmix_home_directory -#define pmix_host_server @PMIX_RENAME@pmix_host_server -#define pmix_hotel_init @PMIX_RENAME@pmix_hotel_init -#define pmix_ifaddrtokindex @PMIX_RENAME@pmix_ifaddrtokindex -#define pmix_ifaddrtoname @PMIX_RENAME@pmix_ifaddrtoname -#define pmix_ifbegin @PMIX_RENAME@pmix_ifbegin -#define pmix_ifcount @PMIX_RENAME@pmix_ifcount -#define pmix_ifgetaliases @PMIX_RENAME@pmix_ifgetaliases -#define pmix_ifindextoaddr @PMIX_RENAME@pmix_ifindextoaddr -#define pmix_ifindextoflags @PMIX_RENAME@pmix_ifindextoflags -#define pmix_ifindextokindex @PMIX_RENAME@pmix_ifindextokindex -#define pmix_ifindextomac @PMIX_RENAME@pmix_ifindextomac -#define pmix_ifindextomask @PMIX_RENAME@pmix_ifindextomask -#define pmix_ifindextomtu @PMIX_RENAME@pmix_ifindextomtu -#define pmix_ifindextoname @PMIX_RENAME@pmix_ifindextoname -#define pmix_ifislocal @PMIX_RENAME@pmix_ifislocal -#define pmix_ifisloopback @PMIX_RENAME@pmix_ifisloopback -#define pmix_ifkindextoaddr @PMIX_RENAME@pmix_ifkindextoaddr -#define pmix_ifkindextoname @PMIX_RENAME@pmix_ifkindextoname -#define pmix_ifmatches @PMIX_RENAME@pmix_ifmatches -#define pmix_ifnametoaddr @PMIX_RENAME@pmix_ifnametoaddr -#define pmix_ifnametoindex @PMIX_RENAME@pmix_ifnametoindex -#define pmix_ifnametokindex @PMIX_RENAME@pmix_ifnametokindex -#define pmix_ifnext @PMIX_RENAME@pmix_ifnext -#define pmix_iftupletoaddr @PMIX_RENAME@pmix_iftupletoaddr -#define pmix_info_caddy_t_class @PMIX_RENAME@pmix_info_caddy_t_class -#define PMIx_Info_directives_string @PMIX_RENAME@PMIx_Info_directives_string -#define PMIx_Init @PMIX_RENAME@PMIx_Init -#define pmix_init_called @PMIX_RENAME@pmix_init_called -#define pmix_initialized @PMIX_RENAME@pmix_initialized -#define PMIx_Initialized @PMIX_RENAME@PMIx_Initialized -#define PMIx_Job_control_nb @PMIX_RENAME@PMIx_Job_control_nb -#define pmix_kval_t_class @PMIX_RENAME@pmix_kval_t_class -#define pmix_listener_t_class @PMIX_RENAME@pmix_listener_t_class -#define pmix_list_item_t_class @PMIX_RENAME@pmix_list_item_t_class -#define pmix_list_t_class @PMIX_RENAME@pmix_list_t_class -#define PMIx_Log_nb @PMIX_RENAME@PMIx_Log_nb -#define PMIx_Lookup @PMIX_RENAME@PMIx_Lookup -#define PMIx_Lookup_nb @PMIX_RENAME@PMIx_Lookup_nb -#define pmix_mca_base_close @PMIX_RENAME@pmix_mca_base_close -#define pmix_mca_base_cmd_line_process_args @PMIX_RENAME@pmix_mca_base_cmd_line_process_args -#define pmix_mca_base_cmd_line_setup @PMIX_RENAME@pmix_mca_base_cmd_line_setup -#define pmix_mca_base_cmd_line_wrap_args @PMIX_RENAME@pmix_mca_base_cmd_line_wrap_args -#define pmix_mca_base_component_close @PMIX_RENAME@pmix_mca_base_component_close -#define pmix_mca_base_component_compare @PMIX_RENAME@pmix_mca_base_component_compare -#define pmix_mca_base_component_compare_priority @PMIX_RENAME@pmix_mca_base_component_compare_priority -#define pmix_mca_base_component_compatible @PMIX_RENAME@pmix_mca_base_component_compatible -#define pmix_mca_base_component_disable_dlopen @PMIX_RENAME@pmix_mca_base_component_disable_dlopen -#define pmix_mca_base_component_find @PMIX_RENAME@pmix_mca_base_component_find -#define pmix_mca_base_component_find_finalize @PMIX_RENAME@pmix_mca_base_component_find_finalize -#define pmix_mca_base_component_list_item_t_class @PMIX_RENAME@pmix_mca_base_component_list_item_t_class -#define pmix_mca_base_component_parse_requested @PMIX_RENAME@pmix_mca_base_component_parse_requested -#define pmix_mca_base_component_path @PMIX_RENAME@pmix_mca_base_component_path -#define pmix_mca_base_component_priority_list_item_t_class @PMIX_RENAME@pmix_mca_base_component_priority_list_item_t_class -#define pmix_mca_base_component_repository_add @PMIX_RENAME@pmix_mca_base_component_repository_add -#define pmix_mca_base_component_repository_finalize @PMIX_RENAME@pmix_mca_base_component_repository_finalize -#define pmix_mca_base_component_repository_get_components @PMIX_RENAME@pmix_mca_base_component_repository_get_components -#define pmix_mca_base_component_repository_init @PMIX_RENAME@pmix_mca_base_component_repository_init -#define pmix_mca_base_component_repository_item_t_class @PMIX_RENAME@pmix_mca_base_component_repository_item_t_class -#define pmix_mca_base_component_repository_open @PMIX_RENAME@pmix_mca_base_component_repository_open -#define pmix_mca_base_component_repository_release @PMIX_RENAME@pmix_mca_base_component_repository_release -#define pmix_mca_base_component_repository_retain_component @PMIX_RENAME@pmix_mca_base_component_repository_retain_component -#define pmix_mca_base_components_close @PMIX_RENAME@pmix_mca_base_components_close -#define pmix_mca_base_components_filter @PMIX_RENAME@pmix_mca_base_components_filter -#define pmix_mca_base_component_show_load_errors @PMIX_RENAME@pmix_mca_base_component_show_load_errors -#define pmix_mca_base_component_to_string @PMIX_RENAME@pmix_mca_base_component_to_string -#define pmix_mca_base_component_track_load_errors @PMIX_RENAME@pmix_mca_base_component_track_load_errors -#define pmix_mca_base_component_unload @PMIX_RENAME@pmix_mca_base_component_unload -#define pmix_mca_base_component_var_register @PMIX_RENAME@pmix_mca_base_component_var_register -#define pmix_mca_base_failed_component_t_class @PMIX_RENAME@pmix_mca_base_failed_component_t_class -#define pmix_mca_base_framework_close @PMIX_RENAME@pmix_mca_base_framework_close -#define pmix_mca_base_framework_components_close @PMIX_RENAME@pmix_mca_base_framework_components_close -#define pmix_mca_base_framework_components_open @PMIX_RENAME@pmix_mca_base_framework_components_open -#define pmix_mca_base_framework_components_register @PMIX_RENAME@pmix_mca_base_framework_components_register -#define pmix_mca_base_framework_is_open @PMIX_RENAME@pmix_mca_base_framework_is_open -#define pmix_mca_base_framework_is_registered @PMIX_RENAME@pmix_mca_base_framework_is_registered -#define pmix_mca_base_framework_open @PMIX_RENAME@pmix_mca_base_framework_open -#define pmix_mca_base_framework_register @PMIX_RENAME@pmix_mca_base_framework_register -#define pmix_mca_base_framework_var_register @PMIX_RENAME@pmix_mca_base_framework_var_register -#define pmix_mca_base_open @PMIX_RENAME@pmix_mca_base_open -#define pmix_mca_base_select @PMIX_RENAME@pmix_mca_base_select -#define pmix_mca_base_system_default_path @PMIX_RENAME@pmix_mca_base_system_default_path -#define pmix_mca_base_user_default_path @PMIX_RENAME@pmix_mca_base_user_default_path -#define pmix_mca_base_var_build_env @PMIX_RENAME@pmix_mca_base_var_build_env -#define pmix_mca_base_var_cache_files @PMIX_RENAME@pmix_mca_base_var_cache_files -#define pmix_mca_base_var_check_exclusive @PMIX_RENAME@pmix_mca_base_var_check_exclusive -#define pmix_mca_base_var_deregister @PMIX_RENAME@pmix_mca_base_var_deregister -#define pmix_mca_base_var_dump @PMIX_RENAME@pmix_mca_base_var_dump -#define pmix_mca_base_var_env_name @PMIX_RENAME@pmix_mca_base_var_env_name -#define pmix_mca_base_var_finalize @PMIX_RENAME@pmix_mca_base_var_finalize -#define pmix_mca_base_var_find @PMIX_RENAME@pmix_mca_base_var_find -#define pmix_mca_base_var_find_by_name @PMIX_RENAME@pmix_mca_base_var_find_by_name -#define pmix_mca_base_var_get @PMIX_RENAME@pmix_mca_base_var_get -#define pmix_mca_base_var_get_count @PMIX_RENAME@pmix_mca_base_var_get_count -#define pmix_mca_base_var_get_value @PMIX_RENAME@pmix_mca_base_var_get_value -#define pmix_mca_base_var_group_component_register @PMIX_RENAME@pmix_mca_base_var_group_component_register -#define pmix_mca_base_var_group_deregister @PMIX_RENAME@pmix_mca_base_var_group_deregister -#define pmix_mca_base_var_group_find @PMIX_RENAME@pmix_mca_base_var_group_find -#define pmix_mca_base_var_group_find_by_name @PMIX_RENAME@pmix_mca_base_var_group_find_by_name -#define pmix_mca_base_var_group_get @PMIX_RENAME@pmix_mca_base_var_group_get -#define pmix_mca_base_var_group_get_count @PMIX_RENAME@pmix_mca_base_var_group_get_count -#define pmix_mca_base_var_group_get_stamp @PMIX_RENAME@pmix_mca_base_var_group_get_stamp -#define pmix_mca_base_var_group_register @PMIX_RENAME@pmix_mca_base_var_group_register -#define pmix_mca_base_var_group_set_var_flag @PMIX_RENAME@pmix_mca_base_var_group_set_var_flag -#define pmix_mca_base_var_group_t_class @PMIX_RENAME@pmix_mca_base_var_group_t_class -#define pmix_mca_base_var_init @PMIX_RENAME@pmix_mca_base_var_init -#define pmix_mca_base_var_process_env_list @PMIX_RENAME@pmix_mca_base_var_process_env_list -#define pmix_mca_base_var_process_env_list_from_file @PMIX_RENAME@pmix_mca_base_var_process_env_list_from_file -#define pmix_mca_base_var_register @PMIX_RENAME@pmix_mca_base_var_register -#define pmix_mca_base_var_register_synonym @PMIX_RENAME@pmix_mca_base_var_register_synonym -#define pmix_mca_base_var_set_flag @PMIX_RENAME@pmix_mca_base_var_set_flag -#define pmix_mca_base_var_set_value @PMIX_RENAME@pmix_mca_base_var_set_value -#define pmix_mca_base_var_t_class @PMIX_RENAME@pmix_mca_base_var_t_class -#define pmix_mutex_t_class @PMIX_RENAME@pmix_mutex_t_class -#define pmix_namelist_t_class @PMIX_RENAME@pmix_namelist_t_class -#define pmix_net_addr_isipv4public @PMIX_RENAME@pmix_net_addr_isipv4public -#define pmix_net_finalize @PMIX_RENAME@pmix_net_finalize -#define pmix_net_get_hostname @PMIX_RENAME@pmix_net_get_hostname -#define pmix_net_get_port @PMIX_RENAME@pmix_net_get_port -#define pmix_net_init @PMIX_RENAME@pmix_net_init -#define pmix_net_isaddr @PMIX_RENAME@pmix_net_isaddr -#define pmix_net_islocalhost @PMIX_RENAME@pmix_net_islocalhost -#define pmix_net_prefix2netmask @PMIX_RENAME@pmix_net_prefix2netmask -#define pmix_net_samenetwork @PMIX_RENAME@pmix_net_samenetwork -#define PMIx_Notify_event @PMIX_RENAME@PMIx_Notify_event -#define pmix_nspace_caddy_t_class @PMIX_RENAME@pmix_nspace_caddy_t_class -#define pmix_nspace_t_class @PMIX_RENAME@pmix_nspace_t_class -#define pmix_object_t_class @PMIX_RENAME@pmix_object_t_class -#define pmix_os_path @PMIX_RENAME@pmix_os_path -#define pmix_output @PMIX_RENAME@pmix_output -#define pmix_output_close @PMIX_RENAME@pmix_output_close -#define pmix_output_finalize @PMIX_RENAME@pmix_output_finalize -#define pmix_output_get_verbosity @PMIX_RENAME@pmix_output_get_verbosity -#define pmix_output_check_verbosity @PMIX_RENAME@pmix_output_check_verbosity -#define pmix_output_hexdump @PMIX_RENAME@pmix_output_hexdump -#define pmix_output_init @PMIX_RENAME@pmix_output_init -#define pmix_output_open @PMIX_RENAME@pmix_output_open -#define pmix_output_reopen @PMIX_RENAME@pmix_output_reopen -#define pmix_output_reopen_all @PMIX_RENAME@pmix_output_reopen_all -#define pmix_output_set_output_file_info @PMIX_RENAME@pmix_output_set_output_file_info -#define pmix_output_set_verbosity @PMIX_RENAME@pmix_output_set_verbosity -#define pmix_output_switch @PMIX_RENAME@pmix_output_switch -#define pmix_output_vverbose @PMIX_RENAME@pmix_output_vverbose -#define pmix_path_access @PMIX_RENAME@pmix_path_access -#define pmix_path_df @PMIX_RENAME@pmix_path_df -#define pmix_path_find @PMIX_RENAME@pmix_path_find -#define pmix_path_findv @PMIX_RENAME@pmix_path_findv -#define pmix_path_is_absolute @PMIX_RENAME@pmix_path_is_absolute -#define pmix_path_nfs @PMIX_RENAME@pmix_path_nfs -#define pmix_pdl_base_framework @PMIX_RENAME@pmix_pdl_base_framework -#define pmix_peer_t_class @PMIX_RENAME@pmix_peer_t_class -#define pmix_pending_connection_t_class @PMIX_RENAME@pmix_pending_connection_t_class -#define PMIx_Persistence_string @PMIX_RENAME@PMIx_Persistence_string -#define pmix_pif_base_framework @PMIX_RENAME@pmix_pif_base_framework -#define pmix_pinstall_dirs @PMIX_RENAME@pmix_pinstall_dirs -#define pmix_pinstalldirs_base_framework @PMIX_RENAME@pmix_pinstalldirs_base_framework -#define pmix_pnet @PMIX_RENAME@pmix_pnet -#define pmix_pnet_base_child_finalized @PMIX_RENAME@pmix_pnet_base_child_finalized -#define pmix_pnet_base_framework @PMIX_RENAME@pmix_pnet_base_framework -#define pmix_pnet_base_local_app_finalized @PMIX_RENAME@pmix_pnet_base_local_app_finalized -#define pmix_pnet_base_select @PMIX_RENAME@pmix_pnet_base_select -#define pmix_pnet_base_setup_app @PMIX_RENAME@pmix_pnet_base_setup_app -#define pmix_pnet_base_setup_fork @PMIX_RENAME@pmix_pnet_base_setup_fork -#define pmix_pnet_base_setup_local_network @PMIX_RENAME@pmix_pnet_base_setup_local_network -#define pmix_pnet_globals @PMIX_RENAME@pmix_pnet_globals -#define pmix_pointer_array_add @PMIX_RENAME@pmix_pointer_array_add -#define pmix_pointer_array_init @PMIX_RENAME@pmix_pointer_array_init -#define pmix_pointer_array_set_item @PMIX_RENAME@pmix_pointer_array_set_item -#define pmix_pointer_array_set_size @PMIX_RENAME@pmix_pointer_array_set_size -#define pmix_pointer_array_t_class @PMIX_RENAME@pmix_pointer_array_t_class -#define pmix_pointer_array_test_and_set_item @PMIX_RENAME@pmix_pointer_array_test_and_set_item -#define pmix_preg @PMIX_RENAME@pmix_preg -#define pmix_preg_base_framework @PMIX_RENAME@pmix_preg_base_framework -#define pmix_preg_base_generate_node_regex @PMIX_RENAME@pmix_preg_base_generate_node_regex -#define pmix_preg_base_generate_ppn @PMIX_RENAME@pmix_preg_base_generate_ppn -#define pmix_preg_base_parse_nodes @PMIX_RENAME@pmix_preg_base_parse_nodes -#define pmix_preg_base_parse_procs @PMIX_RENAME@pmix_preg_base_parse_procs -#define pmix_preg_base_resolve_nodes @PMIX_RENAME@pmix_preg_base_resolve_nodes -#define pmix_preg_base_resolve_peers @PMIX_RENAME@pmix_preg_base_resolve_peers -#define pmix_preg_base_select @PMIX_RENAME@pmix_preg_base_select -#define pmix_preg_globals @PMIX_RENAME@pmix_preg_globals -#define PMIx_Process_monitor_nb @PMIX_RENAME@PMIx_Process_monitor_nb -#define PMIx_Proc_state_string @PMIX_RENAME@PMIx_Proc_state_string -#define pmix_psec_base_assign_module @PMIX_RENAME@pmix_psec_base_assign_module -#define pmix_psec_base_framework @PMIX_RENAME@pmix_psec_base_framework -#define pmix_psec_base_get_available_modules @PMIX_RENAME@pmix_psec_base_get_available_modules -#define pmix_psec_base_select @PMIX_RENAME@pmix_psec_base_select -#define pmix_psensor @PMIX_RENAME@pmix_psensor -#define pmix_psensor_base @PMIX_RENAME@pmix_psensor_base -#define pmix_psensor_base_framework @PMIX_RENAME@pmix_psensor_base_framework -#define pmix_psensor_base_select @PMIX_RENAME@pmix_psensor_base_select -#define pmix_psensor_base_start @PMIX_RENAME@pmix_psensor_base_start -#define pmix_psensor_base_stop @PMIX_RENAME@pmix_psensor_base_stop -#define pmix_pshmem @PMIX_RENAME@pmix_pshmem -#define pmix_pshmem_base_framework @PMIX_RENAME@pmix_pshmem_base_framework -#define pmix_pshmem_base_select @PMIX_RENAME@pmix_pshmem_base_select -#define pmix_ptl_base_assign_module @PMIX_RENAME@pmix_ptl_base_assign_module -#define pmix_ptl_base_cancel_recv @PMIX_RENAME@pmix_ptl_base_cancel_recv -#define pmix_ptl_base_connect @PMIX_RENAME@pmix_ptl_base_connect -#define pmix_ptl_base_connect_to_peer @PMIX_RENAME@pmix_ptl_base_connect_to_peer -#define pmix_ptl_base_framework @PMIX_RENAME@pmix_ptl_base_framework -#define pmix_ptl_base_get_available_modules @PMIX_RENAME@pmix_ptl_base_get_available_modules -#define pmix_ptl_base_lost_connection @PMIX_RENAME@pmix_ptl_base_lost_connection -#define pmix_ptl_base_output @PMIX_RENAME@pmix_ptl_base_output -#define pmix_ptl_base_process_msg @PMIX_RENAME@pmix_ptl_base_process_msg -#define pmix_ptl_base_recv_blocking @PMIX_RENAME@pmix_ptl_base_recv_blocking -#define pmix_ptl_base_recv_handler @PMIX_RENAME@pmix_ptl_base_recv_handler -#define pmix_ptl_base_register_recv @PMIX_RENAME@pmix_ptl_base_register_recv -#define pmix_ptl_base_select @PMIX_RENAME@pmix_ptl_base_select -#define pmix_ptl_base_send @PMIX_RENAME@pmix_ptl_base_send -#define pmix_ptl_base_send_blocking @PMIX_RENAME@pmix_ptl_base_send_blocking -#define pmix_ptl_base_send_handler @PMIX_RENAME@pmix_ptl_base_send_handler -#define pmix_ptl_base_send_recv @PMIX_RENAME@pmix_ptl_base_send_recv -#define pmix_ptl_base_set_blocking @PMIX_RENAME@pmix_ptl_base_set_blocking -#define pmix_ptl_base_set_nonblocking @PMIX_RENAME@pmix_ptl_base_set_nonblocking -#define pmix_ptl_base_set_notification_cbfunc @PMIX_RENAME@pmix_ptl_base_set_notification_cbfunc -#define pmix_ptl_base_start_listening @PMIX_RENAME@pmix_ptl_base_start_listening -#define pmix_ptl_base_stop_listening @PMIX_RENAME@pmix_ptl_base_stop_listening -#define pmix_ptl_globals @PMIX_RENAME@pmix_ptl_globals -#define pmix_ptl_posted_recv_t_class @PMIX_RENAME@pmix_ptl_posted_recv_t_class -#define pmix_ptl_queue_t_class @PMIX_RENAME@pmix_ptl_queue_t_class -#define pmix_ptl_recv_t_class @PMIX_RENAME@pmix_ptl_recv_t_class -#define pmix_ptl_send_t_class @PMIX_RENAME@pmix_ptl_send_t_class -#define pmix_ptl_sr_t_class @PMIX_RENAME@pmix_ptl_sr_t_class -#define PMIx_Publish @PMIX_RENAME@PMIx_Publish -#define PMIx_Publish_nb @PMIX_RENAME@PMIx_Publish_nb -#define PMIx_Put @PMIX_RENAME@PMIx_Put -#define pmix_query_caddy_t_class @PMIX_RENAME@pmix_query_caddy_t_class -#define PMIx_Query_info_nb @PMIX_RENAME@PMIx_Query_info_nb -#define pmix_rand @PMIX_RENAME@pmix_rand -#define pmix_random @PMIX_RENAME@pmix_random -#define pmix_rank_info_t_class @PMIX_RENAME@pmix_rank_info_t_class -#define pmix_recursive_mutex_t_class @PMIX_RENAME@pmix_recursive_mutex_t_class -#define pmix_regex_range_t_class @PMIX_RENAME@pmix_regex_range_t_class -#define pmix_regex_value_t_class @PMIX_RENAME@pmix_regex_value_t_class -#define PMIx_Register_event_handler @PMIX_RENAME@PMIx_Register_event_handler -#define pmix_register_params @PMIX_RENAME@pmix_register_params -#define PMIx_Resolve_nodes @PMIX_RENAME@PMIx_Resolve_nodes -#define PMIx_Resolve_peers @PMIX_RENAME@PMIx_Resolve_peers -#define pmix_ring_buffer_init @PMIX_RENAME@pmix_ring_buffer_init -#define pmix_ring_buffer_poke @PMIX_RENAME@pmix_ring_buffer_poke -#define pmix_ring_buffer_pop @PMIX_RENAME@pmix_ring_buffer_pop -#define pmix_ring_buffer_push @PMIX_RENAME@pmix_ring_buffer_push -#define pmix_rte_finalize @PMIX_RENAME@pmix_rte_finalize -#define pmix_rte_init @PMIX_RENAME@pmix_rte_init -#define PMIx_Scope_string @PMIX_RENAME@PMIx_Scope_string -#define PMIx_server_deregister_client @PMIX_RENAME@PMIx_server_deregister_client -#define PMIx_server_deregister_nspace @PMIX_RENAME@PMIx_server_deregister_nspace -#define PMIx_server_dmodex_request @PMIX_RENAME@PMIx_server_dmodex_request -#define PMIx_server_finalize @PMIX_RENAME@PMIx_server_finalize -#define pmix_server_globals @PMIX_RENAME@pmix_server_globals -#define PMIx_server_init @PMIX_RENAME@PMIx_server_init -#define PMIx_server_register_client @PMIX_RENAME@PMIx_server_register_client -#define PMIx_server_register_nspace @PMIX_RENAME@PMIx_server_register_nspace -#define PMIx_server_setup_application @PMIX_RENAME@PMIx_server_setup_application -#define PMIx_server_setup_fork @PMIX_RENAME@PMIx_server_setup_fork -#define PMIx_server_setup_local_support @PMIX_RENAME@PMIx_server_setup_local_support -#define pmix_setenv @PMIX_RENAME@pmix_setenv -#define pmix_setup_caddy_t_class @PMIX_RENAME@pmix_setup_caddy_t_class -#define pmix_shift_caddy_t_class @PMIX_RENAME@pmix_shift_caddy_t_class -#define pmix_show_help @PMIX_RENAME@pmix_show_help -#define pmix_show_help_add_dir @PMIX_RENAME@pmix_show_help_add_dir -#define pmix_show_help_finalize @PMIX_RENAME@pmix_show_help_finalize -#define pmix_show_help_init @PMIX_RENAME@pmix_show_help_init -#define pmix_show_help_string @PMIX_RENAME@pmix_show_help_string -#define pmix_show_help_vstring @PMIX_RENAME@pmix_show_help_vstring -#define pmix_show_vhelp @PMIX_RENAME@pmix_show_vhelp -#define pmix_snprintf @PMIX_RENAME@pmix_snprintf -#define PMIx_Spawn @PMIX_RENAME@PMIx_Spawn -#define PMIx_Spawn_nb @PMIX_RENAME@PMIx_Spawn_nb -#define pmix_srand @PMIX_RENAME@pmix_srand -#define PMIx_Store_internal @PMIX_RENAME@PMIx_Store_internal -#define pmix_sync_wait_mt @PMIX_RENAME@pmix_sync_wait_mt -#define pmix_thread_get_self @PMIX_RENAME@pmix_thread_get_self -#define pmix_thread_join @PMIX_RENAME@pmix_thread_join -#define pmix_thread_kill @PMIX_RENAME@pmix_thread_kill -#define pmix_thread_self_compare @PMIX_RENAME@pmix_thread_self_compare -#define pmix_thread_set_main @PMIX_RENAME@pmix_thread_set_main -#define pmix_thread_start @PMIX_RENAME@pmix_thread_start -#define pmix_thread_t_class @PMIX_RENAME@pmix_thread_t_class -#define pmix_tmp_directory @PMIX_RENAME@pmix_tmp_directory -#define PMIx_tool_finalize @PMIX_RENAME@PMIx_tool_finalize -#define PMIx_tool_init @PMIX_RENAME@PMIx_tool_init -#define pmix_tsd_key_create @PMIX_RENAME@pmix_tsd_key_create -#define pmix_tsd_keys_destruct @PMIX_RENAME@pmix_tsd_keys_destruct -#define PMIx_Unpublish @PMIX_RENAME@PMIx_Unpublish -#define PMIx_Unpublish_nb @PMIX_RENAME@PMIx_Unpublish_nb -#define pmix_unsetenv @PMIX_RENAME@pmix_unsetenv -#define pmix_util_compress_string @PMIX_RENAME@pmix_util_compress_string -#define pmix_util_getid @PMIX_RENAME@pmix_util_getid -#define pmix_util_get_ranges @PMIX_RENAME@pmix_util_get_ranges -#define pmix_util_keyval_parse @PMIX_RENAME@pmix_util_keyval_parse -#define pmix_util_keyval_parse_finalize @PMIX_RENAME@pmix_util_keyval_parse_finalize -#define pmix_util_keyval_parse_init @PMIX_RENAME@pmix_util_keyval_parse_init -#define pmix_util_keyval_parse_lineno @PMIX_RENAME@pmix_util_keyval_parse_lineno -#define pmix_util_keyval_save_internal_envars @PMIX_RENAME@pmix_util_keyval_save_internal_envars -#define pmix_util_parse_range_options @PMIX_RENAME@pmix_util_parse_range_options -#define pmix_util_uncompress_string @PMIX_RENAME@pmix_util_uncompress_string -#define pmix_value_array_set_size @PMIX_RENAME@pmix_value_array_set_size -#define pmix_value_array_t_class @PMIX_RENAME@pmix_value_array_t_class -#define pmix_value_load @PMIX_RENAME@pmix_value_load -#define pmix_value_xfer @PMIX_RENAME@pmix_value_xfer -#define pmix_var_type_names @PMIX_RENAME@pmix_var_type_names -#define pmix_vasprintf @PMIX_RENAME@pmix_vasprintf -#define pmix_vsnprintf @PMIX_RENAME@pmix_vsnprintf diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h b/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h index 9a5ac16ff2..050e5df5a9 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science @@ -543,34 +543,41 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, * memory usage is released */ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void); -/* given a semicolon-separated list of input values, generate - * a regex that can be passed down to the client for parsing. - * The caller is responsible for free'ing the resulting - * string +/* Given a comma-separated list of \refarg{input} values, generate + * a reduced size representation of the input that can be passed + * down to PMIx_server_register_nspace for parsing. The order of + * the individual values in the \refarg{input} string is preserved + * across the operation. The caller is responsible for releasing + * the returned data. * - * If values have leading zero's, then that is preserved. You - * have to add back any prefix/suffix for node names - * odin[009-015,017-023,076-086] - * - * "pmix:odin[009-015,017-023,076-086]" - * - * Note that the "pmix" at the beginning of each regex indicates - * that the PMIx native parser is to be used by the client for - * parsing the provided regex. Other parsers may be supported - see - * the pmix_client.h header for a list. + * The returned representation may be an arbitrary array of bytes + * as opposed to a valid NULL-terminated string. However, the + * method used to generate the representation shall be identified + * with a colon-delimited string at the beginning of the output. + * For example, an output starting with "pmix:" indicates that + * the representation is a PMIx-defined regular expression. + * In contrast, an output starting with "blob:" is a compressed + * binary array. */ PMIX_EXPORT pmix_status_t PMIx_generate_regex(const char *input, char **regex); -/* The input is expected to consist of a comma-separated list - * of ranges. Thus, an input of: - * "1-4;2-5;8,10,11,12;6,7,9" - * would generate a regex of - * "[pmix:2x(3);8,10-12;6-7,9]" +/* The input shall consist of a semicolon-separated list of ranges + * representing the ranks of processes on each node of the job - + * e.g., "1-4;2-5;8,10,11,12;6,7,9". Each field of the input must + * correspond to the node name provided at that position in the + * input to PMIx_generate_regex. Thus, in the example, ranks 1-4 + * would be located on the first node of the comma-separated list + * of names provided to PMIx_generate_regex, and ranks 2-5 would + * be on the second name in the list. * - * Note that the "pmix" at the beginning of each regex indicates - * that the PMIx native parser is to be used by the client for - * parsing the provided regex. Other parsers may be supported - see - * the pmix_client.h header for a list. + * The returned representation may be an arbitrary array of bytes + * as opposed to a valid NULL-terminated string. However, the + * method used to generate the representation shall be identified + * with a colon-delimited string at the beginning of the output. + * For example, an output starting with "pmix:" indicates that + * the representation is a PMIx-defined regular expression. + * In contrast, an output starting with "blob:" is a compressed + * binary array. */ PMIX_EXPORT pmix_status_t PMIx_generate_ppn(const char *input, char **ppn); @@ -751,6 +758,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_deliver_inventory(pmix_info_t info[], size pmix_info_t directives[], size_t ndirs, pmix_op_cbfunc_t cbfunc, void *cbdata); + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_tool.h b/opal/mca/pmix/pmix3x/pmix/include/pmix_tool.h index 7ea0062a01..0212a17e85 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_tool.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_tool.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in index af4a00cd5d..38145c04a6 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in @@ -2,7 +2,7 @@ * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/maint/pmix.pc.in b/opal/mca/pmix/pmix3x/pmix/maint/pmix.pc.in new file mode 100644 index 0000000000..a66680c859 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/maint/pmix.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: pmix +Description: Process Management Interface for Exascale (PMIx) +Version: @PACKAGE_VERSION@ +URL: https://pmix.org/ +Requires: @PC_REQUIRES@ +Libs: -L${libdir} -lpmix @PC_PRIVATE_LIBS@ +Cflags: -I${includedir} diff --git a/opal/mca/pmix/pmix3x/pmix/src/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/Makefile.am index 9522167dfc..641429ae35 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -42,6 +42,8 @@ sources = nodist_headers = EXTRA_DIST = dist_pmixdata_DATA = +nobase_pmix_HEADERS = +pmixdir = $(pmixincludedir)/$(subdir) # place to capture sources for backward compatibility libs pmi1_sources = @@ -105,6 +107,11 @@ include tools/Makefile.include include common/Makefile.include include hwloc/Makefile.include +if WANT_INSTALL_HEADERS +nobase_pmix_HEADERS += $(headers) +endif + + MAINTAINERCLEANFILES = Makefile.in config.h config.h.in DISTCLEANFILES = Makefile CLEANFILES = core.* *~ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include index 20b9a3c8f8..c7070ddac6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include @@ -15,7 +15,7 @@ # reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -38,6 +38,4 @@ include atomics/sys/arm/Makefile.include include atomics/sys/arm64/Makefile.include include atomics/sys/ia32/Makefile.include include atomics/sys/powerpc/Makefile.include -include atomics/sys/sparcv9/Makefile.include -include atomics/sys/sync_builtin/Makefile.include include atomics/sys/gcc_builtin/Makefile.include diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h index 9fa0f4eefb..c69e540568 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 Research Organization for Information Science @@ -32,27 +32,16 @@ /* Architectures */ #define PMIX_UNSUPPORTED 0000 #define PMIX_IA32 0010 -#define PMIX_IA64 0020 #define PMIX_X86_64 0030 #define PMIX_POWERPC32 0050 #define PMIX_POWERPC64 0051 -#define PMIX_SPARC 0060 -#define PMIX_SPARCV9_32 0061 -#define PMIX_SPARCV9_64 0062 -#define PMIX_MIPS 0070 #define PMIX_ARM 0100 #define PMIX_ARM64 0101 -#define PMIX_S390 0110 -#define PMIX_S390X 0111 -#define PMIX_BUILTIN_SYNC 0200 #define PMIX_BUILTIN_GCC 0202 #define PMIX_BUILTIN_NO 0203 #define PMIX_BUILTIN_C11 0204 /* Formats */ #define PMIX_DEFAULT 1000 /* standard for given architecture */ -#define PMIX_DARWIN 1001 /* Darwin / OS X on PowerPC */ -#define PMIX_PPC_LINUX 1002 /* Linux on PowerPC */ -#define PMIX_AIX 1003 /* AIX on Power / PowerPC */ #endif /* #ifndef PMIX_SYS_ARCHITECTURE_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h index 5aca60ea36..783870c691 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -52,7 +52,7 @@ #ifndef PMIX_SYS_ATOMIC_H #define PMIX_SYS_ATOMIC_H 1 -#include "pmix_config.h" +#include "src/include/pmix_config.h" #include @@ -164,8 +164,6 @@ enum { *********************************************************************/ #if defined(DOXYGEN) /* don't include system-level gorp when generating doxygen files */ -#elif PMIX_ASSEMBLY_BUILTIN == PMIX_BUILTIN_SYNC -#include "src/atomics/sys/sync_builtin/atomic.h" #elif PMIX_ASSEMBLY_BUILTIN == PMIX_BUILTIN_GCC #include "src/atomics/sys/gcc_builtin/atomic.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_X86_64 @@ -176,20 +174,10 @@ enum { #include "src/atomics/sys/arm64/atomic.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_IA32 #include "src/atomics/sys/ia32/atomic.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_IA64 -#include "src/atomics/sys/ia64/atomic.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_MIPS -#include "src/atomics/sys/mips/atomic.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_POWERPC32 #include "src/atomics/sys/powerpc/atomic.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_POWERPC64 #include "src/atomics/sys/powerpc/atomic.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_SPARC -#include "src/atomics/sys/sparc/atomic.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_32 -#include "src/atomics/sys/sparcv9/atomic.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 -#include "src/atomics/sys/sparcv9/atomic.h" #endif #ifndef DOXYGEN diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h index 5fc5b0a132..8bd5e5eac6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h @@ -215,6 +215,7 @@ typedef atomic_flag pmix_atomic_lock_t; */ static inline void pmix_atomic_lock_init (pmix_atomic_lock_t *lock, bool value) { + (void)value; atomic_flag_clear (lock); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h index 967d13c63f..8a5bc2bfc6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h @@ -4,7 +4,7 @@ * reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ */ @@ -44,9 +44,6 @@ #elif PMIX_ASSEMBLY_ARCH == PMIX_IA32 #define __NR_process_vm_readv 347 #define __NR_process_vm_writev 348 -#elif PMIX_ASSEMBLY_ARCH == PMIX_IA64 -#define __NR_process_vm_readv 1332 -#define __NR_process_vm_writev 1333 #elif PMIX_ASSEMBLY_ARCH == PMIX_POWERPC32 #define __NR_process_vm_readv 351 #define __NR_process_vm_writev 352 @@ -65,33 +62,6 @@ #define __NR_process_vm_readv 270 #define __NR_process_vm_writev 271 -#elif PMIX_ASSEMBLY_ARCH == PMIX_MIPS - -#if _MIPS_SIM == _MIPS_SIM_ABI64 - -#define __NR_process_vm_readv 5304 -#define __NR_process_vm_writev 5305 - -#elif _MIPS_SIM == _MIPS_SIM_NABI32 - -#define __NR_process_vm_readv 6309 -#define __NR_process_vm_writev 6310 - -#else - -#error "Unsupported MIPS architecture for process_vm_readv and process_vm_writev syscalls" - -#endif - -#elif PMIX_ASSEMBLY_ARCH == PMIX_S390 - -#define __NR_process_vm_readv 340 -#define __NR_process_vm_writev 341 - -#elif PMIX_ASSEMBLY_ARCH == PMIX_S390X - -#define __NR_process_vm_readv 340 -#define __NR_process_vm_writev 341 #else #error "Unsupported architecture for process_vm_readv and process_vm_writev syscalls" diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/Makefile.include deleted file mode 100644 index f2ad630bf6..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/Makefile.include +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This makefile.am does not stand on its own - it is included from pmix/include/Makefile.am - -headers += \ - atomics/sys/sparcv9/atomic.h \ - atomics/sys/sparcv9/timer.h diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h deleted file mode 100644 index e74a152090..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd. - * Copyright (c) 2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_ATOMIC_H -#define PMIX_SYS_ARCH_ATOMIC_H 1 - -/* - * On sparc v9, use casa and casxa (compare and swap) instructions. - */ - -#define ASI_P "0x80" - -#define MEPMIXMBAR(type) __asm__ __volatile__ ("membar " type : : : "memory") - - -/********************************************************************** - * - * Define constants for Sparc v9 (Ultra Sparc) - * - *********************************************************************/ -#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1 - -#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1 - -#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1 - - -/********************************************************************** - * - * Memory Barriers - * - *********************************************************************/ -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline void pmix_atomic_mb(void) -{ - MEPMIXMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad"); -} - - -static inline void pmix_atomic_rmb(void) -{ - MEPMIXMBAR("#LoadLoad"); -} - - -static inline void pmix_atomic_wmb(void) -{ - MEPMIXMBAR("#StoreStore"); -} - -static inline void pmix_atomic_isync(void) -{ -} - - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - - -/********************************************************************** - * - * Atomic math operations - * - *********************************************************************/ -#if PMIX_GCC_INLINE_ASSEMBLY - -static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) -{ - /* casa [reg(rs1)] %asi, reg(rs2), reg(rd) - * - * if (*(reg(rs1)) == reg(rs2) ) - * swap reg(rd), *(reg(rs1)) - * else - * reg(rd) = *(reg(rs1)) - */ - - int32_t prev = newval; - bool ret; - - __asm__ __volatile__("casa [%1] " ASI_P ", %2, %0" - : "+r" (prev) - : "r" (addr), "r" (*oldval)); - ret = (prev == *oldval); - *oldval = prev; - return ret; -} - - -static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) -{ - bool rc; - - rc = pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval); - pmix_atomic_rmb(); - - return rc; -} - - -static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) -{ - pmix_atomic_wmb(); - return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval); -} - - -#if PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 - -static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) -{ - /* casa [reg(rs1)] %asi, reg(rs2), reg(rd) - * - * if (*(reg(rs1)) == reg(rs1) ) - * swap reg(rd), *(reg(rs1)) - * else - * reg(rd) = *(reg(rs1)) - */ - int64_t prev = newval; - bool ret; - - __asm__ __volatile__("casxa [%1] " ASI_P ", %2, %0" - : "+r" (prev) - : "r" (addr), "r" (*oldval)); - ret = (prev == *oldval); - *oldval = prev; - return ret; -} - -#else /* PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 */ - -static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) -{ - /* casa [reg(rs1)] %asi, reg(rs2), reg(rd) - * - * if (*(reg(rs1)) == reg(rs1) ) - * swap reg(rd), *(reg(rs1)) - * else - * reg(rd) = *(reg(rs1)) - * - */ - int64_t prev = newval; - bool ret; - - __asm__ __volatile__( - "ldx %0, %%g1 \n\t" /* g1 = ret */ - "ldx %2, %%g2 \n\t" /* g2 = oldval */ - "casxa [%1] " ASI_P ", %%g2, %%g1 \n\t" - "stx %%g1, %0 \n" - : "+m"(prev) - : "r"(addr), "m"(*oldval) - : "%g1", "%g2" - ); - - ret = (prev == *oldval); - *oldval = prev; - return ret; -} - -#endif /* PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 */ - -static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) -{ - bool rc; - - rc = pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval); - pmix_atomic_rmb(); - - return rc; -} - - -static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) -{ - pmix_atomic_wmb(); - return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval); -} - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - - -#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/timer.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/timer.h deleted file mode 100644 index 354babad46..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/timer.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_TIMER_H -#define PMIX_SYS_ARCH_TIMER_H 1 - -typedef uint64_t pmix_timer_t; - -#if PMIX_GCC_INLINE_ASSEMBLY - - -#if PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 - -static inline pmix_timer_t -pmix_sys_timer_get_cycles(void) -{ - pmix_timer_t ret; - - __asm__ __volatile__("rd %%tick, %0" : "=r"(ret)); - - return ret; -} - -#else /* PMIX_SPARCV9_32 */ - -static inline pmix_timer_t -pmix_sys_timer_get_cycles(void) -{ - pmix_timer_t ret; - int a, b; - - __asm__ __volatile__("rd %%tick, %0 \n" - "srlx %0, 32, %1 " : - "=r"(a), "=r"(b) - ); - - ret = (0x00000000FFFFFFFF & a) | (((pmix_timer_t) b) << 32); - - return ret; -} - -#endif - -#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 1 - -#else - -#define PMIX_HAVE_SYS_TIMER_GET_CYCLES 0 - -#endif /* PMIX_GCC_INLINE_ASSEMBLY */ - -#endif /* ! PMIX_SYS_ARCH_TIMER_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/Makefile.include deleted file mode 100644 index a57977a81e..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/Makefile.include +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2009 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2011 Sandia National Laboratories. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This makefile.am does not stand on its own - it is included from pmix/include/Makefile.am - -headers += \ - atomics/sys/sync_builtin/atomic.h diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h deleted file mode 100644 index 240d297f7a..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_SYS_ARCH_ATOMIC_H -#define PMIX_SYS_ARCH_ATOMIC_H 1 - -/********************************************************************** - * - * Memory Barriers - * - *********************************************************************/ -#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1 - -static inline void pmix_atomic_mb(void) -{ - __sync_synchronize(); -} - -static inline void pmix_atomic_rmb(void) -{ - __sync_synchronize(); -} - -static inline void pmix_atomic_wmb(void) -{ - __sync_synchronize(); -} - -#define PMIXMB() pmix_atomic_mb() - -/********************************************************************** - * - * Atomic math operations - * - *********************************************************************/ - -#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1 - -static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) -{ - int32_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); - bool ret = prev == *oldval; - *oldval = prev; - return ret; -} - -#define pmix_atomic_compare_exchange_strong_acq_32 pmix_atomic_compare_exchange_strong_32 -#define pmix_atomic_compare_exchange_strong_rel_32 pmix_atomic_compare_exchange_strong_32 - -#define PMIX_HAVE_ATOMIC_MATH_32 1 - -#define PMIX_HAVE_ATOMIC_ADD_32 1 -static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int32_t delta) -{ - return __sync_fetch_and_add(addr, delta); -} - -#define PMIX_HAVE_ATOMIC_AND_32 1 -static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value) -{ - return __sync_fetch_and_and(addr, value); -} - -#define PMIX_HAVE_ATOMIC_OR_32 1 -static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value) -{ - return __sync_fetch_and_or(addr, value); -} - -#define PMIX_HAVE_ATOMIC_XOR_32 1 -static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value) -{ - return __sync_fetch_and_xor(addr, value); -} - -#define PMIX_HAVE_ATOMIC_SUB_32 1 -static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int32_t delta) -{ - return __sync_fetch_and_sub(addr, delta); -} - -#if PMIX_ASM_SYNC_HAVE_64BIT - -#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1 - -static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) -{ - int64_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); - bool ret = prev == *oldval; - *oldval = prev; - return ret; -} - -#define pmix_atomic_compare_exchange_strong_acq_64 pmix_atomic_compare_exchange_strong_64 -#define pmix_atomic_compare_exchange_strong_rel_64 pmix_atomic_compare_exchange_strong_64 - -#define PMIX_HAVE_ATOMIC_MATH_64 1 -#define PMIX_HAVE_ATOMIC_ADD_64 1 -static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta) -{ - return __sync_fetch_and_add(addr, delta); -} - -#define PMIX_HAVE_ATOMIC_AND_64 1 -static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value) -{ - return __sync_fetch_and_and(addr, value); -} - -#define PMIX_HAVE_ATOMIC_OR_64 1 -static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value) -{ - return __sync_fetch_and_or(addr, value); -} - -#define PMIX_HAVE_ATOMIC_XOR_64 1 -static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value) -{ - return __sync_fetch_and_xor(addr, value); -} - -#define PMIX_HAVE_ATOMIC_SUB_64 1 -static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta) -{ - return __sync_fetch_and_sub(addr, delta); -} - -#endif - -#if PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128 -static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr, - pmix_int128_t *oldval, pmix_int128_t newval) -{ - pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); - bool ret = prev == *oldval; - *oldval = prev; - return ret; -} - -#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1 - -#endif - -#endif /* ! PMIX_SYS_ARCH_ATOMIC_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h index e3fdc1326e..f9ff8c1de1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h @@ -13,7 +13,7 @@ * Copyright (c) 2016 Broadcom Limited. All rights reserved. * Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -79,18 +79,10 @@ BEGIN_C_DECLS #include "src/atomics/sys/arm64/timer.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_IA32 #include "src/atomics/sys/ia32/timer.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_IA64 -#include "src/atomics/sys/ia64/timer.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_POWERPC32 #include "src/atomics/sys/powerpc/timer.h" #elif PMIX_ASSEMBLY_ARCH == PMIX_POWERPC64 #include "src/atomics/sys/powerpc/timer.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_32 -#include "src/atomics/sys/sparcv9/timer.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 -#include "src/atomics/sys/sparcv9/timer.h" -#elif PMIX_ASSEMBLY_ARCH == PMIX_MIPS -#include "src/atomics/sys/mips/timer.h" #endif #ifndef DOXYGEN diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.c index ed44afc934..7be38b2cdd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -21,12 +21,12 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/class/pmix_bitmap.h" /* The number of bits in the underlying type of the bitmap field diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.h index 9017b3b88d..1ab138675a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_bitmap.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +41,7 @@ #ifndef PMIX_BITMAP_H #define PMIX_BITMAP_H -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.c index ead33aecfa..7570a68588 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.h index 95ad39a4f8..c0464bd219 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hash_table.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -34,8 +34,8 @@ #ifndef PMIX_HASH_TABLE_H #define PMIX_HASH_TABLE_H -#include -#include +#include "src/include/pmix_config.h" +#include "src/include/prefetch.h" #ifdef HAVE_STDINT_H #include @@ -43,7 +43,7 @@ #include "src/class/pmix_list.h" -#include +#include "include/pmix_common.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c index 69126edba3..f9e5944c7c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c @@ -2,7 +2,7 @@ /* * Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -11,7 +11,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -22,6 +22,8 @@ static void local_eviction_callback(int fd, short flags, void *arg) { + (void)fd; + (void)flags; pmix_hotel_room_eviction_callback_arg_t *eargs = (pmix_hotel_room_eviction_callback_arg_t*) arg; void *occupant = eargs->hotel->rooms[eargs->room_num].occupant; diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h index f1e331dbb8..3bcb230271 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h @@ -2,7 +2,9 @@ /* * Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -53,10 +55,10 @@ #ifndef PMIX_HOTEL_H #define PMIX_HOTEL_H -#include -#include "src/include/types.h" +#include "src/include/pmix_config.h" #include "src/include/prefetch.h" -#include "pmix_common.h" +#include "include/pmix_common.h" +#include "src/include/types.h" #include "src/class/pmix_object.h" #include PMIX_EVENT_HEADER @@ -307,7 +309,7 @@ static inline void pmix_hotel_checkout_and_return_occupant(pmix_hotel_t *hotel, *occupant = room->occupant; room->occupant = NULL; if (NULL != hotel->evbase) { - event_del(&(room->eviction_timer_event)); + pmix_event_del(&(room->eviction_timer_event)); } hotel->last_unoccupied_room++; assert(hotel->last_unoccupied_room < hotel->num_rooms); diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.c index 933c5bcd5a..fe5df7c0d9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Voltaire All rights reserved. - * Copyright (c) 2013-2015 Intel, Inc. All rights reserved + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "include/pmix_common.h" #include "src/class/pmix_list.h" @@ -143,7 +143,7 @@ bool pmix_list_insert(pmix_list_t *list, pmix_list_item_t *item, long long idx) #if PMIX_ENABLE_DEBUG /* Spot check: ensure this item is only on the list that we - just insertted it into */ + just inserted it into */ item->pmix_list_item_refcount += 1; assert(1 == item->pmix_list_item_refcount); diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h index f29bea22a9..9507d9ab9f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h @@ -13,7 +13,7 @@ * Copyright (c) 2007 Voltaire All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -67,7 +67,7 @@ #ifndef PMIX_LIST_H #define PMIX_LIST_H -#include +#include "src/include/pmix_config.h" #include #include #if HAVE_STDBOOL_H @@ -119,6 +119,14 @@ struct pmix_list_item_t */ typedef struct pmix_list_item_t pmix_list_item_t; +/* static initializer for pmix_list_t */ +#define PMIX_LIST_ITEM_STATIC_INIT \ + { \ + .super = PMIX_OBJ_STATIC_INIT(pmix_object_t), \ + .pmix_list_next = NULL, \ + .pmix_list_prev = NULL, \ + .item_free = 0 \ + } /** * Get the next item in a list. @@ -160,6 +168,15 @@ struct pmix_list_t */ typedef struct pmix_list_t pmix_list_t; +/* static initializer for pmix_list_t */ +#define PMIX_LIST_STATIC_INIT \ + { \ + .super = PMIX_OBJ_STATIC_INIT(pmix_object_t), \ + .pmix_list_sentinel = PMIX_LIST_ITEM_STATIC_INIT, \ + .pmix_list_length = 0 \ + } + + /** Cleanly destruct a list * * The pmix_list_t destructor doesn't release the items on the diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.c index ad8661281b..359e6e7d87 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -25,7 +25,7 @@ * Implementation of pmix_object_t, the base pmix foundation class */ -#include +#include "src/include/pmix_config.h" /* Symbol transforms */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h index 7b7ed41a72..cfc56f19bc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -120,8 +120,8 @@ #ifndef PMIX_OBJECT_H #define PMIX_OBJECT_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #ifdef HAVE_STDLIB_H @@ -175,9 +175,20 @@ PMIX_EXPORT extern int pmix_class_init_epoch; * @param NAME Name of the class to initialize */ #if PMIX_ENABLE_DEBUG -#define PMIX_OBJ_STATIC_INIT(BASE_CLASS) { PMIX_OBJ_MAGIC_ID, PMIX_CLASS(BASE_CLASS), 1, __FILE__, __LINE__ } +#define PMIX_OBJ_STATIC_INIT(BASE_CLASS) \ + { \ + .obj_magic_id = PMIX_OBJ_MAGIC_ID, \ + .obj_class = PMIX_CLASS(BASE_CLASS), \ + .obj_reference_count = 1, \ + .cls_init_file_name = __FILE__, \ + .cls_init_lineno = __LINE__, \ + } #else -#define PMIX_OBJ_STATIC_INIT(BASE_CLASS) { PMIX_CLASS(BASE_CLASS), 1 } +#define PMIX_OBJ_STATIC_INIT(BASE_CLASS) \ + { \ + .obj_class = PMIX_CLASS(BASE_CLASS), \ + .obj_reference_count = 1, \ + } #endif /** diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_pointer_array.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_pointer_array.c index 36b569051c..c625f6e3cf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_pointer_array.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_pointer_array.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.c index e578a4e22b..46c9638c91 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,13 +19,13 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include #include -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/class/pmix_ring_buffer.h" #include "src/util/output.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.h index 8e8d236bd6..c111cd6708 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_ring_buffer.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +25,7 @@ #ifndef PMIX_RING_BUFFER_H #define PMIX_RING_BUFFER_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" #include "src/util/output.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.c index 31c19c15c4..9fe4f8d044 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_value_array.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.h index f20579b82b..5157e15748 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_value_array.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +20,7 @@ #ifndef PMIX_VALUE_ARRAY_H #define PMIX_VALUE_ARRAY_H -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_STRINGS_H @@ -31,7 +31,7 @@ #if PMIX_ENABLE_DEBUG #include "src/util/output.h" #endif -#include "pmix_common.h" +#include "include/pmix_common.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/client/Makefile.include index 80801cc4aa..71f9da7c01 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/client/Makefile.include @@ -1,9 +1,9 @@ # -*- makefile -*- # -# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2020 Intel, Inc. All rights reserved. # Copyright (c) 2014 Artem Y. Polyakov . # All rights reserved. -# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c index 56774e4fb2..395ea211a8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -12,12 +12,10 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include - -#include -#include +#include "include/pmix.h" +#include "include/pmi.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c index 4adf6ba37d..1fb674286f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -12,9 +12,7 @@ * $HEADER$ */ -#include - -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STRING_H #include @@ -27,8 +25,8 @@ #endif #include PMIX_EVENT_HEADER -#include -#include +#include "include/pmi2.h" +#include "include/pmix.h" #include "src/mca/bfrops/bfrops.h" #include "src/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c index 23110da10c..d012c3acfd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. @@ -15,14 +15,12 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include +#include "include/pmix.h" #include "src/include/pmix_globals.h" @@ -46,11 +44,8 @@ #include #endif -#if PMIX_HAVE_ZLIB -#include -#endif #include PMIX_EVENT_HEADER -#if ! PMIX_HAVE_LIBEV +#ifdef PMIX_EVENT2_THREAD_HEADER #include PMIX_EVENT2_THREAD_HEADER #endif @@ -60,7 +55,6 @@ static pmix_status_t pmix_init_result = PMIX_ERR_INIT; #include "src/class/pmix_list.h" #include "src/event/pmix_event.h" #include "src/util/argv.h" -#include "src/util/compress.h" #include "src/util/error.h" #include "src/util/hash.h" #include "src/util/name_fns.h" @@ -69,6 +63,7 @@ static pmix_status_t pmix_init_result = PMIX_ERR_INIT; #include "src/runtime/pmix_rte.h" #include "src/threads/threads.h" #include "src/mca/bfrops/base/base.h" +#include "src/mca/pcompress/base/base.h" #include "src/mca/gds/base/base.h" #include "src/mca/preg/preg.h" #include "src/mca/ptl/base/base.h" @@ -82,7 +77,56 @@ static pmix_status_t pmix_init_result = PMIX_ERR_INIT; static void _notify_complete(pmix_status_t status, void *cbdata) { pmix_event_chain_t *chain = (pmix_event_chain_t*)cbdata; + pmix_notify_caddy_t *cd; + size_t n; + pmix_status_t rc; + PMIX_ACQUIRE_OBJECT(chain); + + /* if the event wasn't found, then cache it as it might + * be registered later */ + if (PMIX_ERR_NOT_FOUND == status && !chain->cached) { + cd = PMIX_NEW(pmix_notify_caddy_t); + cd->status = chain->status; + PMIX_LOAD_PROCID(&cd->source, chain->source.nspace, chain->source.rank); + cd->range = chain->range; + if (0 < chain->ninfo) { + cd->ninfo = chain->ninfo; + PMIX_INFO_CREATE(cd->info, cd->ninfo); + cd->nondefault = chain->nondefault; + /* need to copy the info */ + for (n=0; n < cd->ninfo; n++) { + PMIX_INFO_XFER(&cd->info[n], &chain->info[n]); + } + } + if (NULL != chain->targets) { + cd->ntargets = chain->ntargets; + PMIX_PROC_CREATE(cd->targets, cd->ntargets); + memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); + } + if (NULL != chain->affected) { + cd->naffected = chain->naffected; + PMIX_PROC_CREATE(cd->affected, cd->naffected); + if (NULL == cd->affected) { + cd->naffected = 0; + goto cleanup; + } + memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); + } + /* cache it */ + pmix_output_verbose(2, pmix_client_globals.event_output, + "%s pmix:client_notify - processing complete, caching", + PMIX_NAME_PRINT(&pmix_globals.myid)); + rc = pmix_notify_event_cache(cd); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(cd); + goto cleanup; + } + chain->cached = true; + } + + cleanup: PMIX_RELEASE(chain); } @@ -96,8 +140,9 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, pmix_event_chain_t *chain; size_t ninfo; - pmix_output_verbose(2, pmix_client_globals.base_output, - "pmix:client_notify_recv - processing event"); + pmix_output_verbose(2, pmix_client_globals.event_output, + "%s pmix:client_notify_recv - processing event", + PMIX_NAME_PRINT(&pmix_globals.myid)); /* a zero-byte buffer indicates that this recv is being * completed due to a lost connection */ @@ -175,17 +220,18 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, /* prep the chain for processing */ pmix_prep_event_chain(chain, chain->info, ninfo, false); - pmix_output_verbose(2, pmix_client_globals.base_output, - "[%s:%d] pmix:client_notify_recv - processing event %s, calling errhandler", - pmix_globals.myid.nspace, pmix_globals.myid.rank, PMIx_Error_string(chain->status)); + pmix_output_verbose(2, pmix_client_globals.event_output, + "%s pmix:client_notify_recv - processing event %s, calling errhandler", + PMIX_NAME_PRINT(&pmix_globals.myid), PMIx_Error_string(chain->status)); pmix_invoke_local_event_hdlr(chain); return; error: /* we always need to return */ - pmix_output_verbose(2, pmix_client_globals.base_output, - "pmix:client_notify_recv - unpack error status =%d, calling def errhandler", rc); + pmix_output_verbose(2, pmix_client_globals.event_output, + "%s pmix:client_notify_recv - unpack error status =%s, calling def errhandler", + PMIX_NAME_PRINT(&pmix_globals.myid), PMIx_Error_string(rc)); chain = PMIX_NEW(pmix_event_chain_t); if (NULL == chain) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); @@ -471,7 +517,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, pmix_info_t info[], size_t ninfo) { char *evar; - pmix_status_t rc; + pmix_status_t rc = PMIX_SUCCESS; pmix_cb_t cb; pmix_buffer_t *req; pmix_cmd_t cmd = PMIX_REQ_CMD; @@ -484,6 +530,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, bool found; pmix_ptl_posted_recv_t *rcv; pid_t pid; + pmix_kval_t *kptr; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -657,7 +704,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, found = false; if (info != NULL) { for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_GDS_MODULE)) { PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, info[n].value.data.string, PMIX_STRING); found = true; break; @@ -687,6 +734,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } + rc = PMIX_ERR_UNREACH; } else { /* connect to the server */ rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo); @@ -747,7 +795,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, PMIX_CONSTRUCT_LOCK(&releaselock); PMIX_INFO_LOAD(&evinfo[0], PMIX_EVENT_RETURN_OBJECT, &releaselock, PMIX_POINTER); PMIX_INFO_LOAD(&evinfo[1], PMIX_EVENT_HDLR_NAME, "WAIT-FOR-DEBUGGER", PMIX_STRING); - pmix_output_verbose(2, pmix_client_globals.base_output, + pmix_output_verbose(2, pmix_client_globals.event_output, "[%s:%d] WAITING IN INIT FOR DEBUGGER", pmix_globals.myid.nspace, pmix_globals.myid.rank); PMIx_Register_event_handler(&code, 1, evinfo, 2, @@ -767,7 +815,39 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, if (NULL != info) { _check_for_notify(info, ninfo); } - return PMIX_SUCCESS; + + /* store our server's ID */ + if (NULL != pmix_client_globals.myserver && + NULL != pmix_client_globals.myserver->info) { + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_SERVER_NSPACE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(pmix_client_globals.myserver->info->pname.nspace); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_SERVER_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_PROC_RANK; + kptr->value->data.rank = pmix_client_globals.myserver->info->pname.rank; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + } + + return rc; } PMIX_EXPORT int PMIx_Initialized(void) @@ -1051,7 +1131,7 @@ static void _putfn(int sd, short args, void *cbdata) kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); if (PMIX_STRING_SIZE_CHECK(cb->value)) { /* compress large strings */ - if (pmix_util_compress_string(cb->value->data.string, &tmp, &len)) { + if (pmix_compress.compress_string(cb->value->data.string, &tmp, &len)) { if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); rc = PMIX_ERR_NOMEM; @@ -1398,12 +1478,22 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, for (n=0; NULL != tmp[n]; n++) { /* find the nspace delimiter */ prs = strchr(tmp[n], ':'); + if (NULL == prs) { + /* should never happen, but silence a Coverity warning */ + rc = PMIX_ERR_BAD_PARAM; + pmix_argv_free(tmp); + PMIX_PROC_FREE(pa, np); + *procs = NULL; + *nprocs = 0; + goto done; + } *prs = '\0'; ++prs; p = pmix_argv_split(prs, ','); for (m=0; NULL != p[m]; m++) { PMIX_LOAD_NSPACE(&pa[np].nspace, tmp[n]); - pa[n].rank = strtoul(p[m], NULL, 10); + pa[np].rank = strtoul(p[m], NULL, 10); + ++np; } pmix_argv_free(p); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_connect.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_connect.c index 3938f5f513..8bc1193962 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_connect.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_connect.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -15,13 +15,11 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_stdint.h" -#include -#include +#include "include/pmix.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c index 76c8a936c6..755a0b7e2f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -15,13 +15,11 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_stdint.h" -#include -#include +#include "include/pmix.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c index 3553a8a0c8..90b95d97ce 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016-2018 Mellanox Technologies, Inc. @@ -15,13 +15,11 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_stdint.h" -#include -#include +#include "include/pmix.h" #include "src/include/pmix_globals.h" @@ -45,17 +43,14 @@ #include #endif -#if PMIX_HAVE_ZLIB -#include -#endif #include PMIX_EVENT_HEADER #include "src/class/pmix_list.h" #include "src/mca/bfrops/bfrops.h" +#include "src/mca/pcompress/base/base.h" #include "src/mca/ptl/base/base.h" #include "src/threads/threads.h" #include "src/util/argv.h" -#include "src/util/compress.h" #include "src/util/error.h" #include "src/util/hash.h" #include "src/util/name_fns.h" @@ -65,7 +60,7 @@ #include "pmix_client_ops.h" -static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank, +static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank, char *key, const pmix_info_t info[], size_t ninfo, pmix_cmd_t cmd); @@ -136,11 +131,13 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t pmix_status_t rc; size_t n, nfo; bool wantinfo = false; - bool haveid = false; + char *hostname = NULL; + uint32_t nodeid = UINT32_MAX; + uint32_t appnum = UINT32_MAX; + uint32_t app; pmix_proc_t p; pmix_info_t *iptr; bool copy = false; - uint32_t appnum; pmix_value_t *ival = NULL; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -151,6 +148,11 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t } PMIX_RELEASE_THREAD(&pmix_global_lock); + if (NULL == cbfunc) { + /* no way to return the result! */ + return PMIX_ERR_BAD_PARAM; + } + /* if the proc is NULL, then the caller is assuming * that the key is universally unique within the caller's * own nspace. This most likely indicates that the code @@ -200,15 +202,29 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t PMIX_NAME_PRINT(&p), (NULL == key) ? "NULL" : key); if (!PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { - /* ]don't consider the fastpath option + /* don't consider the fastpath option * for undefined rank or NULL keys */ if (PMIX_RANK_UNDEF == p.rank || NULL == key) { goto doget; } - /* if they are asking about a node-level piece of info, - * then the rank must be UNDEF */ + /* if they passed our nspace and an INVALID rank, and are asking + * for PMIX_RANK, then they are asking for our process rank */ + if (PMIX_RANK_INVALID == p.rank && + PMIX_CHECK_NSPACE(p.nspace, pmix_globals.myid.nspace) && + NULL != key && 0 == strcmp(key, PMIX_RANK)) { + PMIX_VALUE_CREATE(ival, 1); + if (NULL == ival) { + return PMIX_ERR_NOMEM; + } + ival->type = PMIX_PROC_RANK; + ival->data.rank = pmix_globals.myid.rank; + cbfunc(PMIX_SUCCESS, ival, cbdata); + /* ownership of the memory in ival is passed to the + * user in the cbfunc, so don't release it here */ + return PMIX_SUCCESS; + } + /* see if they are asking about a node-level piece of info */ if (pmix_check_node_info(key)) { - p.rank = PMIX_RANK_UNDEF; /* the key is node-related - see if the target node is in the * info array and if they tagged the request accordingly */ if (NULL != info) { @@ -216,26 +232,55 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t if (PMIX_CHECK_KEY(&info[n], PMIX_NODE_INFO)) { wantinfo = true; } else if (PMIX_CHECK_KEY(&info[n], PMIX_HOSTNAME)) { - haveid = true; + hostname = info[n].value.data.string; } else if (PMIX_CHECK_KEY(&info[n], PMIX_NODEID)) { - haveid = true; + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, nodeid, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } } } } - if (wantinfo && haveid) { + if (PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 2, PMIX_RELEASE_WILDCARD)) { + p.rank = PMIX_RANK_UNDEF; + /* see if they told us to get node info */ + if (!wantinfo) { + /* guess not - better do it */ + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_NODE_INFO, NULL, PMIX_BOOL); + copy = true; + p.rank = PMIX_RANK_UNDEF; + goto doget; + } + goto doget; + } + if (wantinfo && (NULL != hostname || UINT32_MAX != nodeid)) { + /* they provided the "node-info" attribute. if they also + * specified the target node and it is NOT us, then dstore cannot + * resolve it and we need the rank to be undefined */ + if ((NULL != hostname && 0 == strcmp(hostname, pmix_globals.hostname)) || + nodeid == pmix_globals.nodeid) { + goto fastpath; + } + p.rank = PMIX_RANK_UNDEF; goto doget; } else if (wantinfo) { - /* missing the nodeid/hostname - add our hostname */ - nfo = ninfo + 1; - PMIX_INFO_CREATE(iptr, nfo); - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&iptr[n], &info[n]); + /* they provided "node-info" but are missing the nodeid/hostname - assume + * they are asking for info about our node. The dstore would have that */ + goto fastpath; + } else if (NULL != hostname) { + /* they did not provide the "node-info" attribute but did specify + * a hostname - if the ID is other than us, then we just need to + * flag it as "node-info" and mark it for the undefined rank so + * the GDS will know where to look */ + if (0 == strcmp(hostname, pmix_globals.hostname)) { + goto fastpath; } - PMIX_INFO_LOAD(&iptr[ninfo], PMIX_HOSTNAME, pmix_globals.hostname, PMIX_STRING); - copy = true; - goto doget; - } else if (haveid) { - /* flag that we want node info */ nfo = ninfo + 1; PMIX_INFO_CREATE(iptr, nfo); for (n=0; n < ninfo; n++) { @@ -243,26 +288,35 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t } PMIX_INFO_LOAD(&iptr[ninfo], PMIX_NODE_INFO, NULL, PMIX_BOOL); copy = true; + p.rank = PMIX_RANK_UNDEF; + goto doget; + } else if (UINT32_MAX != nodeid) { + /* they did not provide the "node-info" attribute but did specify + * the nodeid - if the ID is other than us, then we just need to + * flag it as "node-info" and mark it for the undefined rank so + * the GDS will know where to look */ + if (nodeid == pmix_globals.nodeid) { + goto fastpath; + } + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_NODE_INFO, NULL, PMIX_BOOL); + copy = true; + p.rank = PMIX_RANK_UNDEF; goto doget; } else { - /* missing both */ - nfo = ninfo + 2; - PMIX_INFO_CREATE(iptr, nfo); - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&iptr[n], &info[n]); - } - PMIX_INFO_LOAD(&iptr[ninfo], PMIX_NODE_INFO, NULL, PMIX_BOOL); - PMIX_INFO_LOAD(&iptr[ninfo+1], PMIX_HOSTNAME, pmix_globals.hostname, PMIX_STRING); - copy = true; - goto doget; + /* nothing was given, so assume this is about our node and + * pass it along */ + goto fastpath; } } /* see if they are asking about an app-level piece of info */ wantinfo = false; - haveid = false; if (pmix_check_app_info(key)) { - p.rank = PMIX_RANK_UNDEF; /* the key is app-related - see if the target appnum is in the * info array and if they tagged the request accordingly */ if (NULL != info) { @@ -271,32 +325,68 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t wantinfo = true; } else if (PMIX_CHECK_KEY(&info[n], PMIX_APPNUM) && 0 != info[n].value.data.uint32) { - haveid = true; + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, appnum, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } } } } - if (wantinfo && haveid) { + if (PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 2, PMIX_RELEASE_WILDCARD)) { + p.rank = PMIX_RANK_UNDEF; + /* see if they told us to get app info */ + if (!wantinfo) { + /* guess not - better do it */ + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APP_INFO, NULL, PMIX_BOOL); + copy = true; + p.rank = PMIX_RANK_UNDEF; + goto doget; + } + goto doget; + } + if (wantinfo && UINT32_MAX != appnum) { + /* asked for app-level info and provided an appnum - if it + * isn't our appnum, then we need to redirect */ + rc = _getfn_fastpath(&pmix_globals.myid, PMIX_APPNUM, NULL, 0, &ival); + if (PMIX_SUCCESS == rc) { + PMIX_VALUE_GET_NUMBER(rc, ival, app, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_VALUE_RELEASE(ival); + if (app == appnum) { + goto fastpath; + } + } + p.rank = PMIX_RANK_UNDEF; goto doget; } else if (wantinfo) { - /* missing the appnum - add ours */ - nfo = ninfo + 1; - PMIX_INFO_CREATE(iptr, nfo); - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&iptr[n], &info[n]); - } - /* try to retrieve it */ + /* missing the appnum - assume it is ours */ + goto fastpath; + } else if (UINT32_MAX != appnum) { + /* they did not provide the "app-info" attribute but did specify + * the appnum - if the ID is other than us, then we just need to + * flag it as "app-info" and mark it for the undefined rank so + * the GDS will know where to look */ rc = _getfn_fastpath(&pmix_globals.myid, PMIX_APPNUM, NULL, 0, &ival); - if (PMIX_SUCCESS != rc) { - appnum = ival->data.uint32; + if (PMIX_SUCCESS == rc) { + PMIX_VALUE_GET_NUMBER(rc, ival, app, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } PMIX_VALUE_RELEASE(ival); - } else { - appnum = 0; + if (app == appnum) { + goto fastpath; + } } - PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APPNUM, &appnum, PMIX_UINT32); - copy = true; - goto doget; - } else if (haveid) { - /* flag that we want app info */ nfo = ninfo + 1; PMIX_INFO_CREATE(iptr, nfo); for (n=0; n < ninfo; n++) { @@ -304,44 +394,29 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t } PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APP_INFO, NULL, PMIX_BOOL); copy = true; + p.rank = PMIX_RANK_UNDEF; goto doget; } else { - /* missing both */ - nfo = ninfo + 2; - PMIX_INFO_CREATE(iptr, nfo); - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&iptr[n], &info[n]); - } - PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APP_INFO, NULL, PMIX_BOOL); - /* try to retrieve it */ - rc = _getfn_fastpath(&pmix_globals.myid, PMIX_APPNUM, NULL, 0, &ival); - if (PMIX_SUCCESS != rc) { - appnum = ival->data.uint32; - PMIX_VALUE_RELEASE(ival); - } else { - appnum = 0; - } - PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APPNUM, &appnum, PMIX_UINT32); - copy = true; - goto doget; + /* missing both - all we can do is assume they want our info */ + goto fastpath; } } /* see if they are requesting session info or requesting cache refresh */ for (n=0; n < ninfo; n++) { - if (PMIX_CHECK_KEY(info, PMIX_SESSION_INFO)) { + if (PMIX_CHECK_KEY(info, PMIX_SESSION_INFO) || + PMIX_CHECK_KEY(info, PMIX_GET_REFRESH_CACHE)) { goto doget; } } } + fastpath: /* try to get data directly, without threadshift */ if (PMIX_SUCCESS == (rc = _getfn_fastpath(&p, key, iptr, nfo, &ival))) { - if (NULL != cbfunc) { - cbfunc(rc, ival, cbdata); - /* ownership of the memory in ival is passed to the - * user in the cbfunc, so don't release it here */ - } + cbfunc(rc, ival, cbdata); + /* ownership of the memory in ival is passed to the + * user in the cbfunc, so don't release it here */ return rc; } @@ -379,7 +454,7 @@ static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata) PMIX_WAKEUP_THREAD(&cb->lock); } -static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank, +static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank, char *key, const pmix_info_t info[], size_t ninfo, pmix_cmd_t cmd) { @@ -429,6 +504,17 @@ static pmix_buffer_t* _pack_get(char *nspace, pmix_rank_t rank, return NULL; } } + if (NULL != key) { + /* pack the key */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &key, 1, PMIX_STRING); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return NULL; + } + } + return msg; } @@ -541,19 +627,6 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, } } -static void timeout(int fd, short flags, void *cbdata) -{ - pmix_cb_t *cb = (pmix_cb_t*)cbdata; - - /* let them know that we timed out */ - cb->cbfunc.valuefn(PMIX_ERR_TIMEOUT, NULL, cb->cbdata); - cb->timer_running = false; - - /* remove this request */ - pmix_list_remove_item(&pmix_client_globals.pending_requests, &cb->super); - PMIX_RELEASE(cb); -} - static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb) { pmix_list_t *kvs = &cb->kvs; @@ -602,113 +675,43 @@ static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb) return PMIX_SUCCESS; } -static void infocb(pmix_status_t status, - pmix_info_t *info, size_t ninfo, - void *cbdata, - pmix_release_cbfunc_t release_fn, - void *release_cbdata) -{ - pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; - pmix_value_t *kv = NULL; - pmix_status_t rc; - - if (PMIX_SUCCESS == status) { - if (NULL != info) { - /* there should be only one returned value */ - if (1 != ninfo) { - rc = PMIX_ERR_INVALID_VAL; - } else { - PMIX_VALUE_CREATE(kv, 1); - if (NULL == kv) { - rc = PMIX_ERR_NOMEM; - } else { - /* if this is a compressed string, then uncompress it */ - if (PMIX_COMPRESSED_STRING == info[0].value.type) { - kv->type = PMIX_STRING; - pmix_util_uncompress_string(&kv->data.string, (uint8_t*)info[0].value.data.bo.bytes, info[0].value.data.bo.size); - if (NULL == kv->data.string) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - rc = PMIX_ERR_NOMEM; - PMIX_VALUE_FREE(kv, 1); - kv = NULL; - } else { - rc = PMIX_SUCCESS; - } - } else { - rc = pmix_value_xfer(kv, &info[0].value); - } - } - } - } else { - rc = PMIX_ERR_NOT_FOUND; - } - } else { - rc = status; - } - if (NULL != cd->valcbfunc) { - cd->valcbfunc(rc, kv, cd->cbdata); - } - PMIX_RELEASE(cd); - if (NULL != kv) { - PMIX_VALUE_FREE(kv, 1); - } - if (NULL != release_fn) { - release_fn(release_cbdata); - } -} - static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t key, const pmix_info_t info[], size_t ninfo, pmix_value_t **val) { - pmix_cb_t *cb = PMIX_NEW(pmix_cb_t); + pmix_cb_t cb; pmix_status_t rc = PMIX_SUCCESS; - size_t n; - /* scan the incoming directives */ - if (NULL != info) { - for (n=0; n < ninfo; n++) { - if (PMIX_CHECK_KEY(&info[n], PMIX_DATA_SCOPE)) { - cb->scope = info[n].value.data.scope; - } else if (PMIX_CHECK_KEY(&info[n], PMIX_OPTIONAL) || - PMIX_CHECK_KEY(&info[n], PMIX_IMMEDIATE)) { - continue; - } else { - /* we cannot handle any other directives via this path */ - PMIX_RELEASE(cb); - return PMIX_ERR_NOT_SUPPORTED; - } - } - } - cb->proc = (pmix_proc_t*)proc; - cb->copy = true; - cb->key = (char*)key; - cb->info = (pmix_info_t*)info; - cb->ninfo = ninfo; + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.proc = (pmix_proc_t*)proc; + cb.copy = true; + cb.key = (char*)key; + cb.info = (pmix_info_t*)info; + cb.ninfo = ninfo; PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_client_globals.myserver); if (PMIX_SUCCESS == rc) { - PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, &cb); if (PMIX_SUCCESS == rc) { goto done; } } PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_globals.mypeer); if (PMIX_SUCCESS == rc) { - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); if (PMIX_SUCCESS == rc) { goto done; } } - PMIX_RELEASE(cb); + PMIX_DESTRUCT(&cb); return rc; done: - rc = process_values(val, cb); + rc = process_values(val, &cb); if (NULL != *val) { PMIX_VALUE_COMPRESSED_STRING_UNPACK(*val); } - PMIX_RELEASE(cb); + PMIX_DESTRUCT(&cb); return rc; } @@ -722,17 +725,14 @@ static void _getnbfn(int fd, short flags, void *cbdata) size_t n; pmix_proc_t proc; bool optional = false; - bool immediate = false; bool internal_only = false; - struct timeval tv; - pmix_query_caddy_t *cd; /* cb was passed to us from another thread - acquire it */ PMIX_ACQUIRE_OBJECT(cb); /* set the proc object identifier */ - pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); - proc.rank = cb->pname.rank; + PMIX_LOAD_PROCID(&proc, cb->pname.nspace, cb->pname.rank); + cb->proc = &proc; pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: getnbfn value for proc %s key %s", @@ -744,25 +744,15 @@ static void _getnbfn(int fd, short flags, void *cbdata) for (n=0; n < cb->ninfo; n++) { if (PMIX_CHECK_KEY(&cb->info[n], PMIX_OPTIONAL)) { optional = PMIX_INFO_TRUE(&cb->info[n]); - } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_IMMEDIATE)) { - immediate = PMIX_INFO_TRUE(&cb->info[n]); - } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_TIMEOUT)) { - /* set a timer to kick us out if we don't - * have an answer within their window */ - if (0 < cb->info[n].value.data.integer) { - tv.tv_sec = cb->info[n].value.data.integer; - tv.tv_usec = 0; - pmix_event_evtimer_set(pmix_globals.evbase, &cb->ev, - timeout, cb); - pmix_event_evtimer_add(&cb->ev, &tv); - cb->timer_running = true; - } } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_DATA_SCOPE)) { cb->scope = cb->info[n].value.data.scope; } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_NODE_INFO) || PMIX_CHECK_KEY(&cb->info[n], PMIX_APP_INFO) || PMIX_CHECK_KEY(&cb->info[n], PMIX_SESSION_INFO)) { internal_only = true; + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_GET_REFRESH_CACHE)) { + /* immediately query the server */ + goto request; } } } @@ -792,7 +782,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) if (0 != strcmp(pmix_globals.mypeer->nptr->compat.gds->name, pmix_client_globals.myserver->nptr->compat.gds->name)) { PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); } else { - rc = PMIX_ERR_TAKE_NEXT_OPTION; + rc = PMIX_ERR_NOT_FOUND; } if (PMIX_SUCCESS != rc) { pmix_output_verbose(5, pmix_client_globals.get_output, @@ -806,31 +796,10 @@ static void _getnbfn(int fd, short flags, void *cbdata) proc.rank = PMIX_RANK_WILDCARD; goto request; } else if (NULL != cb->key) { - /* if immediate was given, then we are being directed to - * check with the server even though the caller is looking for - * job-level info. In some cases, a server may elect not - * to provide info at init to save memory */ - if (immediate) { - pmix_output_verbose(5, pmix_client_globals.get_output, - "pmix:client IMMEDIATE given - querying data"); - /* the direct modex request doesn't pass a key as it - * was intended to support non-job-level information. - * So instead, we will use the PMIx_Query function - * to request the information */ - cd = PMIX_NEW(pmix_query_caddy_t); - cd->cbdata = cb->cbdata; - cd->valcbfunc = cb->cbfunc.valuefn; - PMIX_QUERY_CREATE(cd->queries, 1); - cd->nqueries = 1; - pmix_argv_append_nosize(&cd->queries[0].keys, cb->key); - if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(cd->queries, 1, infocb, cd))) { - PMIX_RELEASE(cd); - goto respond; - } - PMIX_RELEASE(cb); - return; - } - /* we should have had this info, so respond with the error */ + /* => cb->key starts with pmix + * we should have had this info, so respond with the error - if + * they want us to check with the server, they should ask us to + * refresh the cache */ pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client returning NOT FOUND error"); goto respond; @@ -841,7 +810,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) } } pmix_output_verbose(5, pmix_client_globals.get_output, - "pmix:client job-level data NOT found"); + "pmix:client job-level data found"); rc = process_values(&val, cb); goto respond; } else if (PMIX_RANK_UNDEF == proc.rank) { @@ -864,6 +833,9 @@ static void _getnbfn(int fd, short flags, void *cbdata) } /* return whatever we found */ rc = process_values(&val, cb); + if (PMIX_SUCCESS != rc) { + goto request; + } } respond: @@ -913,11 +885,11 @@ static void _getnbfn(int fd, short flags, void *cbdata) } } - /* we don't have a pending request, so let's create one - don't worry - * about packing the key as we return everything from that proc */ - msg = _pack_get(cb->pname.nspace, proc.rank, cb->info, cb->ninfo, PMIX_GETNB_CMD); + /* we don't have a pending request, so let's create one */ + msg = _pack_get(cb->proc->nspace, proc.rank, cb->key, cb->info, cb->ninfo, PMIX_GETNB_CMD); if (NULL == msg) { rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); goto respond; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h index 11fc42ca3b..1d8643f46c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +10,7 @@ #ifndef PMIX_CLIENT_OPS_H #define PMIX_CLIENT_OPS_H -#include +#include "src/include/pmix_config.h" #include "src/threads/threads.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c index df1799de91..cce9380caf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -15,13 +15,11 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_stdint.h" -#include -#include +#include "include/pmix.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c index b7aefc4316..7b868df6da 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -15,13 +15,11 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_stdint.h" -#include -#include +#include "include/pmix.h" #include "src/include/pmix_globals.h" @@ -52,7 +50,9 @@ #include "src/mca/pnet/base/base.h" #include "src/util/argv.h" #include "src/util/error.h" +#include "src/util/name_fns.h" #include "src/util/output.h" +#include "src/util/pmix_environ.h" #include "src/mca/gds/gds.h" #include "src/mca/ptl/ptl.h" @@ -64,16 +64,17 @@ static void wait_cbfunc(struct pmix_peer_t *pr, static void spawn_cbfunc(pmix_status_t status, char nspace[], void *cbdata); PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo, - const pmix_app_t apps[], size_t napps, - pmix_nspace_t nspace) + const pmix_app_t apps[], size_t napps, + pmix_nspace_t nspace) { pmix_status_t rc; pmix_cb_t *cb; PMIX_ACQUIRE_THREAD(&pmix_global_lock); - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix: spawn called"); + pmix_output_verbose(2, pmix_client_globals.spawn_output, + "%s pmix: spawn called", + PMIX_NAME_PRINT(&pmix_globals.myid)); if (pmix_globals.init_cntr <= 0) { PMIX_RELEASE_THREAD(&pmix_global_lock); @@ -97,6 +98,12 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo, cb = PMIX_NEW(pmix_cb_t); if (PMIX_SUCCESS != (rc = PMIx_Spawn_nb(job_info, ninfo, apps, napps, spawn_cbfunc, cb))) { + /* note: the call may have returned PMIX_OPERATION_SUCCEEDED thus indicating + * that the spawn was atomically completed */ + if (PMIX_OPERATION_SUCCEEDED == rc) { + PMIX_LOAD_NSPACE(nspace, cb->pname.nspace); + rc = PMIX_SUCCESS; + } PMIX_RELEASE(cb); return rc; } @@ -122,15 +129,12 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin pmix_cb_t *cb; size_t n, m; pmix_app_t *aptr; - bool jobenvars = false; - char *harvest[2] = {"PMIX_MCA_", NULL}; - pmix_kval_t *kv; - pmix_list_t ilist; PMIX_ACQUIRE_THREAD(&pmix_global_lock); - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix: spawn called"); + pmix_output_verbose(2, pmix_client_globals.spawn_output, + "%s pmix: spawn_nb called", + PMIX_NAME_PRINT(&pmix_globals.myid)); if (pmix_globals.init_cntr <= 0) { PMIX_RELEASE_THREAD(&pmix_global_lock); @@ -144,32 +148,6 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin } PMIX_RELEASE_THREAD(&pmix_global_lock); - /* check job info for directives */ - if (NULL != job_info) { - for (n=0; n < ninfo; n++) { - if (PMIX_CHECK_KEY(&job_info[n], PMIX_SETUP_APP_ENVARS)) { - PMIX_CONSTRUCT(&ilist, pmix_list_t); - rc = pmix_pnet_base_harvest_envars(harvest, NULL, &ilist); - if (PMIX_SUCCESS != rc) { - PMIX_LIST_DESTRUCT(&ilist); - return rc; - } - PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { - /* cycle across all the apps and set this envar */ - for (m=0; m < napps; m++) { - aptr = (pmix_app_t*)&apps[m]; - pmix_setenv(kv->value->data.envar.envar, - kv->value->data.envar.value, - true, &aptr->env); - } - } - jobenvars = true; - PMIX_LIST_DESTRUCT(&ilist); - break; - } - } - } - for (n=0; n < napps; n++) { /* do a quick check of the apps directive array to ensure * the ninfo field has been set */ @@ -186,26 +164,6 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin } aptr->ninfo = m; } - if (!jobenvars) { - for (m=0; m < aptr->ninfo; m++) { - if (PMIX_CHECK_KEY(&aptr->info[m], PMIX_SETUP_APP_ENVARS)) { - PMIX_CONSTRUCT(&ilist, pmix_list_t); - rc = pmix_pnet_base_harvest_envars(harvest, NULL, &ilist); - if (PMIX_SUCCESS != rc) { - PMIX_LIST_DESTRUCT(&ilist); - return rc; - } - PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { - pmix_setenv(kv->value->data.envar.envar, - kv->value->data.envar.value, - true, &aptr->env); - } - jobenvars = true; - PMIX_LIST_DESTRUCT(&ilist); - break; - } - } - } } msg = PMIX_NEW(pmix_buffer_t); @@ -330,6 +288,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, /* extract and process any job-related info for this nspace */ if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); + ret = rc; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/common/Makefile.include index dcd723b956..cc50e06c6c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/common/Makefile.include @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c index cce767474e..1082abe258 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -12,16 +12,14 @@ * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/argv.h" @@ -120,7 +118,16 @@ static void acb(pmix_status_t status, void *release_cbdata) { pmix_cb_t *cb = (pmix_cb_t*)cbdata; + size_t n; + cb->status = status; + if (0 < ninfo) { + PMIX_INFO_CREATE(cb->info, ninfo); + cb->ninfo = ninfo; + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&cb->info[n], &info[n]); + } + } if (NULL != release_fn) { release_fn(release_cbdata); } @@ -366,7 +373,7 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm PMIX_RELEASE_THREAD(&pmix_global_lock); /* if the monitor is PMIX_SEND_HEARTBEAT, then send it */ - if (0 == strncmp(monitor->key, PMIX_SEND_HEARTBEAT, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(monitor, PMIX_SEND_HEARTBEAT)) { msg = PMIX_NEW(pmix_buffer_t); if (NULL == msg) { return PMIX_ERR_NOMEM; diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c index b2b26f60c6..ba9d93798b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STRING_H @@ -31,8 +31,7 @@ #include #endif -#include -#include +#include "include/pmix.h" #include "src/mca/bfrops/bfrops.h" #include "src/include/pmix_globals.h" @@ -88,7 +87,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc) if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { /* see if we know this proc */ for (i=0; i < pmix_server_globals.clients.size; i++) { - if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) { + if (NULL == (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) { continue; } if (0 == strncmp(proc->nspace, peer->nptr->nspace, PMIX_MAX_NSLEN)) { @@ -180,7 +179,7 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target, pmix_peer_t *peer; if (NULL == (peer = find_peer(target))) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_FOUND; } /* setup the host */ @@ -211,7 +210,7 @@ PMIX_EXPORT pmix_status_t PMIx_Data_unpack(const pmix_proc_t *source, pmix_peer_t *peer; if (NULL == (peer = find_peer(source))) { - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_ERR_NOT_FOUND; } /* setup the host */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c index 893d19544b..00791a1b97 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c @@ -1,25 +1,33 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#ifdef HAVE_FCNTL_H +#include +#else +#ifdef HAVE_SYS_FCNTL_H +#include +#endif +#endif -#include -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" + +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/argv.h" @@ -51,13 +59,10 @@ static void msgcbfunc(struct pmix_peer_t *peer, /* get the reference ID */ m=1; PMIX_BFROPS_UNPACK(rc, peer, buf, &refid, &m, PMIX_SIZE); - /* store the request - we are in an event, and - * so this is safe */ - if (NULL == pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid)) { - pmix_pointer_array_set_item(&pmix_globals.iof_requests, refid, cd->iofreq); - } + /* store the remote reference id */ + cd->iofreq->remote_id = refid; if (NULL != cd->cbfunc.hdlrregcbfn) { - cd->cbfunc.hdlrregcbfn(PMIX_SUCCESS, refid, cd->cbdata); + cd->cbfunc.hdlrregcbfn(PMIX_SUCCESS, cd->iofreq->local_id, cd->cbdata); } } else if (PMIX_SUCCESS != rc) { status = rc; @@ -74,19 +79,37 @@ static void msgcbfunc(struct pmix_peer_t *peer, } else { cd->cbfunc.opcbfn(status, cd->cbdata); } + } else if (PMIX_SUCCESS != status) { + pmix_pointer_array_set_item(&pmix_globals.iof_requests, cd->iofreq->local_id, NULL); + PMIX_RELEASE(cd->iofreq); } else if (NULL == cd->cbfunc.hdlrregcbfn) { cd->status = status; - cd->ncodes = refid; + cd->iofreq->remote_id = refid; PMIX_WAKEUP_THREAD(&cd->lock); } else { - cd->cbfunc.hdlrregcbfn(PMIX_SUCCESS, refid, cd->cbdata); - } - if (PMIX_SUCCESS != rc && NULL != cd->iofreq) { - PMIX_RELEASE(cd->iofreq); + cd->iofreq->remote_id = refid; + cd->cbfunc.hdlrregcbfn(PMIX_SUCCESS, cd->iofreq->local_id, cd->cbdata); } + PMIX_RELEASE(cd); } +static void mycbfn(pmix_status_t status, + size_t refid, + void *cbdata) +{ + pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata; + + PMIX_ACQUIRE_OBJECT(cd); + if (PMIX_SUCCESS == status) { + cd->status = refid; + } else { + cd->status = status; + } + + PMIX_WAKEUP_THREAD(&cd->lock); +} + PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs, const pmix_info_t directives[], size_t ndirs, pmix_iof_channel_t channel, pmix_iof_cbfunc_t cbfunc, @@ -94,8 +117,9 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs { pmix_shift_caddy_t *cd; pmix_cmd_t cmd = PMIX_IOF_PULL_CMD; - pmix_buffer_t *msg; + pmix_buffer_t *msg = NULL; pmix_status_t rc; + pmix_iof_req_t *req; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -132,24 +156,33 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs if (NULL == cd) { return PMIX_ERR_NOMEM; } - cd->cbfunc.hdlrregcbfn = regcbfunc; - cd->cbdata = regcbdata; + if (NULL == regcbfunc) { + cd->cbfunc.hdlrregcbfn = mycbfn; + PMIX_RETAIN(cd); + cd->cbdata = cd; + } else { + cd->cbfunc.hdlrregcbfn = regcbfunc; + cd->cbdata = regcbdata; + } + /* setup the request item */ - cd->iofreq = PMIX_NEW(pmix_iof_req_t); - if (NULL == cd->iofreq) { - PMIX_RELEASE(cd); - return PMIX_ERR_NOMEM; + req = PMIX_NEW(pmix_iof_req_t); + if (NULL == req) { + rc = PMIX_ERR_NOMEM; + goto cleanup; } /* retain the channels and cbfunc */ - cd->iofreq->channels = channel; - cd->iofreq->cbfunc = cbfunc; + req->channels = channel; + req->cbfunc = cbfunc; + req->local_id = pmix_pointer_array_add(&pmix_globals.iof_requests, req); + cd->iofreq = req; /* we don't need the source specifications - only the * server cares as it will filter against them */ /* setup the registration cmd */ msg = PMIX_NEW(pmix_buffer_t); if (NULL == msg) { - PMIX_RELEASE(cd->iofreq); + PMIX_RELEASE(req); PMIX_RELEASE(cd); return PMIX_ERR_NOMEM; } @@ -200,8 +233,19 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs cleanup: if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - PMIX_RELEASE(cd->iofreq); + if (NULL != msg) { + PMIX_RELEASE(msg); + } + PMIX_RELEASE(req); + PMIX_RELEASE(cd); + } else if (NULL == regcbfunc) { + PMIX_WAIT_THREAD(&cd->lock); + rc = cd->status; + if (0 > rc) { + /* the request failed */ + pmix_pointer_array_set_item(&pmix_globals.iof_requests, req->local_id, NULL); + PMIX_RELEASE(req); + } PMIX_RELEASE(cd); } return rc; @@ -215,6 +259,8 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, pmix_cmd_t cmd = PMIX_IOF_DEREG_CMD; pmix_buffer_t *msg; pmix_status_t rc; + pmix_iof_req_t *req; + size_t remote_id; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -240,6 +286,15 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, } PMIX_RELEASE_THREAD(&pmix_global_lock); + req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, iofhdlr); + if (NULL == req) { + /* bad value */ + return PMIX_ERR_BAD_PARAM; + } + remote_id = req->remote_id; + pmix_pointer_array_set_item(&pmix_globals.iof_requests, iofhdlr, NULL); + PMIX_RELEASE(req); + /* send this request to the server */ cd = PMIX_NEW(pmix_shift_caddy_t); if (NULL == cd) { @@ -276,9 +331,9 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, } } - /* pack the handler ID */ + /* pack the remote handler ID */ PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - msg, &iofhdlr, 1, PMIX_SIZE); + msg, &remote_id, 1, PMIX_SIZE); pmix_output_verbose(2, pmix_client_globals.iof_output, "pmix:iof_dereg sending to server"); @@ -299,10 +354,29 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, } typedef struct { + pmix_object_t super; + pmix_event_t ev; + pmix_lock_t lock; + pmix_status_t status; pmix_op_cbfunc_t cbfunc; void *cbdata; } pmix_ltcaddy_t; +static void ltcon(pmix_ltcaddy_t *p) +{ + PMIX_CONSTRUCT_LOCK(&p->lock); +} +static void ltdes(pmix_ltcaddy_t *p) +{ + PMIX_DESTRUCT_LOCK(&p->lock); +} +static PMIX_CLASS_INSTANCE(pmix_ltcaddy_t, + pmix_object_t, + ltcon, ltdes); + +static pmix_event_t stdinsig_ev; +static pmix_iof_read_event_t *stdinev = NULL; + static void stdincbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, pmix_buffer_t *buf, void *cbdata) @@ -334,6 +408,14 @@ static void stdincbfunc(struct pmix_peer_t *peer, free(cd); } +static void myopcb(pmix_status_t status, void *cbdata) +{ + pmix_ltcaddy_t *cd = (pmix_ltcaddy_t*)cbdata; + + cd->status = status; + PMIX_WAKEUP_THREAD(&cd->lock); +} + pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, pmix_byte_object_t *bo, const pmix_info_t directives[], size_t ndirs, @@ -341,8 +423,11 @@ pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, { pmix_buffer_t *msg; pmix_cmd_t cmd = PMIX_IOF_PUSH_CMD; - pmix_status_t rc; + pmix_status_t rc = PMIX_SUCCESS; pmix_ltcaddy_t *cd; + size_t n; + bool begincollecting, stopcollecting; + int flags, fd = fileno(stdin); PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -351,6 +436,104 @@ pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, } PMIX_RELEASE_THREAD(&pmix_global_lock); + if (NULL == bo) { + /* check the directives */ + for (n=0; n < ndirs; n++) { + if (PMIX_CHECK_KEY(&directives[n], PMIX_IOF_PUSH_STDIN)) { + /* we are to start collecting our stdin and pushing + * it to the specified targets */ + begincollecting = PMIX_INFO_TRUE(&directives[n]); + if (begincollecting) { + /* add these targets to our list */ + if (!pmix_globals.pushstdin) { + /* not already collecting, so start */ + pmix_globals.pushstdin = true; + /* We don't want to set nonblocking on our + * stdio stream. If we do so, we set the file descriptor to + * non-blocking for everyone that has that file descriptor, which + * includes everyone else in our shell pipeline chain. (See + * http://lists.freebsd.org/pipermail/freebsd-hackers/2005-January/009742.html). + * This causes things like "prun -np 1 big_app | cat" to lose + * output, because cat's stdout is then ALSO non-blocking and cat + * isn't built to deal with that case (same with almost all other + * unix text utils). + */ + if (0 != fd) { + if((flags = fcntl(fd, F_GETFL, 0)) < 0) { + pmix_output(pmix_client_globals.iof_output, + "[%s:%d]: fcntl(F_GETFL) failed with errno=%d\n", + __FILE__, __LINE__, errno); + } else { + flags |= O_NONBLOCK; + fcntl(fd, F_SETFL, flags); + } + } + if (isatty(fd)) { + /* We should avoid trying to read from stdin if we + * have a terminal, but are backgrounded. Catch the + * signals that are commonly used when we switch + * between being backgrounded and not. If the + * filedescriptor is not a tty, don't worry about it + * and always stay connected. + */ + pmix_event_signal_set(pmix_globals.evbase, &stdinsig_ev, + SIGCONT, pmix_iof_stdin_cb, + NULL); + + /* setup a read event to read stdin, but don't activate it yet. The + * dst_name indicates who should receive the stdin. If that recipient + * doesn't do a corresponding pull, however, then the stdin will + * be dropped upon receipt at the local daemon + */ + PMIX_IOF_READ_EVENT(&stdinev, + targets, ntargets, + directives, ndirs, fd, + pmix_iof_read_local_handler, false); + + /* check to see if we want the stdin read event to be + * active - we will always at least define the event, + * but may delay its activation + */ + if (pmix_iof_stdin_check(fd)) { + PMIX_IOF_READ_ACTIVATE(stdinev); + } + } else { + /* if we are not looking at a tty, just setup a read event + * and activate it + */ + PMIX_IOF_READ_EVENT(&stdinev, targets, ntargets, + directives, ndirs, fd, + pmix_iof_read_local_handler, true); + } + } + } else { + if (pmix_globals.pushstdin) { + /* remove these targets from the list of + * recipients - if the list is then empty, + * stop collecting. If the targets param + * is NULL, then remove all targets and stop. + * Flush any cached input before calling + * the cbfunc */ + } + } + } else if (PMIX_CHECK_KEY(&directives[n], PMIX_IOF_COMPLETE)) { + /* if we are collecting our stdin for the specified + * targets, then stop - a NULL for targets indicates + * stop for everyone. Flush any remaining cached input + * before calling the cbfunc */ + stopcollecting = PMIX_INFO_TRUE(&directives[n]); + if (stopcollecting) { + if (pmix_globals.pushstdin) { + /* remove these targets from the list of + * recipients - if the list is then empty, + * stop collecting */ + } + } + } + } + return PMIX_OPERATION_SUCCEEDED; + } + /* if we are not a server, then we send the provided * data to our server for processing */ if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || @@ -398,26 +581,40 @@ pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, return rc; } } - PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - msg, bo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - return rc; + if (NULL != bo) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, bo, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } } - cd = (pmix_ltcaddy_t*)malloc(sizeof(pmix_ltcaddy_t)); + cd = PMIX_NEW(pmix_ltcaddy_t); if (NULL == cd) { PMIX_RELEASE(msg); rc = PMIX_ERR_NOMEM; return rc; } + if (NULL == cbfunc) { + cd->cbfunc = myopcb; + PMIX_RETAIN(cd); + cd->cbdata = cd; + } else { + cd->cbfunc = cbfunc; + cd->cbdata = cbdata; + } PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, msg, stdincbfunc, cd); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); free(cd); + } else if (NULL == cbfunc) { + PMIX_WAIT_THREAD(&cd->lock); + rc = cd->status; + PMIX_RELEASE(cd); } return rc; } @@ -430,7 +627,7 @@ pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, targets, ntargets, directives, ndirs, bo, cbfunc, cbdata); - return PMIX_SUCCESS; + return rc; } pmix_status_t pmix_iof_process_iof(pmix_iof_channel_t channels, @@ -487,8 +684,8 @@ pmix_status_t pmix_iof_process_iof(pmix_iof_channel_t channels, PMIX_RELEASE(msg); return rc; } - /* provide the handler ID so they know which cbfunc to use */ - PMIX_BFROPS_PACK(rc, req->requestor, msg, &req->refid, 1, PMIX_SIZE); + /* provide their local handler ID so they know which cbfunc to use */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, &req->remote_id, 1, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); @@ -705,6 +902,11 @@ pmix_status_t pmix_iof_write_output(const pmix_proc_t *name, for (j=0; j < endtaglen && k < PMIX_IOF_BASE_TAGGED_OUT_MAX-1; j++) { output->data[k++] = endtag[j]; } + if (k == PMIX_IOF_BASE_TAGGED_OUT_MAX) { + /* out of space */ + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + goto process; + } /* move the over */ output->data[k++] = '\n'; /* if this isn't the end of the data buffer, add a new start tag */ @@ -781,7 +983,7 @@ void pmix_iof_static_dump_output(pmix_iof_sink_t *sink) dump = false; /* make one last attempt to write this out */ while (NULL != (output = (pmix_iof_write_output_t*)pmix_list_remove_first(&wev->outputs))) { - if (!dump) { + if (!dump && 0 < output->numbytes) { num_written = write(wev->fd, output->data, output->numbytes); if (num_written < output->numbytes) { /* don't retry - just cleanout the list and dump it */ @@ -812,7 +1014,7 @@ void pmix_iof_write_handler(int _fd, short event, void *cbdata) output = (pmix_iof_write_output_t*)item; if (0 == output->numbytes) { /* indicates we are to close this stream */ - PMIX_RELEASE(sink); + PMIX_DESTRUCT(sink); return; } num_written = write(wev->fd, output->data, output->numbytes); @@ -900,15 +1102,34 @@ void pmix_iof_stdin_cb(int fd, short event, void *cbdata) } } -static void restart_stdin(int fd, short event, void *cbdata) +static void iof_stdin_cbfunc(struct pmix_peer_t *peer, + pmix_ptl_hdr_t *hdr, + pmix_buffer_t *buf, void *cbdata) { - pmix_iof_read_event_t *tm = (pmix_iof_read_event_t*)cbdata; + pmix_iof_read_event_t *stdinev = (pmix_iof_read_event_t*)cbdata; + int cnt; + pmix_status_t rc, ret; - PMIX_ACQUIRE_OBJECT(tm); + PMIX_ACQUIRE_OBJECT(stdinev); - if (!tm->active) { - PMIX_IOF_READ_ACTIVATE(tm); + /* check the return status */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &ret, &cnt, PMIX_STATUS); + if (PMIX_SUCCESS != rc) { + pmix_event_del(&stdinev->ev); + stdinev->active = false; + PMIX_POST_OBJECT(stdinev); + return; } + /* if the status wasn't success, then terminate the forward */ + if (PMIX_SUCCESS != ret) { + pmix_event_del(&stdinev->ev); + stdinev->active = false; + PMIX_POST_OBJECT(stdinev); + return; + } + + pmix_iof_stdin_cb(0, 0, stdinev); } /* this is the read handler for stdin */ @@ -917,18 +1138,19 @@ void pmix_iof_read_local_handler(int unusedfd, short event, void *cbdata) pmix_iof_read_event_t *rev = (pmix_iof_read_event_t*)cbdata; unsigned char data[PMIX_IOF_BASE_MSG_MAX]; int32_t numbytes; - int fd; pmix_status_t rc; pmix_buffer_t *msg; pmix_cmd_t cmd = PMIX_IOF_PUSH_CMD; + pmix_byte_object_t bo; + int fd; PMIX_ACQUIRE_OBJECT(rev); - /* As we may use timer events, fd can be bogus (-1) - * use the right one here - */ - fd = fileno(stdin); - + if (0 > rev->fd) { + fd = fileno(stdin); + } else { + fd = rev->fd; + } /* read up to the fragment size */ memset(data, 0, PMIX_IOF_BASE_MSG_MAX); numbytes = read(fd, data, sizeof(data)); @@ -968,50 +1190,68 @@ void pmix_iof_read_local_handler(int unusedfd, short event, void *cbdata) if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); - goto restart; + return; } + /* pack the number of targets */ PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - msg, &numbytes, 1, PMIX_INT32); + msg, &rev->ntargets, 1, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); - goto restart; + return; } + /* and the targets */ + if (0 < rev->ntargets) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, rev->targets, rev->ntargets, PMIX_PROC); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return; + } + } + /* pack the number of directives */ PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - msg, data, numbytes, PMIX_BYTE); + msg, &rev->ndirs, 1, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); - goto restart; + return; } + /* and the directives */ + if (0 < rev->ndirs) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, rev->directives, rev->ndirs, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return; + } + } + + /* pack the data */ + bo.bytes = (char*)data; + bo.size = numbytes; + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &bo, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return; + } + + /* send it to the server */ PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, - msg, stdincbfunc, NULL); + msg, iof_stdin_cbfunc, rev); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); } - restart: - /* if num_bytes was zero, or we read the last piece of the file, then we need to terminate the event */ - if (0 == numbytes) { - /* this will also close our stdin file descriptor */ - PMIX_RELEASE(rev); - } else { - /* if we are looking at a tty, then we just go ahead and restart the - * read event assuming we are not backgrounded - */ - if (pmix_iof_stdin_check(fd)) { - restart_stdin(fd, 0, rev); - } else { - /* delay for awhile and then restart */ - pmix_event_evtimer_set(pmix_globals.evbase, - &rev->ev, restart_stdin, rev); - rev->tv.tv_sec = 0; - rev->tv.tv_usec = 10000; - PMIX_POST_OBJECT(rev); - pmix_event_evtimer_add(&rev->ev, &rev->tv); - } + if (0 < numbytes) { + PMIX_IOF_READ_ACTIVATE(rev); } + /* nothing more to do */ return; } @@ -1044,12 +1284,19 @@ static void iof_read_event_construct(pmix_iof_read_event_t* rev) { rev->fd = -1; rev->active = false; + rev->childproc = NULL; rev->tv.tv_sec = 0; rev->tv.tv_usec = 0; + rev->targets = NULL; + rev->ntargets = 0; + rev->directives = NULL; + rev->ndirs = 0; } static void iof_read_event_destruct(pmix_iof_read_event_t* rev) { - pmix_event_del(&rev->ev); + if (rev->active) { + pmix_event_del(&rev->ev); + } if (0 <= rev->fd) { PMIX_OUTPUT_VERBOSE((20, pmix_client_globals.iof_output, "%s iof: closing fd %d", @@ -1057,6 +1304,12 @@ static void iof_read_event_destruct(pmix_iof_read_event_t* rev) close(rev->fd); rev->fd = -1; } + if (NULL != rev->targets) { + PMIX_PROC_FREE(rev->targets, rev->ntargets); + } + if (NULL != rev->directives) { + PMIX_INFO_FREE(rev->directives, rev->ndirs); + } } PMIX_CLASS_INSTANCE(pmix_iof_read_event_t, pmix_object_t, @@ -1074,14 +1327,16 @@ static void iof_write_event_construct(pmix_iof_write_event_t* wev) } static void iof_write_event_destruct(pmix_iof_write_event_t* wev) { - pmix_event_del(&wev->ev); + if (wev->pending) { + pmix_event_del(&wev->ev); + } if (2 < wev->fd) { PMIX_OUTPUT_VERBOSE((20, pmix_client_globals.iof_output, "%s iof: closing fd %d for write event", PMIX_NAME_PRINT(&pmix_globals.myid), wev->fd)); close(wev->fd); } - PMIX_DESTRUCT(&wev->outputs); + PMIX_LIST_DESTRUCT(&wev->outputs); } PMIX_CLASS_INSTANCE(pmix_iof_write_event_t, pmix_list_item_t, diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h index 66f05a0ade..e0c2fcb840 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h @@ -12,7 +12,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 Mellanox Technologies. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science @@ -32,7 +32,7 @@ #ifndef PMIX_IOF_H #define PMIX_IOF_H -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TYPES_H #include @@ -52,8 +52,6 @@ #include "src/include/pmix_globals.h" #include "src/util/fd.h" -#include "src/common/pmix_iof.h" - BEGIN_C_DECLS /* @@ -99,7 +97,14 @@ typedef struct { struct timeval tv; int fd; bool active; + void *childproc; bool always_readable; + pmix_proc_t name; + pmix_iof_channel_t channel; + pmix_proc_t *targets; + size_t ntargets; + pmix_info_t *directives; + size_t ndirs; } pmix_iof_read_event_t; PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_iof_read_event_t); @@ -132,7 +137,7 @@ pmix_iof_fd_always_ready(int fd) PMIX_POST_OBJECT(wev); \ if (wev->always_writable) { \ /* Regular is always write ready. Use timer to activate */ \ - tv = &wev->tv; \ + tv = &wev->tv; \ } \ if (pmix_event_add(&wev->ev, tv)) { \ PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); \ @@ -188,6 +193,44 @@ pmix_iof_fd_always_ready(int fd) } while(0); +#define PMIX_IOF_READ_EVENT(rv, p, np, d, nd, fid, cbfunc, actv) \ + do { \ + size_t _ii; \ + pmix_iof_read_event_t *rev; \ + PMIX_OUTPUT_VERBOSE((1, pmix_client_globals.iof_output, \ + "defining read event at: %s %d", \ + __FILE__, __LINE__)); \ + rev = PMIX_NEW(pmix_iof_read_event_t); \ + if (NULL != (p)) { \ + (rev)->ntargets = (np); \ + PMIX_PROC_CREATE((rev)->targets, (rev)->ntargets); \ + memcpy((rev)->targets, (p), (np) * sizeof(pmix_proc_t)); \ + } \ + if (NULL != (d) && 0 < (nd)) { \ + PMIX_INFO_CREATE((rev)->directives, (nd)); \ + (rev)->ndirs = (nd); \ + for (_ii=0; _ii < (size_t)nd; _ii++) { \ + PMIX_INFO_XFER(&((rev)->directives[_ii]), &((d)[_ii])); \ + } \ + } \ + rev->fd = (fid); \ + rev->always_readable = pmix_iof_fd_always_ready(fid); \ + *(rv) = rev; \ + if(rev->always_readable) { \ + pmix_event_evtimer_set(pmix_globals.evbase, \ + &rev->ev, (cbfunc), rev); \ + } else { \ + pmix_event_set(pmix_globals.evbase, \ + &rev->ev, (fid), \ + PMIX_EV_READ, \ + (cbfunc), rev); \ + } \ + if ((actv)) { \ + PMIX_IOF_READ_ACTIVATE(rev) \ + } \ + } while(0); + + PMIX_EXPORT pmix_status_t pmix_iof_flush(void); PMIX_EXPORT pmix_status_t pmix_iof_write_output(const pmix_proc_t *name, @@ -196,10 +239,9 @@ PMIX_EXPORT pmix_status_t pmix_iof_write_output(const pmix_proc_t *name, pmix_iof_flags_t *flags); PMIX_EXPORT void pmix_iof_static_dump_output(pmix_iof_sink_t *sink); PMIX_EXPORT void pmix_iof_write_handler(int fd, short event, void *cbdata); -PMIX_EXPORT void pmix_iof_stdin_write_handler(int fd, short event, void *cbdata); PMIX_EXPORT bool pmix_iof_stdin_check(int fd); +PMIX_EXPORT void pmix_iof_read_local_handler(int unusedfd, short event, void *cbdata); PMIX_EXPORT void pmix_iof_stdin_cb(int fd, short event, void *cbdata); -PMIX_EXPORT void pmix_iof_read_local_handler(int fd, short event, void *cbdata); PMIX_EXPORT pmix_status_t pmix_iof_process_iof(pmix_iof_channel_t channels, const pmix_proc_t *source, const pmix_byte_object_t *bo, diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c index e8c97667e4..995769f234 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c @@ -1,25 +1,25 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/argv.h" @@ -255,7 +255,7 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata, for (n=0; n < ndirs; n++) { PMIX_INFO_XFER(&cd->directives[n], (pmix_info_t*)&directives[n]); } - PMIX_INFO_LOAD(&cd->directives[ndirs], PMIX_LOG_SOURCE, &source, PMIX_PROC); + PMIX_INFO_LOAD(&cd->directives[ndirs], PMIX_LOG_SOURCE, source, PMIX_PROC); /* call down to process the request - the various components * will thread shift as required */ rc = pmix_plog.log(source, data, ndata, cd->directives, cd->ndirs, localcbfunc, cd); @@ -263,8 +263,7 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata, PMIX_INFO_FREE(cd->directives, cd->ndirs); PMIX_RELEASE(cd); } - } else if (0 == strncmp(source->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN) && - source->rank == pmix_globals.myid.rank) { + } else if (PMIX_CHECK_PROCID(source, &pmix_globals.myid)) { /* if I am the recorded source, then this is a re-submission of * something that got "upcalled" by a prior call. In this case, * we return a "not supported" error as clearly we couldn't diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c index d4a944cb04..df91b1f497 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c @@ -1,25 +1,25 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/argv.h" @@ -27,7 +27,7 @@ #include "src/util/name_fns.h" #include "src/util/output.h" #include "src/mca/bfrops/bfrops.h" -#include "src/mca/ptl/ptl.h" +#include "src/mca/ptl/base/base.h" #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" @@ -107,7 +107,7 @@ static void query_cbfunc(struct pmix_peer_t *peer, complete: pmix_output_verbose(2, pmix_globals.debug_output, - "pmix:query cback from server releasing"); + "pmix:query cback from server releasing with status %s", PMIx_Error_string(results->status)); /* release the caller */ if (NULL != cd->cbfunc) { cd->cbfunc(results->status, results->info, results->ninfo, cd->cbdata, relcbfunc, results); @@ -115,179 +115,14 @@ static void query_cbfunc(struct pmix_peer_t *peer, PMIX_RELEASE(cd); } -static void _local_relcb(void *cbdata) -{ - pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; - PMIX_RELEASE(cd); -} - -static void _local_cbfunc(int sd, short args, void *cbdata) -{ - pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; - if (NULL != cd->cbfunc) { - cd->cbfunc(cd->status, cd->info, cd->ninfo, cd->cbdata, _local_relcb, cd); - return; - } - PMIX_RELEASE(cd); -} - -PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries, - pmix_info_cbfunc_t cbfunc, void *cbdata) - +static pmix_status_t request_help(pmix_query_t queries[], size_t nqueries, + pmix_info_cbfunc_t cbfunc, void *cbdata) { pmix_query_caddy_t *cd; pmix_cmd_t cmd = PMIX_QUERY_CMD; pmix_buffer_t *msg; pmix_status_t rc; - pmix_cb_t cb; - size_t n, p; - pmix_list_t results; - pmix_kval_t *kv, *kvnxt; - pmix_proc_t proc; - bool rank_given; - PMIX_ACQUIRE_THREAD(&pmix_global_lock); - - pmix_output_verbose(2, pmix_globals.debug_output, - "pmix:query non-blocking"); - - if (pmix_globals.init_cntr <= 0) { - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_INIT; - } - - if (0 == nqueries || NULL == queries) { - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_BAD_PARAM; - } - - /* do a quick check of the qualifiers array to ensure - * the nqual field has been set */ - for (n=0; n < nqueries; n++) { - if (NULL != queries[n].qualifiers && 0 == queries[n].nqual) { - /* look for the info marked as "end" */ - p = 0; - while (!(PMIX_INFO_IS_END(&queries[n].qualifiers[p])) && p < SIZE_MAX) { - ++p; - } - if (SIZE_MAX == p) { - /* nothing we can do */ - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_BAD_PARAM; - } - queries[n].nqual = p; - } - } - - /* setup the list of local results */ - PMIX_CONSTRUCT(&results, pmix_list_t); - - /* check the directives to see if they want us to refresh - * the local cached results - if we wanted to optimize this - * more, we would check each query and allow those that don't - * want to be refreshed to be executed locally, and those that - * did would be sent to the host. However, for now we simply - * */ - memset(proc.nspace, 0, PMIX_MAX_NSLEN+1); - proc.rank = PMIX_RANK_INVALID; - for (n=0; n < nqueries; n++) { - rank_given = false; - for (p=0; p < queries[n].nqual; p++) { - if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_QUERY_REFRESH_CACHE)) { - if (PMIX_INFO_TRUE(&queries[n].qualifiers[p])) { - PMIX_LIST_DESTRUCT(&results); - goto query; - } - } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_PROCID)) { - PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.proc->nspace); - proc.rank = queries[n].qualifiers[p].value.data.proc->rank; - rank_given = true; - } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_NSPACE)) { - PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.string); - } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_RANK)) { - proc.rank = queries[n].qualifiers[p].value.data.rank; - rank_given = true; - } - } - /* we get here if a refresh isn't required - first try a local - * "get" on the data to see if we already have it */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - cb.copy = false; - /* if they are querying about node or app values not directly - * associated with a proc (i.e., they didn't specify the proc), - * then we obtain those by leaving the proc info as undefined */ - if (!rank_given) { - proc.rank = PMIX_RANK_UNDEF; - cb.proc = &proc; - } else { - /* set the proc */ - if (PMIX_RANK_INVALID == proc.rank && - 0 == strlen(proc.nspace)) { - /* use our id */ - cb.proc = &pmix_globals.myid; - } else { - if (0 == strlen(proc.nspace)) { - /* use our nspace */ - PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace); - } - if (PMIX_RANK_INVALID == proc.rank) { - /* user the wildcard rank */ - proc.rank = PMIX_RANK_WILDCARD; - } - cb.proc = &proc; - } - } - for (p=0; NULL != queries[n].keys[p]; p++) { - cb.key = queries[n].keys[p]; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS != rc) { - /* needs to be passed to the host */ - PMIX_LIST_DESTRUCT(&results); - PMIX_DESTRUCT(&cb); - goto query; - } - /* need to retain this result */ - PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &cb.kvs, pmix_kval_t) { - pmix_list_remove_item(&cb.kvs, &kv->super); - pmix_list_append(&results, &kv->super); - } - PMIX_DESTRUCT(&cb); - } - } - - /* if we get here, then all queries were completely locally - * resolved, so construct the results for return */ - cd = PMIX_NEW(pmix_query_caddy_t); - cd->cbfunc = cbfunc; - cd->cbdata = cbdata; - cd->status = PMIX_SUCCESS; - cd->ninfo = pmix_list_get_size(&results); - PMIX_INFO_CREATE(cd->info, cd->ninfo); - n = 0; - PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &results, pmix_kval_t) { - PMIX_LOAD_KEY(cd->info[n].key, kv->key); - rc = pmix_value_xfer(&cd->info[n].value, kv->value); - if (PMIX_SUCCESS != rc) { - cd->status = rc; - PMIX_INFO_FREE(cd->info, cd->ninfo); - break; - } - ++n; - } - /* done with the list of results */ - PMIX_LIST_DESTRUCT(&results); - /* we need to thread-shift as we are not allowed to - * execute the callback function prior to returning - * from the API */ - PMIX_THREADSHIFT(cd, _local_cbfunc); - /* regardless of the result of the query, we return - * PMIX_SUCCESS here to indicate that the operation - * was accepted for processing */ - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_SUCCESS; - - - query: /* if we are the server, then we just issue the query and * return the response */ if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && @@ -350,6 +185,212 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque PMIX_RELEASE(cd); } return rc; + +} + +static void _local_relcb(void *cbdata) +{ + pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; + + if (NULL != cd->info) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + } + PMIX_RELEASE(cd); +} + +static void localquery(int sd, short args, void *cbdata) +{ + pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; + pmix_query_t *queries = cd->queries; + size_t nqueries = cd->nqueries; + pmix_status_t rc; + pmix_cb_t cb; + size_t n, p; + pmix_list_t results; + pmix_kval_t *kv, *kvnxt; + pmix_proc_t proc; + bool rank_given = false; + + /* setup the list of local results */ + PMIX_CONSTRUCT(&results, pmix_list_t); + + for (n=0; n < nqueries; n++) { + PMIX_LOAD_PROCID(&proc, NULL, PMIX_RANK_INVALID); + for (p=0; p < queries[n].nqual; p++) { + if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_PROCID)) { + PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.proc->nspace); + proc.rank = queries[n].qualifiers[p].value.data.proc->rank; + rank_given = true; + } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_NSPACE)) { + PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.string); + } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_RANK)) { + proc.rank = queries[n].qualifiers[p].value.data.rank; + rank_given = true; + } + } + + /* first try a local "get" on the data to see if we already have it */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.copy = false; + /* if they are querying about node or app values not directly + * associated with a proc (i.e., they didn't specify the proc), + * then we obtain those by leaving the proc info as undefined */ + if (!rank_given) { + proc.rank = PMIX_RANK_UNDEF; + cb.proc = &proc; + } else { + /* set the proc */ + if (PMIX_RANK_INVALID == proc.rank && + 0 == strlen(proc.nspace)) { + /* use our id */ + cb.proc = &pmix_globals.myid; + } else { + if (0 == strlen(proc.nspace)) { + /* use our nspace */ + PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace); + } + if (PMIX_RANK_INVALID == proc.rank) { + /* user the wildcard rank */ + proc.rank = PMIX_RANK_WILDCARD; + } + cb.proc = &proc; + } + } + + /* first see if we already have this info */ + for (p=0; NULL != queries[n].keys[p]; p++) { + cb.key = queries[n].keys[p]; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS != rc) { + /* not in our gds */ + PMIX_DESTRUCT(&cb); + goto nextstep; + } + /* need to retain this result */ + PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &cb.kvs, pmix_kval_t) { + pmix_list_remove_item(&cb.kvs, &kv->super); + pmix_list_append(&results, &kv->super); + } + PMIX_DESTRUCT(&cb); + } + } + + nextstep: + if (PMIX_OPERATION_SUCCEEDED == rc) { + /* if we get here, then all queries were locally + * resolved, so construct the results for return */ + cd->status = PMIX_SUCCESS; + cd->ninfo = pmix_list_get_size(&results); + if (0 < cd->ninfo) { + PMIX_INFO_CREATE(cd->info, cd->ninfo); + n = 0; + PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &results, pmix_kval_t) { + PMIX_LOAD_KEY(cd->info[n].key, kv->key); + rc = pmix_value_xfer(&cd->info[n].value, kv->value); + if (PMIX_SUCCESS != rc) { + cd->status = rc; + PMIX_INFO_FREE(cd->info, cd->ninfo); + break; + } + ++n; + } + } + /* done with the list of results */ + PMIX_LIST_DESTRUCT(&results); + + if (NULL != cd->cbfunc) { + cd->cbfunc(cd->status, cd->info, cd->ninfo, cd->cbdata, _local_relcb, cd); + } + } else if (PMIX_SUCCESS != rc) { + /* need to ask our host */ + rc = request_help(cd->queries, cd->nqueries, cd->cbfunc, cd->cbdata); + if (PMIX_SUCCESS != rc) { + /* we have to return the error to the caller */ + if (NULL != cd->cbfunc) { + cd->cbfunc(rc, NULL, 0, cd->cbdata, NULL, NULL); + } + } + PMIX_RELEASE(cd); + return; + } + + /* get here if the query returned PMIX_SUCCESS, which means + * that the query is being processed and will call the cbfunc + * when complete */ +} + +PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries, + pmix_info_cbfunc_t cbfunc, void *cbdata) + +{ + pmix_query_caddy_t *cd; + pmix_status_t rc; + size_t n, p; + + PMIX_ACQUIRE_THREAD(&pmix_global_lock); + + pmix_output_verbose(2, pmix_globals.debug_output, + "pmix:query non-blocking"); + + if (pmix_globals.init_cntr <= 0) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_INIT; + } + PMIX_RELEASE_THREAD(&pmix_global_lock); + + if (0 == nqueries || NULL == queries) { + return PMIX_ERR_BAD_PARAM; + } + + /* do a quick check of the qualifiers arrays to ensure + * the nqual field has been set */ + for (n=0; n < nqueries; n++) { + if (NULL != queries[n].qualifiers && 0 == queries[n].nqual) { + /* look for the info marked as "end" */ + p = 0; + while (!(PMIX_INFO_IS_END(&queries[n].qualifiers[p])) && p < SIZE_MAX) { + ++p; + } + if (SIZE_MAX == p) { + /* nothing we can do */ + return PMIX_ERR_BAD_PARAM; + } + queries[n].nqual = p; + } + } + + /* check the directives to see if they want us to refresh + * the local cached results - if we wanted to optimize this + * more, we would check each query and allow those that don't + * want to be refreshed to be executed locally, and those that + * did would be sent to the host. However, for now we simply + * assume that any requirement to refresh will force all to + * do so */ + for (n=0; n < nqueries; n++) { + for (p=0; p < queries[n].nqual; p++) { + if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_QUERY_REFRESH_CACHE)) { + if (PMIX_INFO_TRUE(&queries[n].qualifiers[p])) { + /* need to refresh the cache from our host */ + rc = request_help(queries, nqueries, cbfunc, cbdata); + return rc; + } + } + } + } + + /* we get here if a refresh isn't required - need to + * threadshift this to access our internal data */ + cd = PMIX_NEW(pmix_query_caddy_t); + cd->queries = queries; + cd->nqueries = nqueries; + cd->cbfunc = cbfunc; + cd->cbdata = cbdata; + PMIX_THREADSHIFT(cd, localquery); + /* regardless of the result of the query, we return + * PMIX_SUCCESS here to indicate that the operation + * was accepted for processing */ + + return PMIX_SUCCESS; } static void acb(pmix_status_t status, diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c index 995f45bddd..d2c34703de 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c @@ -1,25 +1,25 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c index 48a2d5c7a1..7e69ac2068 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -21,7 +21,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STRING_H @@ -33,8 +33,7 @@ #include #endif -#include -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" @@ -230,6 +229,16 @@ PMIX_EXPORT const char* pmix_command_string(pmix_cmd_t cmd) return "IOF PUSH"; case PMIX_IOF_PULL_CMD: return "IOF PULL"; + case PMIX_GROUP_CONSTRUCT_CMD: + return "GROUP CONSTRUCT"; + case PMIX_GROUP_JOIN_CMD: + return "GROUP JOIN"; + case PMIX_GROUP_INVITE_CMD: + return "GROUP INVITE"; + case PMIX_GROUP_LEAVE_CMD: + return "GROUP LEAVE"; + case PMIX_GROUP_DESTRUCT_CMD: + return "GROUP DESTRUCT"; default: return "UNKNOWN"; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h index abfd05f96f..20a75b88ff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h @@ -10,7 +10,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,11 +22,11 @@ #ifndef PMIX_EVENT_H #define PMIX_EVENT_H -#include +#include "src/include/pmix_config.h" #include "src/include/types.h" #include PMIX_EVENT_HEADER -#include +#include "include/pmix_common.h" #include "src/class/pmix_list.h" #include "src/util/output.h" @@ -122,6 +123,7 @@ typedef struct pmix_event_chain_t { bool timer_active; bool nondefault; bool endchain; + bool cached; pmix_proc_t source; pmix_data_range_t range; /* When generating events, callers can specify @@ -147,30 +149,30 @@ PMIX_CLASS_DECLARATION(pmix_event_chain_t); /* prepare a chain for processing by cycling across provided * info structs and translating those supported by the event * system into the chain object*/ -pmix_status_t pmix_prep_event_chain(pmix_event_chain_t *chain, - const pmix_info_t *info, size_t ninfo, - bool xfer); +PMIX_EXPORT pmix_status_t pmix_prep_event_chain(pmix_event_chain_t *chain, + const pmix_info_t *info, size_t ninfo, + bool xfer); /* invoke the error handler that is registered against the given * status, passing it the provided info on the procs that were * affected, plus any additional info provided by the server */ -void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain); +PMIX_EXPORT void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain); -bool pmix_notify_check_range(pmix_range_trkr_t *rng, - const pmix_proc_t *proc); +PMIX_EXPORT bool pmix_notify_check_range(pmix_range_trkr_t *rng, + const pmix_proc_t *proc); -bool pmix_notify_check_affected(pmix_proc_t *interested, size_t ninterested, - pmix_proc_t *affected, size_t naffected); +PMIX_EXPORT bool pmix_notify_check_affected(pmix_proc_t *interested, size_t ninterested, + pmix_proc_t *affected, size_t naffected); /* invoke the server event notification handler */ -pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, - const pmix_proc_t *source, - pmix_data_range_t range, - const pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, + const pmix_proc_t *source, + pmix_data_range_t range, + const pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); -void pmix_event_timeout_cb(int fd, short flags, void *arg); +PMIX_EXPORT void pmix_event_timeout_cb(int fd, short flags, void *arg); #define PMIX_REPORT_EVENT(e, p, r, f) \ do { \ @@ -246,8 +248,11 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg); ch->info = info; \ ch->ninfo = ninfo - 2; \ /* reset the timer */ \ - pmix_event_del(&ch->ev); \ + if (ch->timer_active) { \ + pmix_event_del(&ch->ev); \ + } \ PMIX_POST_OBJECT(ch); \ + ch->timer_active = true; \ pmix_event_add(&ch->ev, &pmix_globals.event_window); \ } \ } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index 3f59e6a881..04c9647809 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -11,15 +11,15 @@ * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/error.h" +#include "src/util/name_fns.h" #include "src/util/output.h" #include "src/mca/bfrops/bfrops.h" @@ -71,7 +71,7 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, } /* if we aren't connected, don't attempt to send */ - if (!pmix_globals.connected) { + if (!pmix_globals.connected && PMIX_RANGE_PROC_LOCAL != range) { PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_UNREACH; } @@ -93,6 +93,7 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, static void notify_event_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, pmix_buffer_t *buf, void *cbdata) { + (void)hdr; pmix_status_t rc, ret; int32_t cnt = 1; pmix_cb_t *cb = (pmix_cb_t*)cbdata; @@ -110,7 +111,7 @@ static void notify_event_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, PMIX_RELEASE(cb); } -static pmix_status_t notify_event_cache(pmix_notify_caddy_t *cd) +pmix_status_t pmix_notify_event_cache(pmix_notify_caddy_t *cd) { pmix_status_t rc; int j; @@ -219,8 +220,12 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, /* setup for our own local callbacks */ chain = PMIX_NEW(pmix_event_chain_t); chain->status = status; - pmix_strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); - chain->source.rank = pmix_globals.myid.rank; + chain->range = range; + if (NULL == source) { + PMIX_LOAD_PROCID(&chain->source, pmix_globals.myid.nspace, pmix_globals.myid.rank); + } else { + PMIX_LOAD_PROCID(&chain->source, source->nspace, source->rank); + } /* we always leave space for event hdlr name and a callback object */ chain->nallocated = ninfo + 2; PMIX_INFO_CREATE(chain->info, chain->nallocated); @@ -231,14 +236,8 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, * ourselves should someone later register for it */ cd = PMIX_NEW(pmix_notify_caddy_t); cd->status = status; - if (NULL == source) { - pmix_strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN); - cd->source.rank = PMIX_RANK_UNDEF; - } else { - pmix_strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN); - cd->source.rank = source->rank; - } - cd->range = range; + PMIX_LOAD_PROCID(&cd->source, chain->source.nspace, chain->source.rank); + cd->range = chain->range; if (0 < chain->ninfo) { cd->ninfo = chain->ninfo; PMIX_INFO_CREATE(cd->info, cd->ninfo); @@ -264,12 +263,13 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); } /* cache it */ - rc = notify_event_cache(cd); + rc = pmix_notify_event_cache(cd); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(cd); goto cleanup; } + chain->cached = true; if (PMIX_RANGE_PROC_LOCAL != range && NULL != msg) { /* create a callback object as we need to pass it to the @@ -327,6 +327,10 @@ static void progress_local_event_hdlr(pmix_status_t status, pmix_list_item_t *item; pmix_event_hdlr_t *nxt; + pmix_output_verbose(2, pmix_client_globals.event_output, + "%s progressing local event", + PMIX_NAME_PRINT(&pmix_globals.myid)); + /* aggregate the results per RFC0018 - first search the * prior chained results to see if any keys have been NULL'd * as this indicates that info struct should be removed */ @@ -620,8 +624,8 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) bool found; pmix_output_verbose(2, pmix_client_globals.event_output, - "%s:%d invoke_local_event_hdlr for status %s", - pmix_globals.myid.nspace, pmix_globals.myid.rank, + "%s invoke_local_event_hdlr for status %s", + PMIX_NAME_PRINT(&pmix_globals.myid), PMIx_Error_string(chain->status)); /* sanity check */ @@ -629,6 +633,9 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) /* should never happen as space must always be * reserved for handler name and callback object*/ rc = PMIX_ERR_BAD_PARAM; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto complete; } @@ -636,15 +643,25 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) if (NULL != chain->targets) { found = false; for (i=0; i < chain->ntargets; i++) { + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s CHECKING TARGET %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_NAME_PRINT(&chain->targets[i])); if (PMIX_CHECK_PROCID(&chain->targets[i], &pmix_globals.myid)) { found = true; break; } } if (!found) { + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto complete; } } + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); /* if we registered a "first" handler, and it fits the given range, * then invoke it first */ @@ -656,6 +673,9 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) chain->affected, chain->naffected)) { /* invoke the handler */ chain->evhdlr = pmix_globals.events.first; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } else if (NULL != pmix_globals.events.first->codes) { /* need to check if this code is included in the array */ @@ -671,6 +691,9 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) if (found && pmix_notify_check_range(&pmix_globals.events.first->rng, &chain->source)) { /* invoke the handler */ chain->evhdlr = pmix_globals.events.first; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } else { @@ -678,11 +701,17 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) if (pmix_notify_check_range(&pmix_globals.events.first->rng, &chain->source)) { /* invoke the handler */ chain->evhdlr = pmix_globals.events.first; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } /* get here if there is no match, so fall thru */ } + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); /* cycle thru the single-event registrations first */ PMIX_LIST_FOREACH(evhdlr, &pmix_globals.events.single_events, pmix_event_hdlr_t) { @@ -692,6 +721,9 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) chain->affected, chain->naffected)) { /* invoke the handler */ chain->evhdlr = evhdlr; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } @@ -707,11 +739,17 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) chain->affected, chain->naffected)) { /* invoke the handler */ chain->evhdlr = evhdlr; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } } } + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); /* if they didn't want it to go to a default handler, then ignore them */ if (!chain->nondefault) { @@ -722,6 +760,9 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) chain->affected, chain->naffected)) { /* invoke the handler */ chain->evhdlr = evhdlr; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } @@ -737,23 +778,37 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) if (1 == pmix_globals.events.last->ncodes && pmix_globals.events.last->codes[0] == chain->status) { chain->evhdlr = pmix_globals.events.last; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } else if (NULL != pmix_globals.events.last->codes) { /* need to check if this code is included in the array */ for (i=0; i < pmix_globals.events.last->ncodes; i++) { if (pmix_globals.events.last->codes[i] == chain->status) { chain->evhdlr = pmix_globals.events.last; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } } else { /* gets run for all codes */ chain->evhdlr = pmix_globals.events.last; + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); goto invk; } } + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + + __FILE__, __LINE__); /* if we got here, then nothing was found */ + rc = PMIX_ERR_NOT_FOUND; complete: /* we still have to call their final callback */ @@ -766,6 +821,9 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) invk: + pmix_output_verbose(8, pmix_client_globals.event_output, + "%s %s:%d", PMIX_NAME_PRINT(&pmix_globals.myid), + __FILE__, __LINE__); /* start with the chain holding only the given info */ chain->ninfo = chain->nallocated - 2; @@ -806,6 +864,8 @@ static void local_cbfunc(pmix_status_t status, void *cbdata) static void _notify_client_event(int sd, short args, void *cbdata) { + (void)sd; + (void)args; pmix_notify_caddy_t *cd = (pmix_notify_caddy_t*)cbdata; pmix_regevents_info_t *reginfoptr; pmix_peer_events_info_t *pr; @@ -849,7 +909,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) * the message until all local procs have received it, or it ages to * the point where it gets pushed out by more recent events */ PMIX_RETAIN(cd); - rc = notify_event_cache(cd); + rc = pmix_notify_event_cache(cd); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } @@ -859,8 +919,10 @@ static void _notify_client_event(int sd, short args, void *cbdata) * against our registrations */ chain = PMIX_NEW(pmix_event_chain_t); chain->status = cd->status; - pmix_strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN); - chain->source.rank = cd->source.rank; + if (holdcd) { + chain->cached = true; + } + PMIX_LOAD_PROCID(&chain->source, cd->source.nspace, cd->source.rank); /* we always leave space for a callback object and * the evhandler name. */ chain->nallocated = cd->ninfo + 2; @@ -1095,15 +1157,6 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, "pmix_server: notify client of event %s", PMIx_Error_string(status)); - if (NULL != info) { - for (n=0; n < ninfo; n++) { - if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_PROXY) && - PMIX_CHECK_PROCID(info[n].value.data.proc, &pmix_globals.myid)) { - return PMIX_OPERATION_SUCCEEDED; - } - } - } - cd = PMIX_NEW(pmix_notify_caddy_t); cd->status = status; if (NULL == source) { @@ -1212,6 +1265,8 @@ bool pmix_notify_check_affected(pmix_proc_t *interested, size_t ninterested, void pmix_event_timeout_cb(int fd, short flags, void *arg) { + (void)fd; + (void)flags; pmix_event_chain_t *ch = (pmix_event_chain_t*)arg; /* need to acquire the object from its originating thread */ @@ -1374,6 +1429,7 @@ static void chcon(pmix_event_chain_t *p) p->source.rank = PMIX_RANK_UNDEF; p->nondefault = false; p->endchain = false; + p->cached = false; p->targets = NULL; p->ntargets = 0; p->range = PMIX_RANGE_UNDEF; diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c index 4ba4d72f1c..092eefca48 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -9,12 +9,11 @@ * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/util/error.h" @@ -30,6 +29,8 @@ pmix_object_t super; volatile bool active; pmix_event_t ev; + pmix_lock_t lock; + pmix_status_t status; size_t index; bool firstoverall; bool enviro; @@ -48,6 +49,7 @@ } pmix_rshift_caddy_t; static void rscon(pmix_rshift_caddy_t *p) { + PMIX_CONSTRUCT_LOCK(&p->lock); p->firstoverall = false; p->enviro = false; p->list = NULL; @@ -65,6 +67,7 @@ static void rscon(pmix_rshift_caddy_t *p) } static void rsdes(pmix_rshift_caddy_t *p) { + PMIX_DESTRUCT_LOCK(&p->lock); if (0 < p->ncodes) { free(p->codes); } @@ -118,12 +121,12 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, } /* call the callback */ - if (NULL != cd && NULL != cd->evregcbfn) { - cd->evregcbfn(ret, index, cd->cbdata); - } if (NULL != cd) { /* check this event against anything in our cache */ check_cached_events(cd); + if (NULL != cd->evregcbfn) { + cd->evregcbfn(ret, index, cd->cbdata); + } } /* release any info we brought along as they are @@ -516,8 +519,22 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) } else if (0 == strncmp(cd->info[n].key, PMIX_RANGE, PMIX_MAX_KEYLEN)) { range = cd->info[n].value.data.range; } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_CUSTOM_RANGE, PMIX_MAX_KEYLEN)) { - parray = (pmix_proc_t*)cd->info[n].value.data.darray->array; - nprocs = cd->info[n].value.data.darray->size; + /* provides an array of pmix_proc_t identifying the procs + * that are to receive this notification, or a single pmix_proc_t */ + if (PMIX_DATA_ARRAY == cd->info[n].value.type && + NULL != cd->info[n].value.data.darray && + NULL != cd->info[n].value.data.darray->array) { + parray = (pmix_proc_t*)cd->info[n].value.data.darray->array; + nprocs = cd->info[n].value.data.darray->size; + } else if (PMIX_PROC == cd->info[n].value.type && + NULL != cd->info[n].value.data.proc) { + parray = cd->info[n].value.data.proc; + nprocs = 1; + } else { + /* this is an error */ + rc = PMIX_ERR_BAD_PARAM; + goto ack; + } } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { cd->affected = cd->info[n].value.data.proc; cd->naffected = 1; @@ -617,28 +634,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) cd->list = NULL; cd->hdlr = evhdlr; cd->firstoverall = firstoverall; - rc = _add_hdlr(cd, &xfer); - PMIX_LIST_DESTRUCT(&xfer); - if (PMIX_SUCCESS != rc && - PMIX_ERR_WOULD_BLOCK != rc) { - /* unable to register */ - --pmix_globals.events.nhdlrs; - rc = PMIX_ERR_EVENT_REGISTRATION; - index = UINT_MAX; - if (firstoverall) { - pmix_globals.events.first = NULL; - } else { - pmix_globals.events.last = NULL; - } - PMIX_RELEASE(evhdlr); - goto ack; - } - if (PMIX_ERR_WOULD_BLOCK == rc) { - /* the callback will provide our response */ - PMIX_RELEASE(cd); - return; - } - goto ack; + goto addtolist; } /* get here if this isn't an overall first or last event - start @@ -705,6 +701,109 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) cd->index = index; cd->hdlr = evhdlr; cd->firstoverall = false; + + addtolist: + if (NULL != cd->list) { + /* now add this event to the appropriate list - if the registration + * subsequently fails, it will be removed */ + + /* if the list is empty, or no location was specified, just put this on it */ + if (0 == pmix_list_get_size(cd->list) || + PMIX_EVENT_ORDER_NONE == location) { + pmix_list_prepend(cd->list, &evhdlr->super); + } else if (PMIX_EVENT_ORDER_FIRST == location) { + /* see if the first handler on the list was also declared as "first" */ + ev = (pmix_event_hdlr_t*)pmix_list_get_first(cd->list); + if (PMIX_EVENT_ORDER_FIRST == ev->precedence) { + /* this is an error */ + --pmix_globals.events.nhdlrs; + rc = PMIX_ERR_EVENT_REGISTRATION; + index = UINT_MAX; + PMIX_RELEASE(evhdlr); + goto ack; + } + /* prepend it to the list */ + pmix_list_prepend(cd->list, &evhdlr->super); + } else if (PMIX_EVENT_ORDER_LAST == location) { + /* see if the last handler on the list was also declared as "last" */ + ev = (pmix_event_hdlr_t*)pmix_list_get_last(cd->list); + if (PMIX_EVENT_ORDER_LAST == ev->precedence) { + /* this is an error */ + --pmix_globals.events.nhdlrs; + rc = PMIX_ERR_EVENT_REGISTRATION; + index = UINT_MAX; + PMIX_RELEASE(evhdlr); + goto ack; + } + /* append it to the list */ + pmix_list_append(cd->list, &evhdlr->super); + } else if (PMIX_EVENT_ORDER_PREPEND == location) { + /* we know the list isn't empty - check the first element to see if + * it is designated to be "first". If so, then we need to put this + * right after it */ + ev = (pmix_event_hdlr_t*)pmix_list_get_first(cd->list); + if (PMIX_EVENT_ORDER_FIRST == ev->precedence) { + ev = (pmix_event_hdlr_t*)pmix_list_get_next(&ev->super); + if (NULL != ev) { + pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); + } else { + /* we are at the end of the list */ + pmix_list_append(cd->list, &evhdlr->super); + } + } else { + pmix_list_prepend(cd->list, &evhdlr->super); + } + } else if (PMIX_EVENT_ORDER_APPEND == location) { + /* we know the list isn't empty - check the last element to see if + * it is designated to be "last". If so, then we need to put this + * right before it */ + ev = (pmix_event_hdlr_t*)pmix_list_get_last(cd->list); + if (PMIX_EVENT_ORDER_LAST == ev->precedence) { + pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); + } else { + pmix_list_append(cd->list, &evhdlr->super); + } + } else { + /* find the named event */ + found = false; + PMIX_LIST_FOREACH(ev, cd->list, pmix_event_hdlr_t) { + if (NULL == ev->name) { + continue; + } + if (0 == strcmp(ev->name, name)) { + if (PMIX_EVENT_ORDER_BEFORE == location) { + /* put it before this handler */ + pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); + } else { + /* put it after this handler */ + ev = (pmix_event_hdlr_t*)pmix_list_get_next(&ev->super); + if (NULL != ev) { + pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); + } else { + /* we are at the end of the list */ + pmix_list_append(cd->list, &evhdlr->super); + } + } + found = true; + break; + } + } + /* if the handler wasn't found, then we return an error. At some + * future time, we may change this behavior and cache this handler + * until the reference one has been registered. However, this could + * turn out to be a laborious search procedure as the reference + * event handler may in turn be dependent on another handler, etc. */ + if (!found) { + /* this is an error */ + --pmix_globals.events.nhdlrs; + rc = PMIX_ERR_EVENT_REGISTRATION; + index = UINT_MAX; + PMIX_RELEASE(evhdlr); + goto ack; + } + } + } + /* tell the server about it, if necessary - any actions * will be deferred until after this event completes */ if (PMIX_RANGE_PROC_LOCAL == range) { @@ -719,106 +818,14 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) --pmix_globals.events.nhdlrs; rc = PMIX_ERR_EVENT_REGISTRATION; index = UINT_MAX; + if (firstoverall) { + pmix_globals.events.first = NULL; + } else if (lastoverall) { + pmix_globals.events.last = NULL; + } else if (NULL != cd->list) { + pmix_list_remove_item(cd->list, &evhdlr->super); + } PMIX_RELEASE(evhdlr); - goto ack; - } - /* now add this event to the appropriate list - if the registration - * subsequently fails, it will be removed */ - - /* if the list is empty, or no location was specified, just put this on it */ - if (0 == pmix_list_get_size(cd->list) || - PMIX_EVENT_ORDER_NONE == location) { - pmix_list_prepend(cd->list, &evhdlr->super); - } else if (PMIX_EVENT_ORDER_FIRST == location) { - /* see if the first handler on the list was also declared as "first" */ - ev = (pmix_event_hdlr_t*)pmix_list_get_first(cd->list); - if (PMIX_EVENT_ORDER_FIRST == ev->precedence) { - /* this is an error */ - --pmix_globals.events.nhdlrs; - rc = PMIX_ERR_EVENT_REGISTRATION; - index = UINT_MAX; - PMIX_RELEASE(evhdlr); - goto ack; - } - /* prepend it to the list */ - pmix_list_prepend(cd->list, &evhdlr->super); - } else if (PMIX_EVENT_ORDER_LAST == location) { - /* see if the last handler on the list was also declared as "last" */ - ev = (pmix_event_hdlr_t*)pmix_list_get_last(cd->list); - if (PMIX_EVENT_ORDER_LAST == ev->precedence) { - /* this is an error */ - --pmix_globals.events.nhdlrs; - rc = PMIX_ERR_EVENT_REGISTRATION; - index = UINT_MAX; - PMIX_RELEASE(evhdlr); - goto ack; - } - /* append it to the list */ - pmix_list_append(cd->list, &evhdlr->super); - } else if (PMIX_EVENT_ORDER_PREPEND == location) { - /* we know the list isn't empty - check the first element to see if - * it is designated to be "first". If so, then we need to put this - * right after it */ - ev = (pmix_event_hdlr_t*)pmix_list_get_first(cd->list); - if (PMIX_EVENT_ORDER_FIRST == ev->precedence) { - ev = (pmix_event_hdlr_t*)pmix_list_get_next(&ev->super); - if (NULL != ev) { - pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); - } else { - /* we are at the end of the list */ - pmix_list_append(cd->list, &evhdlr->super); - } - } else { - pmix_list_prepend(cd->list, &evhdlr->super); - } - } else if (PMIX_EVENT_ORDER_APPEND == location) { - /* we know the list isn't empty - check the last element to see if - * it is designated to be "last". If so, then we need to put this - * right before it */ - ev = (pmix_event_hdlr_t*)pmix_list_get_last(cd->list); - if (PMIX_EVENT_ORDER_LAST == ev->precedence) { - pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); - } else { - pmix_list_append(cd->list, &evhdlr->super); - } - } else { - /* find the named event */ - found = false; - PMIX_LIST_FOREACH(ev, cd->list, pmix_event_hdlr_t) { - if (NULL == ev->name) { - continue; - } - if (0 == strcmp(ev->name, name)) { - if (PMIX_EVENT_ORDER_BEFORE == location) { - /* put it before this handler */ - pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); - } else { - /* put it after this handler */ - ev = (pmix_event_hdlr_t*)pmix_list_get_next(&ev->super); - if (NULL != ev) { - pmix_list_insert_pos(cd->list, &ev->super, &evhdlr->super); - } else { - /* we are at the end of the list */ - pmix_list_append(cd->list, &evhdlr->super); - } - } - found = true; - break; - } - } - /* if the handler wasn't found, then we return an error. At some - * future time, we may change this behavior and cache this handler - * until the reference one has been registered. However, this could - * turn out to be a laborious search procedure as the reference - * event handler may in turn be dependent on another handler, etc. */ - if (!found) { - /* this is an error */ - --pmix_globals.events.nhdlrs; - rc = PMIX_ERR_EVENT_REGISTRATION; - index = UINT_MAX; - PMIX_RELEASE(evhdlr); - goto ack; - } } if (PMIX_ERR_WOULD_BLOCK == rc) { /* the callback will provide our response */ @@ -827,12 +834,6 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) } ack: - /* acknowledge the registration so the caller can release - * their data AND record the event handler index */ - if (NULL != cd->evregcbfn) { - cd->evregcbfn(rc, index, cd->cbdata); - } - /* check if any matching notifications have been locally cached */ check_cached_events(cd); if (NULL != cd->codes) { @@ -840,8 +841,27 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) cd->codes = NULL; } - /* all done */ - PMIX_RELEASE(cd); + /* acknowledge the registration so the caller can release + * their data AND record the event handler index */ + if (NULL != cd->evregcbfn) { + cd->evregcbfn(rc, index, cd->cbdata); + PMIX_RELEASE(cd); + } +} + +static void mycbfn(pmix_status_t status, + size_t refid, + void *cbdata) +{ + pmix_rshift_caddy_t *cd = (pmix_rshift_caddy_t*)cbdata; + + PMIX_ACQUIRE_OBJECT(cd); + if (PMIX_SUCCESS == status) { + cd->status = refid; + } else { + cd->status = status; + } + PMIX_WAKEUP_THREAD(&cd->lock); } PMIX_EXPORT void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncodes, @@ -858,7 +878,7 @@ PMIX_EXPORT void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncode if (pmix_globals.init_cntr <= 0) { PMIX_RELEASE_THREAD(&pmix_global_lock); if (NULL != cbfunc) { - cbfunc(PMIX_ERR_INIT, 0, cbdata); + cbfunc(PMIX_ERR_INIT, SIZE_MAX, cbdata); } return; } @@ -888,13 +908,30 @@ PMIX_EXPORT void PMIx_Register_event_handler(pmix_status_t codes[], size_t ncode cd->info = info; cd->ninfo = ninfo; cd->evhdlr = event_hdlr; - cd->evregcbfn = cbfunc; - cd->cbdata = cbdata; - pmix_output_verbose(2, pmix_client_globals.event_output, - "pmix_register_event_hdlr shifting to progress thread"); + if (NULL != cbfunc) { + pmix_output_verbose(2, pmix_client_globals.event_output, + "pmix_register_event_hdlr shifting to progress thread"); - PMIX_THREADSHIFT(cd, reg_event_hdlr); + cd->evregcbfn = cbfunc; + cd->cbdata = cbdata; + PMIX_THREADSHIFT(cd, reg_event_hdlr); + } else { + cd->evregcbfn = mycbfn; + cd->cbdata = cd; + PMIX_RETAIN(cd); + reg_event_hdlr(0, 0, (void*)cd); + PMIX_WAIT_THREAD(&cd->lock); + if (NULL != cbfunc) { + if (0 > cd->status) { + cbfunc(cd->status, SIZE_MAX, cbdata); + } else { + cbfunc(PMIX_SUCCESS, cd->status, cbdata); + } + } + PMIX_RELEASE(cd); + } + return; } static void dereg_event_hdlr(int sd, short args, void *cbdata) @@ -1085,6 +1122,15 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata) PMIX_RELEASE(cd); } +static void myopcb(pmix_status_t status, void *cbdata) +{ + pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata; + + PMIX_ACQUIRE_OBJECT(cd); + cd->status = status; + PMIX_WAKEUP_THREAD(&cd->lock); +} + PMIX_EXPORT void PMIx_Deregister_event_handler(size_t event_hdlr_ref, pmix_op_cbfunc_t cbfunc, void *cbdata) @@ -1103,11 +1149,19 @@ PMIX_EXPORT void PMIx_Deregister_event_handler(size_t event_hdlr_ref, /* need to thread shift this request */ cd = PMIX_NEW(pmix_shift_caddy_t); - cd->cbfunc.opcbfn = cbfunc; - cd->cbdata = cbdata; + if (NULL == cbfunc) { + cd->cbfunc.opcbfn = myopcb; + PMIX_RETAIN(cd); + cd->cbdata = cd; + } else { + cd->cbfunc.opcbfn = cbfunc; + cd->cbdata = cbdata; + } cd->ref = event_hdlr_ref; pmix_output_verbose(2, pmix_client_globals.event_output, "pmix_deregister_event_hdlr shifting to progress thread"); PMIX_THREADSHIFT(cd, dereg_event_hdlr); + + return; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h index 7468985a04..3f189387cc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h +++ b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h @@ -3,7 +3,7 @@ * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,8 +18,8 @@ #define PMIX_HWLOC_INTERNAL_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #if PMIX_HAVE_HWLOC #include PMIX_HWLOC_HEADER @@ -29,7 +29,7 @@ #define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET #endif -extern hwloc_topology_t pmix_hwloc_topology; +PMIX_EXPORT extern hwloc_topology_t pmix_hwloc_topology; #endif BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c index 14dbae9076..d9a6d0451e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c +++ b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved * Copyright (c) 2017 Inria. All rights reserved. * $COPYRIGHT$ @@ -9,8 +9,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include index 4ab3952e1c..3bc1a068fd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -30,6 +30,9 @@ headers += \ sources += \ include/pmix_globals.c +nodist_headers += \ + include/pmix_config.h + if ! PMIX_EMBEDDED_MODE headers += \ include/align.h \ @@ -47,6 +50,6 @@ headers += \ endif ! PMIX_EMBEDDED_MODE if WANT_INSTALL_HEADERS -nodist_headers += \ +nobase_nodist_pmix_HEADERS = \ include/pmix_config.h endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h index bea74d6e29..a51b8ba981 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h @@ -13,7 +13,7 @@ * Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -359,10 +359,10 @@ including stdint.h */ #define __STDC_LIMIT_MACROS #endif -#include +#include "src/include/pmix_config.h" #include #else -#include +#include "src/include/pmix_stdint.h" #endif /*********************************************************************** diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c index 3fce1389eb..757630c402 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c @@ -6,6 +6,8 @@ * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,11 +17,12 @@ /* THIS FILE IS INCLUDED SOLELY TO INSTANTIATE AND INIT/FINALIZE THE GLOBAL CLASSES */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "include/pmix_common.h" +#include "src/include/types.h" +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" #include "src/include/pmix_globals.h" @@ -42,7 +45,7 @@ #include #endif /* HAVE_DIRENT_H */ -#include +#include "include/pmix_common.h" #include "src/mca/bfrops/bfrops_types.h" #include "src/class/pmix_hash_table.h" @@ -232,7 +235,8 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_peer_t, static void iofreqcon(pmix_iof_req_t *p) { p->requestor = NULL; - p->refid = 0; + p->local_id = 0; + p->remote_id = 0; p->procs = NULL; p->nprocs = 0; p->channels = PMIX_FWD_NO_CHANNELS; @@ -335,6 +339,26 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_info_caddy_t, pmix_list_item_t, NULL, NULL); +static void ifcon(pmix_infolist_t *p) +{ + PMIX_INFO_CONSTRUCT(&p->info); +} +static void ifdes(pmix_infolist_t *p) +{ + PMIX_INFO_DESTRUCT(&p->info); +} +PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_infolist_t, + pmix_list_item_t, + ifcon, ifdes); + +static void qlcon(pmix_querylist_t *p) +{ + PMIX_QUERY_CONSTRUCT(&p->query); +} +PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_querylist_t, + pmix_list_item_t, + qlcon, NULL); + static void qcon(pmix_query_caddy_t *p) { PMIX_CONSTRUCT_LOCK(&p->lock); @@ -345,13 +369,15 @@ static void qcon(pmix_query_caddy_t *p) p->info = NULL; p->ninfo = 0; PMIX_BYTE_OBJECT_CONSTRUCT(&p->bo); + PMIX_CONSTRUCT(&p->results, pmix_list_t); + p->nreplies = 0; + p->nrequests = 0; p->cbfunc = NULL; p->valcbfunc = NULL; p->cbdata = NULL; p->relcbfunc = NULL; p->credcbfunc = NULL; p->validcbfunc = NULL; - PMIX_CONSTRUCT(&p->results, pmix_list_t); } static void qdes(pmix_query_caddy_t *p) { @@ -360,12 +386,52 @@ static void qdes(pmix_query_caddy_t *p) PMIX_PROC_FREE(p->targets, p->ntargets); PMIX_INFO_FREE(p->info, p->ninfo); PMIX_LIST_DESTRUCT(&p->results); - PMIX_QUERY_FREE(p->queries, p->nqueries); } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_query_caddy_t, pmix_object_t, qcon, qdes); +static void ncon(pmix_notify_caddy_t *p) +{ + PMIX_CONSTRUCT_LOCK(&p->lock); +#if defined(__linux__) && PMIX_HAVE_CLOCK_GETTIME + struct timespec tp; + (void) clock_gettime(CLOCK_MONOTONIC, &tp); + p->ts = tp.tv_sec; +#else + /* Fall back to gettimeofday() if we have nothing else */ + struct timeval tv; + gettimeofday(&tv, NULL); + p->ts = tv.tv_sec; +#endif + p->room = -1; + memset(p->source.nspace, 0, PMIX_MAX_NSLEN+1); + p->source.rank = PMIX_RANK_UNDEF; + p->range = PMIX_RANGE_UNDEF; + p->targets = NULL; + p->ntargets = 0; + p->nleft = SIZE_MAX; + p->affected = NULL; + p->naffected = 0; + p->nondefault = false; + p->info = NULL; + p->ninfo = 0; +} +static void ndes(pmix_notify_caddy_t *p) +{ + PMIX_DESTRUCT_LOCK(&p->lock); + if (NULL != p->info) { + PMIX_INFO_FREE(p->info, p->ninfo); + } + PMIX_PROC_FREE(p->affected, p->naffected); + if (NULL != p->targets) { + free(p->targets); + } +} +PMIX_CLASS_INSTANCE(pmix_notify_caddy_t, + pmix_object_t, + ncon, ndes); + void pmix_execute_epilog(pmix_epilog_t *epi) { pmix_cleanup_file_t *cf, *cfnext; @@ -382,6 +448,7 @@ void pmix_execute_epilog(pmix_epilog_t *epi) * some minimum level of protection */ tmp = pmix_argv_split(cf->path, ','); for (n=0; NULL != tmp[n]; n++) { + /* coverity[toctou] */ rc = stat(tmp[n], &statbuf); if (0 != rc) { pmix_output_verbose(10, pmix_globals.debug_output, @@ -415,6 +482,7 @@ void pmix_execute_epilog(pmix_epilog_t *epi) * some minimum level of protection */ tmp = pmix_argv_split(cd->path, ','); for (n=0; NULL != tmp[n]; n++) { + /* coverity[toctou] */ rc = stat(tmp[n], &statbuf); if (0 != rc) { pmix_output_verbose(10, pmix_globals.debug_output, @@ -500,6 +568,7 @@ static void dirpath_destroy(char *path, pmix_cleanup_dir_t *cd, pmix_epilog_t *e /* Check to see if it is a directory */ is_dir = false; + /* coverity[toctou] */ rc = stat(filenm, &buf); if (0 > rc) { /* Handle a race condition. filenm might have been deleted by an diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 9cbcd4a607..d3c82f6726 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -15,6 +15,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,9 +26,8 @@ #ifndef PMIX_GLOBALS_H #define PMIX_GLOBALS_H -#include - -#include +#include "src/include/pmix_config.h" +#include "src/include/types.h" #include #ifdef HAVE_SYS_TYPES_H @@ -35,8 +35,9 @@ #endif #include PMIX_EVENT_HEADER -#include -#include +#include "include/pmix.h" +#include "include/pmix_common.h" +#include "include/pmix_tool.h" #include "src/class/pmix_hash_table.h" #include "src/class/pmix_list.h" @@ -86,31 +87,36 @@ PMIX_CLASS_DECLARATION(pmix_namelist_t); typedef uint8_t pmix_cmd_t; /* define some commands */ -#define PMIX_REQ_CMD 0 -#define PMIX_ABORT_CMD 1 -#define PMIX_COMMIT_CMD 2 -#define PMIX_FENCENB_CMD 3 -#define PMIX_GETNB_CMD 4 -#define PMIX_FINALIZE_CMD 5 -#define PMIX_PUBLISHNB_CMD 6 -#define PMIX_LOOKUPNB_CMD 7 -#define PMIX_UNPUBLISHNB_CMD 8 -#define PMIX_SPAWNNB_CMD 9 -#define PMIX_CONNECTNB_CMD 10 -#define PMIX_DISCONNECTNB_CMD 11 -#define PMIX_NOTIFY_CMD 12 -#define PMIX_REGEVENTS_CMD 13 -#define PMIX_DEREGEVENTS_CMD 14 -#define PMIX_QUERY_CMD 15 -#define PMIX_LOG_CMD 16 -#define PMIX_ALLOC_CMD 17 -#define PMIX_JOB_CONTROL_CMD 18 -#define PMIX_MONITOR_CMD 19 -#define PMIX_GET_CREDENTIAL_CMD 20 -#define PMIX_VALIDATE_CRED_CMD 21 -#define PMIX_IOF_PULL_CMD 22 -#define PMIX_IOF_PUSH_CMD 23 -#define PMIX_IOF_DEREG_CMD 29 +#define PMIX_REQ_CMD 0 +#define PMIX_ABORT_CMD 1 +#define PMIX_COMMIT_CMD 2 +#define PMIX_FENCENB_CMD 3 +#define PMIX_GETNB_CMD 4 +#define PMIX_FINALIZE_CMD 5 +#define PMIX_PUBLISHNB_CMD 6 +#define PMIX_LOOKUPNB_CMD 7 +#define PMIX_UNPUBLISHNB_CMD 8 +#define PMIX_SPAWNNB_CMD 9 +#define PMIX_CONNECTNB_CMD 10 +#define PMIX_DISCONNECTNB_CMD 11 +#define PMIX_NOTIFY_CMD 12 +#define PMIX_REGEVENTS_CMD 13 +#define PMIX_DEREGEVENTS_CMD 14 +#define PMIX_QUERY_CMD 15 +#define PMIX_LOG_CMD 16 +#define PMIX_ALLOC_CMD 17 +#define PMIX_JOB_CONTROL_CMD 18 +#define PMIX_MONITOR_CMD 19 +#define PMIX_GET_CREDENTIAL_CMD 20 +#define PMIX_VALIDATE_CRED_CMD 21 +#define PMIX_IOF_PULL_CMD 22 +#define PMIX_IOF_PUSH_CMD 23 +#define PMIX_GROUP_CONSTRUCT_CMD 24 +#define PMIX_GROUP_JOIN_CMD 25 +#define PMIX_GROUP_INVITE_CMD 26 +#define PMIX_GROUP_LEAVE_CMD 27 +#define PMIX_GROUP_DESTRUCT_CMD 28 +#define PMIX_IOF_DEREG_CMD 29 /* provide a "pretty-print" function for cmds */ const char* pmix_command_string(pmix_cmd_t cmd); @@ -211,7 +217,7 @@ PMIX_CLASS_DECLARATION(pmix_rank_info_t); /* define a very simple caddy for dealing with pmix_info_t - * objects when transferring portions of arrays */ + * and pmix_query_t objects when transferring portions of arrays */ typedef struct { pmix_list_item_t super; pmix_info_t *info; @@ -219,6 +225,18 @@ typedef struct { } pmix_info_caddy_t; PMIX_CLASS_DECLARATION(pmix_info_caddy_t); +typedef struct { + pmix_list_item_t super; + pmix_info_t info; +} pmix_infolist_t; +PMIX_CLASS_DECLARATION(pmix_infolist_t); + +typedef struct { + pmix_list_item_t super; + pmix_query_t query; +} pmix_querylist_t; +PMIX_CLASS_DECLARATION(pmix_querylist_t); + /* object for tracking peers - each peer can have multiple * connections. This can occur if the initial app executes @@ -253,7 +271,8 @@ PMIX_CLASS_DECLARATION(pmix_peer_t); typedef struct { pmix_object_t super; pmix_peer_t *requestor; - size_t refid; + size_t local_id; + size_t remote_id; pmix_proc_t *procs; size_t nprocs; pmix_iof_channel_t channels; @@ -274,8 +293,10 @@ typedef struct { size_t ntargets; pmix_info_t *info; size_t ninfo; - pmix_byte_object_t bo; pmix_list_t results; + size_t nreplies; + size_t nrequests; + pmix_byte_object_t bo; pmix_info_cbfunc_t cbfunc; pmix_value_cbfunc_t valcbfunc; pmix_release_cbfunc_t relcbfunc; @@ -411,6 +432,17 @@ PMIX_CLASS_DECLARATION(pmix_cb_t); pmix_event_active(&((r)->ev), EV_WRITE, 1); \ } while (0) +#define PMIX_TIMED_THREADSHIFT(r, c, t) \ + do { \ + struct timeval _tv = {0, 0}; \ + _tv.tv_sec = (t); \ + pmix_event_evtimer_set(pmix_globals.evbase, \ + &((r)->ev), \ + (c), (r)); \ + PMIX_POST_OBJECT((r)); \ + pmix_event_evtimer_add(&((r)->ev), &_tv); \ + } while (0) + typedef struct { pmix_object_t super; @@ -449,7 +481,9 @@ typedef struct { * handlers can look at it */ pmix_info_t *info; size_t ninfo; + /* allow for a buffer to be carried across internal processing */ pmix_buffer_t *buf; + /* the final callback to be executed upon completion of the event */ pmix_op_cbfunc_t cbfunc; void *cbdata; } pmix_notify_caddy_t; @@ -467,6 +501,8 @@ typedef struct { uid_t uid; // my effective uid gid_t gid; // my effective gid char *hostname; // my hostname + uint32_t appnum; // my appnum + pid_t pid; // my local pid uint32_t nodeid; // my nodeid, if given int pindex; pmix_event_base_t *evbase; @@ -489,8 +525,9 @@ typedef struct { * look them up */ pmix_gds_base_module_t *mygds; /* IOF controls */ - bool tag_output; + bool pushstdin; pmix_list_t stdin_targets; // list of pmix_namelist_t + bool tag_output; bool xml_output; bool timestamp_output; size_t output_limit; @@ -500,6 +537,8 @@ typedef struct { /* provide access to a function to cleanup epilogs */ PMIX_EXPORT void pmix_execute_epilog(pmix_epilog_t *ep); +PMIX_EXPORT pmix_status_t pmix_notify_event_cache(pmix_notify_caddy_t *cd); + PMIX_EXPORT extern pmix_globals_t pmix_globals; PMIX_EXPORT extern pmix_lock_t pmix_global_lock; @@ -508,6 +547,8 @@ static inline bool pmix_check_node_info(const char* key) char *keys[] = { PMIX_LOCAL_PEERS, PMIX_LOCAL_SIZE, + PMIX_NODE_SIZE, + PMIX_LOCALLDR, NULL }; size_t n; @@ -524,6 +565,8 @@ static inline bool pmix_check_app_info(const char* key) { char *keys[] = { PMIX_APP_SIZE, + PMIX_APPLDR, + PMIX_WDIR, NULL }; size_t n; @@ -536,7 +579,6 @@ static inline bool pmix_check_app_info(const char* key) return false; } - END_C_DECLS #endif /* PMIX_GLOBALS_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/prefetch.h b/opal/mca/pmix/pmix3x/pmix/src/include/prefetch.h index 09e581028e..57f631bd56 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/prefetch.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/prefetch.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +20,7 @@ #ifndef PMIX_PREFETCH_H #define PMIX_PREFETCH_H -#include +#include "src/include/pmix_config.h" #if PMIX_C_HAVE_BUILTIN_EXPECT #define PMIX_LIKELY(expression) __builtin_expect(!!(expression), 1) diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/types.h b/opal/mca/pmix/pmix3x/pmix/src/include/types.h index 6b52843ee4..95ae070eef 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/types.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2019 Research Organization for Information Science @@ -24,7 +24,8 @@ #ifndef PMIX_TYPES_H #define PMIX_TYPES_H -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #ifdef HAVE_STDINT_H #include @@ -54,7 +55,6 @@ #endif #include -#include /* diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/base/base.h index 9ba7d2fb49..129f572e6c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/base.h @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,7 +26,7 @@ #ifndef PMIX_MCA_BASE_H #define PMIX_MCA_BASE_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_close.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_close.c index f42c2f038f..6e393052e9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_close.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_close.c @@ -13,7 +13,7 @@ * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,13 +21,13 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/util/output.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_component_repository.h" -#include "pmix_common.h" +#include "include/pmix_common.h" extern int pmix_mca_base_opened; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_cmd_line.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_cmd_line.c index af826b69fc..c5dc6e69ff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_cmd_line.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_cmd_line.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -28,7 +28,7 @@ #include "src/util/pmix_environ.h" #include "src/util/show_help.h" #include "src/mca/base/base.h" -#include "pmix_common.h" +#include "include/pmix_common.h" /* diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_compare.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_compare.c index 8f1fed5e56..2c27d3d438 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_compare.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_compare.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c index 7d96e21c36..155dce901b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c @@ -16,7 +16,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -55,7 +55,7 @@ #include "src/mca/mca.h" #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_component_repository.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/mca/pdl/base/base.h" #if PMIX_HAVE_PDL_SUPPORT diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c index 062b1cb75d..14304291e2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TYPES_H #include #endif @@ -40,7 +40,7 @@ #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_component_repository.h" #include "src/mca/pdl/base/base.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/class/pmix_hash_table.h" #include "src/util/basename.h" #include "src/util/show_help.h" @@ -94,6 +94,7 @@ static pmix_hash_table_t pmix_mca_base_component_repository; static int process_repository_item (const char *filename, void *data) { + (void)data; char name[PMIX_MCA_BASE_MAX_COMPONENT_NAME_LEN + 1]; char type[PMIX_MCA_BASE_MAX_TYPE_NAME_LEN + 1]; pmix_mca_base_component_repository_item_t *ri; @@ -418,20 +419,18 @@ int pmix_mca_base_component_repository_open(pmix_mca_base_framework_t *framework char *err_msg = NULL; if (PMIX_SUCCESS != pmix_pdl_open(ri->ri_path, true, false, &ri->ri_dlhandle, &err_msg)) { if (NULL == err_msg) { - err_msg = "pmix_dl_open() error message was NULL!"; - } - /* Because libltdl erroneously says "file not found" for any - type of error -- which is especially misleading when the file - is actually there but cannot be opened for some other reason - (e.g., missing symbol) -- do some simple huersitics and if - the file [probably] does exist, print a slightly better error - message. */ - if (0 == strcasecmp("file not found", err_msg) && - (file_exists(ri->ri_path, "lo") || - file_exists(ri->ri_path, "so") || - file_exists(ri->ri_path, "dylib") || - file_exists(ri->ri_path, "dll"))) { - err_msg = "perhaps a missing symbol, or compiled for a different version of Open MPI?"; + err_msg = strdup("pmix_dl_open() error message was NULL!"); + } else if (file_exists(ri->ri_path, "lo") || + file_exists(ri->ri_path, "so") || + file_exists(ri->ri_path, "dylib") || + file_exists(ri->ri_path, "dll")) { + /* Because libltdl erroneously says "file not found" for any + * type of error -- which is especially misleading when the file + * is actually there but cannot be opened for some other reason + * (e.g., missing symbol) -- do some simple huersitics and if + * the file [probably] does exist, print a slightly better error + * message. */ + err_msg = strdup("perhaps a missing symbol, or compiled for a different version of OpenPMIx"); } pmix_output_verbose(vl, 0, "pmix_mca_base_component_repository_open: unable to open %s: %s (ignored)", ri->ri_base, err_msg); @@ -441,11 +440,13 @@ int pmix_mca_base_component_repository_open(pmix_mca_base_framework_t *framework f_comp->comp = ri; if (0 > asprintf(&(f_comp->error_msg), "%s", err_msg)) { PMIX_RELEASE(f_comp); + free(err_msg); return PMIX_ERR_BAD_PARAM; } pmix_list_append(&framework->framework_failed_components, &f_comp->super); } + free(err_msg); return PMIX_ERR_BAD_PARAM; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.h b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.h index 830f40fa06..7a6f246a29 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.h @@ -13,7 +13,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,7 +37,7 @@ #ifndef PMIX_MCA_BASE_COMPONENT_REPOSITORY_H #define PMIX_MCA_BASE_COMPONENT_REPOSITORY_H -#include +#include "src/include/pmix_config.h" #include "src/mca/pdl/pdl.h" #include "src/mca/pdl/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_close.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_close.c index 22d757a0ae..b47f977ca0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_close.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_close.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,14 +20,14 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" #include "src/util/output.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_component_repository.h" -#include "pmix_common.h" +#include "include/pmix_common.h" void pmix_mca_base_component_unload (const pmix_mca_base_component_t *component, int output_id) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_open.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_open.c index 63aa9f1997..be115abf9b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_open.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_open.c @@ -14,7 +14,7 @@ * Copyright (c) 2011-2015 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2014 Hochschule Esslingen. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +22,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -34,7 +34,7 @@ #include "src/util/output.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" -#include "pmix_common.h" +#include "include/pmix_common.h" /* * Local functions diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_register.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_register.c index fc53b411cd..3a6ac227ea 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_register.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_register.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -36,7 +36,7 @@ #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_framework.h" #include "src/mca/base/pmix_mca_base_component_repository.h" -#include "pmix_common.h" +#include "include/pmix_common.h" /* * Local functions diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_select.c index b039bf66c2..fc837fe239 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_components_select.c @@ -5,7 +5,7 @@ * Corporation. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,7 +13,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -28,7 +28,7 @@ #include "src/mca/mca.h" #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_component_repository.h" -#include "pmix_common.h" +#include "include/pmix_common.h" int pmix_mca_base_select(const char *type_name, int output_id, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.c index e99e7af089..b347a8d6a7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.c @@ -3,7 +3,7 @@ * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,9 +11,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/output.h" #include "pmix_mca_base_framework.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.h b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.h index 27c5885548..7de70a3895 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_framework.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ #if !defined(PMIX_MCA_BASE_FRAMEWORK_H) #define PMIX_MCA_BASE_FRAMEWORK_H -#include +#include "src/include/pmix_config.h" #include "src/mca/mca.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_list.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_list.c index 1d5f8b6fcd..ad2a30bb2d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_list.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_list.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" #include "src/mca/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c index fbb55dcb35..37823b8649 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c @@ -13,7 +13,7 @@ * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -38,7 +38,7 @@ #include "src/mca/mca.h" #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_component_repository.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/pmix_environ.h" /* @@ -77,16 +77,15 @@ int pmix_mca_base_open(void) } /* define the system and user default paths */ -#if PMIX_WANT_HOME_CONFIG_FILES pmix_mca_base_system_default_path = strdup(pmix_pinstall_dirs.pmixlibdir); - rc = asprintf(&pmix_mca_base_user_default_path, "%s"PMIX_PATH_SEP".pmix"PMIX_PATH_SEP"components", pmix_home_directory()); -#else - rc = asprintf(&pmix_mca_base_system_default_path, "%s", pmix_pinstall_dirs.pmixlibdir); -#endif - +#if PMIX_WANT_HOME_CONFIG_FILES + value = (char*)pmix_home_directory(geteuid()); + rc = asprintf(&pmix_mca_base_user_default_path, "%s"PMIX_PATH_SEP".pmix"PMIX_PATH_SEP"components", value); if (0 > rc) { return PMIX_ERR_OUT_OF_RESOURCE; } +#endif + /* see if the user wants to override the defaults */ if (NULL == pmix_mca_base_user_default_path) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_parse_paramfile.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_parse_paramfile.c index 12785f22d5..3d4afa9dff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_parse_paramfile.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_parse_paramfile.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +20,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c index f1736447a0..9a8172c2ac 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.c @@ -13,9 +13,9 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,7 +23,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -46,7 +46,7 @@ #include "src/util/error.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_vari.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/output.h" #include "src/util/pmix_environ.h" @@ -423,16 +423,22 @@ int pmix_mca_base_var_cache_files(bool rel_path_search) int ret; /* We may need this later */ - home = (char*)pmix_home_directory(); + home = (char*)pmix_home_directory(geteuid()); - if(NULL == cwd) { + if (NULL == cwd) { cwd = (char *) malloc(sizeof(char) * MAXPATHLEN); - if( NULL == (cwd = getcwd(cwd, MAXPATHLEN) )) { + if (NULL == (cwd = getcwd(cwd, MAXPATHLEN))) { pmix_output(0, "Error: Unable to get the current working directory\n"); cwd = strdup("."); } } + /* if we were passed our PMIx param file contents, then no need + * to obtain them here */ + if (NULL != getenv("PMIX_PARAM_FILE_PASSED")) { + return PMIX_SUCCESS; + } + #if PMIX_WANT_HOME_CONFIG_FILES ret = asprintf(&pmix_mca_base_var_files, "%s"PMIX_PATH_SEP".pmix" PMIX_PATH_SEP "mca-params.conf%c%s" PMIX_PATH_SEP "pmix-mca-params.conf", @@ -792,6 +798,7 @@ static int var_set_from_string (pmix_mca_base_var_t *var, char *src) int pmix_mca_base_var_set_value (int vari, const void *value, size_t size, pmix_mca_base_var_source_t source, const char *source_file) { + (void)size; pmix_mca_base_var_t *var; int ret; @@ -952,6 +959,7 @@ static int var_find (const char *project_name, const char *framework_name, const char *component_name, const char *variable_name, bool invalidok) { + (void)project_name; char *full_name; int ret, vari; @@ -1608,6 +1616,7 @@ int pmix_mca_base_var_register_synonym (int synonym_for, const char *project_nam static int var_get_env (pmix_mca_base_var_t *var, const char *name, char **source, char **value) { + (void)var; char *source_env, *value_env; int ret; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.h b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.h index c23a7b757e..a720e51777 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var.h @@ -13,7 +13,7 @@ * Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,7 +60,7 @@ #ifndef PMIX_MCA_BASE_VAR_H #define PMIX_MCA_BASE_VAR_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" #include "src/class/pmix_value_array.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.c index b5bb281b68..ff72bbd52b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/mca/base/pmix_mca_base_var_enum.h" #include "src/mca/base/base.h" @@ -48,6 +48,7 @@ static int enum_get_value (pmix_mca_base_var_enum_t *self, int index, int *value static int pmix_mca_base_var_enum_bool_get_count (pmix_mca_base_var_enum_t *enumerator, int *count) { + (void)enumerator; *count = 2; return PMIX_SUCCESS; } @@ -55,6 +56,7 @@ static int pmix_mca_base_var_enum_bool_get_count (pmix_mca_base_var_enum_t *enum static int pmix_mca_base_var_enum_bool_get_value (pmix_mca_base_var_enum_t *self, int index, int *value, const char **string_value) { + (void)self; if (1 < index) { return PMIX_ERR_VALUE_OUT_OF_BOUNDS; } @@ -68,6 +70,7 @@ static int pmix_mca_base_var_enum_bool_get_value (pmix_mca_base_var_enum_t *self static int pmix_mca_base_var_enum_bool_vfs (pmix_mca_base_var_enum_t *self, const char *string_value, int *value) { + (void)self; char *tmp; int v; @@ -95,6 +98,7 @@ static int pmix_mca_base_var_enum_bool_vfs (pmix_mca_base_var_enum_t *self, cons static int pmix_mca_base_var_enum_bool_sfv (pmix_mca_base_var_enum_t *self, const int value, char **string_value) { + (void)self; if (string_value) { *string_value = strdup (value ? "true" : "false"); } @@ -104,6 +108,7 @@ static int pmix_mca_base_var_enum_bool_sfv (pmix_mca_base_var_enum_t *self, cons static int pmix_mca_base_var_enum_bool_dump (pmix_mca_base_var_enum_t *self, char **out) { + (void)self; *out = strdup ("0: f|false|disabled|no, 1: t|true|enabled|yes"); return *out ? PMIX_SUCCESS : PMIX_ERR_OUT_OF_RESOURCE; } @@ -135,6 +140,7 @@ static pmix_mca_base_var_enum_value_t verbose_values[] = { static int pmix_mca_base_var_enum_verbose_vfs (pmix_mca_base_var_enum_t *self, const char *string_value, int *value) { + (void)self; char *tmp; int v; @@ -165,6 +171,7 @@ static int pmix_mca_base_var_enum_verbose_vfs (pmix_mca_base_var_enum_t *self, c static int pmix_mca_base_var_enum_verbose_sfv (pmix_mca_base_var_enum_t *self, const int value, char **string_value) { + (void)self; int ret; if (value < 0 || value > 100) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.h b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.h index fbe0bcaee4..2ca4e95517 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_enum.h @@ -13,7 +13,7 @@ * Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,10 +24,10 @@ #if !defined(PMIX_MCA_BASE_VAR_ENUM_H) #define PMIX_MCA_BASE_VAR_ENUM_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" -#include "pmix_common.h" +#include "include/pmix_common.h" typedef struct pmix_mca_base_var_enum_t pmix_mca_base_var_enum_t; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_group.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_group.c index 642c7dba45..9fb09c6530 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_group.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_var_group.c @@ -13,7 +13,7 @@ * Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -38,7 +38,7 @@ #include "src/util/show_help.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_vari.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/output.h" #include "src/util/pmix_environ.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_vari.h b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_vari.h index e2bd97b1e2..0dd3b28b98 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_vari.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_vari.h @@ -13,7 +13,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,7 +37,7 @@ #ifndef PMIX_MCA_BASE_VAR_INTERNAL_H #define PMIX_MCA_BASE_VAR_INTERNAL_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" #include "src/class/pmix_list.h" @@ -69,9 +69,9 @@ typedef enum { #define PMIX_VAR_IS_SETTABLE(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_SETTABLE)) #define PMIX_VAR_IS_DEPRECATED(var) (!!((var).mbv_flags & PMIX_MCA_BASE_VAR_FLAG_DEPRECATED)) -extern const char *pmix_var_type_names[]; -extern const size_t pmix_var_type_sizes[]; -extern bool pmix_mca_base_var_initialized; +PMIX_EXPORT extern const char *pmix_var_type_names[]; +PMIX_EXPORT extern const size_t pmix_var_type_sizes[]; +PMIX_EXPORT extern bool pmix_mca_base_var_initialized; /** * \internal @@ -113,35 +113,35 @@ PMIX_CLASS_DECLARATION(pmix_mca_base_var_file_value_t); * @param[out] group Returned group if it exists * @param[in] invalidok Return group even if it has been deregistered */ -int pmix_mca_base_var_group_get_internal (const int group_index, pmix_mca_base_var_group_t **group, bool invalidok); +PMIX_EXPORT int pmix_mca_base_var_group_get_internal (const int group_index, pmix_mca_base_var_group_t **group, bool invalidok); /** * \internal * * Parse a parameter file. */ -int pmix_mca_base_parse_paramfile(const char *paramfile, pmix_list_t *list); +PMIX_EXPORT int pmix_mca_base_parse_paramfile(const char *paramfile, pmix_list_t *list); /** * \internal * * Add a variable to a group */ -int pmix_mca_base_var_group_add_var (const int group_index, const int param_index); +PMIX_EXPORT int pmix_mca_base_var_group_add_var (const int group_index, const int param_index); /** * \internal * * Add a performance variable to a group */ -int pmix_mca_base_var_group_add_pvar (const int group_index, const int param_index); +PMIX_EXPORT int pmix_mca_base_var_group_add_pvar (const int group_index, const int param_index); /** * \internal * * Generate a full name with _ between all of the non-NULL arguments */ -int pmix_mca_base_var_generate_full_name4 (const char *project, const char *framework, +PMIX_EXPORT int pmix_mca_base_var_generate_full_name4 (const char *project, const char *framework, const char *component, const char *variable, char **full_name); @@ -150,15 +150,15 @@ int pmix_mca_base_var_generate_full_name4 (const char *project, const char *fram * * Call save_value callback for generated internal mca parameter storing env variables */ -int pmix_mca_base_internal_env_store(void); +PMIX_EXPORT int pmix_mca_base_internal_env_store(void); /** * \internal * * Initialize/finalize MCA variable groups */ -int pmix_mca_base_var_group_init (void); -int pmix_mca_base_var_group_finalize (void); +PMIX_EXPORT int pmix_mca_base_var_group_init (void); +PMIX_EXPORT int pmix_mca_base_var_group_finalize (void); END_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h index 41ee2de266..f2f04fa4f2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h @@ -11,9 +11,11 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +26,7 @@ #ifndef PMIX_BFROP_BASE_H_ #define PMIX_BFROP_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -72,6 +74,7 @@ PMIX_CLASS_DECLARATION(pmix_bfrops_base_active_module_t); struct pmix_bfrops_globals_t { pmix_list_t actives; bool initialized; + bool selected; size_t initial_size; size_t threshold_size; pmix_bfrop_buffer_type_t default_type; @@ -159,48 +162,76 @@ PMIX_EXPORT extern pmix_bfrops_globals_t pmix_bfrops_globals; #endif /* Unpack generic size macros */ -#define PMIX_BFROP_UNPACK_SIZE_MISMATCH(unpack_type, remote_type, ret) \ +#define PMIX_BFROP_UNPACK_SIZE_MISMATCH(reg_types, unpack_type, remote_type, ret) \ do { \ switch(remote_type) { \ case PMIX_UINT8: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint8_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, uint8_t, remote_type); \ break; \ case PMIX_INT8: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int8_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, int8_t, remote_type); \ break; \ case PMIX_UINT16: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint16_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, uint16_t, remote_type); \ break; \ case PMIX_INT16: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int16_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, int16_t, remote_type); \ break; \ case PMIX_UINT32: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint32_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, uint32_t, remote_type); \ break; \ case PMIX_INT32: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int32_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, int32_t, remote_type); \ break; \ case PMIX_UINT64: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, uint64_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, uint64_t, remote_type); \ break; \ case PMIX_INT64: \ - PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, int64_t, remote_type); \ + PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, int64_t, remote_type); \ break; \ default: \ ret = PMIX_ERR_NOT_FOUND; \ } \ } while (0) +#define PMIX_BFROPS_PACK_TYPE(r, b, s, n, t, arr) \ + do { \ + pmix_bfrop_type_info_t *__info; \ + /* Lookup the pack function for this type and call it */ \ + __info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item((arr),\ + (t)); \ + if (NULL == __info) { \ + (r) = PMIX_ERR_UNKNOWN_DATA_TYPE; \ + } else { \ + (r) = __info->odti_pack_fn(arr, b, s, n, t); \ + } \ + } while(0) + +#define PMIX_BFROPS_UNPACK_TYPE(r, b, d, n, t, arr) \ + do { \ + pmix_bfrop_type_info_t *__info; \ + /* Lookup the unpack function for this type and call it */ \ + __info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item((arr),\ + (t)); \ + if (NULL == __info) { \ + (r) = PMIX_ERR_UNKNOWN_DATA_TYPE; \ + } else { \ + (r) = __info->odti_unpack_fn(arr, b, d, n, t); \ + } \ + } while(0) + /* NOTE: do not need to deal with endianness here, as the unpacking of the underling sender-side type will do that for us. Repeat: the data in tmpbuf[] is already in host byte order. */ -#define PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(unpack_type, tmptype, tmpbfroptype) \ +#define PMIX_BFROP_UNPACK_SIZE_MISMATCH_FOUND(reg_types, unpack_type, tmptype, tmpbfroptype) \ do { \ int32_t i; \ - tmptype *tmpbuf = (tmptype*)malloc(sizeof(tmptype) * (*num_vals)); \ - ret = unpack_gentype(buffer, tmpbuf, num_vals, tmpbfroptype); \ - for (i = 0 ; i < *num_vals ; ++i) { \ - ((unpack_type*) dest)[i] = (unpack_type)(tmpbuf[i]); \ + tmptype *tmpbuf = (tmptype*)calloc(*num_vals, sizeof(tmptype)); \ + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, tmpbuf, num_vals, tmpbfroptype, reg_types); \ + if (PMIX_ERR_UNKNOWN_DATA_TYPE != ret) { \ + for (i = 0 ; i < *num_vals ; ++i) { \ + ((unpack_type*) dest)[i] = (unpack_type)(tmpbuf[i]); \ + } \ } \ free(tmpbuf); \ } while (0) @@ -211,6 +242,16 @@ typedef struct pmix_info_array { pmix_info_t *array; } pmix_info_array_t; +typedef pmix_status_t (*pmix_bfrop_internal_pack_fn_t)(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, + const void *src, + int32_t num_values, + pmix_data_type_t type); + +typedef pmix_status_t (*pmix_bfrop_internal_unpack_fn_t)(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *max_num_values, + pmix_data_type_t type); /** * Internal struct used for holding registered bfrop functions @@ -222,9 +263,9 @@ typedef struct pmix_info_array { /** Debugging string name */ char *odti_name; /** Pack function */ - pmix_bfrop_pack_fn_t odti_pack_fn; + pmix_bfrop_internal_pack_fn_t odti_pack_fn; /** Unpack function */ - pmix_bfrop_unpack_fn_t odti_unpack_fn; + pmix_bfrop_internal_unpack_fn_t odti_unpack_fn; /** copy function */ pmix_bfrop_copy_fn_t odti_copy_fn; /** prpmix_status_t function */ @@ -240,8 +281,8 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_bfrop_type_info_t); _info = PMIX_NEW(pmix_bfrop_type_info_t); \ _info->odti_name = strdup((n)); \ _info->odti_type = (t); \ - _info->odti_pack_fn = (pmix_bfrop_pack_fn_t)(p); \ - _info->odti_unpack_fn = (pmix_bfrop_unpack_fn_t)(u); \ + _info->odti_pack_fn = (pmix_bfrop_internal_pack_fn_t)(p); \ + _info->odti_unpack_fn = (pmix_bfrop_internal_unpack_fn_t)(u); \ _info->odti_copy_fn = (pmix_bfrop_copy_fn_t)(c) ; \ _info->odti_print_fn = (pmix_bfrop_print_fn_t)(pr) ; \ pmix_pointer_array_set_item((arr), (t), _info); \ @@ -306,88 +347,131 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_buffer(pmix_pointer_array_t *reg const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_bool(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_sizet(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_byte(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_string(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pid(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int16(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int32(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int64(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_string(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_float(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_double(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_timeval(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_time(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_status(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_buf(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_bo(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_proc(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_value(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_info(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pdata(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_app(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_kval(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_array(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_modex(pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_persist(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_datatype(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_ptr(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_scope(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_range(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_cmd(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_info_directives(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pstate(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pinfo(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_darray(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_rank(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_query(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_val(pmix_buffer_t *buffer, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *p); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_iof_channel(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_iof_channel(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_envar(pmix_buffer_t *buffer, const void *src, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_envar(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +PMIX_EXPORT pmix_status_t pmix_bfrops_base_pack_regex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); /* @@ -398,90 +482,135 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes void *dst, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_bool(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_byte(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_string(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pid(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int16(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int32(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int64(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_float(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_double(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_status(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *val); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_value(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_buf(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_modex(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_persist(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_ptr(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_scope(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_range(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_cmd(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_info_directives(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pstate(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_rank(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_iof_channel(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_iof_channel(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_envar(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_envar(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_regex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + /**** DEPRECATED ****/ -PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_array(pmix_buffer_t *buffer, void *dest, +PMIX_EXPORT pmix_status_t pmix_bfrops_base_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); /* @@ -538,6 +667,9 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest, PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest, pmix_envar_t *src, pmix_data_type_t type); +PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_regex(char **dest, + char *src, + pmix_data_type_t type); /* * "Standard" print functions @@ -646,6 +778,10 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_iof_channel(char **output, char PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_envar(char **output, char *prefix, pmix_envar_t *src, pmix_data_type_t type); +PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_regex(char **output, char *prefix, + char *src, + pmix_data_type_t type); + /* * Common helper functions @@ -655,9 +791,11 @@ PMIX_EXPORT char* pmix_bfrop_buffer_extend(pmix_buffer_t *bptr, size_t bytes_to_ PMIX_EXPORT bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd); -PMIX_EXPORT pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type); +PMIX_EXPORT pmix_status_t pmix_bfrop_store_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type); +PMIX_EXPORT pmix_status_t pmix_bfrop_get_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t *type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c index d5bf41e94f..1a7030511a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -19,13 +19,14 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" #include "src/include/pmix_globals.h" +#include "src/mca/preg/preg.h" #include "src/mca/bfrops/base/base.h" @@ -202,6 +203,9 @@ pmix_status_t pmix_bfrops_base_std_copy(void **dest, void *src, pmix_status_t pmix_bfrops_base_copy_string(char **dest, char *src, pmix_data_type_t type) { + if (PMIX_STRING != type) { + return PMIX_ERR_BAD_PARAM; + } if (NULL == src) { /* got zero-length string/NULL pointer - store NULL */ *dest = NULL; } else { @@ -218,6 +222,9 @@ pmix_status_t pmix_bfrops_base_copy_value(pmix_value_t **dest, { pmix_value_t *p; + if (PMIX_VALUE != type) { + return PMIX_ERR_BAD_PARAM; + } /* create the new object */ *dest = (pmix_value_t*)malloc(sizeof(pmix_value_t)); if (NULL == *dest) { @@ -235,6 +242,9 @@ pmix_status_t pmix_bfrops_base_copy_info(pmix_info_t **dest, pmix_info_t *src, pmix_data_type_t type) { + if (PMIX_VALUE != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_info_t*)malloc(sizeof(pmix_info_t)); pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); (*dest)->flags = src->flags; @@ -245,6 +255,9 @@ pmix_status_t pmix_bfrops_base_copy_buf(pmix_buffer_t **dest, pmix_buffer_t *src, pmix_data_type_t type) { + if (PMIX_BUFFER != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = PMIX_NEW(pmix_buffer_t); pmix_bfrops_base_copy_payload(*dest, src); return PMIX_SUCCESS; @@ -256,6 +269,9 @@ pmix_status_t pmix_bfrops_base_copy_app(pmix_app_t **dest, { size_t j; + if (PMIX_APP != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_app_t*)malloc(sizeof(pmix_app_t)); (*dest)->cmd = strdup(src->cmd); (*dest)->argv = pmix_argv_copy(src->argv); @@ -279,6 +295,9 @@ pmix_status_t pmix_bfrops_base_copy_kval(pmix_kval_t **dest, { pmix_kval_t *p; + if (PMIX_KVAL != type) { + return PMIX_ERR_BAD_PARAM; + } /* create the new object */ *dest = PMIX_NEW(pmix_kval_t); if (NULL == *dest) { @@ -296,6 +315,9 @@ pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest, pmix_proc_t *src, pmix_data_type_t type) { + if (PMIX_PROC != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_proc_t*)malloc(sizeof(pmix_proc_t)); if (NULL == *dest) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -309,6 +331,9 @@ pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src, pmix_data_type_t type) { + if (PMIX_PERSIST != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_persistence_t*)malloc(sizeof(pmix_persistence_t)); if (NULL == *dest) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -321,6 +346,9 @@ pmix_status_t pmix_bfrops_base_copy_bo(pmix_byte_object_t **dest, pmix_byte_object_t *src, pmix_data_type_t type) { + if (PMIX_BYTE_OBJECT != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_byte_object_t*)malloc(sizeof(pmix_byte_object_t)); if (NULL == *dest) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -335,6 +363,9 @@ pmix_status_t pmix_bfrops_base_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src, pmix_data_type_t type) { + if (PMIX_PDATA != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t)); pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); (*dest)->proc.rank = src->proc.rank; @@ -348,6 +379,9 @@ pmix_status_t pmix_bfrops_base_copy_pinfo(pmix_proc_info_t **dest, { pmix_proc_info_t *p; + if (PMIX_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } PMIX_PROC_INFO_CREATE(p, 1); if (NULL == p) { return PMIX_ERR_NOMEM; @@ -388,6 +422,10 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest, pmix_query_t *pq, *sq; pmix_envar_t *pe, *se; + if (PMIX_DATA_ARRAY != type) { + return PMIX_ERR_BAD_PARAM; + } + p = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); if (NULL == p) { return PMIX_ERR_NOMEM; @@ -815,6 +853,9 @@ pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest, { pmix_status_t rc; + if (PMIX_QUERY != type) { + return PMIX_ERR_BAD_PARAM; + } *dest = (pmix_query_t*)malloc(sizeof(pmix_query_t)); if (NULL != src->keys) { (*dest)->keys = pmix_argv_copy(src->keys); @@ -833,6 +874,9 @@ pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest, pmix_envar_t *src, pmix_data_type_t type) { + if (PMIX_ENVAR != type) { + return PMIX_ERR_BAD_PARAM; + } PMIX_ENVAR_CREATE(*dest, 1); if (NULL == (*dest)) { return PMIX_ERR_NOMEM; @@ -846,3 +890,16 @@ pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest, (*dest)->separator = src->separator; return PMIX_SUCCESS; } + +pmix_status_t pmix_bfrops_base_copy_regex(char **dest, + char *src, + pmix_data_type_t type) +{ + size_t len; + + if (PMIX_REGEX != type) { + return PMIX_ERR_BAD_PARAM; + } + + return pmix_preg.copy(dest, &len, src); +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c index e93f14889a..1de9ecb65e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +19,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include @@ -28,6 +30,7 @@ #include "src/util/argv.h" #include "src/util/error.h" #include "src/include/pmix_globals.h" +#include "src/mca/preg/preg.h" #include "src/mca/bfrops/base/base.h" @@ -201,7 +204,13 @@ void pmix_bfrops_base_value_load(pmix_value_t *v, const void *data, PMIX_ERROR_LOG(rc); } break; - + case PMIX_REGEX: + /* load it into the byte object */ + rc = pmix_preg.copy(&v->data.bo.bytes, &v->data.bo.size, (char*)data); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + break; default: /* silence warnings */ break; @@ -354,6 +363,15 @@ pmix_status_t pmix_bfrops_base_value_unload(pmix_value_t *kv, *data = envar; *sz = sizeof(pmix_envar_t); break; + case PMIX_REGEX: + if (NULL != kv->data.bo.bytes && 0 < kv->data.bo.size) { + *data = kv->data.bo.bytes; + *sz = kv->data.bo.size; + } else { + *data = NULL; + *sz = 0; + } + break; default: /* silence warnings */ rc = PMIX_ERROR; @@ -501,6 +519,7 @@ pmix_value_cmp_t pmix_bfrops_base_value_cmp(pmix_value_t *p, } rc = PMIX_EQUAL; break; + default: pmix_output(0, "COMPARE-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type); } @@ -600,6 +619,7 @@ pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p, break; case PMIX_BYTE_OBJECT: case PMIX_COMPRESSED_STRING: + case PMIX_REGEX: memset(&p->data.bo, 0, sizeof(pmix_byte_object_t)); if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) { p->data.bo.bytes = malloc(src->data.bo.size); @@ -727,39 +747,23 @@ bool pmix_bfrop_too_small(pmix_buffer_t *buffer, size_t bytes_reqd) return false; } -pmix_status_t pmix_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type) +pmix_status_t pmix_bfrop_store_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t type) { - uint16_t tmp; - char *dst; + pmix_status_t ret; - /* check to see if buffer needs extending */ - if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, sizeof(tmp)))) { - return PMIX_ERR_OUT_OF_RESOURCE; - } - tmp = pmix_htons(type); - memcpy(dst, &tmp, sizeof(tmp)); - buffer->pack_ptr += sizeof(tmp); - buffer->bytes_used += sizeof(tmp); - - return PMIX_SUCCESS; + PMIX_BFROPS_PACK_TYPE(ret, buffer, &type, 1, PMIX_UINT16, regtypes); + return ret; } -pmix_status_t pmix_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type) +pmix_status_t pmix_bfrop_get_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t *type) { - uint16_t tmp; + pmix_status_t ret; + int32_t m = 1; - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, sizeof(tmp))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; - } - - /* unpack the data */ - memcpy(&tmp, buffer->unpack_ptr, sizeof(tmp)); - tmp = pmix_ntohs(tmp); - memcpy(type, &tmp, sizeof(tmp)); - buffer->unpack_ptr += sizeof(tmp); - - return PMIX_SUCCESS; + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, type, &m, PMIX_UINT16, regtypes); + return ret; } const char* pmix_bfrops_base_data_type_string(pmix_pointer_array_t *regtypes, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_frame.c index 952ca015bb..5944c9be8f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +23,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -47,11 +47,26 @@ #include "src/mca/bfrops/base/static-components.h" /* Instantiate the global vars */ -pmix_bfrops_globals_t pmix_bfrops_globals = {{{0}}}; +pmix_bfrops_globals_t pmix_bfrops_globals = { + .actives = PMIX_LIST_STATIC_INIT, + .initialized = false, + .initial_size = 0, + .threshold_size = 0, +#if PMIX_ENABLE_DEBUG + .default_type = PMIX_BFROP_BUFFER_FULLY_DESC +#else + .default_type = PMIX_BFROP_BUFFER_NON_DESC +#endif +}; int pmix_bfrops_base_output = 0; static int pmix_bfrop_register(pmix_mca_base_register_flag_t flags) { + if (PMIX_MCA_BASE_REGISTER_DEFAULT == flags) { + /* do something to silence warning */ + int count=0; + ++count; + } pmix_bfrops_globals.initial_size = PMIX_BFROP_DEFAULT_INITIAL_SIZE; pmix_mca_base_var_register("pmix", "bfrops", "base", "initial_size", "Initial size of a buffer", @@ -88,6 +103,7 @@ static pmix_status_t pmix_bfrop_close(void) return PMIX_SUCCESS; } pmix_bfrops_globals.initialized = false; + pmix_bfrops_globals.selected = false; /* the components will cleanup when closed */ PMIX_LIST_DESTRUCT(&pmix_bfrops_globals.actives); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c index 4045d874ec..419b5973cb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +19,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include @@ -30,6 +32,7 @@ #include "src/util/error.h" #include "src/util/output.h" #include "src/include/pmix_globals.h" +#include "src/mca/preg/preg.h" #include "src/mca/bfrops/base/base.h" @@ -49,14 +52,14 @@ pmix_status_t pmix_bfrops_base_pack(pmix_pointer_array_t *regtypes, /* Pack the number of values */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix_bfrop_store_data_type(buffer, PMIX_INT32))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop_store_data_type(regtypes, buffer, PMIX_INT32))) { return rc; } } - if (PMIX_SUCCESS != (rc = pmix_bfrops_base_pack_int32(buffer, &num_vals, 1, PMIX_INT32))) { + PMIX_BFROPS_PACK_TYPE(rc, buffer, &num_vals, 1, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != rc) { return rc; } - /* Pack the value(s) */ return pmix_bfrops_base_pack_buffer(regtypes, buffer, src, num_vals, type); } @@ -68,7 +71,6 @@ pmix_status_t pmix_bfrops_base_pack_buffer(pmix_pointer_array_t *regtypes, pmix_data_type_t type) { pmix_status_t rc; - pmix_bfrop_type_info_t *info; pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_pack_buffer( %p, %p, %lu, %d )\n", @@ -76,47 +78,12 @@ pmix_status_t pmix_bfrops_base_pack_buffer(pmix_pointer_array_t *regtypes, /* Pack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix_bfrop_store_data_type(buffer, type))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop_store_data_type(regtypes, buffer, type))) { return rc; } } - - /* Lookup the pack function for this type and call it */ - if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(regtypes, type))) { - PMIX_ERROR_LOG(PMIX_ERR_UNKNOWN_DATA_TYPE); - return PMIX_ERR_UNKNOWN_DATA_TYPE; - } - - return info->odti_pack_fn(buffer, src, num_vals, type); -} - -static pmix_status_t pack_gentype(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) -{ - switch(type) { - case PMIX_INT8: - case PMIX_UINT8: - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, type); - break; - - case PMIX_INT16: - case PMIX_UINT16: - return pmix_bfrops_base_pack_int16(buffer, src, num_vals, type); - break; - - case PMIX_INT32: - case PMIX_UINT32: - return pmix_bfrops_base_pack_int32(buffer, src, num_vals, type); - break; - - case PMIX_INT64: - case PMIX_UINT64: - return pmix_bfrops_base_pack_int64(buffer, src, num_vals, type); - break; - - default: - return PMIX_ERR_UNKNOWN_DATA_TYPE; - } + PMIX_BFROPS_PACK_TYPE(rc, buffer, src, num_vals, type, regtypes); + return rc; } /* PACK FUNCTIONS FOR GENERIC SYSTEM TYPES */ @@ -124,7 +91,8 @@ static pmix_status_t pack_gentype(pmix_buffer_t *buffer, const void *src, /* * BOOL */ - pmix_status_t pmix_bfrops_base_pack_bool(pmix_buffer_t *buffer, const void *src, + pmix_status_t pmix_bfrops_base_pack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { uint8_t *dst; @@ -134,6 +102,12 @@ static pmix_status_t pack_gentype(pmix_buffer_t *buffer, const void *src, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_pack_bool * %d\n", num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_BOOL != type) { + return PMIX_ERR_BAD_PARAM; + } /* check to see if buffer needs extending */ if (NULL == (dst = (uint8_t*)pmix_bfrop_buffer_extend(buffer, num_vals))) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -158,61 +132,76 @@ static pmix_status_t pack_gentype(pmix_buffer_t *buffer, const void *src, /* * INT */ -pmix_status_t pmix_bfrops_base_pack_int(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; + if (PMIX_INT != type && PMIX_UINT != type) { + return PMIX_ERR_BAD_PARAM; + } /* System types need to always be described so we can properly unpack them */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, BFROP_TYPE_INT))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_INT))) { return ret; } /* Turn around and pack the real type */ - return pack_gentype(buffer, src, num_vals, BFROP_TYPE_INT); + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, BFROP_TYPE_INT, regtypes); + return ret; } /* * SIZE_T */ -pmix_status_t pmix_bfrops_base_pack_sizet(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret; + if (PMIX_SIZE != type) { + return PMIX_ERR_BAD_PARAM; + } /* System types need to always be described so we can properly unpack them. */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, BFROP_TYPE_SIZE_T))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_SIZE_T))) { return ret; } - return pack_gentype(buffer, src, num_vals, BFROP_TYPE_SIZE_T); + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, BFROP_TYPE_SIZE_T, regtypes); + return ret; } /* * PID_T */ -pmix_status_t pmix_bfrops_base_pack_pid(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret; + if (PMIX_PID != type) { + return PMIX_ERR_BAD_PARAM; + } /* System types need to always be described so we can properly unpack them. */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, BFROP_TYPE_PID_T))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_PID_T))) { return ret; } /* Turn around and pack the real type */ - return pack_gentype(buffer, src, num_vals, BFROP_TYPE_PID_T); + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, BFROP_TYPE_PID_T, regtypes); + return ret; } - /* * BYTE, CHAR, INT8 */ -pmix_status_t pmix_bfrops_base_pack_byte(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { char *dst; @@ -220,6 +209,12 @@ pmix_status_t pmix_bfrops_base_pack_byte(pmix_buffer_t *buffer, const void *src, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_pack_byte * %d\n", num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_BYTE != type && PMIX_UINT8 != type && PMIX_INT8 != type) { + return PMIX_ERR_BAD_PARAM; + } /* check to see if buffer needs extending */ if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals))) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -238,7 +233,8 @@ pmix_status_t pmix_bfrops_base_pack_byte(pmix_buffer_t *buffer, const void *src, /* * INT16 */ -pmix_status_t pmix_bfrops_base_pack_int16(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int32_t i; @@ -248,6 +244,12 @@ pmix_status_t pmix_bfrops_base_pack_int16(pmix_buffer_t *buffer, const void *src pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_pack_int16 * %d\n", num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INT16 != type && PMIX_UINT16 != type) { + return PMIX_ERR_BAD_PARAM; + } /* check to see if buffer needs extending */ if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -267,7 +269,8 @@ pmix_status_t pmix_bfrops_base_pack_int16(pmix_buffer_t *buffer, const void *src /* * INT32 */ -pmix_status_t pmix_bfrops_base_pack_int32(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int32_t i; @@ -277,6 +280,12 @@ pmix_status_t pmix_bfrops_base_pack_int32(pmix_buffer_t *buffer, const void *src pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_pack_int32 * %d\n", num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INT32 != type && PMIX_UINT32 != type) { + return PMIX_ERR_BAD_PARAM; + } /* check to see if buffer needs extending */ if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, num_vals*sizeof(tmp)))) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -295,7 +304,8 @@ pmix_status_t pmix_bfrops_base_pack_int32(pmix_buffer_t *buffer, const void *src /* * INT64 */ -pmix_status_t pmix_bfrops_base_pack_int64(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int32_t i; @@ -306,6 +316,12 @@ pmix_status_t pmix_bfrops_base_pack_int64(pmix_buffer_t *buffer, const void *src pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_pack_int64 * %d\n", num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INT64 != type && PMIX_UINT64 != type) { + return PMIX_ERR_BAD_PARAM; + } /* check to see if buffer needs extending */ if (NULL == (dst = pmix_bfrop_buffer_extend(buffer, bytes_packed))) { return PMIX_ERR_OUT_OF_RESOURCE; @@ -326,34 +342,45 @@ pmix_status_t pmix_bfrops_base_pack_int64(pmix_buffer_t *buffer, const void *src /* * STRING */ -pmix_status_t pmix_bfrops_base_pack_string(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret = PMIX_SUCCESS; int32_t i, len; char **ssrc = (char**) src; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_STRING != type) { + return PMIX_ERR_BAD_PARAM; + } for (i = 0; i < num_vals; ++i) { if (NULL == ssrc[i]) { /* got zero-length string/NULL pointer - store NULL */ len = 0; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &len, 1, PMIX_INT32))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &len, 1, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } else { len = (int32_t)strlen(ssrc[i]) + 1; // retain the NULL terminator - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &len, 1, PMIX_INT32))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &len, 1, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ssrc[i], len, PMIX_BYTE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, ssrc[i], len, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } } -return ret; + return ret; } /* FLOAT */ -pmix_status_t pmix_bfrops_base_pack_float(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret = PMIX_SUCCESS; @@ -361,23 +388,30 @@ pmix_status_t pmix_bfrops_base_pack_float(pmix_buffer_t *buffer, const void *src float *ssrc = (float*)src; char *convert; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_FLOAT != type) { + return PMIX_ERR_BAD_PARAM; + } for (i = 0; i < num_vals; ++i) { ret = asprintf(&convert, "%f", ssrc[i]); if (0 > ret) { return PMIX_ERR_OUT_OF_RESOURCE; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &convert, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &convert, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { free(convert); return ret; } free(convert); } - return PMIX_SUCCESS; } /* DOUBLE */ -pmix_status_t pmix_bfrops_base_pack_double(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret = PMIX_SUCCESS; @@ -385,23 +419,30 @@ pmix_status_t pmix_bfrops_base_pack_double(pmix_buffer_t *buffer, const void *sr double *ssrc = (double*)src; char *convert; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_DOUBLE != type) { + return PMIX_ERR_BAD_PARAM; + } for (i = 0; i < num_vals; ++i) { ret = asprintf(&convert, "%f", ssrc[i]); if (0 > ret) { return PMIX_ERR_OUT_OF_RESOURCE; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &convert, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &convert, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { free(convert); return ret; } free(convert); } - return PMIX_SUCCESS; } /* TIMEVAL */ -pmix_status_t pmix_bfrops_base_pack_timeval(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int64_t tmp[2]; @@ -409,19 +450,26 @@ pmix_status_t pmix_bfrops_base_pack_timeval(pmix_buffer_t *buffer, const void *s int32_t i; struct timeval *ssrc = (struct timeval *)src; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_TIMEVAL != type) { + return PMIX_ERR_BAD_PARAM; + } for (i = 0; i < num_vals; ++i) { tmp[0] = (int64_t)ssrc[i].tv_sec; tmp[1] = (int64_t)ssrc[i].tv_usec; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int64(buffer, tmp, 2, PMIX_INT64))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, tmp, 2, PMIX_INT64, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } - return PMIX_SUCCESS; } /* TIME */ -pmix_status_t pmix_bfrops_base_pack_time(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret = PMIX_SUCCESS; @@ -429,21 +477,28 @@ pmix_status_t pmix_bfrops_base_pack_time(pmix_buffer_t *buffer, const void *src, time_t *ssrc = (time_t *)src; uint64_t ui64; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_TIME != type) { + return PMIX_ERR_BAD_PARAM; + } /* time_t is a system-dependent size, so cast it * to uint64_t as a generic safe size */ for (i = 0; i < num_vals; ++i) { ui64 = (uint64_t)ssrc[i]; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int64(buffer, &ui64, 1, PMIX_UINT64))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ui64, 1, PMIX_UINT64, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } - return PMIX_SUCCESS; } /* STATUS */ -pmix_status_t pmix_bfrops_base_pack_status(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret = PMIX_SUCCESS; @@ -451,38 +506,57 @@ pmix_status_t pmix_bfrops_base_pack_status(pmix_buffer_t *buffer, const void *sr pmix_status_t *ssrc = (pmix_status_t *)src; int32_t status; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_STATUS != type) { + return PMIX_ERR_BAD_PARAM; + } for (i = 0; i < num_vals; ++i) { status = (int32_t)ssrc[i]; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &status, 1, PMIX_INT32))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &status, 1, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { PMIX_ERROR_LOG(ret); return ret; } } - return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_buf(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_buffer_t *ptr; int32_t i; int ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_BUFFER != type) { + return PMIX_ERR_BAD_PARAM; + } ptr = (pmix_buffer_t *) src; for (i = 0; i < num_vals; ++i) { /* pack the type of buffer */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, &ptr[i].type, 1, PMIX_BYTE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].type, 1, + PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the number of bytes */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].bytes_used, 1, PMIX_SIZE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].bytes_used, 1, + PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the bytes */ if (0 < ptr[i].bytes_used) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].base_ptr, ptr[i].bytes_used, PMIX_BYTE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, ptr[i].base_ptr, + ptr[i].bytes_used, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -490,20 +564,30 @@ pmix_status_t pmix_bfrops_base_pack_buf(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_bo(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { int ret; int i; pmix_byte_object_t *bo; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_BYTE_OBJECT != type) { + return PMIX_ERR_BAD_PARAM; + } bo = (pmix_byte_object_t*)src; for (i=0; i < num_vals; i++) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &bo[i].size, 1, PMIX_SIZE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &bo[i].size, 1, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < bo[i].size) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, bo[i].bytes, bo[i].size, + PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -511,21 +595,31 @@ pmix_status_t pmix_bfrops_base_pack_bo(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_proc(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_proc_t *proc; int32_t i; int ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_PROC != type) { + return PMIX_ERR_BAD_PARAM; + } proc = (pmix_proc_t *) src; for (i = 0; i < num_vals; ++i) { char *ptr = proc[i].nspace; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &ptr, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_rank(buffer, &proc[i].rank, 1, PMIX_PROC_RANK))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &proc[i].rank, 1, + PMIX_PROC_RANK, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -534,31 +628,38 @@ pmix_status_t pmix_bfrops_base_pack_proc(pmix_buffer_t *buffer, const void *src, /* PMIX_VALUE */ -pmix_status_t pmix_bfrops_base_pack_value(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_value_t *ptr; int32_t i; int ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_VALUE != type) { + return PMIX_ERR_BAD_PARAM; + } ptr = (pmix_value_t *) src; for (i = 0; i < num_vals; ++i) { /* pack the type */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, ptr[i].type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, ptr[i].type))) { return ret; } /* now pack the right field */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_val(buffer, &ptr[i]))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_val(regtypes, buffer, &ptr[i]))) { return ret; } } - return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_info(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_info_t *info; @@ -566,31 +667,41 @@ pmix_status_t pmix_bfrops_base_pack_info(pmix_buffer_t *buffer, const void *src, int ret; char *foo; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } info = (pmix_info_t *) src; for (i = 0; i < num_vals; ++i) { /* pack key */ foo = info[i].key; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &foo, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &foo, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack info directives */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info_directives(buffer, &info[i].flags, 1, PMIX_INFO_DIRECTIVES))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &info[i].flags, 1, + PMIX_INFO_DIRECTIVES, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the type */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, info[i].value.type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, info[i].value.type))) { return ret; } /* pack value */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_val(buffer, &info[i].value))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_val(regtypes, buffer, &info[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_pdata(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_pdata_t *pdata; @@ -598,26 +709,35 @@ pmix_status_t pmix_bfrops_base_pack_pdata(pmix_buffer_t *buffer, const void *src int ret; char *foo; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_PDATA != type) { + return PMIX_ERR_BAD_PARAM; + } pdata = (pmix_pdata_t *) src; for (i = 0; i < num_vals; ++i) { /* pack the proc */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_proc(buffer, &pdata[i].proc, 1, PMIX_PROC))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pdata[i].proc, 1, + PMIX_PROC, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack key */ foo = pdata[i].key; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &foo, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &foo, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { PMIX_ERROR_LOG(ret); return ret; } /* pack the type */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, pdata[i].value.type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, pdata[i].value.type))) { PMIX_ERROR_LOG(ret); return ret; } /* pack value */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_val(buffer, &pdata[i].value))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_val(regtypes, buffer, &pdata[i].value))) { PMIX_ERROR_LOG(ret); return ret; } @@ -625,53 +745,79 @@ pmix_status_t pmix_bfrops_base_pack_pdata(pmix_buffer_t *buffer, const void *src return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_app(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_app_t *app; int32_t i, j, nvals; int ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_APP != type) { + return PMIX_ERR_BAD_PARAM; + } app = (pmix_app_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &app[i].cmd, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &app[i].cmd, 1, PMIX_STRING, + regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* argv */ nvals = pmix_argv_count(app[i].argv); - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int(buffer, &nvals, 1, PMIX_INT32))) { + /* although nvals is technically an int32, we have to pack it + * as a generic int due to a typo in earlier release series. This + * preserves the ordering of bytes in the packed buffer as it + * includes a tag indicating the actual size of the value. No + * harm is done as generic int is equivalent to int32 on all + * current systems - just something to watch out for in the + * future should someone someday change the size of "int" */ + PMIX_BFROPS_PACK_TYPE(ret, buffer, &nvals, 1, PMIX_INT, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } for (j=0; j < nvals; j++) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &app[i].argv[j], 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &app[i].argv[j], 1, PMIX_STRING, + regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } /* env */ nvals = pmix_argv_count(app[i].env); - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &nvals, 1, PMIX_INT32))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &nvals, 1, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } for (j=0; j < nvals; j++) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &app[i].env[j], 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &app[i].env[j], 1, + PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } /* cwd */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &app[i].cwd, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &app[i].cwd, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* maxprocs */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int(buffer, &app[i].maxprocs, 1, PMIX_INT))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &app[i].maxprocs, 1, PMIX_INT, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* info array */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &app[i].ninfo, 1, PMIX_SIZE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &app[i].ninfo, 1, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < app[i].ninfo) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, app[i].info, app[i].ninfo, PMIX_INFO))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, app[i].info, app[i].ninfo, PMIX_INFO, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -680,327 +826,269 @@ pmix_status_t pmix_bfrops_base_pack_app(pmix_buffer_t *buffer, const void *src, } -pmix_status_t pmix_bfrops_base_pack_kval(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; int32_t i; int ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_KVAL != type) { + return PMIX_ERR_BAD_PARAM; + } ptr = (pmix_kval_t *) src; for (i = 0; i < num_vals; ++i) { /* pack the key */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &ptr[i].key, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].key, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the value */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_value(buffer, ptr[i].value, 1, PMIX_VALUE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, ptr[i].value, 1, PMIX_VALUE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } - return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_persist(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); + pmix_status_t ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_PERSIST != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_BYTE, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_datatype(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_int16(buffer, src, num_vals, type); + pmix_status_t ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_DATA_TYPE != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT16, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_ptr(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { + pmix_status_t ret; uint8_t foo=1; + + if (NULL == regtypes || NULL != src || 0 == num_vals) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_POINTER != type) { + return PMIX_ERR_BAD_PARAM; + } /* it obviously makes no sense to pack a pointer and * send it somewhere else, so we just pack a sentinel */ - return pmix_bfrops_base_pack_byte(buffer, &foo, 1, PMIX_UINT8); + PMIX_BFROPS_PACK_TYPE(ret, buffer, &foo, 1, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_scope(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_SCOPE != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_range(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_DATA_RANGE != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_cmd(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_COMMAND != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_info_directives(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_int32(buffer, src, num_vals, PMIX_UINT32); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INFO_DIRECTIVES != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT32, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_pstate(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_PROC_STATE != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_pinfo(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - pmix_proc_info_t *pinfo = (pmix_proc_info_t*)src; + pmix_proc_info_t *pinfo = (pmix_proc_info_t *) src; pmix_status_t ret; int32_t i; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_PROC_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } for (i=0; i < num_vals; i++) { /* pack the proc identifier */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_proc(buffer, &pinfo[i].proc, 1, PMIX_PROC))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pinfo[i].proc, 1, PMIX_PROC, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the hostname and exec */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &pinfo[i].hostname, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pinfo[i].hostname, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &pinfo[i].executable_name, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pinfo[i].executable_name, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the pid and state */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pid(buffer, &pinfo[i].pid, 1, PMIX_PID))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pinfo[i].pid, 1, PMIX_PID, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pstate(buffer, &pinfo[i].state, 1, PMIX_PROC_STATE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pinfo[i].state, 1, PMIX_PROC_STATE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_darray(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - pmix_data_array_t *p = (pmix_data_array_t*)src; + pmix_data_array_t *p = (pmix_data_array_t *) src; pmix_status_t ret; int32_t i; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_DATA_ARRAY != type) { + return PMIX_ERR_BAD_PARAM; + } for (i=0; i < num_vals; i++) { /* pack the actual type in the array */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(buffer, p[i].type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_store_data_type(regtypes, buffer, + p[i].type))) { return ret; } /* pack the number of array elements */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &p[i].size, 1, PMIX_SIZE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &p[i].size, 1, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 == p[i].size || PMIX_UNDEF == p[i].type) { /* nothing left to do */ continue; } - /* pack the actual elements - have to do this the hard way */ - switch(p[i].type) { - case PMIX_UNDEF: - break; - case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_bool(buffer, p[i].array, p[i].size, PMIX_BOOL))) { - return ret; - } - break; - case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, p[i].array, p[i].size, PMIX_BYTE))) { - return ret; - } - break; - case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, p[i].array, p[i].size, PMIX_STRING))) { - return ret; - } - break; - case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, p[i].array, p[i].size, PMIX_SIZE))) { - return ret; - } - break; - case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pid(buffer, p[i].array, p[i].size, PMIX_PID))) { - return ret; - } - break; - case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int(buffer, p[i].array, p[i].size, PMIX_INT))) { - return ret; - } - break; - case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, p[i].array, p[i].size, PMIX_INT8))) { - return ret; - } - break; - case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int16(buffer, p[i].array, p[i].size, PMIX_INT16))) { - return ret; - } - break; - case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, p[i].array, p[i].size, PMIX_INT32))) { - return ret; - } - break; - case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int64(buffer, p[i].array, p[i].size, PMIX_INT64))) { - return ret; - } - break; - case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int(buffer, p[i].array, p[i].size, PMIX_UINT))) { - return ret; - } - break; - case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, p[i].array, p[i].size, PMIX_UINT8))) { - return ret; - } - break; - case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int16(buffer, p[i].array, p[i].size, PMIX_UINT16))) { - return ret; - } - break; - case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, p[i].array, p[i].size, PMIX_UINT32))) { - return ret; - } - break; - case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int64(buffer, p[i].array, p[i].size, PMIX_UINT64))) { - return ret; - } - break; - case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_float(buffer, p[i].array, p[i].size, PMIX_FLOAT))) { - return ret; - } - break; - case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_double(buffer, p[i].array, p[i].size, PMIX_DOUBLE))) { - return ret; - } - break; - case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_timeval(buffer, p[i].array, p[i].size, PMIX_TIMEVAL))) { - return ret; - } - break; - case PMIX_TIME: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_time(buffer, p[i].array, p[i].size, PMIX_TIME))) { - return ret; - } - break; - case PMIX_STATUS: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_status(buffer, p[i].array, p[i].size, PMIX_STATUS))) { - return ret; - } - break; - case PMIX_INFO: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, p[i].array, p[i].size, PMIX_INFO))) { - return ret; - } - break; - case PMIX_PROC: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_proc(buffer, p[i].array, p[i].size, PMIX_PROC))) { - return ret; - } - break; - case PMIX_PROC_RANK: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_rank(buffer, p[i].array, p[i].size, PMIX_PROC_RANK))) { - return ret; - } - break; - case PMIX_BYTE_OBJECT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_bo(buffer, p[i].array, p[i].size, PMIX_BYTE_OBJECT))) { - return ret; - } - break; - case PMIX_PERSIST: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_persist(buffer, p[i].array, p[i].size, PMIX_PERSIST))) { - return ret; - } - break; - case PMIX_POINTER: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_ptr(buffer, p[i].array, p[i].size, PMIX_POINTER))) { - return ret; - } - break; - case PMIX_SCOPE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_scope(buffer, p[i].array, p[i].size, PMIX_SCOPE))) { - return ret; - } - break; - case PMIX_DATA_RANGE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_range(buffer, p[i].array, p[i].size, PMIX_DATA_RANGE))) { - return ret; - } - break; - case PMIX_PROC_STATE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pstate(buffer, p[i].array, p[i].size, PMIX_PROC_STATE))) { - return ret; - } - break; - case PMIX_PROC_INFO: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pinfo(buffer, p[i].array, p[i].size, PMIX_PROC_INFO))) { - return ret; - } - break; - case PMIX_DATA_ARRAY: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_darray(buffer, p[i].array, p[i].size, PMIX_DATA_ARRAY))) { - return ret; - } - break; - case PMIX_QUERY: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_query(buffer, p[i].array, p[i].size, PMIX_QUERY))) { - return ret; - } - break; - case PMIX_VALUE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_value(buffer, p[i].array, p[i].size, PMIX_QUERY))) { - return ret; - } - break; - case PMIX_ALLOC_DIRECTIVE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_alloc_directive(buffer, p[i].array, p[i].size, PMIX_ALLOC_DIRECTIVE))) { - return ret; - } - break; - case PMIX_ENVAR: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_envar(buffer, p[i].array, p[i].size, PMIX_ENVAR))) { - return ret; - } - break; - - default: - pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", - __FILE__, __LINE__, (int)p[i].type); - return PMIX_ERROR; + /* pack the actual elements */ + PMIX_BFROPS_PACK_TYPE(ret, buffer, p[i].array, p[i].size, p[i].type, regtypes); + if (PMIX_ERR_UNKNOWN_DATA_TYPE == ret) { + pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", + __FILE__, __LINE__, (int)p[i].type); + } + if (PMIX_SUCCESS != ret) { + return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_rank(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_int32(buffer, src, num_vals, PMIX_UINT32); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_PROC_RANK != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT32, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_query(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_query_t *pq = (pmix_query_t*)src; @@ -1008,27 +1096,38 @@ pmix_status_t pmix_bfrops_base_pack_query(pmix_buffer_t *buffer, const void *src int32_t i; int32_t nkeys; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_QUERY != type) { + return PMIX_ERR_BAD_PARAM; + } for (i=0; i < num_vals; i++) { /* pack the number of keys */ nkeys = pmix_argv_count(pq[i].keys); - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &nkeys, 1, PMIX_INT32))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &nkeys, 1, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < nkeys) { /* pack the keys */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, pq[i].keys, nkeys, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, pq[i].keys, nkeys, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } /* pack the number of qualifiers */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &pq[i].nqual, 1, PMIX_SIZE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &pq[i].nqual, 1, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < pq[i].nqual) { /* pack any provided qualifiers */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, pq[i].qualifiers, pq[i].nqual, PMIX_INFO))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, pq[i].qualifiers, pq[i].nqual, PMIX_INFO, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } + } } return PMIX_SUCCESS; @@ -1037,7 +1136,8 @@ pmix_status_t pmix_bfrops_base_pack_query(pmix_buffer_t *buffer, const void *src /********************/ /* PACK FUNCTIONS FOR VALUE TYPES */ -pmix_status_t pmix_bfrops_base_pack_val(pmix_buffer_t *buffer, +pmix_status_t pmix_bfrops_base_pack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *p) { pmix_status_t ret; @@ -1045,206 +1145,110 @@ pmix_status_t pmix_bfrops_base_pack_val(pmix_buffer_t *buffer, switch (p->type) { case PMIX_UNDEF: break; - case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_bool(buffer, &p->data.flag, 1, PMIX_BOOL))) { - return ret; - } - break; - case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, &p->data.byte, 1, PMIX_BYTE))) { - return ret; - } - break; - case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &p->data.string, 1, PMIX_STRING))) { - return ret; - } - break; - case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &p->data.size, 1, PMIX_SIZE))) { - return ret; - } - break; - case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pid(buffer, &p->data.pid, 1, PMIX_PID))) { - return ret; - } - break; - case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int(buffer, &p->data.integer, 1, PMIX_INT))) { - return ret; - } - break; - case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, &p->data.int8, 1, PMIX_INT8))) { - return ret; - } - break; - case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int16(buffer, &p->data.int16, 1, PMIX_INT16))) { - return ret; - } - break; - case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &p->data.int32, 1, PMIX_INT32))) { - return ret; - } - break; - case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int64(buffer, &p->data.int64, 1, PMIX_INT64))) { - return ret; - } - break; - case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int(buffer, &p->data.uint, 1, PMIX_UINT))) { - return ret; - } - break; - case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, &p->data.uint8, 1, PMIX_UINT8))) { - return ret; - } - break; - case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int16(buffer, &p->data.uint16, 1, PMIX_UINT16))) { - return ret; - } - break; - case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int32(buffer, &p->data.uint32, 1, PMIX_UINT32))) { - return ret; - } - break; - case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_int64(buffer, &p->data.uint64, 1, PMIX_UINT64))) { - return ret; - } - break; - case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_float(buffer, &p->data.fval, 1, PMIX_FLOAT))) { - return ret; - } - break; - case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_double(buffer, &p->data.dval, 1, PMIX_DOUBLE))) { - return ret; - } - break; - case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_timeval(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { - return ret; - } - break; - case PMIX_TIME: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_time(buffer, &p->data.time, 1, PMIX_TIME))) { - return ret; - } - break; - case PMIX_STATUS: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_status(buffer, &p->data.status, 1, PMIX_STATUS))) { - return ret; - } - break; - case PMIX_PROC: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_proc(buffer, p->data.proc, 1, PMIX_PROC))) { - return ret; - } - break; - case PMIX_PROC_RANK: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_rank(buffer, &p->data.rank, 1, PMIX_PROC_RANK))) { - return ret; - } - break; - case PMIX_BYTE_OBJECT: - case PMIX_COMPRESSED_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_bo(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { - return ret; - } - break; - case PMIX_PERSIST: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_persist(buffer, &p->data.persist, 1, PMIX_PERSIST))) { - return ret; - } - break; - case PMIX_POINTER: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_ptr(buffer, &p->data.ptr, 1, PMIX_POINTER))) { - return ret; - } - break; - case PMIX_SCOPE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_scope(buffer, &p->data.scope, 1, PMIX_SCOPE))) { - return ret; - } - break; - case PMIX_DATA_RANGE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_range(buffer, &p->data.range, 1, PMIX_DATA_RANGE))) { - return ret; - } - break; - case PMIX_PROC_STATE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pstate(buffer, &p->data.state, 1, PMIX_PROC_STATE))) { - return ret; - } - break; case PMIX_PROC_INFO: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_pinfo(buffer, p->data.pinfo, 1, PMIX_PROC_INFO))) { - return ret; - } - break; case PMIX_DATA_ARRAY: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_darray(buffer, p->data.darray, 1, PMIX_DATA_ARRAY))) { + case PMIX_PROC: + PMIX_BFROPS_PACK_TYPE(ret, buffer, p->data.ptr, 1, p->type, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } break; - case PMIX_ALLOC_DIRECTIVE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_alloc_directive(buffer, &p->data.adir, 1, PMIX_ALLOC_DIRECTIVE))) { - return ret; - } - break; - case PMIX_ENVAR: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_envar(buffer, &p->data.envar, 1, PMIX_ENVAR))) { - return ret; - } - break; - default: - pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", - __FILE__, __LINE__, (int)p->type); - return PMIX_ERROR; + PMIX_BFROPS_PACK_TYPE(ret, buffer, &p->data, 1, p->type, regtypes); + if (PMIX_ERR_UNKNOWN_DATA_TYPE == ret) { + pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", + __FILE__, __LINE__, (int)p->type); + return PMIX_ERROR; + } else if (PMIX_SUCCESS != ret) { + return ret; + } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_ALLOC_DIRECTIVE != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_iof_channel(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_iof_channel(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_pack_int16(buffer, src, num_vals, PMIX_UINT16); + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_IOF_CHANNEL != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_UINT16, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_pack_envar(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix_bfrops_base_pack_envar(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_envar_t *ptr = (pmix_envar_t*)src; int32_t i; pmix_status_t ret; + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_ENVAR != type) { + return PMIX_ERR_BAD_PARAM; + } for (i=0; i < num_vals; ++i) { /* pack the name */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &ptr[i].envar, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].envar, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the value */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_string(buffer, &ptr[i].value, 1, PMIX_STRING))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].value, 1, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* pack the separator */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, &ptr[i].separator, 1, PMIX_BYTE))) { + PMIX_BFROPS_PACK_TYPE(ret, buffer, &ptr[i].separator, 1, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { + return ret; + } + } + return PMIX_SUCCESS; +} + +pmix_status_t pmix_bfrops_base_pack_regex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + char **ptr = (char**)src; + int32_t i; + pmix_status_t ret; + + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_REGEX != type) { + return PMIX_ERR_BAD_PARAM; + } + for (i=0; i < num_vals; ++i) { + ret = pmix_preg.pack(buffer, ptr[i]); + if (PMIX_SUCCESS != ret) { return ret; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c index d17a731257..3987e31a53 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * @@ -21,9 +21,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "src/include/pmix_stdint.h" #include #ifdef HAVE_TIME_H @@ -64,6 +64,9 @@ int pmix_bfrops_base_print_bool(char **output, char *prefix, char *prefx; int ret; + if (PMIX_BOOL != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -105,6 +108,9 @@ int pmix_bfrops_base_print_byte(char **output, char *prefix, char *prefx; int ret; + if (PMIX_BYTE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -145,6 +151,9 @@ int pmix_bfrops_base_print_string(char **output, char *prefix, char *prefx; int ret; + if (PMIX_STRING != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -185,6 +194,9 @@ int pmix_bfrops_base_print_size(char **output, char *prefix, char *prefx; int ret; + if (PMIX_SIZE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -225,6 +237,9 @@ int pmix_bfrops_base_print_pid(char **output, char *prefix, char *prefx; int ret; + if (PMIX_PID != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -264,6 +279,9 @@ int pmix_bfrops_base_print_int(char **output, char *prefix, char *prefx; int ret; + if (PMIX_INT != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -304,6 +322,9 @@ int pmix_bfrops_base_print_uint(char **output, char *prefix, char *prefx; int ret; + if (PMIX_UINT != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -344,6 +365,9 @@ int pmix_bfrops_base_print_uint8(char **output, char *prefix, char *prefx; int ret; + if (PMIX_UINT8 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -384,6 +408,9 @@ int pmix_bfrops_base_print_uint16(char **output, char *prefix, char *prefx; int ret; + if (PMIX_UINT16 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -424,6 +451,9 @@ int pmix_bfrops_base_print_uint32(char **output, char *prefix, char *prefx; int ret; + if (PMIX_UINT32 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -464,6 +494,9 @@ int pmix_bfrops_base_print_int8(char **output, char *prefix, char *prefx; int ret; + if (PMIX_INT8 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -504,6 +537,9 @@ int pmix_bfrops_base_print_int16(char **output, char *prefix, char *prefx; int ret; + if (PMIX_INT16 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -544,6 +580,9 @@ int pmix_bfrops_base_print_int32(char **output, char *prefix, char *prefx; int ret; + if (PMIX_INT32 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -584,6 +623,9 @@ int pmix_bfrops_base_print_uint64(char **output, char *prefix, char *prefx; int ret; + if (PMIX_UINT64 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -625,6 +667,9 @@ int pmix_bfrops_base_print_int64(char **output, char *prefix, char *prefx; int ret; + if (PMIX_INT64 != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -665,6 +710,9 @@ int pmix_bfrops_base_print_float(char **output, char *prefix, char *prefx; int ret; + if (PMIX_FLOAT != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -705,6 +753,9 @@ int pmix_bfrops_base_print_double(char **output, char *prefix, char *prefx; int ret; + if (PMIX_DOUBLE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -746,6 +797,9 @@ int pmix_bfrops_base_print_time(char **output, char *prefix, char *t; int ret; + if (PMIX_TIME != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -789,6 +843,9 @@ int pmix_bfrops_base_print_timeval(char **output, char *prefix, char *prefx; int ret; + if (PMIX_TIMEVAL != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -830,6 +887,9 @@ int pmix_bfrops_base_print_status(char **output, char *prefix, char *prefx; int ret; + if (PMIX_STATUS != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -876,6 +936,9 @@ int pmix_bfrops_base_print_status(char **output, char *prefix, char *prefx; int rc; + if (PMIX_VALUE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1041,6 +1104,9 @@ int pmix_bfrops_base_print_info(char **output, char *prefix, char *tmp=NULL, *tmp2=NULL; int ret; + if (PMIX_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } pmix_bfrops_base_print_value(&tmp, NULL, &src->value, PMIX_VALUE); pmix_bfrops_base_print_info_directives(&tmp2, NULL, &src->flags, PMIX_INFO_DIRECTIVES); ret = asprintf(output, "%sKEY: %s\n%s\t%s\n%s\t%s", prefix, src->key, @@ -1060,6 +1126,9 @@ int pmix_bfrops_base_print_pdata(char **output, char *prefix, char *tmp1, *tmp2; int ret; + if (PMIX_PDATA != type) { + return PMIX_ERR_BAD_PARAM; + } pmix_bfrops_base_print_proc(&tmp1, NULL, &src->proc, PMIX_PROC); pmix_bfrops_base_print_value(&tmp2, NULL, &src->value, PMIX_VALUE); ret = asprintf(output, "%s %s KEY: %s %s", prefix, tmp1, src->key, @@ -1080,12 +1149,20 @@ int pmix_bfrops_base_print_pdata(char **output, char *prefix, int pmix_bfrops_base_print_buf(char **output, char *prefix, pmix_buffer_t *src, pmix_data_type_t type) { + if (NULL == output || NULL == prefix || + NULL == src || PMIX_BUFFER != type) { + return PMIX_ERR_BAD_PARAM; + } return PMIX_SUCCESS; } int pmix_bfrops_base_print_app(char **output, char *prefix, pmix_app_t *src, pmix_data_type_t type) { + if (NULL == output || NULL == prefix || + NULL == src || PMIX_APP != type) { + return PMIX_ERR_BAD_PARAM; + } return PMIX_SUCCESS; } @@ -1095,6 +1172,9 @@ int pmix_bfrops_base_print_proc(char **output, char *prefix, char *prefx; int rc; + if (PMIX_PROC != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1134,6 +1214,10 @@ int pmix_bfrops_base_print_proc(char **output, char *prefix, int pmix_bfrops_base_print_kval(char **output, char *prefix, pmix_kval_t *src, pmix_data_type_t type) { + if (NULL == output || NULL == prefix || + NULL == src || PMIX_KVAL != type) { + return PMIX_ERR_BAD_PARAM; + } return PMIX_SUCCESS; } @@ -1142,6 +1226,9 @@ int pmix_bfrops_base_print_persist(char **output, char *prefix, { char *prefx; + if (PMIX_PERSIST != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1178,6 +1265,9 @@ pmix_status_t pmix_bfrops_base_print_scope(char **output, char *prefix, { char *prefx; + if (PMIX_SCOPE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1204,6 +1294,9 @@ pmix_status_t pmix_bfrops_base_print_range(char **output, char *prefix, { char *prefx; + if (PMIX_DATA_RANGE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1229,6 +1322,9 @@ pmix_status_t pmix_bfrops_base_print_cmd(char **output, char *prefix, { char *prefx; + if (PMIX_COMMAND != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1255,6 +1351,9 @@ pmix_status_t pmix_bfrops_base_print_info_directives(char **output, char *prefix { char *prefx; + if (PMIX_INFO_DIRECTIVES != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1282,6 +1381,9 @@ pmix_status_t pmix_bfrops_base_print_datatype(char **output, char *prefix, char *prefx; int ret; + if (PMIX_DATA_TYPE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1322,6 +1424,9 @@ int pmix_bfrops_base_print_bo(char **output, char *prefix, char *prefx; int ret; + if (PMIX_BYTE_OBJECT != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1362,6 +1467,9 @@ int pmix_bfrops_base_print_ptr(char **output, char *prefix, char *prefx; int ret; + if (PMIX_POINTER != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1390,6 +1498,9 @@ pmix_status_t pmix_bfrops_base_print_pstate(char **output, char *prefix, char *prefx; int ret; + if (PMIX_PROC_STATE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1420,6 +1531,9 @@ pmix_status_t pmix_bfrops_base_print_pinfo(char **output, char *prefix, pmix_status_t rc = PMIX_SUCCESS; char *p2, *tmp; + if (PMIX_PROC_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1462,6 +1576,9 @@ pmix_status_t pmix_bfrops_base_print_darray(char **output, char *prefix, char *prefx; int ret; + if (PMIX_DATA_ARRAY != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1493,6 +1610,9 @@ pmix_status_t pmix_bfrops_base_print_query(char **output, char *prefix, char *tmp, *t2, *t3; size_t n; + if (PMIX_QUERY != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1564,6 +1684,9 @@ pmix_status_t pmix_bfrops_base_print_rank(char **output, char *prefix, char *prefx; int rc; + if (PMIX_PROC_RANK != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1609,6 +1732,9 @@ pmix_status_t pmix_bfrops_base_print_alloc_directive(char **output, char *prefix char *prefx; int ret; + if (PMIX_ALLOC_DIRECTIVE != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1638,6 +1764,9 @@ pmix_status_t pmix_bfrops_base_print_iof_channel(char **output, char *prefix, char *prefx; int ret; + if (PMIX_IOF_CHANNEL != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1667,6 +1796,9 @@ pmix_status_t pmix_bfrops_base_print_envar(char **output, char *prefix, char *prefx; int ret; + if (PMIX_ENVAR != type) { + return PMIX_ERR_BAD_PARAM; + } /* deal with NULL prefix */ if (NULL == prefix) { if (0 > asprintf(&prefx, " ")) { @@ -1690,3 +1822,35 @@ pmix_status_t pmix_bfrops_base_print_envar(char **output, char *prefix, return PMIX_SUCCESS; } } + +pmix_status_t pmix_bfrops_base_print_regex(char **output, char *prefix, + char *src, + pmix_data_type_t type) +{ + char *prefx; + int ret; + + if (PMIX_REGEX != type) { + return PMIX_ERR_BAD_PARAM; + } + /* deal with NULL prefix */ + if (NULL == prefix) { + if (0 > asprintf(&prefx, " ")) { + return PMIX_ERR_NOMEM; + } + } else { + prefx = prefix; + } + + ret = asprintf(output, "%sData type: PMIX_REGEX\tName: %s", prefx, src); + + if (prefx != prefix) { + free(prefx); + } + + if (0 > ret) { + return PMIX_ERR_OUT_OF_RESOURCE; + } else { + return PMIX_SUCCESS; + } +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_select.c index 24a9e33594..2d6e56a178 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -29,8 +31,6 @@ #include "src/mca/bfrops/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_bfrop_base_select(void) @@ -43,11 +43,11 @@ int pmix_bfrop_base_select(void) int rc, priority; bool inserted; - if (selected) { + if (pmix_bfrops_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_bfrops_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_bfrops_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_stubs.c index 04543b83cc..fff03a31e5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_stubs.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include @@ -31,13 +31,110 @@ #include "src/mca/bfrops/base/base.h" +static const char* basic_type_string(pmix_data_type_t type) +{ + switch(type) { + case PMIX_BOOL: + return "PMIX_BOOL"; + case PMIX_REGEX: + return "PMIX_REGEX"; + case PMIX_BYTE: + return "PMIX_BYTE"; + case PMIX_STRING: + return "PMIX_STRING"; + case PMIX_SIZE: + return "PMIX_SIZE"; + case PMIX_PID: + return "PMIX_PID"; + case PMIX_INT: + return "PMIX_INT"; + case PMIX_INT8: + return "PMIX_INT8"; + case PMIX_INT16: + return "PMIX_INT16"; + case PMIX_INT32: + return "PMIX_INT32"; + case PMIX_INT64: + return "PMIX_INT64"; + case PMIX_UINT: + return "PMIX_UINT"; + case PMIX_UINT8: + return "PMIX_UINT8"; + case PMIX_UINT16: + return "PMIX_UINT16"; + case PMIX_UINT32: + return "PMIX_UINT32"; + case PMIX_UINT64: + return "PMIX_UINT64"; + case PMIX_FLOAT: + return "PMIX_FLOAT"; + case PMIX_DOUBLE: + return "PMIX_DOUBLE"; + case PMIX_TIMEVAL: + return "PMIX_TIMEVAL"; + case PMIX_TIME: + return "PMIX_TIME"; + case PMIX_STATUS: + return "PMIX_STATUS"; + case PMIX_VALUE: + return "PMIX_VALUE"; + case PMIX_PROC: + return "PMIX_PROC"; + case PMIX_APP: + return "PMIX_APP"; + case PMIX_INFO: + return "PMIX_INFO"; + case PMIX_PDATA: + return "PMIX_PDATA"; + case PMIX_BUFFER: + return "PMIX_BUFFER"; + case PMIX_BYTE_OBJECT: + return "PMIX_BYTE_OBJECT"; + case PMIX_KVAL: + return "PMIX_KVAL"; + case PMIX_PERSIST: + return "PMIX_PERSIST"; + case PMIX_POINTER: + return "PMIX_POINTER"; + case PMIX_SCOPE: + return "PMIX_SCOPE"; + case PMIX_DATA_RANGE: + return "PMIX_DATA_RANGE"; + case PMIX_COMMAND: + return "PMIX_COMMAND"; + case PMIX_INFO_DIRECTIVES: + return "PMIX_INFO_DIRECTIVES"; + case PMIX_DATA_TYPE: + return "PMIX_DATA_TYPE"; + case PMIX_PROC_STATE: + return "PMIX_PROC_STATE"; + case PMIX_PROC_INFO: + return "PMIX_PROC_INFO"; + case PMIX_DATA_ARRAY: + return "PMIX_DATA_ARRAY"; + case PMIX_PROC_RANK: + return "PMIX_PROC_RANK"; + case PMIX_QUERY: + return "PMIX_QUERY"; + case PMIX_COMPRESSED_STRING: + return "PMIX_COMPRESSED_STRING"; + case PMIX_ALLOC_DIRECTIVE: + return "PMIX_ALLOC_DIRECTIVE"; + case PMIX_IOF_CHANNEL: + return "PMIX_IOF_CHANNEL"; + case PMIX_ENVAR: + return "PMIX_ENVAR"; + default: + return "NOT INITIALIZED"; + } +} PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type) { pmix_bfrops_base_active_module_t *active; char *reply; if (!pmix_bfrops_globals.initialized) { - return "NOT INITIALIZED"; + return basic_type_string(type); } PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c index 051c35d82a..5a707a6298 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c @@ -10,10 +10,10 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ * @@ -22,14 +22,14 @@ * $HEADER$ */ -#include - -#include +#include "src/include/pmix_config.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" #include "src/include/pmix_globals.h" +#include "src/mca/preg/preg.h" + #include "src/mca/bfrops/bfrops_types.h" #include "src/mca/bfrops/base/base.h" @@ -41,7 +41,6 @@ static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtyp { pmix_status_t rc; pmix_data_type_t local_type; - pmix_bfrop_type_info_t *info; pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrops_base_unpack_buffer( %p, %p, %lu, %d )\n", @@ -49,7 +48,7 @@ static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtyp /** Unpack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(buffer, &local_type))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(regtypes, buffer, &local_type))) { PMIX_ERROR_LOG(rc); return rc; } @@ -59,14 +58,8 @@ static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtyp return PMIX_ERR_PACK_MISMATCH; } } - - /* Lookup the unpack function for this type and call it */ - if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(regtypes, type))) { - PMIX_ERROR_LOG(PMIX_ERR_UNPACK_FAILURE); - return PMIX_ERR_UNPACK_FAILURE; - } - - return info->odti_unpack_fn(buffer, dst, num_vals, type); + PMIX_BFROPS_UNPACK_TYPE(rc, buffer, dst, num_vals, type, regtypes); + return rc; } pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes, @@ -103,7 +96,7 @@ pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes, * int32_t as used here. */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(buffer, &local_type))) { + if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(regtypes, buffer, &local_type))) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ @@ -117,7 +110,8 @@ pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes, } n=1; - if (PMIX_SUCCESS != (rc = pmix_bfrops_base_unpack_int32(buffer, &local_num, &n, PMIX_INT32))) { + PMIX_BFROPS_UNPACK_TYPE(rc, buffer, &local_num, &n, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != rc) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ @@ -152,41 +146,13 @@ pmix_status_t pmix_bfrops_base_unpack(pmix_pointer_array_t *regtypes, return ret; } -static pmix_status_t unpack_gentype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - switch(type) { - case PMIX_INT8: - case PMIX_UINT8: - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, type); - break; - - case PMIX_INT16: - case PMIX_UINT16: - return pmix_bfrops_base_unpack_int16(buffer, dest, num_vals, type); - break; - - case PMIX_INT32: - case PMIX_UINT32: - return pmix_bfrops_base_unpack_int32(buffer, dest, num_vals, type); - break; - - case PMIX_INT64: - case PMIX_UINT64: - return pmix_bfrops_base_unpack_int64(buffer, dest, num_vals, type); - break; - - default: - return PMIX_ERR_UNKNOWN_DATA_TYPE; - } -} - /* UNPACK GENERIC SYSTEM TYPES */ /* * BOOL */ - pmix_status_t pmix_bfrops_base_unpack_bool(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix_bfrops_base_unpack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; @@ -196,6 +162,13 @@ static pmix_status_t unpack_gentype(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_bool * %d\n", (int)*num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_BOOL != type) { + return PMIX_ERR_BAD_PARAM; + } + /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, *num_vals)) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -222,24 +195,28 @@ static pmix_status_t unpack_gentype(pmix_buffer_t *buffer, void *dest, /* * INT */ -pmix_status_t pmix_bfrops_base_unpack_int(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_INT != type && PMIX_UINT != type) { + return PMIX_ERR_BAD_PARAM; + } + + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_INT) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = unpack_gentype(buffer, dest, num_vals, BFROP_TYPE_INT))) { - } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_INT, regtypes); } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(int, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, int, remote_type, ret); } return ret; @@ -248,50 +225,63 @@ pmix_status_t pmix_bfrops_base_unpack_int(pmix_buffer_t *buffer, void *dest, /* * SIZE_T */ -pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SIZE != type) { + return PMIX_ERR_BAD_PARAM; + } + + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, + &remote_type))) { + PMIX_ERROR_LOG(ret); return ret; } if (remote_type == BFROP_TYPE_SIZE_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = unpack_gentype(buffer, dest, num_vals, BFROP_TYPE_SIZE_T))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_SIZE_T, + regtypes); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(size_t, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, size_t, remote_type, ret); } - return ret; } /* * PID_T */ -pmix_status_t pmix_bfrops_base_unpack_pid(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_PID != type) { + return PMIX_ERR_BAD_PARAM; + } + + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_PID_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = unpack_gentype(buffer, dest, num_vals, BFROP_TYPE_PID_T))) { - } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_PID_T, regtypes); } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, pid_t, remote_type, ret); } return ret; @@ -303,12 +293,20 @@ pmix_status_t pmix_bfrops_base_unpack_pid(pmix_buffer_t *buffer, void *dest, /* * BYTE, CHAR, INT8 */ -pmix_status_t pmix_bfrops_base_unpack_byte(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_byte * %d\n", (int)*num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_BYTE != type && PMIX_UINT8 != type && PMIX_INT8 != type) { + return PMIX_ERR_BAD_PARAM; + } + /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, *num_vals)) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -323,7 +321,8 @@ pmix_status_t pmix_bfrops_base_unpack_byte(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_int16(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; @@ -332,6 +331,13 @@ pmix_status_t pmix_bfrops_base_unpack_int16(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_int16 * %d\n", (int)*num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INT16 != type && PMIX_UINT16 != type) { + return PMIX_ERR_BAD_PARAM; + } + /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -348,7 +354,8 @@ pmix_status_t pmix_bfrops_base_unpack_int16(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_int32(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; @@ -357,6 +364,13 @@ pmix_status_t pmix_bfrops_base_unpack_int32(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_int32 * %d\n", (int)*num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INT32 != type && PMIX_UINT32 != type) { + return PMIX_ERR_BAD_PARAM; + } + /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -373,13 +387,21 @@ pmix_status_t pmix_bfrops_base_unpack_int32(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_int16(buffer, dest, num_vals, type); + pmix_status_t ret; + + if (PMIX_DATA_TYPE != type) { + return PMIX_ERR_BAD_PARAM; + } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_INT16, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_int64(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i; @@ -388,6 +410,13 @@ pmix_status_t pmix_bfrops_base_unpack_int64(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_int64 * %d\n", (int)*num_vals); + if (NULL == regtypes) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_INT64 != type && PMIX_UINT64 != type) { + return PMIX_ERR_BAD_PARAM; + } + /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -404,15 +433,21 @@ pmix_status_t pmix_bfrops_base_unpack_int64(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_string(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; int32_t i, len, n=1; char **sdest = (char**) dest; + if (PMIX_STRING != type) { + return PMIX_ERR_BAD_PARAM; + } + for (i = 0; i < (*num_vals); ++i) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int32(buffer, &len, &n, PMIX_INT32))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &len, &n, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 == len) { /* zero-length string - unpack the NULL */ @@ -422,7 +457,8 @@ pmix_status_t pmix_bfrops_base_unpack_string(pmix_buffer_t *buffer, void *dest, if (NULL == sdest[i]) { return PMIX_ERR_OUT_OF_RESOURCE; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, sdest[i], &len, PMIX_BYTE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, sdest[i], &len, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -431,7 +467,8 @@ pmix_status_t pmix_bfrops_base_unpack_string(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_float(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; @@ -442,16 +479,16 @@ pmix_status_t pmix_bfrops_base_unpack_float(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_float * %d\n", (int)*num_vals); - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(float))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; + if (PMIX_FLOAT != type) { + return PMIX_ERR_BAD_PARAM; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &convert, &n, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &convert, &n, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL != convert) { @@ -463,7 +500,8 @@ pmix_status_t pmix_bfrops_base_unpack_float(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_double(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; @@ -474,16 +512,16 @@ pmix_status_t pmix_bfrops_base_unpack_double(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_double * %d\n", (int)*num_vals); - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(double))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; + if (PMIX_DOUBLE != type) { + return PMIX_ERR_BAD_PARAM; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &convert, &n, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &convert, &n, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL != convert) { @@ -495,7 +533,8 @@ pmix_status_t pmix_bfrops_base_unpack_double(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; @@ -506,15 +545,15 @@ pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_timeval * %d\n", (int)*num_vals); - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(struct timeval))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; + if (PMIX_TIMEVAL != type) { + return PMIX_ERR_BAD_PARAM; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=2; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int64(buffer, tmp, &n, PMIX_INT64))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, tmp, &n, PMIX_INT64, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } tt.tv_sec = tmp[0]; @@ -524,7 +563,8 @@ pmix_status_t pmix_bfrops_base_unpack_timeval(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; @@ -539,15 +579,15 @@ pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_time * %d\n", (int)*num_vals); - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, (*num_vals)*(sizeof(uint64_t)))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; + if (PMIX_TIME != type) { + return PMIX_ERR_BAD_PARAM; } /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int64(buffer, &ui64, &n, PMIX_UINT64))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ui64, &n, PMIX_UINT64, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } tmp = (time_t)ui64; @@ -557,19 +597,22 @@ pmix_status_t pmix_bfrops_base_unpack_time(pmix_buffer_t *buffer, void *dest, } -pmix_status_t pmix_bfrops_base_unpack_status(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack_status * %d\n", (int)*num_vals); - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, (*num_vals)*(sizeof(pmix_status_t)))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; + if (PMIX_STATUS != type) { + return PMIX_ERR_BAD_PARAM; } /* unpack the data */ - return pmix_bfrops_base_unpack_int32(buffer, dest, num_vals, PMIX_INT32); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_INT32, regtypes); + return ret; } @@ -578,161 +621,24 @@ pmix_status_t pmix_bfrops_base_unpack_status(pmix_buffer_t *buffer, void *dest, /* * PMIX_VALUE */ -pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer, +pmix_status_t pmix_bfrops_base_unpack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *val) { int m; - pmix_status_t ret; + pmix_status_t ret = PMIX_SUCCESS; m = 1; switch (val->type) { case PMIX_UNDEF: break; - case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_bool(buffer, &val->data.flag, &m, PMIX_BOOL))) { - return ret; - } - break; - case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, &val->data.byte, &m, PMIX_BYTE))) { - return ret; - } - break; - case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &val->data.string, &m, PMIX_STRING))) { - return ret; - } - break; - case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &val->data.size, &m, PMIX_SIZE))) { - return ret; - } - break; - case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pid(buffer, &val->data.pid, &m, PMIX_PID))) { - return ret; - } - break; - case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int(buffer, &val->data.integer, &m, PMIX_INT))) { - return ret; - } - break; - case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, &val->data.int8, &m, PMIX_INT8))) { - return ret; - } - break; - case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int16(buffer, &val->data.int16, &m, PMIX_INT16))) { - return ret; - } - break; - case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int32(buffer, &val->data.int32, &m, PMIX_INT32))) { - return ret; - } - break; - case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int64(buffer, &val->data.int64, &m, PMIX_INT64))) { - return ret; - } - break; - case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int(buffer, &val->data.uint, &m, PMIX_UINT))) { - return ret; - } - break; - case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, &val->data.uint8, &m, PMIX_UINT8))) { - return ret; - } - break; - case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int16(buffer, &val->data.uint16, &m, PMIX_UINT16))) { - return ret; - } - break; - case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int32(buffer, &val->data.uint32, &m, PMIX_UINT32))) { - return ret; - } - break; - case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int64(buffer, &val->data.uint64, &m, PMIX_UINT64))) { - return ret; - } - break; - case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_float(buffer, &val->data.fval, &m, PMIX_FLOAT))) { - return ret; - } - break; - case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_double(buffer, &val->data.dval, &m, PMIX_DOUBLE))) { - return ret; - } - break; - case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_timeval(buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { - return ret; - } - break; - case PMIX_TIME: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_time(buffer, &val->data.time, &m, PMIX_TIME))) { - return ret; - } - break; - case PMIX_STATUS: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_status(buffer, &val->data.status, &m, PMIX_STATUS))) { - return ret; - } - break; case PMIX_PROC: /* this field is now a pointer, so we must allocate storage for it */ PMIX_PROC_CREATE(val->data.proc, m); if (NULL == val->data.proc) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_proc(buffer, val->data.proc, &m, PMIX_PROC))) { - return ret; - } - break; - case PMIX_PROC_RANK: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_rank(buffer, &val->data.rank, &m, PMIX_PROC_RANK))) { - return ret; - } - break; - case PMIX_BYTE_OBJECT: - case PMIX_COMPRESSED_STRING: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_bo(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { - return ret; - } - break; - case PMIX_PERSIST: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_persist(buffer, &val->data.proc, &m, PMIX_PERSIST))) { - return ret; - } - break; - case PMIX_POINTER: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_ptr(buffer, &val->data.ptr, &m, PMIX_POINTER))) { - return ret; - } - break; - case PMIX_SCOPE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_scope(buffer, &val->data.scope, &m, PMIX_SCOPE))) { - return ret; - } - break; - case PMIX_DATA_RANGE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_range(buffer, &val->data.range, &m, PMIX_DATA_RANGE))) { - return ret; - } - break; - case PMIX_PROC_STATE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pstate(buffer, &val->data.state, &m, PMIX_PROC_STATE))) { - return ret; - } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.proc, &m, PMIX_PROC, regtypes); break; case PMIX_PROC_INFO: /* this is now a pointer, so allocate storage for it */ @@ -740,9 +646,7 @@ pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer, if (NULL == val->data.pinfo) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pinfo(buffer, val->data.pinfo, &m, PMIX_PROC_INFO))) { - return ret; - } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.pinfo, &m, PMIX_PROC_INFO, regtypes); break; case PMIX_DATA_ARRAY: /* this is now a pointer, so allocate storage for it */ @@ -750,29 +654,20 @@ pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer, if (NULL == val->data.darray) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_darray(buffer, val->data.darray, &m, PMIX_DATA_ARRAY))) { - return ret; - } - break; - case PMIX_ALLOC_DIRECTIVE: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_alloc_directive(buffer, &val->data.adir, &m, PMIX_ALLOC_DIRECTIVE))) { - return ret; - } - break; - case PMIX_ENVAR: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_envar(buffer, &val->data.envar, &m, PMIX_ENVAR))) { - return ret; - } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, val->data.darray, &m, PMIX_DATA_ARRAY, regtypes); break; default: - pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type); - return PMIX_ERROR; + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &val->data, &m, val->type, regtypes); + if (PMIX_ERR_UNKNOWN_DATA_TYPE == ret) { + pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type); + } } - return PMIX_SUCCESS; + return ret; } -pmix_status_t pmix_bfrops_base_unpack_value(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_value_t *ptr; @@ -782,14 +677,18 @@ pmix_status_t pmix_bfrops_base_unpack_value(pmix_buffer_t *buffer, void *dest, ptr = (pmix_value_t *) dest; n = *num_vals; + if (PMIX_VALUE != type) { + return PMIX_ERR_BAD_PARAM; + } + for (i = 0; i < n; ++i) { /* unpack the type */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].type))) { PMIX_ERROR_LOG(ret); return ret; } /* unpack value */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(buffer, &ptr[i])) ) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i])) ) { PMIX_ERROR_LOG(ret); return ret; } @@ -797,7 +696,8 @@ pmix_status_t pmix_bfrops_base_unpack_value(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_info_t *ptr; @@ -808,6 +708,10 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d info", *num_vals); + if (PMIX_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_info_t *) dest; n = *num_vals; @@ -817,7 +721,8 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest, /* unpack key */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { PMIX_ERROR_LOG(ret); return ret; } @@ -828,26 +733,28 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest, free(tmp); /* unpack the directives */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_info_directives(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].value.type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].value.type))) { return ret; } pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: info type %d", ptr[i].value.type); m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(buffer, &ptr[i].value))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_pdata_t *ptr; @@ -858,6 +765,10 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d pdata", *num_vals); + if (PMIX_PDATA != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_pdata_t *) dest; n = *num_vals; @@ -865,13 +776,15 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, PMIX_PDATA_CONSTRUCT(&ptr[i]); /* unpack the proc */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].proc, &m, PMIX_PROC, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack key */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL == tmp) { @@ -883,14 +796,14 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].value.type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].value.type))) { PMIX_ERROR_LOG(ret); return ret; } pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: pdata type %d %s", ptr[i].value.type, ptr[i].value.data.string); m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(buffer, &ptr[i].value))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i].value))) { PMIX_ERROR_LOG(ret); return ret; } @@ -898,7 +811,8 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_buf(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_buffer_t *ptr; @@ -909,16 +823,22 @@ pmix_status_t pmix_bfrops_base_unpack_buf(pmix_buffer_t *buffer, void *dest, ptr = (pmix_buffer_t *) dest; n = *num_vals; + if (PMIX_BUFFER != type) { + return PMIX_ERR_BAD_PARAM; + } + for (i = 0; i < n; ++i) { PMIX_CONSTRUCT(&ptr[i], pmix_buffer_t); /* unpack the type of buffer */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, &ptr[i].type, &m, PMIX_BYTE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].type, &m, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &nbytes, &m, PMIX_SIZE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nbytes, &m, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } m = nbytes; @@ -929,7 +849,8 @@ pmix_status_t pmix_bfrops_base_unpack_buf(pmix_buffer_t *buffer, void *dest, return PMIX_ERR_NOMEM; } /* unpack the bytes */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].base_ptr, &m, PMIX_BYTE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].base_ptr, &m, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -941,7 +862,8 @@ pmix_status_t pmix_bfrops_base_unpack_buf(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_proc_t *ptr; @@ -952,6 +874,10 @@ pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d procs", *num_vals); + if (PMIX_PROC != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_proc_t *) dest; n = *num_vals; @@ -962,8 +888,8 @@ pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest, /* unpack nspace */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { - PMIX_ERROR_LOG(ret); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL == tmp) { @@ -974,15 +900,16 @@ pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest, free(tmp); /* unpack the rank */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_rank(buffer, &ptr[i].rank, &m, PMIX_PROC_RANK))) { - PMIX_ERROR_LOG(ret); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].rank, &m, PMIX_PROC_RANK, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_app_t *ptr; @@ -994,6 +921,10 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d apps", *num_vals); + if (PMIX_APP != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_app_t *) dest; n = *num_vals; @@ -1002,19 +933,29 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, PMIX_APP_CONSTRUCT(&ptr[i]); /* unpack cmd */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].cmd, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].cmd, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack argc */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int(buffer, &nval, &m, PMIX_INT32))) { + /* although nval is technically an int32, we have to unpack it + * as a generic int due to a typo in earlier release series. This + * preserves the ordering of bytes in the packed buffer as it + * includes a tag indicating the actual size of the value. No + * harm is done as generic int is equivalent to int32 on all + * current systems - just something to watch out for in the + * future should someone someday change the size of "int" */ + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nval, &m, PMIX_INT, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack argv */ for (k=0; k < nval; k++) { m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL == tmp) { @@ -1025,13 +966,15 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, } /* unpack env */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int32(buffer, &nval, &m, PMIX_INT32))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nval, &m, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } for (k=0; k < nval; k++) { m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL == tmp) { @@ -1042,23 +985,27 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, } /* unpack cwd */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].cwd, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].cwd, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack maxprocs */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int(buffer, &ptr[i].maxprocs, &m, PMIX_INT))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].maxprocs, &m, PMIX_INT, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack info array */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].ninfo, &m, PMIX_SIZE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].ninfo, &m, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < ptr[i].ninfo) { PMIX_INFO_CREATE(ptr[i].info, ptr[i].ninfo); m = ptr[i].ninfo; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_info(buffer, ptr[i].info, &m, PMIX_INFO))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].info, &m, PMIX_INFO, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -1066,7 +1013,8 @@ pmix_status_t pmix_bfrops_base_unpack_app(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; @@ -1076,6 +1024,10 @@ pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d kvals", *num_vals); + if (PMIX_KVAL != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_kval_t*) dest; n = *num_vals; @@ -1083,29 +1035,38 @@ pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest, PMIX_CONSTRUCT(&ptr[i], pmix_kval_t); /* unpack the key */ m = 1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].key, &m, PMIX_STRING))) { - PMIX_ERROR_LOG(ret); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].key, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* allocate the space */ ptr[i].value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); /* unpack the value */ m = 1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].value, &m, PMIX_VALUE))) { - PMIX_ERROR_LOG(ret); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].value, &m, PMIX_VALUE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_persist(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (PMIX_PERSIST != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_BYTE, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_byte_object_t *ptr; @@ -1115,6 +1076,10 @@ pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d byte_object", *num_vals); + if (PMIX_BYTE_OBJECT != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_byte_object_t *) dest; n = *num_vals; @@ -1122,13 +1087,15 @@ pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_byte_object_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].size, &m, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < ptr[i].size) { ptr[i].bytes = (char*)malloc(ptr[i].size * sizeof(char)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].bytes, &m, PMIX_BYTE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].bytes, &m, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -1136,49 +1103,103 @@ pmix_status_t pmix_bfrops_base_unpack_bo(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_ptr(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { uint8_t foo=1; int32_t cnt=1; + pmix_status_t ret; + + if (NULL == dest) { + return PMIX_ERR_BAD_PARAM; + } + if (NULL == num_vals) { + return PMIX_ERR_BAD_PARAM; + } + if (PMIX_POINTER != type) { + return PMIX_ERR_BAD_PARAM; + } /* it obviously makes no sense to pack a pointer and * send it somewhere else, so we just unpack the sentinel */ - return pmix_bfrops_base_unpack_byte(buffer, &foo, &cnt, PMIX_UINT8); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &foo, &cnt, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_scope(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (PMIX_SCOPE != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_range(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (PMIX_DATA_RANGE != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_cmd(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (PMIX_COMMAND != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_info_directives(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_int32(buffer, dest, num_vals, PMIX_UINT32); + pmix_status_t ret; + + if (PMIX_INFO_DIRECTIVES != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT32, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_pstate(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (PMIX_PROC_STATE != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_proc_info_t *ptr; @@ -1188,6 +1209,10 @@ pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d pinfo", *num_vals); + if (PMIX_PROC_INFO != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_proc_info_t *) dest; n = *num_vals; @@ -1195,43 +1220,54 @@ pmix_status_t pmix_bfrops_base_unpack_pinfo(pmix_buffer_t *buffer, void *dest, PMIX_PROC_INFO_CONSTRUCT(&ptr[i]); /* unpack the proc */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].proc, &m, PMIX_PROC, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack the hostname */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].hostname, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].hostname, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack the executable */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].executable_name, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].executable_name, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack pid */ - m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pid(buffer, &ptr[i].pid, &m, PMIX_PID))) { + m=1; + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].pid, &m, PMIX_PID, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack state */ - m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pstate(buffer, &ptr[i].state, &m, PMIX_PROC_STATE))) { + m=1; + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].state, &m, PMIX_PROC_STATE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_data_array_t *ptr; int32_t i, n, m; pmix_status_t ret; + pmix_data_type_t t; pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d data arrays", *num_vals); + if (PMIX_DATA_ARRAY != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_data_array_t *) dest; n = *num_vals; @@ -1239,12 +1275,13 @@ pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_data_array_t)); /* unpack the type */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(buffer, &ptr[i].type))) { + if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].type))) { return ret; } /* unpack the number of array elements */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].size, &m, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 == ptr[i].size || PMIX_UNDEF == ptr[i].type) { @@ -1253,262 +1290,36 @@ pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest, } /* allocate storage for the array and unpack the array elements */ m = ptr[i].size; - switch(ptr[i].type) { - case PMIX_BOOL: - ptr[i].array = (bool*)malloc(m * sizeof(bool)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_bool(buffer, ptr[i].array, &m, PMIX_BOOL))) { - return ret; - } - break; - case PMIX_BYTE: - case PMIX_INT8: - case PMIX_UINT8: - ptr[i].array = (uint8_t*)malloc(m * sizeof(uint8_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_INT16: - case PMIX_UINT16: - ptr[i].array = (uint16_t*)malloc(m * sizeof(uint16_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int16(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_INT32: - case PMIX_UINT32: - ptr[i].array = (uint32_t*)malloc(m * sizeof(uint32_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int32(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_INT64: - case PMIX_UINT64: - ptr[i].array = (uint64_t*)malloc(m * sizeof(uint64_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int64(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_STRING: - ptr[i].array = (char**)malloc(m * sizeof(char*)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_SIZE: - ptr[i].array = (size_t*)malloc(m * sizeof(size_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_PID: - ptr[i].array = (pid_t*)malloc(m * sizeof(pid_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pid(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_INT: - case PMIX_UINT: - ptr[i].array = (int*)malloc(m * sizeof(int)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_FLOAT: - ptr[i].array = (float*)malloc(m * sizeof(float)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_float(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_DOUBLE: - ptr[i].array = (double*)malloc(m * sizeof(double)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_double(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_TIMEVAL: - ptr[i].array = (struct timeval *)malloc(m * sizeof(struct timeval)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_timeval(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_TIME: - ptr[i].array = (time_t*)malloc(m * sizeof(time_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_time(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_STATUS: - ptr[i].array = (pmix_status_t*)malloc(m * sizeof(pmix_status_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_status(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_INFO: - ptr[i].array = (pmix_info_t*)malloc(m * sizeof(pmix_info_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_info(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_PROC: - ptr[i].array = (pmix_proc_t*)malloc(m * sizeof(pmix_proc_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_proc(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_BYTE_OBJECT: - case PMIX_COMPRESSED_STRING: - ptr[i].array = (pmix_byte_object_t*)malloc(m * sizeof(pmix_byte_object_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_bo(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_PERSIST: - ptr[i].array = (pmix_persistence_t*)malloc(m * sizeof(pmix_persistence_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_persist(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_POINTER: - ptr[i].array = (char*)malloc(m * sizeof(char*)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_ptr(buffer, ptr[i].array, &m, PMIX_POINTER))) { - return ret; - } - break; - case PMIX_SCOPE: - ptr[i].array = (pmix_scope_t*)malloc(m * sizeof(pmix_scope_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_scope(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_DATA_RANGE: - ptr[i].array = (pmix_data_range_t*)malloc(m * sizeof(pmix_data_range_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_range(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_PROC_STATE: - ptr[i].array = (pmix_proc_state_t*)malloc(m * sizeof(pmix_proc_state_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pstate(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_PROC_INFO: - ptr[i].array = (pmix_proc_info_t*)malloc(m * sizeof(pmix_proc_info_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_pinfo(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_QUERY: - ptr[i].array = (pmix_query_t*)malloc(m * sizeof(pmix_query_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_query(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_VALUE: - ptr[i].array = (pmix_value_t*)malloc(m * sizeof(pmix_value_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - case PMIX_ENVAR: - ptr[i].array = (pmix_envar_t*)malloc(m * sizeof(pmix_envar_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_envar(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - default: - return PMIX_ERR_NOT_SUPPORTED; + t = ptr[i].type; + + PMIX_DATA_ARRAY_CONSTRUCT(&ptr[i], m, t); + if (NULL == ptr[i].array) { + return PMIX_ERR_NOMEM; + } + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].array, &m, t, regtypes); + if (PMIX_SUCCESS != ret) { + return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_rank(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_int32(buffer, dest, num_vals, PMIX_UINT32); + pmix_status_t ret; + + if (PMIX_PROC_RANK != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT32, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_query_t *ptr; @@ -1519,6 +1330,10 @@ pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d queries", *num_vals); + if (PMIX_QUERY != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_query_t *) dest; n = *num_vals; @@ -1526,7 +1341,8 @@ pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest, PMIX_QUERY_CONSTRUCT(&ptr[i]); /* unpack the number of keys */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_int32(buffer, &nkeys, &m, PMIX_INT32))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &nkeys, &m, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < nkeys) { @@ -1536,20 +1352,23 @@ pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest, } /* unpack keys */ m=nkeys; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, ptr[i].keys, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].keys, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } /* unpack the number of qualifiers */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].nqual, &m, PMIX_SIZE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].nqual, &m, PMIX_SIZE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 < ptr[i].nqual) { /* unpack the qualifiers */ PMIX_INFO_CREATE(ptr[i].qualifiers, ptr[i].nqual); m = ptr[i].nqual; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_info(buffer, ptr[i].qualifiers, &m, PMIX_INFO))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, ptr[i].qualifiers, &m, PMIX_INFO, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -1557,19 +1376,36 @@ pmix_status_t pmix_bfrops_base_unpack_query(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + pmix_status_t ret; + + if (PMIX_ALLOC_DIRECTIVE != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT8, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_iof_channel(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_iof_channel(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix_bfrops_base_unpack_int16(buffer, dest, num_vals, PMIX_UINT16); + pmix_status_t ret; + + if (PMIX_IOF_CHANNEL != type) { + return PMIX_ERR_BAD_PARAM; + } + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_UINT16, regtypes); + return ret; } -pmix_status_t pmix_bfrops_base_unpack_envar(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix_bfrops_base_unpack_envar(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_envar_t *ptr; @@ -1579,6 +1415,10 @@ pmix_status_t pmix_bfrops_base_unpack_envar(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix_bfrop_unpack: %d envars", *num_vals); + if (PMIX_ENVAR != type) { + return PMIX_ERR_BAD_PARAM; + } + ptr = (pmix_envar_t *) dest; n = *num_vals; @@ -1586,17 +1426,48 @@ pmix_status_t pmix_bfrops_base_unpack_envar(pmix_buffer_t *buffer, void *dest, PMIX_ENVAR_CONSTRUCT(&ptr[i]); /* unpack the name */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].envar, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].envar, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack the value */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_string(buffer, &ptr[i].value, &m, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].value, &m, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } /* unpack the separator */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, &ptr[i].separator, &m, PMIX_BYTE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].separator, &m, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { + return ret; + } + } + return PMIX_SUCCESS; +} + +pmix_status_t pmix_bfrops_base_unpack_regex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + char **ptr; + int32_t i, n; + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix_bfrop_unpack: %d regex", *num_vals); + + if (PMIX_REGEX != type) { + return PMIX_ERR_BAD_PARAM; + } + + ptr = (char **) dest; + n = *num_vals; + + for (i = 0; i < n; ++i) { + ret = pmix_preg.unpack(buffer, &ptr[n]); + if (PMIX_SUCCESS != ret) { + *num_vals = n; return ret; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h index 258b727afe..8ff6099c5d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -31,9 +31,9 @@ #ifndef PMIX_BFROP_H_ #define PMIX_BFROP_H_ -#include -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" +#include "src/include/types.h" #include "src/mca/mca.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops_types.h index b1afcbcfc1..3827abd378 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops_types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops_types.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,13 +28,13 @@ #ifndef PMIX_MCA_BFROP_TYPES_H_ #define PMIX_MCA_BFROP_TYPES_H_ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" #include "src/class/pmix_pointer_array.h" #include "src/class/pmix_list.h" -#include +#include "include/pmix_common.h" BEGIN_C_DECLS @@ -146,7 +146,7 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_buffer_t); /* Convenience macro to check for empty buffer without * exposing the internals */ #define PMIX_BUFFER_IS_EMPTY(b) \ - 0 == (b)->bytes_used + (0 == (b)->bytes_used) END_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12.c index 84e0387cd8..5df2a04fad 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12.c @@ -13,7 +13,9 @@ * Copyright (c) 201-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 201-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +24,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include "src/mca/bfrops/base/base.h" #include "bfrop_v12.h" @@ -444,13 +446,15 @@ int pmix12_v2_to_v1_datatype(pmix_data_type_t v2type) return v1type; } -pmix_status_t pmix12_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_store_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, + pmix_data_type_t type) { int v1type; v1type = pmix12_v2_to_v1_datatype(type); - return pmix12_bfrop_pack_datatype(buffer, &v1type, 1, PMIX_INT); + return pmix12_bfrop_pack_datatype(regtypes, buffer, &v1type, 1, PMIX_INT); } pmix_data_type_t pmix12_v1_to_v2_datatype(int v1type) @@ -491,13 +495,14 @@ pmix_data_type_t pmix12_v1_to_v2_datatype(int v1type) return v2type; } -pmix_status_t pmix12_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type) +pmix_status_t pmix12_bfrop_get_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t *type) { int32_t n=1; int v1type; pmix_status_t rc; - rc = pmix12_bfrop_unpack_datatype(buffer, &v1type, &n, PMIX_INT); + rc = pmix12_bfrop_unpack_datatype(regtypes, buffer, &v1type, &n, PMIX_INT); if (UINT16_MAX < v1type) { *type = 0; return PMIX_ERR_UNKNOWN_DATA_TYPE; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12_component.c index 4a9f5fc170..61de655da6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/bfrop_v12_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/types.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c index c4eeeb14bb..b94ad16aba 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -20,7 +20,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h index 9c74c85568..137d9e70fb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h @@ -11,10 +11,12 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +27,7 @@ #ifndef PMIX1_BFROP_INTERNAL_H_ #define PMIX1_BFROP_INTERNAL_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -122,175 +124,249 @@ pmix_value_cmp_t pmix12_bfrop_value_cmp(pmix_value_t *p, /* * Specialized functions */ -pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, - int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dst, + int32_t *num_vals, pmix_data_type_t type); /* * Internal pack functions */ -pmix_status_t pmix12_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - -pmix_status_t pmix12_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - -pmix_status_t pmix12_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); - -pmix_status_t pmix12_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -/* compatibility functions - no corresponding PMIx v1.x definitions */ -pmix_status_t pmix12_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_range(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_info_directives(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_proc_state(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_proc_info(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_query(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); + +pmix_status_t pmix12_bfrop_pack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); + +pmix_status_t pmix12_bfrop_pack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src, + +pmix_status_t pmix12_bfrop_pack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +/* compatibility functions - no corresponding PMIx v1.x definitions */ +pmix_status_t pmix12_bfrop_pack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_proc_state(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_proc_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_pack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); /* * Internal unpack functions */ -pmix_status_t pmix12_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - -pmix_status_t pmix12_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - -pmix_status_t pmix12_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - -pmix_status_t pmix12_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -/* compatibility functions - no corresponding PMIx v1.x definitions */ -pmix_status_t pmix12_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_info_directives(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_proc_state(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_proc_info(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + +pmix_status_t pmix12_bfrop_unpack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + +pmix_status_t pmix12_bfrop_unpack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix12_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest, + +pmix_status_t pmix12_bfrop_unpack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +/* compatibility functions - no corresponding PMIx v1.x definitions */ +pmix_status_t pmix12_bfrop_unpack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_proc_state(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_proc_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_unpack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); /* @@ -408,9 +484,12 @@ pmix_status_t pmix12_bfrop_print_rank(char **output, char *prefix, /* * Internal helper functions */ -pmix_status_t pmix12_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type); +pmix_status_t pmix12_bfrop_store_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, + pmix_data_type_t type); -pmix_status_t pmix12_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type); +pmix_status_t pmix12_bfrop_get_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t *type); int pmix12_v2_to_v1_datatype(pmix_data_type_t v2type); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c index efddd287de..f418ca5b9d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c @@ -10,10 +10,10 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -23,9 +23,7 @@ * $HEADER$ */ -#include - -#include +#include "src/include/pmix_config.h" #ifdef HAVE_ARPA_INET_H #include @@ -37,11 +35,12 @@ #include "bfrop_v12.h" #include "internal.h" - pmix_status_t pmix12_bfrop_pack(pmix_buffer_t *buffer, +pmix_status_t pmix12_bfrop_pack(pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_status_t rc; + pmix_pointer_array_t *regtypes = &mca_bfrops_v12_component.types; /* check for error */ if (NULL == buffer) { @@ -50,21 +49,22 @@ /* Pack the number of values */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix12_bfrop_store_data_type(buffer, PMIX_INT32))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_store_data_type(regtypes, buffer, PMIX_INT32))) { return rc; } } - if (PMIX_SUCCESS != (rc = pmix12_bfrop_pack_int32(buffer, &num_vals, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_pack_int32(regtypes, buffer, &num_vals, 1, PMIX_INT32))) { return rc; } /* Pack the value(s) */ - return pmix12_bfrop_pack_buffer(buffer, src, num_vals, type); + return pmix12_bfrop_pack_buffer(regtypes, buffer, src, num_vals, type); } -pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer, - const void *src, int32_t num_vals, - pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, + const void *src, int32_t num_vals, + pmix_data_type_t type) { pmix_status_t rc; pmix_bfrop_type_info_t *info; @@ -95,7 +95,7 @@ pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer, /* Pack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix12_bfrop_store_data_type(buffer, v1type))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_store_data_type(regtypes, buffer, v1type))) { return rc; } } @@ -111,7 +111,7 @@ pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer, return PMIX_ERR_PACK_FAILURE; } - return info->odti_pack_fn(buffer, src, num_vals, v1type); + return info->odti_pack_fn(regtypes, buffer, src, num_vals, v1type); } @@ -120,8 +120,9 @@ pmix_status_t pmix12_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * BOOL */ -pmix_status_t pmix12_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { uint8_t *dst; int32_t i; @@ -152,54 +153,57 @@ pmix_status_t pmix12_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, /* * INT */ -pmix_status_t pmix12_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; /* System types need to always be described so we can properly unpack them */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(buffer, BFROP_TYPE_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_INT))) { return ret; } /* Turn around and pack the real type */ - return pmix12_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_INT); + return pmix12_bfrop_pack_buffer(regtypes, buffer, src, num_vals, BFROP_TYPE_INT); } /* * SIZE_T */ -pmix_status_t pmix12_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; /* System types need to always be described so we can properly unpack them. */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(buffer, BFROP_TYPE_SIZE_T))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_SIZE_T))) { return ret; } - return pmix12_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_SIZE_T); + return pmix12_bfrop_pack_buffer(regtypes, buffer, src, num_vals, BFROP_TYPE_SIZE_T); } /* * PID_T */ -pmix_status_t pmix12_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; /* System types need to always be described so we can properly unpack them. */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(buffer, BFROP_TYPE_PID_T))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_PID_T))) { return ret; } /* Turn around and pack the real type */ - return pmix12_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_PID_T); + return pmix12_bfrop_pack_buffer(regtypes, buffer, src, num_vals, BFROP_TYPE_PID_T); } @@ -208,8 +212,9 @@ pmix_status_t pmix12_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, /* * BYTE, CHAR, INT8 */ -pmix_status_t pmix12_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { char *dst; @@ -232,8 +237,9 @@ pmix_status_t pmix12_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, /* * INT16 */ -pmix_status_t pmix12_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *srctmp = (uint16_t*) src; @@ -259,8 +265,9 @@ pmix_status_t pmix12_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, /* * INT32 */ -pmix_status_t pmix12_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint32_t tmp, *srctmp = (uint32_t*) src; @@ -283,17 +290,19 @@ pmix_status_t pmix12_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { - return pmix12_bfrop_pack_int32(buffer, src, num_vals, type); + return pmix12_bfrop_pack_int32(regtypes, buffer, src, num_vals, type); } /* * INT64 */ -pmix_status_t pmix12_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, tmp2; @@ -321,8 +330,9 @@ pmix_status_t pmix12_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, /* * STRING */ -pmix_status_t pmix12_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int ret = PMIX_SUCCESS; int32_t i, len; @@ -331,16 +341,16 @@ pmix_status_t pmix12_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { if (NULL == ssrc[i]) { /* got zero-length string/NULL pointer - store NULL */ len = 0; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(regtypes, buffer, &len, 1, PMIX_INT32))) { return ret; } } else { len = (int32_t)strlen(ssrc[i]) + 1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(regtypes, buffer, &len, 1, PMIX_INT32))) { return ret; } if (PMIX_SUCCESS != (ret = - pmix12_bfrop_pack_byte(buffer, ssrc[i], len, PMIX_BYTE))) { + pmix12_bfrop_pack_byte(regtypes, buffer, ssrc[i], len, PMIX_BYTE))) { return ret; } } @@ -350,8 +360,9 @@ pmix_status_t pmix12_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, } /* FLOAT */ -pmix_status_t pmix12_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -362,7 +373,7 @@ pmix_status_t pmix12_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, if (0 > asprintf(&convert, "%f", ssrc[i])) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &convert, 1, PMIX_STRING))) { free(convert); return ret; } @@ -373,8 +384,9 @@ pmix_status_t pmix12_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, } /* DOUBLE */ -pmix_status_t pmix12_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -385,7 +397,7 @@ pmix_status_t pmix12_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, if (0 > asprintf(&convert, "%f", ssrc[i])) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &convert, 1, PMIX_STRING))) { free(convert); return ret; } @@ -396,8 +408,9 @@ pmix_status_t pmix12_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, } /* TIMEVAL */ -pmix_status_t pmix12_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int64_t tmp[2]; pmix_status_t ret = PMIX_SUCCESS; @@ -407,7 +420,7 @@ pmix_status_t pmix12_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { tmp[0] = (int64_t)ssrc[i].tv_sec; tmp[1] = (int64_t)ssrc[i].tv_usec; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int64(buffer, tmp, 2, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int64(regtypes, buffer, tmp, 2, PMIX_INT64))) { return ret; } } @@ -416,8 +429,9 @@ pmix_status_t pmix12_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, } /* TIME */ -pmix_status_t pmix12_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -429,7 +443,7 @@ pmix_status_t pmix12_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, */ for (i = 0; i < num_vals; ++i) { ui64 = (uint64_t)ssrc[i]; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int64(buffer, &ui64, 1, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int64(regtypes, buffer, &ui64, 1, PMIX_UINT64))) { return ret; } } @@ -439,7 +453,8 @@ pmix_status_t pmix12_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, /* PACK FUNCTIONS FOR GENERIC PMIX TYPES */ -static pmix_status_t pack_val(pmix_buffer_t *buffer, +static pmix_status_t pack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *p) { pmix_status_t ret; @@ -448,97 +463,97 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, switch (p->type) { case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.flag, 1, PMIX_BOOL))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.flag, 1, PMIX_BOOL))) { return ret; } break; case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.byte, 1, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.byte, 1, PMIX_BYTE))) { return ret; } break; case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.string, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.string, 1, PMIX_STRING))) { return ret; } break; case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.size, 1, PMIX_SIZE))) { return ret; } break; case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.pid, 1, PMIX_PID))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.pid, 1, PMIX_PID))) { return ret; } break; case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.integer, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.integer, 1, PMIX_INT))) { return ret; } break; case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int8, 1, PMIX_INT8))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.int8, 1, PMIX_INT8))) { return ret; } break; case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int16, 1, PMIX_INT16))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.int16, 1, PMIX_INT16))) { return ret; } break; case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int32, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.int32, 1, PMIX_INT32))) { return ret; } break; case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.int64, 1, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.int64, 1, PMIX_INT64))) { return ret; } break; case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint, 1, PMIX_UINT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.uint, 1, PMIX_UINT))) { return ret; } break; case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint8, 1, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.uint8, 1, PMIX_UINT8))) { return ret; } break; case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint16, 1, PMIX_UINT16))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.uint16, 1, PMIX_UINT16))) { return ret; } break; case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint32, 1, PMIX_UINT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.uint32, 1, PMIX_UINT32))) { return ret; } break; case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.uint64, 1, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.uint64, 1, PMIX_UINT64))) { return ret; } break; case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.fval, 1, PMIX_FLOAT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.fval, 1, PMIX_FLOAT))) { return ret; } break; case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.dval, 1, PMIX_DOUBLE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.dval, 1, PMIX_DOUBLE))) { return ret; } break; case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { return ret; } break; case PMIX_BYTE_OBJECT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { return ret; } break; @@ -549,7 +564,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, } array.size = p->data.darray->size; array.array = (pmix_info_t*)p->data.darray->array; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &array, 1, PMIX_INFO_ARRAY))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &array, 1, PMIX_INFO_ARRAY))) { return ret; } break; @@ -557,7 +572,7 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, case PMIX_PROC_RANK: /* must convert this to an int */ rank = p->data.rank; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &rank, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(regtypes, buffer, &rank, 1, PMIX_INT))) { return ret; } break; @@ -572,8 +587,9 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, /* * PMIX_VALUE */ -pmix_status_t pmix12_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_value_t *ptr; int32_t i; @@ -587,11 +603,11 @@ pmix_status_t pmix12_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, * using the store_data_type function. This means we lose the translation! * So get it here */ v1type = pmix12_v2_to_v1_datatype(ptr[i].type); - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &v1type, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(regtypes, buffer, &v1type, 1, PMIX_INT))) { return ret; } /* now pack the right field */ - if (PMIX_SUCCESS != (ret = pack_val(buffer, &ptr[i]))) { + if (PMIX_SUCCESS != (ret = pack_val(regtypes, buffer, &ptr[i]))) { return ret; } } @@ -600,8 +616,9 @@ pmix_status_t pmix12_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, } -pmix_status_t pmix12_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_info_t *info; int32_t i; @@ -614,26 +631,27 @@ pmix_status_t pmix12_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack key */ foo = info[i].key; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &foo, 1, PMIX_STRING))) { return ret; } /* pack the type - unfortunately, v1.2 directly packed the int instead of * using the store_data_type function. This means we lose the translation! * So get it here */ v1type = pmix12_v2_to_v1_datatype(info[i].value.type); - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &v1type, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(regtypes, buffer, &v1type, 1, PMIX_INT))) { return ret; } /* pack value */ - if (PMIX_SUCCESS != (ret = pack_val(buffer, &info[i].value))) { + if (PMIX_SUCCESS != (ret = pack_val(regtypes, buffer, &info[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_pdata_t *pdata; int32_t i; @@ -645,31 +663,32 @@ pmix_status_t pmix12_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the proc */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_proc(buffer, &pdata[i].proc, 1, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_proc(regtypes, buffer, &pdata[i].proc, 1, PMIX_PROC))) { return ret; } /* pack key */ foo = pdata[i].key; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &foo, 1, PMIX_STRING))) { return ret; } /* pack the type - unfortunately, v1.2 directly packed the int instead of * using the store_data_type function. This means we lose the translation! * So get it here */ v1type = pmix12_v2_to_v1_datatype(pdata[i].value.type); - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &v1type, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(regtypes, buffer, &v1type, 1, PMIX_INT))) { return ret; } /* pack value */ - if (PMIX_SUCCESS != (ret = pack_val(buffer, &pdata[i].value))) { + if (PMIX_SUCCESS != (ret = pack_val(regtypes, buffer, &pdata[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_buffer_t *ptr; int32_t i; @@ -679,12 +698,12 @@ pmix_status_t pmix12_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the number of bytes */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &ptr[i].bytes_used, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(regtypes, buffer, &ptr[i].bytes_used, 1, PMIX_SIZE))) { return ret; } /* pack the bytes */ if (0 < ptr[i].bytes_used) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(buffer, ptr[i].base_ptr, ptr[i].bytes_used, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(regtypes, buffer, ptr[i].base_ptr, ptr[i].bytes_used, PMIX_BYTE))) { return ret; } } @@ -692,8 +711,9 @@ pmix_status_t pmix12_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_proc_t *proc; int32_t i; @@ -703,18 +723,19 @@ pmix_status_t pmix12_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { char *ptr = proc[i].nspace; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &ptr, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &ptr, 1, PMIX_STRING))) { return ret; } - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &proc[i].rank, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(regtypes, buffer, &proc[i].rank, 1, PMIX_INT))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_app_t *app; int32_t i, j, nvals; @@ -724,39 +745,39 @@ pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, app = (pmix_app_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &app[i].cmd, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &app[i].cmd, 1, PMIX_STRING))) { return ret; } /* argv */ argc = pmix_argv_count(app[i].argv); - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &argc, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(regtypes, buffer, &argc, 1, PMIX_INT))) { return ret; } for (j=0; j < argc; j++) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &app[i].argv[j], 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &app[i].argv[j], 1, PMIX_STRING))) { return ret; } } /* env */ nvals = pmix_argv_count(app[i].env); - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(buffer, &nvals, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int32(regtypes, buffer, &nvals, 1, PMIX_INT32))) { return ret; } for (j=0; j < nvals; j++) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &app[i].env[j], 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &app[i].env[j], 1, PMIX_STRING))) { return ret; } } /* maxprocs */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(buffer, &app[i].maxprocs, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_int(regtypes, buffer, &app[i].maxprocs, 1, PMIX_INT))) { return ret; } /* info array */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &app[i].ninfo, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(regtypes, buffer, &app[i].ninfo, 1, PMIX_SIZE))) { return ret; } if (0 < app[i].ninfo) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_info(buffer, app[i].info, app[i].ninfo, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_info(regtypes, buffer, app[i].info, app[i].ninfo, PMIX_INFO))) { return ret; } } @@ -765,8 +786,9 @@ pmix_status_t pmix12_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, } -pmix_status_t pmix12_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; int32_t i; @@ -776,11 +798,11 @@ pmix_status_t pmix12_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the key */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(buffer, &ptr[i].key, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_string(regtypes, buffer, &ptr[i].key, 1, PMIX_STRING))) { return ret; } /* pack the value */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_value(buffer, ptr[i].value, 1, ptr[i].value->type))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_value(regtypes, buffer, ptr[i].value, 1, ptr[i].value->type))) { return ret; } } @@ -788,8 +810,9 @@ pmix_status_t pmix12_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; int32_t i; @@ -799,12 +822,12 @@ pmix_status_t pmix12_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the size */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { /* pack the values */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_info(regtypes, buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { return ret; } } @@ -813,8 +836,9 @@ pmix_status_t pmix12_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i; @@ -823,11 +847,11 @@ pmix_status_t pmix12_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, ptr = (pmix_modex_data_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if( 0 < ptr[i].size){ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(regtypes, buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { return ret; } } @@ -835,14 +859,16 @@ pmix_status_t pmix12_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { - return pmix12_bfrop_pack_int(buffer, src, num_vals, PMIX_INT); + return pmix12_bfrop_pack_int(regtypes, buffer, src, num_vals, PMIX_INT); } -pmix_status_t pmix12_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; int i; @@ -850,11 +876,11 @@ pmix_status_t pmix12_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, bo = (pmix_byte_object_t*)src; for (i=0; i < num_vals; i++) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(buffer, &bo[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_sizet(regtypes, buffer, &bo[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < bo[i].size) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_byte(regtypes, buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) { return ret; } } @@ -862,15 +888,17 @@ pmix_status_t pmix12_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { /* v1.x has no concept of packing a pointer, so just return */ return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_scope_t *scope = (pmix_scope_t*)src; unsigned int *v1scope; @@ -885,21 +913,23 @@ pmix_status_t pmix12_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src, for (i=0; i < num_vals; i++) { v1scope[i] = (unsigned int)scope[i]; } - ret = pmix12_bfrop_pack_int(buffer, (void*)v1scope, num_vals, PMIX_UINT); + ret = pmix12_bfrop_pack_int(regtypes, buffer, (void*)v1scope, num_vals, PMIX_UINT); free(v1scope); return ret; } -pmix_status_t pmix12_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { /* v1.2 declares pmix_status_t as an enum, which translates to int and * matches that of v2 */ - return pmix12_bfrop_pack_int(buffer, src, num_vals, PMIX_INT); + return pmix12_bfrop_pack_int(regtypes, buffer, src, num_vals, PMIX_INT); } -pmix_status_t pmix12_bfrop_pack_range(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_data_range_t *range = (pmix_data_range_t*)src; unsigned int *v1range; @@ -914,13 +944,14 @@ pmix_status_t pmix12_bfrop_pack_range(pmix_buffer_t *buffer, const void *src, for (i=0; i < num_vals; i++) { v1range[i] = (unsigned int)range[i]; } - ret = pmix12_bfrop_pack_int(buffer, (void*)v1range, num_vals, PMIX_UINT); + ret = pmix12_bfrop_pack_int(regtypes, buffer, (void*)v1range, num_vals, PMIX_UINT); free(v1range); return ret; } -pmix_status_t pmix12_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_cmd_t *cmd = (pmix_cmd_t*)src; int *v1cmd; @@ -935,48 +966,54 @@ pmix_status_t pmix12_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src, for (i=0; i < num_vals; i++) { v1cmd[i] = cmd[i]; } - ret = pmix12_bfrop_pack_int(buffer, (void*)v1cmd, num_vals, PMIX_INT); + ret = pmix12_bfrop_pack_int(regtypes, buffer, (void*)v1cmd, num_vals, PMIX_INT); free(v1cmd); return ret; } -pmix_status_t pmix12_bfrop_pack_info_directives(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { /* v1.x has no concept of an info directive, so just return */ return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_proc_state(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_pack_proc_state(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { /* v1.x has no concept of proc state, so just return */ return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + return PMIX_ERR_NOT_SUPPORTED; +} + +pmix_status_t pmix12_bfrop_pack_proc_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + return PMIX_ERR_NOT_SUPPORTED; + +} + +pmix_status_t pmix12_bfrop_pack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_pack_proc_info(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) -{ - return PMIX_ERR_NOT_SUPPORTED; - -} - -pmix_status_t pmix12_bfrop_pack_query(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix12_bfrop_pack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) -{ - return PMIX_ERR_NOT_SUPPORTED; -} - -pmix_status_t pmix12_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) { /* v1 rank is just an int, not a separate data type - it is defined * to be an unint32 in v2 */ - return pmix12_bfrop_pack_int(buffer, src, num_vals, PMIX_INT); + return pmix12_bfrop_pack_int(regtypes, buffer, src, num_vals, PMIX_INT); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/print.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/print.c index 90dac291c2..650762db78 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/print.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/print.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -21,9 +21,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "src/include/pmix_stdint.h" #include #ifdef HAVE_TIME_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c index 667f9c6484..769f345889 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c @@ -10,10 +10,10 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -23,9 +23,7 @@ * $HEADER$ */ -#include - -#include +#include "src/include/pmix_config.h" #include "src/util/argv.h" #include "src/util/error.h" @@ -34,42 +32,14 @@ #include "bfrop_v12.h" #include "internal.h" -static pmix_status_t unpack_gentype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - switch(type) { - case PMIX_INT8: - case PMIX_UINT8: - return pmix12_bfrop_unpack_byte(buffer, dest, num_vals, type); - break; - - case PMIX_INT16: - case PMIX_UINT16: - return pmix12_bfrop_unpack_int16(buffer, dest, num_vals, type); - break; - - case PMIX_INT32: - case PMIX_UINT32: - return pmix12_bfrop_unpack_int32(buffer, dest, num_vals, type); - break; - - case PMIX_INT64: - case PMIX_UINT64: - return pmix12_bfrop_unpack_int64(buffer, dest, num_vals, type); - break; - - default: - return PMIX_ERR_UNKNOWN_DATA_TYPE; - } -} - pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, - void *dst, int32_t *num_vals, - pmix_data_type_t type) + void *dst, int32_t *num_vals, + pmix_data_type_t type) { pmix_status_t rc, ret; int32_t local_num, n=1; pmix_data_type_t local_type; + pmix_pointer_array_t *regtypes = &mca_bfrops_v12_component.types; pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack: for type %d", (int)type); @@ -101,7 +71,7 @@ pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, * int32_t as used here. */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix12_bfrop_get_data_type(buffer, &local_type))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_get_data_type(regtypes, buffer, &local_type))) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ @@ -115,7 +85,7 @@ pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, } n=1; - if (PMIX_SUCCESS != (rc = pmix12_bfrop_unpack_int32(buffer, &local_num, &n, PMIX_INT32))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_unpack_int32(regtypes, buffer, &local_num, &n, PMIX_INT32))) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ @@ -133,8 +103,9 @@ pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, */ if (local_num > *num_vals) { local_num = *num_vals; - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n", - (void*)buffer, dst, (long unsigned int)*num_vals, (int)type); + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix12_bfrop_unpack: inadequate space ( %p, %p, %lu, %d )\n", + (void*)buffer, dst, (long unsigned int)*num_vals, (int)type); ret = PMIX_ERR_UNPACK_INADEQUATE_SPACE; } else { /** enough or more than enough storage */ *num_vals = local_num; /** let the user know how many we actually unpacked */ @@ -142,7 +113,7 @@ pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, } /** Unpack the value(s) */ - if (PMIX_SUCCESS != (rc = pmix12_bfrop_unpack_buffer(buffer, dst, &local_num, type))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_unpack_buffer(regtypes, buffer, dst, &local_num, type))) { PMIX_ERROR_LOG(rc); *num_vals = 0; ret = rc; @@ -151,12 +122,12 @@ pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, return ret; } -pmix_status_t pmix12_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t *num_vals, - pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dst, int32_t *num_vals, + pmix_data_type_t type) { pmix_status_t rc; pmix_data_type_t local_type, v1type; - pmix_bfrop_type_info_t *info; pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_buffer( %p, %p, %lu, %d )\n", (void*)buffer, dst, (long unsigned int)*num_vals, (int)type); @@ -181,7 +152,7 @@ pmix_status_t pmix12_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32 /** Unpack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix12_bfrop_get_data_type(buffer, &local_type))) { + if (PMIX_SUCCESS != (rc = pmix12_bfrop_get_data_type(regtypes, buffer, &local_type))) { PMIX_ERROR_LOG(rc); return rc; } @@ -192,18 +163,8 @@ pmix_status_t pmix12_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32 return PMIX_ERR_PACK_MISMATCH; } } + PMIX_BFROPS_UNPACK_TYPE(rc, buffer, dst, num_vals, v1type, regtypes); - /* Lookup the unpack function for this type and call it */ - - if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v12_component.types, v1type))) { - PMIX_ERROR_LOG(PMIX_ERR_UNPACK_FAILURE); - return PMIX_ERR_UNPACK_FAILURE; - } - - rc = info->odti_unpack_fn(buffer, dst, num_vals, v1type); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - } return rc; } @@ -213,8 +174,9 @@ pmix_status_t pmix12_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32 /* * BOOL */ -pmix_status_t pmix12_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint8_t *src; @@ -247,24 +209,25 @@ pmix_status_t pmix12_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, /* * INT */ -pmix_status_t pmix12_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_INT) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, dest, num_vals, BFROP_TYPE_INT))) { } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(int, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, int, remote_type, ret); } return ret; @@ -273,24 +236,25 @@ pmix_status_t pmix12_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, /* * SIZE_T */ -pmix_status_t pmix12_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_SIZE_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_SIZE_T))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, dest, num_vals, BFROP_TYPE_SIZE_T))) { } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(size_t, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, size_t, remote_type, ret); } return ret; @@ -299,24 +263,25 @@ pmix_status_t pmix12_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, /* * PID_T */ -pmix_status_t pmix12_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_PID_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_PID_T))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, dest, num_vals, BFROP_TYPE_PID_T))) { } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, pid_t, remote_type, ret); } return ret; @@ -328,8 +293,9 @@ pmix_status_t pmix12_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, /* * BYTE, CHAR, INT8 */ -pmix_status_t pmix12_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_byte * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ @@ -346,8 +312,9 @@ pmix_status_t pmix12_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *desttmp = (uint16_t*) dest; @@ -369,8 +336,9 @@ pmix_status_t pmix12_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint32_t tmp, *desttmp = (uint32_t*) dest; @@ -392,19 +360,22 @@ pmix_status_t pmix12_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix12_bfrop_unpack_int32(buffer, dest, num_vals, type); + return pmix12_bfrop_unpack_int32(regtypes, buffer, dest, num_vals, type); } -pmix_status_t pmix12_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, *desttmp = (uint64_t*) dest; - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_int64 * %d\n", (int)*num_vals); + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix12_bfrop_unpack_int64 * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(tmp))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -421,15 +392,17 @@ pmix_status_t pmix12_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; int32_t i, len, n=1; char **sdest = (char**) dest; for (i = 0; i < (*num_vals); ++i) { - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int32(buffer, &len, &n, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int32(regtypes, buffer, + &len, &n, PMIX_INT32))) { return ret; } if (0 == len) { /* zero-length string - unpack the NULL */ @@ -439,7 +412,9 @@ pmix_status_t pmix12_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, if (NULL == sdest[i]) { return PMIX_ERR_OUT_OF_RESOURCE; } - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(buffer, sdest[i], &len, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(regtypes, buffer, + sdest[i], &len, + PMIX_BYTE))) { return ret; } } @@ -448,15 +423,17 @@ pmix_status_t pmix12_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; float *desttmp = (float*) dest, tmp; pmix_status_t ret; char *convert; - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_float * %d\n", (int)*num_vals); + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix12_bfrop_unpack_float * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(float))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -466,7 +443,8 @@ pmix_status_t pmix12_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &convert, &n, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, + &convert, &n, PMIX_STRING))) { return ret; } if (NULL != convert) { @@ -478,15 +456,17 @@ pmix_status_t pmix12_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; double *desttmp = (double*) dest, tmp; pmix_status_t ret; char *convert; - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_double * %d\n", (int)*num_vals); + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix12_bfrop_unpack_double * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(double))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -496,7 +476,9 @@ pmix_status_t pmix12_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &convert, &n, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, + &convert, &n, + PMIX_STRING))) { return ret; } if (NULL != convert) { @@ -508,15 +490,17 @@ pmix_status_t pmix12_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; int64_t tmp[2]; struct timeval *desttmp = (struct timeval *) dest, tt; pmix_status_t ret; - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_timeval * %d\n", (int)*num_vals); + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix12_bfrop_unpack_timeval * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*sizeof(struct timeval))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -525,7 +509,8 @@ pmix_status_t pmix12_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=2; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int64(buffer, tmp, &n, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int64(regtypes, buffer, + tmp, &n, PMIX_INT64))) { return ret; } tt.tv_sec = tmp[0]; @@ -535,8 +520,9 @@ pmix_status_t pmix12_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; time_t *desttmp = (time_t *) dest, tmp; @@ -547,7 +533,8 @@ pmix_status_t pmix12_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, * to uint64_t as a generic safe size */ - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack_time * %d\n", (int)*num_vals); + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix12_bfrop_unpack_time * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*(sizeof(uint64_t)))) { return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; @@ -556,7 +543,8 @@ pmix_status_t pmix12_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int64(buffer, &ui64, &n, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int64(regtypes, buffer, + &ui64, &n, PMIX_UINT64))) { return ret; } tmp = (time_t)ui64; @@ -571,7 +559,8 @@ pmix_status_t pmix12_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, /* * PMIX_VALUE */ -static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) +static pmix_status_t unpack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *val) { int32_t m; pmix_status_t ret; @@ -579,92 +568,92 @@ static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) m = 1; switch (val->type) { case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.flag, &m, PMIX_BOOL))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.flag, &m, PMIX_BOOL))) { return ret; } break; case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.byte, &m, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.byte, &m, PMIX_BYTE))) { return ret; } break; case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.string, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.string, &m, PMIX_STRING))) { return ret; } break; case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.size, &m, PMIX_SIZE))) { return ret; } break; case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.pid, &m, PMIX_PID))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.pid, &m, PMIX_PID))) { return ret; } break; case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.integer, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.integer, &m, PMIX_INT))) { return ret; } break; case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.int8, &m, PMIX_INT8))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.int8, &m, PMIX_INT8))) { return ret; } break; case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.int16, &m, PMIX_INT16))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.int16, &m, PMIX_INT16))) { return ret; } break; case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.int32, &m, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.int32, &m, PMIX_INT32))) { return ret; } break; case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.int64, &m, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.int64, &m, PMIX_INT64))) { return ret; } break; case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.uint, &m, PMIX_UINT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint, &m, PMIX_UINT))) { return ret; } break; case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.uint8, &m, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint8, &m, PMIX_UINT8))) { return ret; } break; case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.uint16, &m, PMIX_UINT16))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint16, &m, PMIX_UINT16))) { return ret; } break; case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.uint32, &m, PMIX_UINT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint32, &m, PMIX_UINT32))) { return ret; } break; case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.uint64, &m, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint64, &m, PMIX_UINT64))) { return ret; } break; case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.fval, &m, PMIX_FLOAT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.fval, &m, PMIX_FLOAT))) { return ret; } break; case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.dval, &m, PMIX_DOUBLE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.dval, &m, PMIX_DOUBLE))) { return ret; } break; case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { return ret; } break; @@ -675,12 +664,12 @@ static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) val->data.darray->type = PMIX_INFO_ARRAY; val->data.darray->size = m; /* unpack into it */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.darray->array, &m, PMIX_INFO_ARRAY))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.darray->array, &m, PMIX_INFO_ARRAY))) { return ret; } break; case PMIX_BYTE_OBJECT: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(regtypes, buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { return ret; } break; @@ -692,8 +681,9 @@ static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_value_t *ptr; int32_t i, m, n; @@ -706,7 +696,7 @@ pmix_status_t pmix12_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, for (i = 0; i < n; ++i) { /* unpack the type */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(buffer, &v1type, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(regtypes, buffer, &v1type, &m, PMIX_INT))) { return ret; } /* convert the type - unfortunately, v1.2 directly packed the int instead of @@ -714,15 +704,16 @@ pmix_status_t pmix12_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, * So get it here */ ptr[i].type = pmix12_v1_to_v2_datatype(v1type); /* unpack value */ - if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i])) ) { + if (PMIX_SUCCESS != (ret = unpack_val(regtypes, buffer, &ptr[i])) ) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_info_t *ptr; int32_t i, n, m; @@ -742,7 +733,7 @@ pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, /* unpack key */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -754,7 +745,7 @@ pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(buffer, &v1type, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(regtypes, buffer, &v1type, &m, PMIX_INT))) { return ret; } /* convert the type - unfortunately, v1.2 directly packed the int instead of @@ -764,15 +755,16 @@ pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack: info type %d", ptr[i].value.type); m=1; - if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { + if (PMIX_SUCCESS != (ret = unpack_val(regtypes, buffer, &ptr[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_pdata_t *ptr; int32_t i, n, m; @@ -790,13 +782,13 @@ pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, PMIX_PDATA_CONSTRUCT(&ptr[i]); /* unpack the proc */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_proc(regtypes, buffer, &ptr[i].proc, &m, PMIX_PROC))) { return ret; } /* unpack key */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -808,7 +800,7 @@ pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(buffer, &v1type, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(regtypes, buffer, &v1type, &m, PMIX_INT))) { return ret; } /* convert the type - unfortunately, v1.2 directly packed the int instead of @@ -818,15 +810,16 @@ pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix12_bfrop_unpack: pdata type %d", ptr[i].value.type); m=1; - if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { + if (PMIX_SUCCESS != (ret = unpack_val(regtypes, buffer, &ptr[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_buffer_t *ptr; int32_t i, n, m; @@ -839,7 +832,7 @@ pmix_status_t pmix12_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, for (i = 0; i < n; ++i) { /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(buffer, &nbytes, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(regtypes, buffer, &nbytes, &m, PMIX_SIZE))) { return ret; } m = nbytes; @@ -847,7 +840,7 @@ pmix_status_t pmix12_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, if (0 < nbytes) { ptr[i].base_ptr = (char*)malloc(nbytes); /* unpack the bytes */ - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(buffer, ptr[i].base_ptr, &m, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(regtypes, buffer, ptr[i].base_ptr, &m, PMIX_BYTE))) { return ret; } } @@ -859,8 +852,9 @@ pmix_status_t pmix12_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_proc_t *ptr; int32_t i, n, m; @@ -880,7 +874,7 @@ pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, /* unpack nspace */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -890,7 +884,7 @@ pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, free(tmp); /* unpack the rank */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(buffer, &ptr[i].rank, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(regtypes, buffer, &ptr[i].rank, &m, PMIX_INT))) { return ret; } /* we have to do some conversion here as the definition of rank @@ -904,8 +898,9 @@ pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_app_t *ptr; int32_t i, k, n, m; @@ -925,19 +920,19 @@ pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, PMIX_APP_CONSTRUCT(&ptr[i]); /* unpack cmd */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &ptr[i].cmd, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &ptr[i].cmd, &m, PMIX_STRING))) { return ret; } /* unpack argc */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(buffer, &argc, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(regtypes, buffer, &argc, &m, PMIX_INT))) { return ret; } /* unpack argv */ for (k=0; k < argc; k++) { m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -948,13 +943,13 @@ pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, } /* unpack env */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int32(buffer, &nval, &m, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int32(regtypes, buffer, &nval, &m, PMIX_INT32))) { return ret; } for (k=0; k < nval; k++) { m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -965,18 +960,18 @@ pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, } /* unpack maxprocs */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(buffer, &ptr[i].maxprocs, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_int(regtypes, buffer, &ptr[i].maxprocs, &m, PMIX_INT))) { return ret; } /* unpack info array */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(buffer, &ptr[i].ninfo, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].ninfo, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].ninfo) { PMIX_INFO_CREATE(ptr[i].info, ptr[i].ninfo); m = ptr[i].ninfo; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_info(buffer, ptr[i].info, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_info(regtypes, buffer, ptr[i].info, &m, PMIX_INFO))) { return ret; } } @@ -984,8 +979,9 @@ pmix_status_t pmix12_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; int32_t i, n, m; @@ -1001,7 +997,7 @@ pmix_status_t pmix12_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, PMIX_CONSTRUCT(&ptr[i], pmix_kval_t); /* unpack the key */ m = 1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(buffer, &ptr[i].key, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_string(regtypes, buffer, &ptr[i].key, &m, PMIX_STRING))) { PMIX_ERROR_LOG(ret); return ret; } @@ -1009,7 +1005,7 @@ pmix_status_t pmix12_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, ptr[i].value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); /* unpack the value */ m = 1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_value(buffer, ptr[i].value, &m, PMIX_VALUE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_value(regtypes, buffer, ptr[i].value, &m, PMIX_VALUE))) { PMIX_ERROR_LOG(ret); return ret; } @@ -1017,8 +1013,9 @@ pmix_status_t pmix12_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; int32_t i, n, m; @@ -1036,13 +1033,13 @@ pmix_status_t pmix12_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_info_array_t)); /* unpack the size of this array */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_value(regtypes, buffer, ptr[i].array, &m, PMIX_INFO))) { return ret; } } @@ -1050,8 +1047,9 @@ pmix_status_t pmix12_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i, n, m; @@ -1067,13 +1065,13 @@ pmix_status_t pmix12_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(regtypes, buffer, ptr[i].blob, &m, PMIX_UINT8))) { return ret; } } @@ -1082,14 +1080,16 @@ pmix_status_t pmix12_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, } -pmix_status_t pmix12_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix12_bfrop_unpack_int(buffer, dest, num_vals, PMIX_INT); + return pmix12_bfrop_unpack_int(regtypes, buffer, dest, num_vals, PMIX_INT); } -pmix_status_t pmix12_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_byte_object_t *ptr; int32_t i, n, m; @@ -1105,13 +1105,13 @@ pmix_status_t pmix12_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_byte_object_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].bytes = (char*)malloc(ptr[i].size * sizeof(char)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(buffer, ptr[i].bytes, &m, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_byte(regtypes, buffer, ptr[i].bytes, &m, PMIX_BYTE))) { return ret; } } @@ -1119,68 +1119,79 @@ pmix_status_t pmix12_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix12_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - return PMIX_ERR_NOT_SUPPORTED; -} - -pmix_status_t pmix12_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_info_directives(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix12_bfrop_unpack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_proc_state(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_info_directives(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + return PMIX_ERR_NOT_SUPPORTED; +} + +pmix_status_t pmix12_bfrop_unpack_proc_state(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + return PMIX_ERR_NOT_SUPPORTED; +} + +pmix_status_t pmix12_bfrop_unpack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + return PMIX_ERR_NOT_SUPPORTED; +} + +pmix_status_t pmix12_bfrop_unpack_proc_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } -pmix_status_t pmix12_bfrop_unpack_proc_info(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - return PMIX_ERR_NOT_SUPPORTED; -} - -pmix_status_t pmix12_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix12_bfrop_unpack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { return PMIX_ERR_NOT_SUPPORTED; } - -pmix_status_t pmix12_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - return PMIX_ERR_NOT_SUPPORTED; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20.c index 15774eb4ce..5b1bf9aa61 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20.c @@ -13,7 +13,9 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +24,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include "src/util/error.h" #include "src/include/pmix_globals.h" @@ -436,20 +438,22 @@ pmix_data_type_t pmix20_v21_to_v20_datatype(pmix_data_type_t v21type) return v20type; } -pmix_status_t pmix20_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_store_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t type) { pmix_data_type_t v20type; v20type = pmix20_v21_to_v20_datatype(type); - return pmix20_bfrop_pack_datatype(buffer, &v20type, 1, PMIX_DATA_TYPE); + return pmix20_bfrop_pack_datatype(regtypes, buffer, &v20type, 1, PMIX_DATA_TYPE); } -pmix_status_t pmix20_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type) +pmix_status_t pmix20_bfrop_get_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t *type) { int32_t n=1; pmix_status_t rc; - rc = pmix20_bfrop_unpack_datatype(buffer, type, &n, PMIX_DATA_TYPE); + rc = pmix20_bfrop_unpack_datatype(regtypes, buffer, type, &n, PMIX_DATA_TYPE); return rc; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20_component.c index 9c2e124e81..c506688978 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/bfrop_pmix20_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/types.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c index fbdbae3eff..3503724d4a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -20,7 +20,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h index 1478687f6c..b93bff9b61 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h @@ -11,10 +11,12 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +27,7 @@ #ifndef PMIX20_BFROP_INTERNAL_H_ #define PMIX20_BFROP_INTERNAL_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -123,176 +125,254 @@ pmix_value_cmp_t pmix20_bfrop_value_cmp(pmix_value_t *p, /* * Specialized functions */ -pmix_status_t pmix20_bfrop_pack_buffer(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type); +pmix_status_t pmix20_bfrop_pack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, + const void *src, int32_t num_vals, + pmix_data_type_t type); -pmix_status_t pmix20_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, +pmix_status_t pmix20_bfrop_unpack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dst, int32_t *num_vals, pmix_data_type_t type); /* * Internal pack functions */ -pmix_status_t pmix20_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_range(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_infodirs(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_infodirs(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_pstate(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_query(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_pack_alloc_directive(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); /**** DEPRECATED ****/ -pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); /********************/ /* * Internal unpack functions */ - pmix_status_t pmix20_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_infodirs(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_infodirs(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); + pmix_status_t pmix20_bfrop_unpack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_pstate(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); - pmix_status_t pmix20_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, + pmix_status_t pmix20_bfrop_unpack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix20_bfrop_unpack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix20_bfrop_unpack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix20_bfrop_unpack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); /**** DEPRECATED ****/ -pmix_status_t pmix20_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix20_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); /********************/ @@ -414,9 +494,11 @@ pmix_status_t pmix20_bfrop_print_array(char **output, char *prefix, * Internal helper functions */ -pmix_status_t pmix20_bfrop_store_data_type(pmix_buffer_t *buffer, pmix_data_type_t type); +pmix_status_t pmix20_bfrop_store_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t type); -pmix_status_t pmix20_bfrop_get_data_type(pmix_buffer_t *buffer, pmix_data_type_t *type); +pmix_status_t pmix20_bfrop_get_data_type(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_data_type_t *type); pmix_data_type_t pmix20_v21_to_v20_datatype(pmix_data_type_t v21type); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c index 6aa194b8b9..45887a787b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c @@ -10,10 +10,10 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -23,9 +23,7 @@ * $HEADER$ */ -#include - -#include +#include "src/include/pmix_config.h" #ifdef HAVE_ARPA_INET_H #include @@ -39,10 +37,11 @@ #include "internal.h" pmix_status_t pmix20_bfrop_pack(pmix_buffer_t *buffer, - const void *src, int32_t num_vals, - pmix_data_type_t type) + const void *src, int32_t num_vals, + pmix_data_type_t type) { pmix_status_t rc; + pmix_pointer_array_t *regtypes = &mca_bfrops_v20_component.types; /* check for error */ if (NULL == buffer) { @@ -51,21 +50,24 @@ pmix_status_t pmix20_bfrop_pack(pmix_buffer_t *buffer, /* Pack the number of values */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix20_bfrop_store_data_type(buffer, PMIX_INT32))) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_store_data_type(regtypes, buffer, + PMIX_INT32))) { return rc; } } - if (PMIX_SUCCESS != (rc = pmix20_bfrop_pack_int32(buffer, &num_vals, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_pack_int32(regtypes, buffer, + &num_vals, 1, PMIX_INT32))) { return rc; } /* Pack the value(s) */ - return pmix20_bfrop_pack_buffer(buffer, src, num_vals, type); + return pmix20_bfrop_pack_buffer(regtypes, buffer, src, num_vals, type); } -pmix_status_t pmix20_bfrop_pack_buffer(pmix_buffer_t *buffer, - const void *src, int32_t num_vals, - pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, + const void *src, int32_t num_vals, + pmix_data_type_t type) { pmix_data_type_t v20type; pmix_status_t rc; @@ -86,7 +88,7 @@ pmix_status_t pmix20_bfrop_pack_buffer(pmix_buffer_t *buffer, /* Pack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix20_bfrop_store_data_type(buffer, v20type))) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_store_data_type(regtypes, buffer, v20type))) { return rc; } } @@ -97,7 +99,7 @@ pmix_status_t pmix20_bfrop_pack_buffer(pmix_buffer_t *buffer, return PMIX_ERR_PACK_FAILURE; } - return info->odti_pack_fn(buffer, src, num_vals, v20type); + return info->odti_pack_fn(regtypes, buffer, src, num_vals, v20type); } @@ -106,8 +108,9 @@ pmix_status_t pmix20_bfrop_pack_buffer(pmix_buffer_t *buffer, /* * BOOL */ -pmix_status_t pmix20_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { uint8_t *dst; int32_t i; @@ -139,54 +142,57 @@ pmix_status_t pmix20_bfrop_pack_bool(pmix_buffer_t *buffer, const void *src, /* * INT */ -pmix_status_t pmix20_bfrop_pack_int(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; /* System types need to always be described so we can properly unpack them */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(buffer, BFROP_TYPE_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_INT))) { return ret; } /* Turn around and pack the real type */ - return pmix20_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_INT); + return pmix20_bfrop_pack_buffer(regtypes, buffer, src, num_vals, BFROP_TYPE_INT); } /* * SIZE_T */ -pmix_status_t pmix20_bfrop_pack_sizet(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) + { + pmix_status_t ret; + + /* System types need to always be described so we can properly + unpack them. */ + if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_SIZE_T))) { + return ret; + } + + return pmix20_bfrop_pack_buffer(regtypes, buffer, src, num_vals, BFROP_TYPE_SIZE_T); +} + +/* + * PID_T + */ +pmix_status_t pmix20_bfrop_pack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; /* System types need to always be described so we can properly unpack them. */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(buffer, BFROP_TYPE_SIZE_T))) { - return ret; - } - - return pmix20_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_SIZE_T); -} - -/* - * PID_T - */ -pmix_status_t pmix20_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) - { - pmix_status_t ret; - - /* System types need to always be described so we can properly - unpack them. */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(buffer, BFROP_TYPE_PID_T))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(regtypes, buffer, BFROP_TYPE_PID_T))) { return ret; } /* Turn around and pack the real type */ - return pmix20_bfrop_pack_buffer(buffer, src, num_vals, BFROP_TYPE_PID_T); + return pmix20_bfrop_pack_buffer(regtypes, buffer, src, num_vals, BFROP_TYPE_PID_T); } @@ -195,8 +201,9 @@ pmix_status_t pmix20_bfrop_pack_pid(pmix_buffer_t *buffer, const void *src, /* * BYTE, CHAR, INT8 */ -pmix_status_t pmix20_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { char *dst; @@ -220,8 +227,9 @@ pmix_status_t pmix20_bfrop_pack_byte(pmix_buffer_t *buffer, const void *src, /* * INT16 */ -pmix_status_t pmix20_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *srctmp = (uint16_t*) src; @@ -248,8 +256,9 @@ pmix_status_t pmix20_bfrop_pack_int16(pmix_buffer_t *buffer, const void *src, /* * INT32 */ -pmix_status_t pmix20_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint32_t tmp, *srctmp = (uint32_t*) src; @@ -273,17 +282,22 @@ pmix_status_t pmix20_bfrop_pack_int32(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_datatype(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_int16(buffer, src, num_vals, type); + pmix_status_t ret; + + PMIX_BFROPS_PACK_TYPE(ret, buffer, src, num_vals, PMIX_INT16, regtypes); + return ret; } /* * INT64 */ -pmix_status_t pmix20_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, tmp2; @@ -312,8 +326,9 @@ pmix_status_t pmix20_bfrop_pack_int64(pmix_buffer_t *buffer, const void *src, /* * STRING */ -pmix_status_t pmix20_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i, len; @@ -322,16 +337,16 @@ pmix_status_t pmix20_bfrop_pack_string(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { if (NULL == ssrc[i]) { /* got zero-length string/NULL pointer - store NULL */ len = 0; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(regtypes, buffer, &len, 1, PMIX_INT32))) { return ret; } } else { len = (int32_t)strlen(ssrc[i]) + 1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(buffer, &len, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(regtypes, buffer, &len, 1, PMIX_INT32))) { return ret; } if (PMIX_SUCCESS != (ret = - pmix20_bfrop_pack_byte(buffer, ssrc[i], len, PMIX_BYTE))) { + pmix20_bfrop_pack_byte(regtypes, buffer, ssrc[i], len, PMIX_BYTE))) { return ret; } } @@ -341,8 +356,9 @@ return PMIX_SUCCESS; } /* FLOAT */ -pmix_status_t pmix20_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -353,7 +369,7 @@ pmix_status_t pmix20_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, if (0 > asprintf(&convert, "%f", ssrc[i])) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &convert, 1, PMIX_STRING))) { free(convert); return ret; } @@ -364,8 +380,9 @@ pmix_status_t pmix20_bfrop_pack_float(pmix_buffer_t *buffer, const void *src, } /* DOUBLE */ -pmix_status_t pmix20_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -376,7 +393,7 @@ pmix_status_t pmix20_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, if (0 > asprintf(&convert, "%f", ssrc[i])) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &convert, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &convert, 1, PMIX_STRING))) { free(convert); return ret; } @@ -387,8 +404,9 @@ pmix_status_t pmix20_bfrop_pack_double(pmix_buffer_t *buffer, const void *src, } /* TIMEVAL */ -pmix_status_t pmix20_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { int64_t tmp[2]; pmix_status_t ret = PMIX_SUCCESS; @@ -398,7 +416,7 @@ pmix_status_t pmix20_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { tmp[0] = (int64_t)ssrc[i].tv_sec; tmp[1] = (int64_t)ssrc[i].tv_usec; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int64(buffer, tmp, 2, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int64(regtypes, buffer, tmp, 2, PMIX_INT64))) { return ret; } } @@ -407,8 +425,9 @@ pmix_status_t pmix20_bfrop_pack_timeval(pmix_buffer_t *buffer, const void *src, } /* TIME */ -pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -420,7 +439,7 @@ pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, */ for (i = 0; i < num_vals; ++i) { ui64 = (uint64_t)ssrc[i]; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int64(buffer, &ui64, 1, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int64(regtypes, buffer, &ui64, 1, PMIX_UINT64))) { return ret; } } @@ -429,8 +448,9 @@ pmix_status_t pmix20_bfrop_pack_time(pmix_buffer_t *buffer, const void *src, } /* STATUS */ -pmix_status_t pmix20_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret = PMIX_SUCCESS; int32_t i; @@ -439,7 +459,7 @@ pmix_status_t pmix20_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { status = (int32_t)ssrc[i]; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(buffer, &status, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(regtypes, buffer, &status, 1, PMIX_INT32))) { return ret; } } @@ -449,7 +469,8 @@ pmix_status_t pmix20_bfrop_pack_status(pmix_buffer_t *buffer, const void *src, /* PACK FUNCTIONS FOR GENERIC PMIX TYPES */ -static pmix_status_t pack_val(pmix_buffer_t *buffer, +static pmix_status_t pack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *p) { pmix_status_t ret; @@ -458,158 +479,158 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, case PMIX_UNDEF: break; case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.flag, 1, PMIX_BOOL))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.flag, 1, PMIX_BOOL))) { return ret; } break; case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.byte, 1, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.byte, 1, PMIX_BYTE))) { return ret; } break; case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.string, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.string, 1, PMIX_STRING))) { return ret; } break; case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.size, 1, PMIX_SIZE))) { return ret; } break; case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.pid, 1, PMIX_PID))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.pid, 1, PMIX_PID))) { return ret; } break; case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.integer, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.integer, 1, PMIX_INT))) { return ret; } break; case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.int8, 1, PMIX_INT8))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.int8, 1, PMIX_INT8))) { return ret; } break; case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.int16, 1, PMIX_INT16))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.int16, 1, PMIX_INT16))) { return ret; } break; case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.int32, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.int32, 1, PMIX_INT32))) { return ret; } break; case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.int64, 1, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.int64, 1, PMIX_INT64))) { return ret; } break; case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.uint, 1, PMIX_UINT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.uint, 1, PMIX_UINT))) { return ret; } break; case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.uint8, 1, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.uint8, 1, PMIX_UINT8))) { return ret; } break; case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.uint16, 1, PMIX_UINT16))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.uint16, 1, PMIX_UINT16))) { return ret; } break; case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.uint32, 1, PMIX_UINT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.uint32, 1, PMIX_UINT32))) { return ret; } break; case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.uint64, 1, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.uint64, 1, PMIX_UINT64))) { return ret; } break; case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.fval, 1, PMIX_FLOAT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.fval, 1, PMIX_FLOAT))) { return ret; } break; case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.dval, 1, PMIX_DOUBLE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.dval, 1, PMIX_DOUBLE))) { return ret; } break; case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.tv, 1, PMIX_TIMEVAL))) { return ret; } break; case PMIX_TIME: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.time, 1, PMIX_TIME))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.time, 1, PMIX_TIME))) { return ret; } break; case PMIX_STATUS: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.status, 1, PMIX_STATUS))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.status, 1, PMIX_STATUS))) { return ret; } break; case PMIX_PROC: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, p->data.proc, 1, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, p->data.proc, 1, PMIX_PROC))) { return ret; } break; case PMIX_PROC_RANK: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.rank, 1, PMIX_PROC_RANK))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.rank, 1, PMIX_PROC_RANK))) { return ret; } break; case PMIX_BYTE_OBJECT: case PMIX_COMPRESSED_STRING: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { return ret; } break; case PMIX_PERSIST: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.persist, 1, PMIX_PERSIST))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.persist, 1, PMIX_PERSIST))) { return ret; } break; case PMIX_POINTER: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.ptr, 1, PMIX_POINTER))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.ptr, 1, PMIX_POINTER))) { return ret; } break; case PMIX_SCOPE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.scope, 1, PMIX_SCOPE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.scope, 1, PMIX_SCOPE))) { return ret; } break; case PMIX_DATA_RANGE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.range, 1, PMIX_DATA_RANGE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.range, 1, PMIX_DATA_RANGE))) { return ret; } break; case PMIX_PROC_STATE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, &p->data.state, 1, PMIX_PROC_STATE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, &p->data.state, 1, PMIX_PROC_STATE))) { return ret; } break; case PMIX_PROC_INFO: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, p->data.pinfo, 1, PMIX_PROC_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, p->data.pinfo, 1, PMIX_PROC_INFO))) { return ret; } break; case PMIX_DATA_ARRAY: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, p->data.darray, 1, PMIX_DATA_ARRAY))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, p->data.darray, 1, PMIX_DATA_ARRAY))) { return ret; } break; case PMIX_QUERY: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, p->data.darray, 1, PMIX_QUERY))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, p->data.darray, 1, PMIX_QUERY))) { return ret; } break; @@ -623,7 +644,8 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, /* * PMIX_VALUE */ - pmix_status_t pmix20_bfrop_pack_value(pmix_buffer_t *buffer, const void *src, + pmix_status_t pmix20_bfrop_pack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_value_t *ptr; @@ -634,11 +656,11 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, for (i = 0; i < num_vals; ++i) { /* pack the type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(buffer, ptr[i].type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_store_data_type(regtypes, buffer, ptr[i].type))) { return ret; } /* now pack the right field */ - if (PMIX_SUCCESS != (ret = pack_val(buffer, &ptr[i]))) { + if (PMIX_SUCCESS != (ret = pack_val(regtypes, buffer, &ptr[i]))) { return ret; } } @@ -647,8 +669,9 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, } -pmix_status_t pmix20_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_info_t *info; int32_t i; @@ -660,27 +683,28 @@ pmix_status_t pmix20_bfrop_pack_info(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack key */ foo = info[i].key; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &foo, 1, PMIX_STRING))) { return ret; } /* pack info directives flag */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_infodirs(buffer, &info[i].flags, 1, PMIX_INFO_DIRECTIVES))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_infodirs(regtypes, buffer, &info[i].flags, 1, PMIX_INFO_DIRECTIVES))) { return ret; } /* pack the type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(buffer, &info[i].value.type, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(regtypes, buffer, &info[i].value.type, 1, PMIX_INT))) { return ret; } /* pack value */ - if (PMIX_SUCCESS != (ret = pack_val(buffer, &info[i].value))) { + if (PMIX_SUCCESS != (ret = pack_val(regtypes, buffer, &info[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_pdata_t *pdata; int32_t i; @@ -691,28 +715,29 @@ pmix_status_t pmix20_bfrop_pack_pdata(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the proc */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_proc(buffer, &pdata[i].proc, 1, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_proc(regtypes, buffer, &pdata[i].proc, 1, PMIX_PROC))) { return ret; } /* pack key */ foo = pdata[i].key; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &foo, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &foo, 1, PMIX_STRING))) { return ret; } /* pack the type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(buffer, &pdata[i].value.type, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(regtypes, buffer, &pdata[i].value.type, 1, PMIX_INT))) { return ret; } /* pack value */ - if (PMIX_SUCCESS != (ret = pack_val(buffer, &pdata[i].value))) { + if (PMIX_SUCCESS != (ret = pack_val(regtypes, buffer, &pdata[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_buffer_t *ptr; int32_t i; @@ -722,12 +747,12 @@ pmix_status_t pmix20_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the number of bytes */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &ptr[i].bytes_used, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(regtypes, buffer, &ptr[i].bytes_used, 1, PMIX_SIZE))) { return ret; } /* pack the bytes */ if (0 < ptr[i].bytes_used) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_byte(buffer, ptr[i].base_ptr, ptr[i].bytes_used, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_byte(regtypes, buffer, ptr[i].base_ptr, ptr[i].bytes_used, PMIX_BYTE))) { return ret; } } @@ -735,8 +760,9 @@ pmix_status_t pmix20_bfrop_pack_buf(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_proc_t *proc; int32_t i; @@ -746,18 +772,19 @@ pmix_status_t pmix20_bfrop_pack_proc(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { char *ptr = proc[i].nspace; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &ptr, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &ptr, 1, PMIX_STRING))) { return ret; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_rank(buffer, &proc[i].rank, 1, PMIX_PROC_RANK))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_rank(regtypes, buffer, &proc[i].rank, 1, PMIX_PROC_RANK))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_app_t *app; int32_t i, j, nvals; @@ -766,43 +793,43 @@ pmix_status_t pmix20_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, app = (pmix_app_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &app[i].cmd, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &app[i].cmd, 1, PMIX_STRING))) { return ret; } /* argv */ nvals = pmix_argv_count(app[i].argv); - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(buffer, &nvals, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(regtypes, buffer, &nvals, 1, PMIX_INT32))) { return ret; } for (j=0; j < nvals; j++) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &app[i].argv[j], 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &app[i].argv[j], 1, PMIX_STRING))) { return ret; } } /* env */ nvals = pmix_argv_count(app[i].env); - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(buffer, &nvals, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(regtypes, buffer, &nvals, 1, PMIX_INT32))) { return ret; } for (j=0; j < nvals; j++) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &app[i].env[j], 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &app[i].env[j], 1, PMIX_STRING))) { return ret; } } /* cwd */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &app[i].cwd, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &app[i].cwd, 1, PMIX_STRING))) { return ret; } /* maxprocs */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(buffer, &app[i].maxprocs, 1, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int(regtypes, buffer, &app[i].maxprocs, 1, PMIX_INT))) { return ret; } /* info array */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &app[i].ninfo, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(regtypes, buffer, &app[i].ninfo, 1, PMIX_SIZE))) { return ret; } if (0 < app[i].ninfo) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_info(buffer, app[i].info, app[i].ninfo, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_info(regtypes, buffer, app[i].info, app[i].ninfo, PMIX_INFO))) { return ret; } } @@ -811,8 +838,9 @@ pmix_status_t pmix20_bfrop_pack_app(pmix_buffer_t *buffer, const void *src, } -pmix_status_t pmix20_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; int32_t i; @@ -824,11 +852,11 @@ pmix_status_t pmix20_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the key */ st = ptr[i].key; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &st, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &st, 1, PMIX_STRING))) { return ret; } /* pack the value */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_value(buffer, ptr[i].value, 1, PMIX_VALUE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_value(regtypes, buffer, ptr[i].value, 1, PMIX_VALUE))) { return ret; } } @@ -836,8 +864,9 @@ pmix_status_t pmix20_bfrop_pack_kval(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i; @@ -846,11 +875,11 @@ pmix_status_t pmix20_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, ptr = (pmix_modex_data_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if( 0 < ptr[i].size){ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_byte(regtypes, buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { return ret; } } @@ -858,38 +887,44 @@ pmix_status_t pmix20_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_persist(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + return pmix20_bfrop_pack_byte(regtypes, buffer, src, num_vals, PMIX_UINT8); +} + +pmix_status_t pmix20_bfrop_pack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); + return pmix20_bfrop_pack_byte(regtypes, buffer, src, num_vals, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_pack_scope(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + return pmix20_bfrop_pack_byte(regtypes, buffer, src, num_vals, PMIX_UINT8); +} + +pmix_status_t pmix20_bfrop_pack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); + return pmix20_bfrop_pack_byte(regtypes, buffer, src, num_vals, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_pack_range(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_infodirs(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); + return pmix20_bfrop_pack_int32(regtypes, buffer, src, num_vals, PMIX_UINT32); } -pmix_status_t pmix20_bfrop_pack_cmd(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) -{ - return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); -} - -pmix_status_t pmix20_bfrop_pack_infodirs(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) -{ - return pmix20_bfrop_pack_int32(buffer, src, num_vals, PMIX_UINT32); -} - -pmix_status_t pmix20_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_status_t ret; int i; @@ -897,11 +932,11 @@ pmix_status_t pmix20_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, bo = (pmix_byte_object_t*)src; for (i=0; i < num_vals; i++) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &bo[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(regtypes, buffer, &bo[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < bo[i].size) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_byte(buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_byte(regtypes, buffer, bo[i].bytes, bo[i].size, PMIX_BYTE))) { return ret; } } @@ -909,23 +944,26 @@ pmix_status_t pmix20_bfrop_pack_bo(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_ptr(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { uint8_t foo=1; /* it obviously makes no sense to pack a pointer and * send it somewhere else, so we just pack a sentinel */ - return pmix20_bfrop_pack_byte(buffer, &foo, 1, PMIX_UINT8); + return pmix20_bfrop_pack_byte(regtypes, buffer, &foo, 1, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_pack_pstate(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); + return pmix20_bfrop_pack_byte(regtypes, buffer, src, num_vals, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_proc_info_t *pinfo = (pmix_proc_info_t*)src; pmix_status_t ret; @@ -933,29 +971,30 @@ pmix_status_t pmix20_bfrop_pack_pinfo(pmix_buffer_t *buffer, const void *src, for (i=0; i < num_vals; i++) { /* pack the proc identifier */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_proc(buffer, &pinfo[i].proc, 1, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_proc(regtypes, buffer, &pinfo[i].proc, 1, PMIX_PROC))) { return ret; } /* pack the hostname and exec */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &pinfo[i].hostname, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &pinfo[i].hostname, 1, PMIX_STRING))) { return ret; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, &pinfo[i].executable_name, 1, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, &pinfo[i].executable_name, 1, PMIX_STRING))) { return ret; } /* pack the pid and state */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_pid(buffer, &pinfo[i].pid, 1, PMIX_PID))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_pid(regtypes, buffer, &pinfo[i].pid, 1, PMIX_PID))) { return ret; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_pstate(buffer, &pinfo[i].state, 1, PMIX_PROC_STATE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_pstate(regtypes, buffer, &pinfo[i].state, 1, PMIX_PROC_STATE))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_data_array_t *p = (pmix_data_array_t*)src; pmix_status_t ret; @@ -963,11 +1002,11 @@ pmix_status_t pmix20_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src, for (i=0; i < num_vals; i++) { /* pack the actual type in the array */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_datatype(buffer, &p[i].type, 1, PMIX_DATA_TYPE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_datatype(regtypes, buffer, &p[i].type, 1, PMIX_DATA_TYPE))) { return ret; } /* pack the number of array elements */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &p[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(regtypes, buffer, &p[i].size, 1, PMIX_SIZE))) { return ret; } if (0 == p[i].size || PMIX_UNDEF == p[i].type) { @@ -975,21 +1014,23 @@ pmix_status_t pmix20_bfrop_pack_darray(pmix_buffer_t *buffer, const void *src, continue; } /* pack the actual elements */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, p[i].array, p[i].size, p[i].type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(regtypes, buffer, p[i].array, p[i].size, p[i].type))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_rank(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_int32(buffer, src, num_vals, PMIX_UINT32); + return pmix20_bfrop_pack_int32(regtypes, buffer, src, num_vals, PMIX_UINT32); } -pmix_status_t pmix20_bfrop_pack_query(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_query_t *pq = (pmix_query_t*)src; pmix_status_t ret; @@ -999,22 +1040,22 @@ pmix_status_t pmix20_bfrop_pack_query(pmix_buffer_t *buffer, const void *src, for (i=0; i < num_vals; i++) { /* pack the number of keys */ nkeys = pmix_argv_count(pq[i].keys); - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(buffer, &nkeys, 1, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_int32(regtypes, buffer, &nkeys, 1, PMIX_INT32))) { return ret; } if (0 < nkeys) { /* pack the keys */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(buffer, pq[i].keys, nkeys, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_string(regtypes, buffer, pq[i].keys, nkeys, PMIX_STRING))) { return ret; } } /* pack the number of qualifiers */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &pq[i].nqual, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(regtypes, buffer, &pq[i].nqual, 1, PMIX_SIZE))) { return ret; } if (0 < pq[i].nqual) { /* pack any provided qualifiers */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_info(buffer, pq[i].qualifiers, pq[i].nqual, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_info(regtypes, buffer, pq[i].qualifiers, pq[i].nqual, PMIX_INFO))) { return ret; } } @@ -1022,14 +1063,16 @@ pmix_status_t pmix20_bfrop_pack_query(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_pack_alloc_directive(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_pack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { - return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); + return pmix20_bfrop_pack_byte(regtypes, buffer, src, num_vals, PMIX_UINT8); } /**** DEPRECATED ****/ -pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, +pmix_status_t pmix20_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; @@ -1040,12 +1083,12 @@ pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the size */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { /* pack the values */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(regtypes, buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { return ret; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c index a9009be364..7f937d8db5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -21,9 +21,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "src/include/pmix_stdint.h" #include #ifdef HAVE_TIME_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c index 91ce264fd3..59c6c7a6cf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c @@ -10,10 +10,10 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -23,9 +23,7 @@ * $HEADER$ */ -#include - -#include +#include "src/include/pmix_config.h" #include "src/util/argv.h" #include "src/util/error.h" @@ -34,42 +32,14 @@ #include "bfrop_pmix20.h" #include "internal.h" -static pmix_status_t unpack_gentype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - switch(type) { - case PMIX_INT8: - case PMIX_UINT8: - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, type); - break; - - case PMIX_INT16: - case PMIX_UINT16: - return pmix20_bfrop_unpack_int16(buffer, dest, num_vals, type); - break; - - case PMIX_INT32: - case PMIX_UINT32: - return pmix20_bfrop_unpack_int32(buffer, dest, num_vals, type); - break; - - case PMIX_INT64: - case PMIX_UINT64: - return pmix20_bfrop_unpack_int64(buffer, dest, num_vals, type); - break; - - default: - return PMIX_ERR_UNKNOWN_DATA_TYPE; - } -} - pmix_status_t pmix20_bfrop_unpack(pmix_buffer_t *buffer, - void *dst, int32_t *num_vals, - pmix_data_type_t type) + void *dst, int32_t *num_vals, + pmix_data_type_t type) { pmix_status_t rc, ret; int32_t local_num, n=1; pmix_data_type_t local_type; + pmix_pointer_array_t *regtypes = &mca_bfrops_v20_component.types; /* check for error */ if (NULL == buffer || NULL == dst || NULL == num_vals) { @@ -96,7 +66,7 @@ pmix_status_t pmix20_bfrop_unpack(pmix_buffer_t *buffer, * int32_t as used here. */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix20_bfrop_get_data_type(buffer, &local_type))) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_get_data_type(regtypes, buffer, &local_type))) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ @@ -109,7 +79,8 @@ pmix_status_t pmix20_bfrop_unpack(pmix_buffer_t *buffer, } n=1; - if (PMIX_SUCCESS != (rc = pmix20_bfrop_unpack_int32(buffer, &local_num, &n, PMIX_INT32))) { + PMIX_BFROPS_UNPACK_TYPE(rc, buffer, &local_num, &n, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != rc) { *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ @@ -137,7 +108,7 @@ pmix_status_t pmix20_bfrop_unpack(pmix_buffer_t *buffer, } /** Unpack the value(s) */ - if (PMIX_SUCCESS != (rc = pmix20_bfrop_unpack_buffer(buffer, dst, &local_num, type))) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_unpack_buffer(regtypes, buffer, dst, &local_num, type))) { *num_vals = 0; ret = rc; } @@ -145,12 +116,12 @@ pmix_status_t pmix20_bfrop_unpack(pmix_buffer_t *buffer, return ret; } -pmix_status_t pmix20_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32_t *num_vals, - pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_buffer(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dst, int32_t *num_vals, + pmix_data_type_t type) { pmix_status_t rc; pmix_data_type_t local_type, v20type; - pmix_bfrop_type_info_t *info; pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix20_bfrop_unpack_buffer( %p, %p, %lu, %d )\n", @@ -167,7 +138,7 @@ pmix_status_t pmix20_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32 /** Unpack the declared data type */ if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) { - if (PMIX_SUCCESS != (rc = pmix20_bfrop_get_data_type(buffer, &local_type))) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_get_data_type(regtypes, buffer, &local_type))) { return rc; } /* if the data types don't match, then return an error */ @@ -176,14 +147,8 @@ pmix_status_t pmix20_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32 return PMIX_ERR_PACK_MISMATCH; } } - - /* Lookup the unpack function for this type and call it */ - - if (NULL == (info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&mca_bfrops_v20_component.types, v20type))) { - return PMIX_ERR_UNPACK_FAILURE; - } - - return info->odti_unpack_fn(buffer, dst, num_vals, v20type); + PMIX_BFROPS_UNPACK_TYPE(rc, buffer, dst, num_vals, v20type, regtypes); + return rc; } @@ -192,8 +157,9 @@ pmix_status_t pmix20_bfrop_unpack_buffer(pmix_buffer_t *buffer, void *dst, int32 /* * BOOL */ -pmix_status_t pmix20_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_bool(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint8_t *src; @@ -227,24 +193,26 @@ pmix_status_t pmix20_bfrop_unpack_bool(pmix_buffer_t *buffer, void *dest, /* * INT */ -pmix_status_t pmix20_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_int(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_INT) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, dest, + num_vals, BFROP_TYPE_INT))) { } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(int, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, int, remote_type, ret); } return ret; @@ -253,24 +221,26 @@ pmix_status_t pmix20_bfrop_unpack_int(pmix_buffer_t *buffer, void *dest, /* * SIZE_T */ -pmix_status_t pmix20_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_sizet(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_SIZE_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_SIZE_T))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, + dest, num_vals, BFROP_TYPE_SIZE_T))) { } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(size_t, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, size_t, remote_type, ret); } return ret; @@ -279,24 +249,25 @@ pmix_status_t pmix20_bfrop_unpack_sizet(pmix_buffer_t *buffer, void *dest, /* * PID_T */ -pmix_status_t pmix20_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_pid(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; pmix_data_type_t remote_type; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(buffer, &remote_type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(regtypes, buffer, &remote_type))) { return ret; } if (remote_type == BFROP_TYPE_PID_T) { /* fast path it if the sizes are the same */ /* Turn around and unpack the real type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, dest, num_vals, BFROP_TYPE_PID_T))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, dest, num_vals, BFROP_TYPE_PID_T))) { } } else { /* slow path - types are different sizes */ - PMIX_BFROP_UNPACK_SIZE_MISMATCH(pid_t, remote_type, ret); + PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, pid_t, remote_type, ret); } return ret; @@ -308,8 +279,9 @@ pmix_status_t pmix20_bfrop_unpack_pid(pmix_buffer_t *buffer, void *dest, /* * BYTE, CHAR, INT8 */ -pmix_status_t pmix20_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_byte(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix20_bfrop_unpack_byte * %d\n", (int)*num_vals); @@ -327,8 +299,9 @@ pmix_status_t pmix20_bfrop_unpack_byte(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_int16(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint16_t tmp, *desttmp = (uint16_t*) dest; @@ -351,8 +324,9 @@ pmix_status_t pmix20_bfrop_unpack_int16(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_int32(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint32_t tmp, *desttmp = (uint32_t*) dest; @@ -375,14 +349,19 @@ pmix_status_t pmix20_bfrop_unpack_int32(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_datatype(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_datatype(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_int16(buffer, dest, num_vals, type); + pmix_status_t ret; + + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_INT16, regtypes); + return ret; } -pmix_status_t pmix20_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_int64(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i; uint64_t tmp, *desttmp = (uint64_t*) dest; @@ -405,15 +384,17 @@ pmix_status_t pmix20_bfrop_unpack_int64(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_string(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_status_t ret; int32_t i, len, n=1; char **sdest = (char**) dest; for (i = 0; i < (*num_vals); ++i) { - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int32(buffer, &len, &n, PMIX_INT32))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &len, &n, PMIX_INT32, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (0 == len) { /* zero-length string - unpack the NULL */ @@ -423,7 +404,8 @@ pmix_status_t pmix20_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, if (NULL == sdest[i]) { return PMIX_ERR_OUT_OF_RESOURCE; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(buffer, sdest[i], &len, PMIX_BYTE))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, sdest[i], &len, PMIX_BYTE, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } } @@ -432,8 +414,9 @@ pmix_status_t pmix20_bfrop_unpack_string(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_float(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; float *desttmp = (float*) dest, tmp; @@ -451,7 +434,8 @@ pmix_status_t pmix20_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &convert, &n, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &convert, &n, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL != convert) { @@ -463,8 +447,9 @@ pmix_status_t pmix20_bfrop_unpack_float(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_double(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; double *desttmp = (double*) dest, tmp; @@ -482,7 +467,8 @@ pmix_status_t pmix20_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, for (i = 0; i < (*num_vals); ++i) { n=1; convert = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &convert, &n, PMIX_STRING))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &convert, &n, PMIX_STRING, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } if (NULL != convert) { @@ -494,8 +480,9 @@ pmix_status_t pmix20_bfrop_unpack_double(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_timeval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; int64_t tmp[2]; @@ -512,7 +499,8 @@ pmix_status_t pmix20_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=2; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int64(buffer, tmp, &n, PMIX_INT64))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, tmp, &n, PMIX_INT64, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } tt.tv_sec = tmp[0]; @@ -522,8 +510,9 @@ pmix_status_t pmix20_bfrop_unpack_timeval(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_time(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { int32_t i, n; time_t *desttmp = (time_t *) dest, tmp; @@ -536,15 +525,11 @@ pmix_status_t pmix20_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix20_bfrop_unpack_time * %d\n", (int)*num_vals); - /* check to see if there's enough data in buffer */ - if (pmix_bfrop_too_small(buffer, (*num_vals)*(sizeof(uint64_t)))) { - return PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER; - } - /* unpack the data */ for (i = 0; i < (*num_vals); ++i) { n=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int64(buffer, &ui64, &n, PMIX_UINT64))) { + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ui64, &n, PMIX_UINT64, regtypes); + if (PMIX_SUCCESS != ret) { return ret; } tmp = (time_t)ui64; @@ -554,10 +539,13 @@ pmix_status_t pmix20_bfrop_unpack_time(pmix_buffer_t *buffer, void *dest, } -pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_status(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix20_bfrop_unpack_status * %d\n", (int)*num_vals); /* check to see if there's enough data in buffer */ if (pmix_bfrop_too_small(buffer, (*num_vals)*(sizeof(pmix_status_t)))) { @@ -565,7 +553,8 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, } /* unpack the data */ - return pmix20_bfrop_unpack_int32(buffer, dest, num_vals, PMIX_INT32); + PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, PMIX_INT32, regtypes); + return ret; } @@ -574,8 +563,9 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, /* * PMIX_VALUE */ - static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) - { +static pmix_status_t unpack_val(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, pmix_value_t *val) +{ int32_t m; pmix_status_t ret; @@ -584,102 +574,102 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, case PMIX_UNDEF: break; case PMIX_BOOL: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.flag, &m, PMIX_BOOL))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.flag, &m, PMIX_BOOL))) { return ret; } break; case PMIX_BYTE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.byte, &m, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.byte, &m, PMIX_BYTE))) { return ret; } break; case PMIX_STRING: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.string, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.string, &m, PMIX_STRING))) { return ret; } break; case PMIX_SIZE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.size, &m, PMIX_SIZE))) { return ret; } break; case PMIX_PID: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.pid, &m, PMIX_PID))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.pid, &m, PMIX_PID))) { return ret; } break; case PMIX_INT: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.integer, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.integer, &m, PMIX_INT))) { return ret; } break; case PMIX_INT8: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.int8, &m, PMIX_INT8))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.int8, &m, PMIX_INT8))) { return ret; } break; case PMIX_INT16: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.int16, &m, PMIX_INT16))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.int16, &m, PMIX_INT16))) { return ret; } break; case PMIX_INT32: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.int32, &m, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.int32, &m, PMIX_INT32))) { return ret; } break; case PMIX_INT64: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.int64, &m, PMIX_INT64))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.int64, &m, PMIX_INT64))) { return ret; } break; case PMIX_UINT: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.uint, &m, PMIX_UINT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint, &m, PMIX_UINT))) { return ret; } break; case PMIX_UINT8: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.uint8, &m, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint8, &m, PMIX_UINT8))) { return ret; } break; case PMIX_UINT16: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.uint16, &m, PMIX_UINT16))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint16, &m, PMIX_UINT16))) { return ret; } break; case PMIX_UINT32: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.uint32, &m, PMIX_UINT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint32, &m, PMIX_UINT32))) { return ret; } break; case PMIX_UINT64: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.uint64, &m, PMIX_UINT64))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.uint64, &m, PMIX_UINT64))) { return ret; } break; case PMIX_FLOAT: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.fval, &m, PMIX_FLOAT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.fval, &m, PMIX_FLOAT))) { return ret; } break; case PMIX_DOUBLE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.dval, &m, PMIX_DOUBLE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.dval, &m, PMIX_DOUBLE))) { return ret; } break; case PMIX_TIMEVAL: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.tv, &m, PMIX_TIMEVAL))) { return ret; } break; case PMIX_TIME: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.time, &m, PMIX_TIME))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.time, &m, PMIX_TIME))) { return ret; } break; case PMIX_STATUS: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.status, &m, PMIX_STATUS))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.status, &m, PMIX_STATUS))) { return ret; } break; @@ -689,43 +679,43 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, if (NULL == val->data.proc) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, val->data.proc, &m, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, val->data.proc, &m, PMIX_PROC))) { return ret; } break; case PMIX_PROC_RANK: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.rank, &m, PMIX_PROC_RANK))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.rank, &m, PMIX_PROC_RANK))) { return ret; } break; case PMIX_BYTE_OBJECT: case PMIX_COMPRESSED_STRING: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.bo, &m, PMIX_BYTE_OBJECT))) { return ret; } break; case PMIX_PERSIST: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.proc, &m, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.proc, &m, PMIX_PROC))) { return ret; } break; case PMIX_POINTER: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.ptr, &m, PMIX_POINTER))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.ptr, &m, PMIX_POINTER))) { return ret; } break; case PMIX_SCOPE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.scope, &m, PMIX_SCOPE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.scope, &m, PMIX_SCOPE))) { return ret; } break; case PMIX_DATA_RANGE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.range, &m, PMIX_DATA_RANGE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.range, &m, PMIX_DATA_RANGE))) { return ret; } break; case PMIX_PROC_STATE: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.state, &m, PMIX_PROC_STATE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.state, &m, PMIX_PROC_STATE))) { return ret; } break; @@ -735,7 +725,7 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, if (NULL == val->data.pinfo) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, val->data.pinfo, &m, PMIX_PROC_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, val->data.pinfo, &m, PMIX_PROC_INFO))) { return ret; } break; @@ -745,12 +735,12 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, if (NULL == val->data.darray) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, val->data.darray, &m, PMIX_DATA_ARRAY))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, val->data.darray, &m, PMIX_DATA_ARRAY))) { return ret; } break; case PMIX_QUERY: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, val->data.darray, &m, PMIX_QUERY))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, val->data.darray, &m, PMIX_QUERY))) { return ret; } break; @@ -762,7 +752,7 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, val->data.darray->type = PMIX_INFO_ARRAY; val->data.darray->size = m; /* unpack into it */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.darray->array, &m, PMIX_INFO_ARRAY))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, &val->data.darray->array, &m, PMIX_INFO_ARRAY))) { return ret; } break; @@ -775,8 +765,9 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_value(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_value_t *ptr; int32_t i, n; @@ -787,19 +778,20 @@ pmix_status_t pmix20_bfrop_unpack_value(pmix_buffer_t *buffer, void *dest, for (i = 0; i < n; ++i) { /* unpack the type */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(buffer, &ptr[i].type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_get_data_type(regtypes, buffer, &ptr[i].type))) { return ret; } /* unpack value */ - if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i])) ) { + if (PMIX_SUCCESS != (ret = unpack_val(regtypes, buffer, &ptr[i])) ) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_info(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_info_t *ptr; int32_t i, n, m; @@ -818,7 +810,7 @@ pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, /* unpack key */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { PMIX_ERROR_LOG(ret); return ret; } @@ -830,7 +822,7 @@ pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, free(tmp); /* unpack the flags */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_infodirs(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_infodirs(regtypes, buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) { PMIX_ERROR_LOG(ret); return ret; } @@ -838,14 +830,14 @@ pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(regtypes, buffer, &ptr[i].value.type, &m, PMIX_INT))) { PMIX_ERROR_LOG(ret); return ret; } pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix20_bfrop_unpack: info type %d", ptr[i].value.type); m=1; - if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { + if (PMIX_SUCCESS != (ret = unpack_val(regtypes, buffer, &ptr[i].value))) { PMIX_ERROR_LOG(ret); return ret; } @@ -853,8 +845,9 @@ pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_pdata(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_pdata_t *ptr; int32_t i, n, m; @@ -871,13 +864,13 @@ pmix_status_t pmix20_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, PMIX_PDATA_CONSTRUCT(&ptr[i]); /* unpack the proc */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_proc(regtypes, buffer, &ptr[i].proc, &m, PMIX_PROC))) { return ret; } /* unpack key */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -889,21 +882,22 @@ pmix_status_t pmix20_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, * instead of a pointer in this struct, we directly unpack it to * avoid the malloc */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(regtypes, buffer, &ptr[i].value.type, &m, PMIX_INT))) { return ret; } pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, "pmix20_bfrop_unpack: pdata type %d", ptr[i].value.type); m=1; - if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) { + if (PMIX_SUCCESS != (ret = unpack_val(regtypes, buffer, &ptr[i].value))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_buf(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_buffer_t *ptr; int32_t i, n, m; @@ -916,7 +910,7 @@ pmix_status_t pmix20_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, for (i = 0; i < n; ++i) { /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &nbytes, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &nbytes, &m, PMIX_SIZE))) { return ret; } m = nbytes; @@ -924,7 +918,7 @@ pmix_status_t pmix20_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, if (0 < nbytes) { ptr[i].base_ptr = (char*)malloc(nbytes); /* unpack the bytes */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(buffer, ptr[i].base_ptr, &m, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(regtypes, buffer, ptr[i].base_ptr, &m, PMIX_BYTE))) { return ret; } } @@ -936,8 +930,9 @@ pmix_status_t pmix20_bfrop_unpack_buf(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_proc(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_proc_t *ptr; int32_t i, n, m; @@ -957,7 +952,7 @@ pmix_status_t pmix20_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, /* unpack nspace */ m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -967,15 +962,16 @@ pmix_status_t pmix20_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, free(tmp); /* unpack the rank */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_rank(buffer, &ptr[i].rank, &m, PMIX_PROC_RANK))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_rank(regtypes, buffer, &ptr[i].rank, &m, PMIX_PROC_RANK))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_app(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_app_t *ptr; int32_t i, k, n, m; @@ -994,19 +990,19 @@ pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, PMIX_APP_CONSTRUCT(&ptr[i]); /* unpack cmd */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &ptr[i].cmd, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &ptr[i].cmd, &m, PMIX_STRING))) { return ret; } /* unpack argc */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(buffer, &nval, &m, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(regtypes, buffer, &nval, &m, PMIX_INT32))) { return ret; } /* unpack argv */ for (k=0; k < nval; k++) { m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -1017,13 +1013,13 @@ pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, } /* unpack env */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int32(buffer, &nval, &m, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int32(regtypes, buffer, &nval, &m, PMIX_INT32))) { return ret; } for (k=0; k < nval; k++) { m=1; tmp = NULL; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &tmp, &m, PMIX_STRING))) { return ret; } if (NULL == tmp) { @@ -1034,23 +1030,23 @@ pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, } /* unpack cwd */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &ptr[i].cwd, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &ptr[i].cwd, &m, PMIX_STRING))) { return ret; } /* unpack maxprocs */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(buffer, &ptr[i].maxprocs, &m, PMIX_INT))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int(regtypes, buffer, &ptr[i].maxprocs, &m, PMIX_INT))) { return ret; } /* unpack info array */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &ptr[i].ninfo, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].ninfo, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].ninfo) { PMIX_INFO_CREATE(ptr[i].info, ptr[i].ninfo); m = ptr[i].ninfo; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_info(buffer, ptr[i].info, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_info(regtypes, buffer, ptr[i].info, &m, PMIX_INFO))) { return ret; } } @@ -1058,8 +1054,9 @@ pmix_status_t pmix20_bfrop_unpack_app(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_kval(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_kval_t *ptr; int32_t i, n, m; @@ -1075,7 +1072,7 @@ pmix_status_t pmix20_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, PMIX_CONSTRUCT(&ptr[i], pmix_kval_t); /* unpack the key */ m = 1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &ptr[i].key, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &ptr[i].key, &m, PMIX_STRING))) { PMIX_ERROR_LOG(ret); return ret; } @@ -1083,7 +1080,7 @@ pmix_status_t pmix20_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, ptr[i].value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); /* unpack the value */ m = 1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_value(buffer, ptr[i].value, &m, PMIX_VALUE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_value(regtypes, buffer, ptr[i].value, &m, PMIX_VALUE))) { PMIX_ERROR_LOG(ret); return ret; } @@ -1091,8 +1088,9 @@ pmix_status_t pmix20_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i, n, m; @@ -1108,13 +1106,13 @@ pmix_status_t pmix20_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(regtypes, buffer, ptr[i].blob, &m, PMIX_UINT8))) { return ret; } } @@ -1122,38 +1120,44 @@ pmix_status_t pmix20_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_persist(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix20_bfrop_unpack_persist(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + return pmix20_bfrop_unpack_byte(regtypes, buffer, dest, num_vals, PMIX_UINT8); +} + +pmix_status_t pmix20_bfrop_unpack_scope(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + return pmix20_bfrop_unpack_byte(regtypes, buffer, dest, num_vals, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_unpack_scope(pmix_buffer_t *buffer, void *dest, +pmix_status_t pmix20_bfrop_unpack_range(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + return pmix20_bfrop_unpack_byte(regtypes, buffer, dest, num_vals, PMIX_UINT8); +} + +pmix_status_t pmix20_bfrop_unpack_cmd(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + return pmix20_bfrop_unpack_byte(regtypes, buffer, dest, num_vals, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_unpack_range(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_infodirs(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + return pmix20_bfrop_unpack_int32(regtypes, buffer, dest, num_vals, PMIX_UINT32); } -pmix_status_t pmix20_bfrop_unpack_cmd(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); -} - -pmix_status_t pmix20_bfrop_unpack_infodirs(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - return pmix20_bfrop_unpack_int32(buffer, dest, num_vals, PMIX_UINT32); -} - -pmix_status_t pmix20_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_bo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_byte_object_t *ptr; int32_t i, n, m; @@ -1169,13 +1173,13 @@ pmix_status_t pmix20_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_byte_object_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].bytes = (char*)malloc(ptr[i].size * sizeof(char)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(buffer, ptr[i].bytes, &m, PMIX_BYTE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_byte(regtypes, buffer, ptr[i].bytes, &m, PMIX_BYTE))) { return ret; } } @@ -1183,26 +1187,29 @@ pmix_status_t pmix20_bfrop_unpack_bo(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_ptr(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_ptr(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { uint8_t foo=1; int32_t cnt=1; /* it obviously makes no sense to pack a pointer and * send it somewhere else, so we just unpack the sentinel */ - return pmix20_bfrop_unpack_byte(buffer, &foo, &cnt, PMIX_UINT8); + return pmix20_bfrop_unpack_byte(regtypes, buffer, &foo, &cnt, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_unpack_pstate(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_pstate(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + return pmix20_bfrop_unpack_byte(regtypes, buffer, dest, num_vals, PMIX_UINT8); } -pmix_status_t pmix20_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_pinfo(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_proc_info_t *ptr; int32_t i, n, m; @@ -1218,35 +1225,36 @@ pmix_status_t pmix20_bfrop_unpack_pinfo(pmix_buffer_t *buffer, void *dest, PMIX_PROC_INFO_CONSTRUCT(&ptr[i]); /* unpack the proc */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_proc(buffer, &ptr[i].proc, &m, PMIX_PROC))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_proc(regtypes, buffer, &ptr[i].proc, &m, PMIX_PROC))) { return ret; } /* unpack the hostname */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &ptr[i].hostname, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &ptr[i].hostname, &m, PMIX_STRING))) { return ret; } /* unpack the executable */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, &ptr[i].executable_name, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, &ptr[i].executable_name, &m, PMIX_STRING))) { return ret; } /* unpack pid */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_pid(buffer, &ptr[i].pid, &m, PMIX_PID))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_pid(regtypes, buffer, &ptr[i].pid, &m, PMIX_PID))) { return ret; } /* unpack state */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_pstate(buffer, &ptr[i].state, &m, PMIX_PROC_STATE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_pstate(regtypes, buffer, &ptr[i].state, &m, PMIX_PROC_STATE))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_darray(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_data_array_t *ptr; int32_t i, n, m; @@ -1263,12 +1271,12 @@ pmix_status_t pmix20_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_data_array_t)); /* unpack the type */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_datatype(buffer, &ptr[i].type, &m, PMIX_DATA_TYPE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_datatype(regtypes, buffer, &ptr[i].type, &m, PMIX_DATA_TYPE))) { return ret; } /* unpack the number of array elements */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 == ptr[i].size || PMIX_UNDEF == ptr[i].type) { @@ -1359,21 +1367,23 @@ pmix_status_t pmix20_bfrop_unpack_darray(pmix_buffer_t *buffer, void *dest, if (NULL == (ptr[i].array = malloc(m * nbytes))) { return PMIX_ERR_NOMEM; } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, ptr[i].array, &m, ptr[i].type))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(regtypes, buffer, ptr[i].array, &m, ptr[i].type))) { return ret; } } return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_rank(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_rank(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_int32(buffer, dest, num_vals, PMIX_UINT32); + return pmix20_bfrop_unpack_int32(regtypes, buffer, dest, num_vals, PMIX_UINT32); } -pmix_status_t pmix20_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_query(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_query_t *ptr; int32_t i, n, m; @@ -1390,7 +1400,7 @@ pmix_status_t pmix20_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, PMIX_QUERY_CONSTRUCT(&ptr[i]); /* unpack the number of keys */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int32(buffer, &nkeys, &m, PMIX_INT32))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_int32(regtypes, buffer, &nkeys, &m, PMIX_INT32))) { return ret; } if (0 < nkeys) { @@ -1400,20 +1410,20 @@ pmix_status_t pmix20_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, } /* unpack keys */ m=nkeys; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(buffer, ptr[i].keys, &m, PMIX_STRING))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_string(regtypes, buffer, ptr[i].keys, &m, PMIX_STRING))) { return ret; } } /* unpack the number of qualifiers */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &ptr[i].nqual, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].nqual, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].nqual) { /* unpack the qualifiers */ PMIX_INFO_CREATE(ptr[i].qualifiers, ptr[i].nqual); m = ptr[i].nqual; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_info(buffer, ptr[i].qualifiers, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_info(regtypes, buffer, ptr[i].qualifiers, &m, PMIX_INFO))) { return ret; } } @@ -1421,16 +1431,18 @@ pmix_status_t pmix20_bfrop_unpack_query(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix20_bfrop_unpack_alloc_directive(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_alloc_directive(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { - return pmix20_bfrop_unpack_byte(buffer, dest, num_vals, PMIX_UINT8); + return pmix20_bfrop_unpack_byte(regtypes, buffer, dest, num_vals, PMIX_UINT8); } /**** DEPRECATED ****/ -pmix_status_t pmix20_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +pmix_status_t pmix20_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; int32_t i, n, m; @@ -1448,13 +1460,13 @@ pmix_status_t pmix20_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_info_array_t)); /* unpack the size of this array */ m=1; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_value(regtypes, buffer, ptr[i].array, &m, PMIX_INFO))) { return ret; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c index 8100b70ed6..ecdec596d8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c @@ -13,7 +13,9 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +24,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include "src/mca/bfrops/base/base.h" #include "bfrop_pmix21.h" @@ -75,14 +77,18 @@ typedef struct pmix_modex_data { size_t size; } pmix_modex_data_t; -static pmix_status_t pmix21_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix21_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -static pmix_status_t pmix21_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix21_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -static pmix_status_t pmix21_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, +static pmix_status_t pmix21_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -static pmix_status_t pmix21_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type); static pmix_status_t pmix21_bfrop_copy_array(pmix_info_array_t **dest, pmix_info_array_t *src, pmix_data_type_t type); @@ -479,7 +485,8 @@ static const char* data_type_string(pmix_data_type_t type) } /**** DEPRECATED ****/ -static pmix_status_t pmix21_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix21_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; @@ -490,12 +497,12 @@ static pmix_status_t pmix21_bfrop_pack_array(pmix_buffer_t *buffer, const void * for (i = 0; i < num_vals; ++i) { /* pack the size */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { /* pack the values */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(regtypes, buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { return ret; } } @@ -504,8 +511,9 @@ static pmix_status_t pmix21_bfrop_pack_array(pmix_buffer_t *buffer, const void * return PMIX_SUCCESS; } -static pmix_status_t pmix21_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) +static pmix_status_t pmix21_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i; @@ -514,11 +522,11 @@ static pmix_status_t pmix21_bfrop_pack_modex(pmix_buffer_t *buffer, const void * ptr = (pmix_modex_data_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if( 0 < ptr[i].size){ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(regtypes, buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { return ret; } } @@ -529,7 +537,8 @@ static pmix_status_t pmix21_bfrop_pack_modex(pmix_buffer_t *buffer, const void * /********************/ /**** DEPRECATED ****/ -static pmix_status_t pmix21_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, +static pmix_status_t pmix21_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; @@ -548,13 +557,15 @@ static pmix_status_t pmix21_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest memset(&ptr[i], 0, sizeof(pmix_info_array_t)); /* unpack the size of this array */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(regtypes, buffer, + &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(regtypes, buffer, + ptr[i].array, &m, PMIX_INFO))) { return ret; } } @@ -562,8 +573,9 @@ static pmix_status_t pmix21_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest return PMIX_SUCCESS; } -static pmix_status_t pmix21_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) +static pmix_status_t pmix21_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; int32_t i, n, m; @@ -579,13 +591,13 @@ static pmix_status_t pmix21_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(regtypes, buffer, ptr[i].blob, &m, PMIX_UINT8))) { return ret; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21_component.c index c47630982a..e410c2dd94 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/types.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c index eac138a80d..b05a1ec033 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c @@ -13,7 +13,9 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +24,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include "src/mca/bfrops/base/base.h" #include "bfrop_pmix3.h" @@ -75,13 +77,17 @@ typedef struct pmix_modex_data { size_t size; } pmix_modex_data_t; -static pmix_status_t pmix3_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix3_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -static pmix_status_t pmix3_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix3_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type); -static pmix_status_t pmix3_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, +static pmix_status_t pmix3_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); -static pmix_status_t pmix3_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, +static pmix_status_t pmix3_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type); static pmix_status_t pmix3_bfrop_copy_array(pmix_info_array_t **dest, pmix_info_array_t *src, @@ -495,7 +501,8 @@ static const char* data_type_string(pmix_data_type_t type) } /**** DEPRECATED ****/ -static pmix_status_t pmix3_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix3_bfrop_pack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; @@ -506,12 +513,12 @@ static pmix_status_t pmix3_bfrop_pack_array(pmix_buffer_t *buffer, const void *s for (i = 0; i < num_vals; ++i) { /* pack the size */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { /* pack the values */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(regtypes, buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { return ret; } } @@ -520,7 +527,8 @@ static pmix_status_t pmix3_bfrop_pack_array(pmix_buffer_t *buffer, const void *s return PMIX_SUCCESS; } -static pmix_status_t pmix3_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, +static pmix_status_t pmix3_bfrop_pack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; @@ -530,11 +538,11 @@ static pmix_status_t pmix3_bfrop_pack_modex(pmix_buffer_t *buffer, const void *s ptr = (pmix_modex_data_t *) src; for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(regtypes, buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if( 0 < ptr[i].size){ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(regtypes, buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { return ret; } } @@ -546,7 +554,8 @@ static pmix_status_t pmix3_bfrop_pack_modex(pmix_buffer_t *buffer, const void *s /********************/ /**** DEPRECATED ****/ -static pmix_status_t pmix3_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, +static pmix_status_t pmix3_bfrop_unpack_array(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; @@ -565,13 +574,13 @@ static pmix_status_t pmix3_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_info_array_t)); /* unpack the size of this array */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(regtypes, buffer, ptr[i].array, &m, PMIX_INFO))) { return ret; } } @@ -579,7 +588,8 @@ static pmix_status_t pmix3_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -static pmix_status_t pmix3_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, +static pmix_status_t pmix3_bfrop_unpack_modex(pmix_pointer_array_t *regtypes, + pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { pmix_modex_data_t *ptr; @@ -596,13 +606,13 @@ static pmix_status_t pmix3_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); /* unpack the number of bytes */ m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(regtypes, buffer, &ptr[i].size, &m, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(regtypes, buffer, ptr[i].blob, &m, PMIX_UINT8))) { return ret; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c index 265b2ded1d..d66888eec9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/types.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c index 81abef989d..f22461cdeb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2019 Mellanox Technologies, Inc. + * Copyright (c) 2016-2020 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -13,7 +13,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -35,15 +35,16 @@ #endif #include -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" #include "src/util/argv.h" -#include "src/util/compress.h" +#include "src/mca/pcompress/pcompress.h" #include "src/util/error.h" +#include "src/util/name_fns.h" #include "src/util/output.h" #include "src/util/pmix_environ.h" #include "src/util/hash.h" @@ -108,9 +109,10 @@ static inline pmix_peer_t * _client_peer(pmix_common_dstore_ctx_t *ds_ctx); static inline int _my_client(const char *nspace, pmix_rank_t rank); static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, - struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_byte_object_t *bo); + pmix_proc_t *proc, + pmix_gds_modex_key_fmt_t key_fmt, + char **kmap, + pmix_buffer_t *pbkt); static pmix_status_t _dstore_store_nolock(pmix_common_dstore_ctx_t *ds_ctx, ns_map_data_t *ns_map, @@ -207,6 +209,7 @@ static inline int _esh_dir_del(const char *path) while (NULL != (d_ptr = readdir(dir))) { snprintf(name, PMIX_PATH_MAX, "%s/%s", path, d_ptr->d_name); + /* coverity[toctou] */ if ( 0 > lstat(name, &st) ){ /* No fatal error here - just log this event * we will hit the error later at rmdir. Keep trying ... @@ -1597,10 +1600,12 @@ pmix_common_dstore_ctx_t *pmix_common_dstor_init(const char *ds_name, pmix_info_ goto err_exit; } - rc = pmix_pshmem.init(); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - goto err_exit; + if (NULL != pmix_pshmem.init) { + rc = pmix_pshmem.init(); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto err_exit; + } } _set_constants_from_env(ds_ctx); @@ -1775,10 +1780,12 @@ PMIX_EXPORT void pmix_common_dstor_finalize(pmix_common_dstore_ctx_t *ds_ctx) _esh_ns_map_cleanup(ds_ctx); _esh_ns_track_cleanup(ds_ctx); - pmix_pshmem.finalize(); + if (NULL != pmix_pshmem.finalize) { + pmix_pshmem.finalize(); + } if (NULL != ds_ctx->base_path){ - if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { + if(PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { /* coverity[toctou] */ if (lstat(ds_ctx->base_path, &st) >= 0){ if (PMIX_SUCCESS != (rc = _esh_dir_del(ds_ctx->base_path))) { @@ -1962,7 +1969,7 @@ static pmix_status_t _dstore_fetch(pmix_common_dstore_ctx_t *ds_ctx, bool all_ranks_found = true; bool key_found = false; pmix_info_t *info = NULL; - size_t ninfo; + size_t ninfo = 0; size_t keyhash = 0; bool lock_is_set = false; @@ -2253,7 +2260,7 @@ done: if( rc != PMIX_SUCCESS ){ if ((NULL == key) && (kval_cnt > 0)) { - if( NULL != info ) { + if( NULL != info && 0 < ninfo ) { PMIX_INFO_FREE(info, ninfo); } if (NULL != kval) { @@ -2385,7 +2392,8 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_setup_fork(pmix_common_dstore_ctx_t } PMIX_EXPORT pmix_status_t pmix_common_dstor_add_nspace(pmix_common_dstore_ctx_t *ds_ctx, - const char *nspace, pmix_info_t info[], size_t ninfo) + const char *nspace, uint32_t local_size, + pmix_info_t info[], size_t ninfo) { pmix_status_t rc = PMIX_SUCCESS; size_t tbl_idx=0; @@ -2393,21 +2401,17 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_add_nspace(pmix_common_dstore_ctx_t char setjobuid = ds_ctx->setjobuid; size_t n; ns_map_data_t *ns_map = NULL; - uint32_t local_size = 0; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, - "gds: dstore add nspace"); + "gds: dstore add nspace %s, local_size %d", + nspace, local_size); if (NULL != info) { for (n=0; n < ninfo; n++) { if (0 == strcmp(PMIX_USERID, info[n].key)) { jobuid = info[n].value.data.uint32; setjobuid = 1; - continue; - } - if (0 == strcmp(PMIX_LOCAL_SIZE, info[n].key)) { - local_size = info[n].value.data.uint32; - continue; + break; } } } @@ -2461,7 +2465,9 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t int in_use = 0; ns_map_data_t *ns_map_data = NULL; ns_map_t *ns_map; +#if PMIX_ENABLE_DEBUG session_t *session_tbl = NULL; +#endif ns_track_elem_t *trk = NULL; int dstor_track_idx; size_t session_tbl_idx; @@ -2511,10 +2517,12 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t /* A lot of nspaces may be using same session info * session record can only be deleted once all references are gone */ if (!in_use) { +#if PMIX_ENABLE_DEBUG session_tbl = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->session_array, session_t); PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s delete session for jobuid: %d", __FILE__, __LINE__, __func__, session_tbl[session_tbl_idx].jobuid)); +#endif _esh_session_release(ds_ctx, session_tbl_idx); } exit: @@ -2544,9 +2552,9 @@ static inline int _my_client(const char *nspace, pmix_rank_t rank) * always contains data solely from remote procs, and we * shall store it accordingly */ PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t *ds_ctx, - struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t *buf) + struct pmix_namespace_t *nspace, + pmix_buffer_t *buf, + void *cbdata) { pmix_status_t rc = PMIX_SUCCESS; pmix_status_t rc1 = PMIX_SUCCESS; @@ -2566,7 +2574,9 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t return rc; } - rc = pmix_gds_base_store_modex(nspace, cbs, buf, (pmix_gds_base_store_modex_cb_fn_t)_dstor_store_modex_cb, ds_ctx); + rc = pmix_gds_base_store_modex(nspace, buf, ds_ctx, + (pmix_gds_base_store_modex_cb_fn_t)_dstor_store_modex_cb, + cbdata); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } @@ -2584,15 +2594,12 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t } static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, - struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_byte_object_t *bo) + pmix_proc_t *proc, + pmix_gds_modex_key_fmt_t key_fmt, + char **kmap, + pmix_buffer_t *pbkt) { - pmix_namespace_t *ns = (pmix_namespace_t*)nspace; pmix_status_t rc = PMIX_SUCCESS; - int32_t cnt; - pmix_buffer_t pbkt; - pmix_proc_t proc; pmix_kval_t *kv; ns_map_data_t *ns_map; pmix_buffer_t tmp; @@ -2600,7 +2607,7 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:dstore:store_modex for nspace %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, - ns->nspace); + proc->nspace); /* NOTE: THE BYTE OBJECT DELIVERED HERE WAS CONSTRUCTED * BY A SERVER, AND IS THEREFORE PACKED USING THE SERVER'S @@ -2612,28 +2619,8 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, * the rank followed by pmix_kval_t's. The list of callbacks * contains all local participants. */ - /* setup the byte object for unpacking */ - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - /* the next step unfortunately NULLs the byte object's - * entries, so we need to ensure we restore them! */ - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, bo->bytes, bo->size); - /* unload the proc that provided this data */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, &proc, &cnt, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); - return rc; - } /* don't store blobs to the sm dstore from local clients */ - if (_my_client(proc.nspace, proc.rank)) { - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); + if (_my_client(proc->nspace, proc->rank)) { return PMIX_SUCCESS; } @@ -2641,18 +2628,14 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, PMIX_CONSTRUCT(&tmp, pmix_buffer_t); /* unpack the remaining values until we hit the end of the buffer */ - cnt = 1; kv = PMIX_NEW(pmix_kval_t); - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); + rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv); + while (PMIX_SUCCESS == rc) { /* store this in the hash table */ - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, &proc, PMIX_REMOTE, kv); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, proc, PMIX_REMOTE, kv); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); return rc; } @@ -2665,8 +2648,10 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, /* proceed to the next element */ kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); + rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv); + if (PMIX_SUCCESS != rc) { + break; + } } /* Release the kv that didn't received the value @@ -2686,18 +2671,14 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, PMIX_UNLOAD_BUFFER(&tmp, kv->value->data.bo.bytes, kv->value->data.bo.size); /* Get the namespace map element for the process "proc" */ - if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, proc.nspace))) { + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, proc->nspace))) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); return rc; } /* Store all keys at once */ - rc = _dstore_store_nolock(ds_ctx, ns_map, proc.rank, kv); + rc = _dstore_store_nolock(ds_ctx, ns_map, proc->rank, kv); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } @@ -2706,12 +2687,6 @@ static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, PMIX_RELEASE(kv); PMIX_DESTRUCT(&tmp); - /* Reset the input buffer */ - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); - return rc; } @@ -2723,7 +2698,10 @@ static pmix_status_t _store_job_info(pmix_common_dstore_ctx_t *ds_ctx, ns_map_da pmix_buffer_t buf; pmix_kval_t kv2, *kvp; pmix_status_t rc = PMIX_SUCCESS; - pmix_info_t *ihost; + uint32_t appnum; + char *hostname, **aliases; + uint32_t nodeid; + bool match; PMIX_CONSTRUCT(&cb, pmix_cb_t); PMIX_CONSTRUCT(&buf, pmix_buffer_t); @@ -2735,6 +2713,10 @@ static pmix_status_t _store_job_info(pmix_common_dstore_ctx_t *ds_ctx, ns_map_da cb.scope = PMIX_INTERNAL; cb.copy = false; + PMIX_OUTPUT_VERBOSE((8, pmix_gds_base_framework.framework_output, + "STORE JOB INFO FOR PROC %s", + PMIX_NAME_PRINT(proc))); + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); if (PMIX_SUCCESS != rc) { if (rc == PMIX_ERR_PROC_ENTRY_NOT_FOUND) { @@ -2745,53 +2727,109 @@ static pmix_status_t _store_job_info(pmix_common_dstore_ctx_t *ds_ctx, ns_map_da } PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - if (PMIX_CHECK_KEY(kv, PMIX_NODE_INFO_ARRAY)) { - /* earlier PMIx versions don't know how to handle - * the info arrays - what they need is a key-value - * pair where the key is the name of the node and - * the value is the local peers. So if the peer - * is earlier than 3.1.5, construct the necessary - * translation. Otherwise, ignore it as the hash - * component will handle it for them */ - if (PMIX_PEER_IS_EARLIER(ds_ctx->clients_peer, 3, 1, 5)) { - pmix_info_t *info; - size_t size, i; - /* if it is our local node, then we are going to pass - * all info */ - info = kv->value->data.darray->array; - size = kv->value->data.darray->size; - ihost = NULL; - for (i = 0; i < size; i++) { - if (PMIX_CHECK_KEY(&info[i], PMIX_HOSTNAME)) { - ihost = &info[i]; + if (PMIX_CHECK_KEY(kv, PMIX_NODE_INFO_ARRAY)) { + /* the dstore currently does not understand info arrays, + * which causes problems when users query for node/app + * info. We cannot fully resolve the problem, but we + * can mitigate it by at least storing the info for + * the local node and this proc's app number */ + pmix_info_t *info; + size_t size, i; + /* if it is our local node, then we are going to pass + * all info */ + info = kv->value->data.darray->array; + size = kv->value->data.darray->size; + hostname = NULL; + nodeid = UINT32_MAX; + aliases = NULL; + for (i = 0; i < size; i++) { + if (PMIX_CHECK_KEY(&info[i], PMIX_HOSTNAME)) { + hostname = info[i].value.data.string; + } else if (PMIX_CHECK_KEY(&info[i], PMIX_NODEID)) { + nodeid = info[i].value.data.uint32; + } else if (PMIX_CHECK_KEY(&info[i], PMIX_HOSTNAME_ALIASES)) { + aliases = pmix_argv_split(info[i].value.data.string, ','); + } + } + if (NULL == hostname && UINT32_MAX == nodeid && NULL == aliases) { + continue; + } + match = false; + if (NULL != hostname && 0 == strcmp(hostname, pmix_globals.hostname)) { + match = true; + } + if (!match && UINT32_MAX != nodeid && nodeid == pmix_globals.nodeid) { + match = true; + } + if (!match && NULL != aliases) { + for (i=0; NULL != aliases[i]; i++) { + if (0 == strcmp(aliases[i], pmix_globals.hostname)) { + match = true; break; } } - if (NULL != ihost) { - PMIX_CONSTRUCT(&kv2, pmix_kval_t); - kv2.key = ihost->value.data.string; - kv2.value = kv->value; + pmix_argv_free(aliases); + } + if (match) { + /* if this host is us, then store each value as its own key */ + for (i = 0; i < size; i++) { + if (PMIX_CHECK_KEY(&info[i], PMIX_HOSTNAME) || + PMIX_CHECK_KEY(&info[i], PMIX_NODEID) || + PMIX_CHECK_KEY(&info[i], PMIX_HOSTNAME_ALIASES)) { + continue; + } + PMIX_OUTPUT_VERBOSE((8, pmix_gds_base_framework.framework_output, + "STORE %s FOR NODE %s", + info[i].key, hostname)); + kv2.key = info[i].key; + kv2.value = &info[i].value; PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &kv2, 1, PMIX_KVAL); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - goto exit; + continue; } - /* if this host is us, then store each value as its own key */ - if (0 == strcmp(kv2.key, pmix_globals.hostname)) { - for (i = 0; i < size; i++) { - kv2.key = info[i].key; - kv2.value = &info[i].value; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &kv2, 1, PMIX_KVAL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - goto exit; - } - } + } + } + /* if the client is earlier than v3.1.5, we also need to store the + * array using the hostname as key */ + if (PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5) && + NULL != hostname) { + kv2.key = hostname; + kv2.value = kv->value; + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &kv2, 1, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + continue; + } + } + } else if (PMIX_CHECK_KEY(kv, PMIX_APP_INFO_ARRAY)) { + /* the dstore currently does not understand info arrays, + * but we will store info from our own app */ + pmix_info_t *info; + size_t size, i; + /* if it is our local node, then we are going to pass + * all info */ + info = kv->value->data.darray->array; + size = kv->value->data.darray->size; + appnum = UINT32_MAX; + for (i = 0; i < size; i++) { + if (PMIX_CHECK_KEY(&info[i], PMIX_APPNUM)) { + appnum = info[i].value.data.uint32; + break; + } + } + if (appnum == pmix_globals.appnum) { + for (i = 0; i < size; i++) { + kv2.key = info[i].key; + kv2.value = &info[i].value; + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &kv2, 1, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + continue; } } } - } else if (PMIX_CHECK_KEY(kv, PMIX_APP_INFO_ARRAY) || - PMIX_CHECK_KEY(kv, PMIX_JOB_INFO_ARRAY) || + } else if (PMIX_CHECK_KEY(kv, PMIX_JOB_INFO_ARRAY) || PMIX_CHECK_KEY(kv, PMIX_SESSION_INFO_ARRAY)) { continue; } else { @@ -2836,8 +2874,7 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_register_job_info(pmix_common_dstore ns_map_data_t *ns_map; _client_compat_save(ds_ctx, peer); - pmix_strncpy(proc.nspace, ns->nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, ns->nspace, PMIX_RANK_WILDCARD); if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, proc.nspace))) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h index 7989ae6ca5..cc91e92cd3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -12,7 +12,7 @@ #ifndef PMIX_DSTORE_H #define PMIX_DSTORE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/gds/gds.h" @@ -20,7 +20,7 @@ BEGIN_C_DECLS -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_value_array.h" #include "dstore_common.h" #include "dstore_segment.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h index 466eccd9a5..a9903ab72c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h @@ -1,6 +1,7 @@ /* - * Copyright (c) 2018 Mellanox Technologies, Inc. + * Copyright (c) 2018-2020 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -13,8 +14,8 @@ #define PMIX_GDS_DS_BASE_H_ #include -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" @@ -49,7 +50,7 @@ PMIX_EXPORT pmix_common_dstore_ctx_t *pmix_common_dstor_init(const char *ds_name pmix_common_dstore_file_cbs_t *file_cb); PMIX_EXPORT void pmix_common_dstor_finalize(pmix_common_dstore_ctx_t *ds_ctx); PMIX_EXPORT pmix_status_t pmix_common_dstor_add_nspace(pmix_common_dstore_ctx_t *ds_ctx, - const char *nspace, pmix_info_t info[], size_t ninfo); + const char *nspace, uint32_t local_size, pmix_info_t info[], size_t ninfo); PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t *ds_ctx, const char* nspace); PMIX_EXPORT pmix_status_t pmix_common_dstor_setup_fork(pmix_common_dstore_ctx_t *ds_ctx, const char *base_path_env, const pmix_proc_t *peer, char ***env); @@ -74,6 +75,6 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_fetch(pmix_common_dstore_ctx_t *ds_c pmix_list_t *kvs); PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t *ds_ctx, struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t *buff); + pmix_buffer_t *buff, + void *cbdata); #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c index 362eeb1d56..f0c4f9bb9e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. @@ -13,7 +13,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_UNISTD_H #include @@ -37,7 +37,7 @@ #endif #endif -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h index 6430273faa..7ac9f5418b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. @@ -13,8 +13,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h index 242fc4dabd..9a51c99274 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h @@ -11,10 +11,12 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +27,7 @@ #ifndef PMIX_GDS_BASE_H_ #define PMIX_GDS_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -73,15 +75,34 @@ PMIX_CLASS_DECLARATION(pmix_gds_base_active_module_t); struct pmix_gds_globals_t { pmix_list_t actives; bool initialized; + bool selected; char *all_mods; }; + +typedef enum { + PMIX_MODEX_KEY_INVALID = -1, + PMIX_MODEX_KEY_NATIVE_FMT, + PMIX_MODEX_KEY_KEYMAP_FMT, + PMIX_MODEX_KEY_MAX +} pmix_gds_modex_key_fmt_t; + +/* define a modex blob info */ +typedef uint8_t pmix_gds_modex_blob_info_t; + +#define PMIX_GDS_COLLECT_BIT 0x0001 +#define PMIX_GDS_KEYMAP_BIT 0x0002 + +#define PMIX_GDS_KEYMAP_IS_SET(byte) (PMIX_GDS_KEYMAP_BIT & (byte)) +#define PMIX_GDS_COLLECT_IS_SET(byte) (PMIX_GDS_COLLECT_BIT & (byte)) + typedef struct pmix_gds_globals_t pmix_gds_globals_t; -typedef void * pmix_gds_base_store_modex_cbdata_t; -typedef pmix_status_t (*pmix_gds_base_store_modex_cb_fn_t)(pmix_gds_base_store_modex_cbdata_t cbdata, - struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_byte_object_t *bo); +typedef void * pmix_gds_base_ctx_t; +typedef pmix_status_t (*pmix_gds_base_store_modex_cb_fn_t)(pmix_gds_base_ctx_t ctx, + pmix_proc_t *proc, + pmix_gds_modex_key_fmt_t key_fmt, + char **kmap, + pmix_buffer_t *pbkt); PMIX_EXPORT extern pmix_gds_globals_t pmix_gds_globals; @@ -106,11 +127,20 @@ PMIX_EXPORT pmix_status_t pmix_gds_base_setup_fork(const pmix_proc_t *proc, char ***env); PMIX_EXPORT pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t *xfer, - pmix_gds_base_store_modex_cb_fn_t cb_fn, - pmix_gds_base_store_modex_cbdata_t cbdata); + pmix_buffer_t * buff, + pmix_gds_base_ctx_t ctx, + pmix_gds_base_store_modex_cb_fn_t cb_fn, + void *cbdata); +PMIX_EXPORT +pmix_status_t pmix_gds_base_modex_pack_kval(pmix_gds_modex_key_fmt_t key_fmt, + pmix_buffer_t *buf, char ***kmap, + pmix_kval_t *kv); + +PMIX_EXPORT +pmix_status_t pmix_gds_base_modex_unpack_kval(pmix_gds_modex_key_fmt_t key_fmt, + pmix_buffer_t *buf, char **kmap, + pmix_kval_t *kv); END_C_DECLS #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c index 505536a31d..2446ca8d7a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c @@ -1,10 +1,10 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science + * Copyright (c) 2018-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ @@ -14,9 +14,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" @@ -24,6 +24,7 @@ #include "src/util/error.h" #include "src/mca/gds/base/base.h" +#include "src/server/pmix_server_ops.h" char* pmix_gds_base_get_available_modules(void) @@ -89,32 +90,47 @@ pmix_status_t pmix_gds_base_setup_fork(const pmix_proc_t *proc, } pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t * buff, - pmix_gds_base_store_modex_cb_fn_t cb_fn, - pmix_gds_base_store_modex_cbdata_t cbdata) + pmix_buffer_t * buff, + pmix_gds_base_ctx_t ctx, + pmix_gds_base_store_modex_cb_fn_t cb_fn, + void *cbdata) { + (void)nspace; pmix_status_t rc = PMIX_SUCCESS; - pmix_namespace_t * ns = (pmix_namespace_t *)nspace; pmix_buffer_t bkt; pmix_byte_object_t bo, bo2; int32_t cnt = 1; - char byte; pmix_collect_t ctype; - bool have_ctype = false; + pmix_server_trkr_t *trk = (pmix_server_trkr_t*)cbdata; + pmix_proc_t proc; + pmix_buffer_t pbkt; + pmix_rank_t rel_rank; + pmix_nspace_caddy_t *nm; + bool found; + char **kmap = NULL; + uint32_t kmap_size; + pmix_gds_modex_key_fmt_t kmap_type; + pmix_gds_modex_blob_info_t blob_info_byte = 0; /* Loop over the enclosed byte object envelopes and * store them in our GDS module */ cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buff, &bo, &cnt, PMIX_BYTE_OBJECT); + + /* If the collect flag is set, we should have some data for unpacking */ + if ((PMIX_COLLECT_YES == trk->collect_type) && + (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc)) { + goto exit; + } + while (PMIX_SUCCESS == rc) { PMIX_CONSTRUCT(&bkt, pmix_buffer_t); PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, bo.bytes, bo.size); /* unpack the data collection flag */ cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &byte, &cnt, PMIX_BYTE); + &bkt, &blob_info_byte, &cnt, PMIX_BYTE); if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { /* no data was returned, so we are done with this blob */ PMIX_DESTRUCT(&bkt); @@ -122,23 +138,61 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, } if (PMIX_SUCCESS != rc) { /* we have an error */ + PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&bkt); - goto error; + goto exit; + } + /* Check that this blob was accumulated with the same data collection + * setting */ + ctype = PMIX_GDS_COLLECT_IS_SET(blob_info_byte) ? + PMIX_COLLECT_YES : PMIX_COLLECT_NO; + if (trk->collect_type != ctype) { + rc = PMIX_ERR_INVALID_ARG; + PMIX_ERROR_LOG(rc); + goto exit; } - // Check that this blob was accumulated with the same data collection setting - if (have_ctype) { - if (ctype != (pmix_collect_t)byte) { - rc = PMIX_ERR_INVALID_ARG; + /* determine the key-map existing flag */ + kmap_type = PMIX_GDS_KEYMAP_IS_SET(blob_info_byte) ? + PMIX_MODEX_KEY_KEYMAP_FMT : PMIX_MODEX_KEY_NATIVE_FMT; + if (PMIX_MODEX_KEY_KEYMAP_FMT == kmap_type) { + /* unpack the size of uniq keys names in the map */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, + &bkt, &kmap_size, &cnt, PMIX_UINT32); + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { + rc = PMIX_SUCCESS; PMIX_DESTRUCT(&bkt); - goto error; + break; + } else if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&bkt); + break; + } + + /* init and unpack key names map, the position of the key name + * in the array determines the unique key index */ + kmap = (char**)(calloc(kmap_size + 1, sizeof(char*))); + if (NULL == kmap) { + rc = PMIX_ERR_OUT_OF_RESOURCE; + PMIX_ERROR_LOG(rc); + goto exit; + } + cnt = kmap_size; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &bkt, + kmap, &cnt, PMIX_STRING); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&bkt); + goto exit; + } + if (pmix_argv_count(kmap) != (int)kmap_size) { + rc = PMIX_ERR_UNPACK_FAILURE; + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&bkt); + goto exit; } } - else { - ctype = (pmix_collect_t)byte; - have_ctype = true; - } - /* unpack the enclosed blobs from the various peers */ cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, @@ -150,11 +204,54 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, * shared memory region, then the data may be available * right away - but the client still has to be notified * of its presence. */ - rc = cb_fn(cbdata, (struct pmix_namespace_t *)ns, cbs, &bo2); + + /* setup the byte object for unpacking */ + PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); + PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, bo2.bytes, bo2.size); + /* unload the proc that provided this data */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, &rel_rank, &cnt, + PMIX_PROC_RANK); if (PMIX_SUCCESS != rc) { - PMIX_DESTRUCT(&bkt); - goto error; + PMIX_ERROR_LOG(rc); + pbkt.base_ptr = NULL; + PMIX_DESTRUCT(&pbkt); + break; } + found = false; + /* calculate proc form the relative rank */ + if (pmix_list_get_size(&trk->nslist) == 1) { + found = true; + nm = (pmix_nspace_caddy_t*)pmix_list_get_first(&trk->nslist); + } else { + PMIX_LIST_FOREACH(nm, &trk->nslist, pmix_nspace_caddy_t) { + if (rel_rank < nm->ns->nprocs) { + found = true; + break; + } + rel_rank -= nm->ns->nprocs; + } + } + if (false == found) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + pbkt.base_ptr = NULL; + PMIX_DESTRUCT(&pbkt); + break; + } + PMIX_PROC_LOAD(&proc, nm->ns->nspace, rel_rank); + + /* call a specific GDS function to storing + * part of the process data */ + rc = cb_fn(ctx, &proc, kmap_type, kmap, &pbkt); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + pbkt.base_ptr = NULL; + PMIX_DESTRUCT(&pbkt); + break; + } + pbkt.base_ptr = NULL; + PMIX_DESTRUCT(&pbkt); PMIX_BYTE_OBJECT_DESTRUCT(&bo2); /* get the next blob */ cnt = 1; @@ -162,24 +259,133 @@ pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, &bkt, &bo2, &cnt, PMIX_BYTE_OBJECT); } PMIX_DESTRUCT(&bkt); + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { rc = PMIX_SUCCESS; } else if (PMIX_SUCCESS != rc) { - goto error; + PMIX_ERROR_LOG(rc); + goto exit; } /* unpack and process the next blob */ cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buff, &bo, &cnt, PMIX_BYTE_OBJECT); } + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { rc = PMIX_SUCCESS; - } - -error: - if (PMIX_SUCCESS != rc) { + } else if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } - +exit: + pmix_argv_free(kmap); return rc; } + +/* + * Pack the key-value as a tuple of key-name index and key-value. + * The key-name to store replaced by unique key-index that stored + * to the key-map. So the remote server can determine the key-name + * by the index from map that packed in modex as well. + * + * kmap - key values array by (char*), uses to store unique key + * names string and determine their indexes + * + * buf - output buffer to pack key-values + * + * kv - pmix key-value pair + */ +pmix_status_t pmix_gds_base_modex_pack_kval(pmix_gds_modex_key_fmt_t key_fmt, + pmix_buffer_t *buf, char ***kmap, + pmix_kval_t *kv) +{ + uint32_t key_idx; + pmix_status_t rc = PMIX_SUCCESS; + + if (PMIX_MODEX_KEY_KEYMAP_FMT == key_fmt) { + rc = pmix_argv_append_unique_idx((int*)&key_idx, kmap, kv->key); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + /* pack key-index */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, &key_idx, 1, PMIX_UINT32); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + /* pack key-value */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, kv->value, 1, PMIX_VALUE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + } else if (PMIX_MODEX_KEY_NATIVE_FMT == key_fmt) { + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, kv, 1, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + } else { + rc = PMIX_ERR_BAD_PARAM; + PMIX_ERROR_LOG(rc); + return rc; + } + + return PMIX_SUCCESS; +} + +/* + * Unpack the key-value as a tuple of key-name index and key-value. + * + * kmap - key values array by (char*), uses to store unique key + * names string and determine their indexes + * + * buf - input buffer to unpack key-values + * + * kv - unpacked pmix key-value pair + */ +pmix_status_t pmix_gds_base_modex_unpack_kval(pmix_gds_modex_key_fmt_t key_fmt, + pmix_buffer_t *buf, char **kmap, + pmix_kval_t *kv) +{ + int32_t cnt; + uint32_t key_idx; + pmix_status_t rc = PMIX_SUCCESS; + + if (PMIX_MODEX_KEY_KEYMAP_FMT == key_fmt) { + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, &key_idx, &cnt, PMIX_UINT32); + if (PMIX_SUCCESS != rc) { + return rc; + } + // sanity check + if (NULL == kmap[key_idx]) { + rc = PMIX_ERR_BAD_PARAM; + PMIX_ERROR_LOG(rc); + return rc; + } + kv->key = strdup(kmap[key_idx]); + cnt = 1; + PMIX_VALUE_CREATE(kv->value, 1); + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, kv->value, &cnt, PMIX_VALUE); + if (PMIX_SUCCESS != rc) { + free(kv->key); + PMIX_VALUE_RELEASE(kv->value); + PMIX_ERROR_LOG(rc); + return rc; + } + } else if (PMIX_MODEX_KEY_NATIVE_FMT == key_fmt) { + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, kv, &cnt, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + return rc; + } + } else { + rc = PMIX_ERR_BAD_PARAM; + PMIX_ERROR_LOG(rc); + return rc; + } + + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_frame.c index c6f4d48297..6a64767217 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +23,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -57,6 +57,7 @@ static pmix_status_t pmix_gds_close(void) return PMIX_SUCCESS; } pmix_gds_globals.initialized = false; + pmix_gds_globals.selected = false; PMIX_LIST_FOREACH_SAFE(active, prev, &pmix_gds_globals.actives, pmix_gds_base_active_module_t) { pmix_list_remove_item(&pmix_gds_globals.actives, &active->super); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_select.c index 25318ad223..05acfb5f3a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -30,8 +32,6 @@ #include "src/mca/gds/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_gds_base_select(pmix_info_t info[], size_t ninfo) @@ -45,11 +45,11 @@ int pmix_gds_base_select(pmix_info_t info[], size_t ninfo) bool inserted; char **mods = NULL; - if (selected) { + if (pmix_gds_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_gds_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_gds_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c index 43c1008d56..5c36214caa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * Copyright (c) 2016-2020 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -13,8 +13,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/util/error.h" #include "src/mca/gds/base/base.h" @@ -119,10 +119,10 @@ static pmix_status_t ds12_store(const pmix_proc_t *proc, * always contains data solely from remote procs, and we * shall store it accordingly */ static pmix_status_t ds12_store_modex(struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t *buf) + pmix_buffer_t *buf, + void *cbdata) { - return pmix_common_dstor_store_modex(ds12_ctx, nspace, cbs, buf); + return pmix_common_dstor_store_modex(ds12_ctx, nspace, buf, cbdata); } static pmix_status_t ds12_fetch(const pmix_proc_t *proc, @@ -139,11 +139,10 @@ static pmix_status_t ds12_setup_fork(const pmix_proc_t *peer, char ***env) return pmix_common_dstor_setup_fork(ds12_ctx, PMIX_DSTORE_ESH_BASE_PATH, peer, env); } -static pmix_status_t ds12_add_nspace(const char *nspace, - pmix_info_t info[], - size_t ninfo) +static pmix_status_t ds12_add_nspace(const char *nspace, uint32_t local_size, + pmix_info_t info[], size_t ninfo) { - return pmix_common_dstor_add_nspace(ds12_ctx, nspace, info, ninfo); + return pmix_common_dstor_add_nspace(ds12_ctx, nspace, local_size, info, ninfo); } static pmix_status_t ds12_del_nspace(const char* nspace) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c index 54d29c69ef..cfd9a542b0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -28,8 +28,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/gds.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c index 701578d83a..cba8965b17 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c @@ -2,6 +2,7 @@ * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. * + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,7 +10,7 @@ * $HEADER$ */ -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h index 33c8864743..dbc2896df9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,8 +12,8 @@ #ifndef GDS_DS12_FILE_H #define GDS_DS12_FILE_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" extern pmix_common_dstore_file_cbs_t pmix_ds12_file_module; extern pmix_common_dstore_file_cbs_t pmix_ds20_file_module; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c index 9872dd7c4d..dbe4647a38 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -8,8 +9,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/common/dstore/dstore_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h index 9d9b91ad1e..5f4beb29e0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,8 +12,8 @@ #ifndef DS12_LOCK_H #define DS12_LOCK_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/common/dstore/dstore_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c index 53c805580f..445231668c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. @@ -13,7 +13,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_UNISTD_H #include @@ -28,7 +28,7 @@ #include #endif -#include +#include "include/pmix_common.h" #include "src/mca/common/dstore/dstore_common.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c index 0bcce2b769..8192f0532e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c @@ -13,7 +13,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_UNISTD_H @@ -26,7 +26,7 @@ #include #endif -#include +#include "include/pmix_common.h" #include "src/mca/common/dstore/dstore_common.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c index d50cb8124c..5a8f36d676 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c @@ -2,6 +2,7 @@ * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. * + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,7 +10,7 @@ * $HEADER$ */ -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c index a3f32c9c26..4dfb321212 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * Copyright (c) 2016-2020 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -13,8 +13,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/util/error.h" #include "src/mca/gds/base/base.h" @@ -107,10 +107,10 @@ static pmix_status_t ds21_store(const pmix_proc_t *proc, * always contains data solely from remote procs, and we * shall store it accordingly */ static pmix_status_t ds21_store_modex(struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t *buf) + pmix_buffer_t *buf, + void *cbdata) { - return pmix_common_dstor_store_modex(ds21_ctx, nspace, cbs, buf); + return pmix_common_dstor_store_modex(ds21_ctx, nspace, buf, cbdata); } static pmix_status_t ds21_fetch(const pmix_proc_t *proc, @@ -145,11 +145,10 @@ static pmix_status_t ds21_setup_fork(const pmix_proc_t *peer, char ***env) return rc; } -static pmix_status_t ds21_add_nspace(const char *nspace, - pmix_info_t info[], - size_t ninfo) +static pmix_status_t ds21_add_nspace(const char *nspace, uint32_t local_size, + pmix_info_t info[], size_t ninfo) { - return pmix_common_dstor_add_nspace(ds21_ctx, nspace, info, ninfo); + return pmix_common_dstor_add_nspace(ds21_ctx, nspace, local_size, info, ninfo); } static pmix_status_t ds21_del_nspace(const char* nspace) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c index 14e4e49b75..6ead0667bb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -28,8 +28,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/gds.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c index 7a23edd206..4648b9d792 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c @@ -3,6 +3,7 @@ * All rights reserved. * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +11,7 @@ * $HEADER$ */ -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/mca/gds/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h index ea75788ffe..b7dcfb54ab 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,8 +12,8 @@ #ifndef GDS_DS21_FILE_H #define GDS_DS21_FILE_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" extern pmix_common_dstore_file_cbs_t pmix_ds21_file_module; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c index 340343d8c8..f83b5eaf71 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -8,8 +9,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/common/dstore/dstore_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h index 158e7cbf5a..ec14e04a78 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,8 +12,8 @@ #ifndef DS21_LOCK_H #define DS21_LOCK_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/common/dstore/dstore_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c index a9194a8a68..6e0ff5dfd0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c @@ -1,7 +1,6 @@ /* - * Copyright (c) 2018 Mellanox Technologies, Inc. + * Copyright (c) 2018-2020 Mellanox Technologies, Inc. * All rights reserved. - * * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * @@ -10,8 +9,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H @@ -88,7 +87,7 @@ static void ncon(lock_item_t *p) { static void ldes(lock_item_t *p) { uint32_t i; - if(PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { + if(PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && (NULL != p->seg_desc)) { segment_hdr_t *seg_hdr = (segment_hdr_t *)p->seg_desc->seg_info.seg_base_addr; if (p->lockfile) { unlink(p->lockfile); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h index 9ced4788aa..6d1278095d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * Copyright (c) 2016-2020 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -14,10 +14,10 @@ #ifndef PMIX_GDS_H #define PMIX_GDS_H -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/base/pmix_mca_base_framework.h" @@ -234,17 +234,14 @@ typedef pmix_status_t (*pmix_gds_base_module_store_fn_t)(const pmix_proc_t *proc * ranks - a list of pmix_rank_info_t for the local ranks from this * nspace - this is to be used to filter the cbs list * - * cbs - a list of pmix_server_caddy_t's that contain the pmix_peer_t - * pointers of the local participants. The list can be used to - * identify those participants corresponding to this nspace - * (and thus, GDS component) + * cbdata - pointer to modex callback data * * bo - pointer to the byte object containing the data * */ typedef pmix_status_t (*pmix_gds_base_module_store_modex_fn_t)(struct pmix_namespace_t *ns, - pmix_list_t *cbs, - pmix_buffer_t *buff); + pmix_buffer_t *buff, + void *cbdata); /** * define a convenience macro for storing modex byte objects @@ -253,17 +250,16 @@ typedef pmix_status_t (*pmix_gds_base_module_store_modex_fn_t)(struct pmix_names * * n - pointer to the pmix_namespace_t this blob is to be stored for * - * l - pointer to pmix_list_t containing pmix_server_caddy_t objects - * of the local_cbs of the collective tracker - * * b - pointer to pmix_byte_object_t containing the data + * + * t - pointer to the modex server tracker */ -#define PMIX_GDS_STORE_MODEX(r, n, l, b) \ +#define PMIX_GDS_STORE_MODEX(r, n, b, t) \ do { \ pmix_output_verbose(1, pmix_gds_base_output, \ "[%s:%d] GDS STORE MODEX WITH %s", \ __FILE__, __LINE__, (n)->compat.gds->name); \ - (r) = (n)->compat.gds->store_modex((struct pmix_namespace_t*)n, l, b); \ + (r) = (n)->compat.gds->store_modex((struct pmix_namespace_t*)n, b, t); \ } while (0) /** @@ -346,11 +342,12 @@ typedef pmix_status_t (*pmix_gds_base_module_setup_fork_fn_t)(const pmix_proc_t * @return PMIX_SUCCESS on success. */ typedef pmix_status_t (*pmix_gds_base_module_add_nspace_fn_t)(const char *nspace, + uint32_t nlocalprocs, pmix_info_t info[], size_t ninfo); /* define a convenience macro for add_nspace based on peer */ -#define PMIX_GDS_ADD_NSPACE(s, n, i, ni) \ +#define PMIX_GDS_ADD_NSPACE(s, n, ls, i, ni) \ do { \ pmix_gds_base_active_module_t *_g; \ pmix_status_t _s = PMIX_SUCCESS; \ @@ -361,7 +358,7 @@ typedef pmix_status_t (*pmix_gds_base_module_add_nspace_fn_t)(const char *nspace PMIX_LIST_FOREACH(_g, &pmix_gds_globals.actives, \ pmix_gds_base_active_module_t) { \ if (NULL != _g->module->add_nspace) { \ - _s = _g->module->add_nspace(n, i, ni); \ + _s = _g->module->add_nspace(n, ls, i, ni); \ } \ if (PMIX_SUCCESS != _s) { \ (s) = PMIX_ERROR; \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c index de12f51c14..2b5128ecdc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c @@ -3,7 +3,7 @@ * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Mellanox Technologies, Inc. + * Copyright (c) 2018-2020 Mellanox Technologies, Inc. * All rights reserved. * * $COPYRIGHT$ @@ -13,7 +13,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_UNISTD_H @@ -30,16 +30,16 @@ #endif #include -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" +#include "src/mca/pcompress/base/base.h" +#include "src/mca/preg/preg.h" #include "src/mca/ptl/base/base.h" #include "src/util/argv.h" -#include "src/util/compress.h" -#include "src/mca/preg/preg.h" #include "src/util/error.h" #include "src/util/hash.h" #include "src/util/output.h" @@ -69,13 +69,14 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, pmix_kval_t *kv); static pmix_status_t hash_store_modex(struct pmix_namespace_t *ns, - pmix_list_t *cbs, - pmix_buffer_t *buff); + pmix_buffer_t *buff, + void *cbdata); -static pmix_status_t _hash_store_modex(void * cbdata, - struct pmix_namespace_t *ns, - pmix_list_t *cbs, - pmix_byte_object_t *bo); +static pmix_status_t _hash_store_modex(pmix_gds_base_ctx_t ctx, + pmix_proc_t *proc, + pmix_gds_modex_key_fmt_t key_fmt, + char **kmap, + pmix_buffer_t *pbkt); static pmix_status_t hash_fetch(const pmix_proc_t *proc, pmix_scope_t scope, bool copy, @@ -85,9 +86,8 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, static pmix_status_t setup_fork(const pmix_proc_t *peer, char ***env); -static pmix_status_t nspace_add(const char *nspace, - pmix_info_t info[], - size_t ninfo); +static pmix_status_t nspace_add(const char *nspace, uint32_t nlocalprocs, + pmix_info_t info[], size_t ninfo); static pmix_status_t nspace_del(const char *nspace); @@ -163,6 +163,7 @@ typedef struct { pmix_list_item_t super; uint32_t nodeid; char *hostname; + char **aliases; pmix_list_t info; } pmix_nodeinfo_t; @@ -247,6 +248,7 @@ static void ndinfocon(pmix_nodeinfo_t *p) { p->nodeid = UINT32_MAX; p->hostname = NULL; + p->aliases = NULL; PMIX_CONSTRUCT(&p->info, pmix_list_t); } static void ndinfodes(pmix_nodeinfo_t *p) @@ -254,12 +256,18 @@ static void ndinfodes(pmix_nodeinfo_t *p) if (NULL != p->hostname) { free(p->hostname); } + if (NULL != p->aliases) { + pmix_argv_free(p->aliases); + } PMIX_LIST_DESTRUCT(&p->info); } static PMIX_CLASS_INSTANCE(pmix_nodeinfo_t, pmix_list_item_t, ndinfocon, ndinfodes); +/********************************************** + * Local Functions + **********************************************/ static pmix_job_t* get_tracker(const pmix_nspace_t nspace, bool create) { pmix_job_t *trk, *t; @@ -301,6 +309,82 @@ static pmix_job_t* get_tracker(const pmix_nspace_t nspace, bool create) return trk; } +static bool check_hostname(char *h1, char *h2) +{ + if (0 == strcmp(h1, h2)) { + return true; + } + return false; +} + +static bool check_node(pmix_nodeinfo_t *n1, + pmix_nodeinfo_t *n2) +{ + int i, j; + + if (UINT32_MAX != n1->nodeid && + UINT32_MAX != n2->nodeid && + n1->nodeid == n2->nodeid) { + return true; + } + + if (NULL == n1->hostname || NULL == n2->hostname) { + return false; + } + + if (check_hostname(n1->hostname, n2->hostname)) { + return true; + } + + if (NULL != n1->aliases) { + for (i=0; NULL != n1->aliases[i]; i++) { + if (check_hostname(n1->aliases[i], n2->hostname)) { + return true; + } + if (NULL != n2->aliases) { + for (j=0; NULL != n2->aliases[j]; j++) { + if (check_hostname(n1->hostname, n2->aliases[j])) { + return true; + } + if (check_hostname(n1->aliases[i], n2->aliases[j])) { + return true; + } + } + } + } + } else if (NULL != n2->aliases) { + for (j=0; NULL != n2->aliases[j]; j++) { + if (check_hostname(n1->hostname, n2->aliases[j])) { + return true; + } + } + } + + return false; +} + +static bool check_nodename(pmix_nodeinfo_t *nptr, char *hostname) +{ + int i; + + if (NULL == nptr->hostname) { + return false; + } + + if (check_hostname(nptr->hostname, hostname)) { + return true; + } + + if (NULL != nptr->aliases) { + for (i=0; NULL != nptr->aliases[i]; i++) { + if (check_hostname(nptr->aliases[i], hostname)) { + return true; + } + } + } + return false; +} + /********************************************** * Forward Declarations **********************************************/ @@ -345,6 +429,9 @@ static pmix_status_t process_node_array(pmix_value_t *val, /* cache the values while searching for the nodeid * and/or hostname */ for (j=0; j < size; j++) { + pmix_output_verbose(12, pmix_gds_base_framework.framework_output, + "%s gds:hash:node_array for key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), iptr[j].key); if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODEID)) { if (NULL == nd) { nd = PMIX_NEW(pmix_nodeinfo_t); @@ -361,6 +448,24 @@ static pmix_status_t process_node_array(pmix_value_t *val, nd = PMIX_NEW(pmix_nodeinfo_t); } nd->hostname = strdup(iptr[j].value.data.string); + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_HOSTNAME_ALIASES)) { + if (NULL == nd) { + nd = PMIX_NEW(pmix_nodeinfo_t); + } + nd->aliases = pmix_argv_split(iptr[j].value.data.string, ','); + /* need to cache this value as well */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(iptr[j].key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + PMIX_RELEASE(nd); + PMIX_LIST_DESTRUCT(&cache); + return rc; + } + pmix_list_append(&cache, &kp2->super); } else { kp2 = PMIX_NEW(pmix_kval_t); kp2->key = strdup(iptr[j].key); @@ -389,8 +494,7 @@ static pmix_status_t process_node_array(pmix_value_t *val, * provided list */ update = false; PMIX_LIST_FOREACH(ndptr, tgt, pmix_nodeinfo_t) { - if ((ndptr->nodeid != UINT32_MAX && (ndptr->nodeid == nd->nodeid)) || - (NULL != ndptr->hostname && NULL != nd->hostname && 0 == strcmp(ndptr->hostname, nd->hostname))) { + if (check_node(ndptr, nd)) { /* we assume that the data is updating the current * values */ if (NULL == ndptr->hostname && NULL != nd->hostname) { @@ -402,6 +506,9 @@ static pmix_status_t process_node_array(pmix_value_t *val, break; } } + if (!update) { + pmix_list_append(tgt, &nd->super); + } /* transfer the cached items to the nodeinfo list */ kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); @@ -422,9 +529,6 @@ static pmix_status_t process_node_array(pmix_value_t *val, } PMIX_LIST_DESTRUCT(&cache); - if (!update) { - pmix_list_append(tgt, &nd->super); - } return PMIX_SUCCESS; } @@ -443,7 +547,7 @@ static pmix_status_t process_app_array(pmix_value_t *val, pmix_status_t rc = PMIX_SUCCESS; uint32_t appnum; pmix_apptrkr_t *app = NULL, *apptr; - pmix_kval_t *kp2, *k1, *knext; + pmix_kval_t *kp2, *k1; pmix_nodeinfo_t *nd; bool update; @@ -468,6 +572,9 @@ static pmix_status_t process_app_array(pmix_value_t *val, iptr = (pmix_info_t*)val->data.darray->array; for (j=0; j < size; j++) { + pmix_output_verbose(12, pmix_gds_base_framework.framework_output, + "%s gds:hash:app_array for key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), iptr[j].key); if (PMIX_CHECK_KEY(&iptr[j], PMIX_APPNUM)) { PMIX_VALUE_GET_NUMBER(rc, &iptr[j].value, appnum, uint32_t); if (PMIX_SUCCESS != rc) { @@ -507,6 +614,7 @@ static pmix_status_t process_app_array(pmix_value_t *val, * an appnum so long as only one app is in the job */ if (0 == pmix_list_get_size(&trk->apps)) { app = PMIX_NEW(pmix_apptrkr_t); + app->appnum = 0; } else { /* this is not allowed to happen - they are required * to provide us with an app number per the standard */ @@ -528,7 +636,9 @@ static pmix_status_t process_app_array(pmix_value_t *val, break; } } - + if (!update) { + pmix_list_append(&trk->apps, &app->super); + } /* point the app at its job */ if (NULL == app->job) { PMIX_RETAIN(trk); @@ -541,7 +651,7 @@ static pmix_status_t process_app_array(pmix_value_t *val, /* if this is an update, we have to ensure each data * item only appears once on the list */ if (update) { - PMIX_LIST_FOREACH_SAFE(k1, knext, &app->appinfo, pmix_kval_t) { + PMIX_LIST_FOREACH(k1, &app->appinfo, pmix_kval_t) { if (PMIX_CHECK_KEY(k1, kp2->key)) { pmix_list_remove_item(&app->appinfo, &k1->super); PMIX_RELEASE(k1); @@ -607,7 +717,7 @@ static pmix_status_t process_job_array(pmix_info_t *info, return PMIX_ERR_BAD_PARAM; } /* parse the regex to get the argv array containing proc ranks on each node */ - if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(iptr[j].value.data.string, procs))) { + if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(iptr[j].value.data.bo.bytes, procs))) { PMIX_ERROR_LOG(rc); return rc; } @@ -619,22 +729,8 @@ static pmix_status_t process_job_array(pmix_info_t *info, PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); return PMIX_ERR_BAD_PARAM; } - /* store the node map itself since that is - * what v3 uses */ - kp2 = PMIX_NEW(pmix_kval_t); - kp2->key = strdup(PMIX_NODE_MAP); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - kp2->value->type = PMIX_STRING; - kp2->value->data.string = strdup(iptr[j].value.data.string); - if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->internal, PMIX_RANK_WILDCARD, kp2))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - return rc; - } - PMIX_RELEASE(kp2); // maintain acctg - /* parse the regex to get the argv array of node names */ - if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(iptr[j].value.data.string, nodes))) { + if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(iptr[j].value.data.bo.bytes, nodes))) { PMIX_ERROR_LOG(rc); return rc; } @@ -836,6 +932,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_UINT32; kp2->value->data.uint32 = pmix_argv_count(nodes); + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map adding key %s to job info", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -848,12 +948,7 @@ static pmix_status_t store_map(pmix_job_t *trk, /* check and see if we already have this node */ nd = NULL; PMIX_LIST_FOREACH(ndptr, &trk->nodeinfo, pmix_nodeinfo_t) { - if (NULL != ndptr->hostname && 0 == strcmp(ndptr->hostname, nodes[n])) { - /* we assume that the data is updating the current - * values */ - if (NULL == ndptr->hostname) { - ndptr->hostname = strdup(nodes[n]); - } + if (check_nodename(ndptr, nodes[n])) { nd = ndptr; break; } @@ -861,6 +956,7 @@ static pmix_status_t store_map(pmix_job_t *trk, if (NULL == nd) { nd = PMIX_NEW(pmix_nodeinfo_t); nd->hostname = strdup(nodes[n]); + nd->nodeid = n; pmix_list_append(&trk->nodeinfo, &nd->super); } /* store the proc list as-is */ @@ -876,6 +972,10 @@ static pmix_status_t store_map(pmix_job_t *trk, } kp2->value->type = PMIX_STRING; kp2->value->data.string = strdup(ppn[n]); + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map adding key %s to node %s info", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + kp2->key, nodes[n]); /* ensure this item only appears once on the list */ PMIX_LIST_FOREACH(kp1, &nd->info, pmix_kval_t) { if (PMIX_CHECK_KEY(kp1, kp2->key)) { @@ -900,6 +1000,10 @@ static pmix_status_t store_map(pmix_job_t *trk, } kp2->value->type = PMIX_PROC_RANK; kp2->value->data.rank = rank; + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map adding key %s to node %s info", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + kp2->key, nodes[n]); /* ensure this item only appears once on the list */ PMIX_LIST_FOREACH(kp1, &nd->info, pmix_kval_t) { if (PMIX_CHECK_KEY(kp1, kp2->key)) { @@ -927,6 +1031,10 @@ static pmix_status_t store_map(pmix_job_t *trk, } kp2->value->type = PMIX_UINT32; kp2->value->data.uint32 = pmix_argv_count(procs); + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map adding key %s to node %s info", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + kp2->key, nodes[n]); /* ensure this item only appears once on the list */ PMIX_LIST_FOREACH(kp1, &nd->info, pmix_kval_t) { if (PMIX_CHECK_KEY(kp1, kp2->key)) { @@ -964,6 +1072,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->key = strdup(PMIX_NODEID); kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_UINT32; + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for [%s:%u]: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, rank, kp2->key); kp2->value->data.uint32 = n; if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); @@ -978,6 +1090,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_UINT16; kp2->value->data.uint16 = m; + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for [%s:%u]: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, rank, kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -992,6 +1108,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_UINT16; kp2->value->data.uint16 = m; + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for [%s:%u]: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, rank, kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -1012,6 +1132,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_STRING; kp2->value->data.string = pmix_argv_join(nodes, ','); + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for nspace %s: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -1028,6 +1152,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_UINT32; kp2->value->data.uint32 = totalprocs; + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for nspace %s: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -1047,6 +1175,10 @@ static pmix_status_t store_map(pmix_job_t *trk, kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); kp2->value->type = PMIX_UINT32; kp2->value->data.uint32 = totalprocs; + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for nspace %s: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -1078,6 +1210,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, uint32_t flags = 0; pmix_nodeinfo_t *nd, *ndptr; pmix_apptrkr_t *apptr; + bool found; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:cache_job_info for nspace %s with %lu info", @@ -1098,6 +1231,9 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, /* cache the job info on the internal hash table for this nspace */ ht = &trk->internal; for (n=0; n < ninfo; n++) { + pmix_output_verbose(12, pmix_gds_base_framework.framework_output, + "%s gds:hash:cache_job_info for key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), info[n].key); if (PMIX_CHECK_KEY(&info[n], PMIX_SESSION_ID)) { PMIX_VALUE_GET_NUMBER(rc, &info[n].value, sid, uint32_t); if (PMIX_SUCCESS != rc) { @@ -1148,23 +1284,20 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); return PMIX_ERR_BAD_PARAM; } - /* store the node map itself since that is - * what v3 uses */ - kp2 = PMIX_NEW(pmix_kval_t); - kp2->key = strdup(PMIX_NODE_MAP); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - kp2->value->type = PMIX_STRING; - kp2->value->data.string = strdup(info[n].value.data.string); - if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - return rc; - } - PMIX_RELEASE(kp2); // maintain acctg - /* parse the regex to get the argv array of node names */ - if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(info[n].value.data.string, &nodes))) { - PMIX_ERROR_LOG(rc); + if (PMIX_REGEX == info[n].value.type) { + if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(info[n].value.data.bo.bytes, &nodes))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else if (PMIX_STRING == info[n].value.type) { + if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(info[n].value.data.string, &nodes))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else { + PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); + rc = PMIX_ERR_TYPE_MISMATCH; goto release; } /* mark that we got the map */ @@ -1176,14 +1309,26 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, return PMIX_ERR_BAD_PARAM; } /* parse the regex to get the argv array containing proc ranks on each node */ - if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(info[n].value.data.string, &procs))) { - PMIX_ERROR_LOG(rc); + if (PMIX_REGEX == info[n].value.type) { + if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(info[n].value.data.bo.bytes, &procs))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else if (PMIX_STRING == info[n].value.type) { + if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(info[n].value.data.string, &procs))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else { + PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); + rc = PMIX_ERR_TYPE_MISMATCH; goto release; } /* mark that we got the map */ flags |= PMIX_HASH_PROC_MAP; } else if (PMIX_CHECK_KEY(&info[n], PMIX_PROC_DATA)) { flags |= PMIX_HASH_PROC_DATA; + found = false; /* an array of data pertaining to a specific proc */ if (PMIX_DATA_ARRAY != info[n].value.type) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); @@ -1217,7 +1362,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, /* if the value contains a string that is longer than the * limit, then compress it */ if (PMIX_STRING_SIZE_CHECK(kp2->value)) { - if (pmix_util_compress_string(kp2->value->data.string, &tmp, &len)) { + if (pmix_compress.compress_string(kp2->value->data.string, &tmp, &len)) { if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); rc = PMIX_ERR_NOMEM; @@ -1239,6 +1384,32 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, PMIX_RELEASE(kp2); goto release; } + /* if this is the appnum, pass it to the pmdl framework */ + if (PMIX_CHECK_KEY(kp2, PMIX_APPNUM)) { + found = true; + if (rank == pmix_globals.myid.rank) { + pmix_globals.appnum = kp2->value->data.uint32; + } + } + PMIX_RELEASE(kp2); // maintain acctg + } + if (!found) { + /* if they didn't give us an appnum for this proc, we have + * to assume it is appnum=0 */ + uint32_t zero = 0; + kp2 = PMIX_NEW(pmix_kval_t); + if (NULL == kp2) { + rc = PMIX_ERR_NOMEM; + goto release; + } + kp2->key = strdup(PMIX_APPNUM); + PMIX_VALUE_CREATE(kp2->value, 1); + PMIX_VALUE_LOAD(kp2->value, &zero, PMIX_UINT32); + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + goto release; + } PMIX_RELEASE(kp2); // maintain acctg } } else if (pmix_check_node_info(info[n].key)) { @@ -1246,7 +1417,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, * node - start by seeing if our node is on the list */ nd = NULL; PMIX_LIST_FOREACH(ndptr, &trk->nodeinfo, pmix_nodeinfo_t) { - if (0 == strcmp(pmix_globals.hostname, ndptr->hostname)) { + if (check_nodename(ndptr, pmix_globals.hostname)) { nd = ndptr; break; } @@ -1312,7 +1483,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, /* if the value contains a string that is longer than the * limit, then compress it */ if (PMIX_STRING_SIZE_CHECK(kp2->value)) { - if (pmix_util_compress_string(kp2->value->data.string, &tmp, &len)) { + if (pmix_compress.compress_string(kp2->value->data.string, &tmp, &len)) { if (NULL == tmp) { rc = PMIX_ERR_NOMEM; PMIX_ERROR_LOG(rc); @@ -1469,7 +1640,7 @@ static pmix_status_t register_info(pmix_peer_t *peer, break; } } - if (NULL != hname && 0 == strcmp(pmix_globals.hostname, hname)) { + if (NULL != hname && check_hostname(pmix_globals.hostname, hname)) { /* older versions are looking for node-level keys for * only their own node as standalone keys */ for (n=0; n < ninfo; n++) { @@ -1568,6 +1739,9 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, * for another peer in this nspace so we don't waste * time doing it again */ if (NULL != ns->jobbkt) { + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:register_job_info copying prepacked payload", + pmix_globals.myid.nspace, pmix_globals.myid.rank); /* we have packed this before - can just deliver it */ PMIX_BFROPS_COPY_PAYLOAD(rc, peer, reply, ns->jobbkt); if (PMIX_SUCCESS != rc) { @@ -1595,6 +1769,9 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, * been given to us in the info array - pack * them for delivery */ /* pack the name of the nspace */ + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:register_job_info packing new payload", + pmix_globals.myid.nspace, pmix_globals.myid.rank); msg = ns->nspace; PMIX_BFROPS_PACK(rc, peer, reply, &msg, 1, PMIX_STRING); if (PMIX_SUCCESS != rc) { @@ -1691,6 +1868,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, &buf2, &rank, &cnt, PMIX_PROC_RANK); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kptr); PMIX_DESTRUCT(&buf2); return rc; } @@ -1703,7 +1881,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, /* if the value contains a string that is longer than the * limit, then compress it */ if (PMIX_STRING_SIZE_CHECK(kp2->value)) { - if (pmix_util_compress_string(kp2->value->data.string, &tmp, &len)) { + if (pmix_compress.compress_string(kp2->value->data.string, &tmp, &len)) { if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); rc = PMIX_ERR_NOMEM; @@ -1720,6 +1898,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); + PMIX_RELEASE(kptr); PMIX_DESTRUCT(&buf2); return rc; } @@ -1743,6 +1922,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, &buf2, &nnodes, &cnt, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kptr); PMIX_DESTRUCT(&buf2); return rc; } @@ -1754,6 +1934,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, &buf2, &kv, &cnt, PMIX_KVAL); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kptr); PMIX_DESTRUCT(&buf2); PMIX_DESTRUCT(&kv); return rc; @@ -1763,12 +1944,9 @@ static pmix_status_t hash_store_job_info(const char *nspace, /* check and see if we already have this node */ nd = NULL; PMIX_LIST_FOREACH(ndptr, &trk->nodeinfo, pmix_nodeinfo_t) { - if (NULL != ndptr->hostname && 0 == strcmp(ndptr->hostname, kv.key)) { + if (check_nodename(ndptr, kv.key)) { /* we assume that the data is updating the current * values */ - if (NULL == ndptr->hostname) { - ndptr->hostname = strdup(kv.key); - } nd = ndptr; break; } @@ -1781,12 +1959,14 @@ static pmix_status_t hash_store_job_info(const char *nspace, /* save the list of peers for this node */ kp2 = PMIX_NEW(pmix_kval_t); if (NULL == kp2) { + PMIX_RELEASE(kptr); return PMIX_ERR_NOMEM; } kp2->key = strdup(PMIX_LOCAL_PEERS); kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); if (NULL == kp2->value) { PMIX_RELEASE(kp2); + PMIX_RELEASE(kptr); return PMIX_ERR_NOMEM; } kp2->value->type = PMIX_STRING; @@ -1816,6 +1996,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); + PMIX_RELEASE(kptr); PMIX_DESTRUCT(&kv); PMIX_DESTRUCT(&buf2); pmix_argv_free(procs); @@ -1838,6 +2019,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); + PMIX_RELEASE(kptr); PMIX_DESTRUCT(&kv); PMIX_DESTRUCT(&buf2); return rc; @@ -1849,23 +2031,24 @@ static pmix_status_t hash_store_job_info(const char *nspace, } else if (PMIX_CHECK_KEY(kptr, PMIX_APP_INFO_ARRAY)) { if (PMIX_SUCCESS != (rc = process_app_array(kptr->value, trk))) { PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); + PMIX_RELEASE(kptr); return rc; } } else if (PMIX_CHECK_KEY(kptr, PMIX_NODE_INFO_ARRAY)) { if (PMIX_SUCCESS != (rc = process_node_array(kptr->value, &trk->nodeinfo))) { PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); + PMIX_RELEASE(kptr); return rc; } } else { /* if the value contains a string that is longer than the * limit, then compress it */ if (PMIX_STRING_SIZE_CHECK(kptr->value)) { - if (pmix_util_compress_string(kptr->value->data.string, &tmp, &len)) { + if (pmix_compress.compress_string(kptr->value->data.string, &tmp, &len)) { if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); rc = PMIX_ERR_NOMEM; + PMIX_RELEASE(kptr); return rc; } kptr->value->type = PMIX_COMPRESSED_STRING; @@ -2006,7 +2189,7 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, /* if the value contains a string that is longer than the * limit, then compress it */ if (PMIX_STRING_SIZE_CHECK(kp->value)) { - if (pmix_util_compress_string(kp->value->data.string, &tmp, &len)) { + if (pmix_compress.compress_string(kp->value->data.string, &tmp, &len)) { if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); rc = PMIX_ERR_NOMEM; @@ -2087,31 +2270,29 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, * always contains data solely from remote procs, and we * shall store it accordingly */ static pmix_status_t hash_store_modex(struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_buffer_t *buf) { - return pmix_gds_base_store_modex(nspace, cbs, buf, _hash_store_modex, NULL); + pmix_buffer_t *buf, + void *cbdata) { + return pmix_gds_base_store_modex(nspace, buf, NULL, + _hash_store_modex, cbdata); } -static pmix_status_t _hash_store_modex(void * cbdata, - struct pmix_namespace_t *nspace, - pmix_list_t *cbs, - pmix_byte_object_t *bo) +static pmix_status_t _hash_store_modex(pmix_gds_base_ctx_t ctx, + pmix_proc_t *proc, + pmix_gds_modex_key_fmt_t key_fmt, + char **kmap, + pmix_buffer_t *pbkt) { - pmix_namespace_t *ns = (pmix_namespace_t*)nspace; pmix_job_t *trk; pmix_status_t rc = PMIX_SUCCESS; - int32_t cnt; - pmix_buffer_t pbkt; - pmix_proc_t proc; pmix_kval_t *kv; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:store_modex for nspace %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, - ns->nspace); + proc->nspace); /* find the hash table for this nspace */ - trk = get_tracker(ns->nspace, true); + trk = get_tracker(proc->nspace, true); if (NULL == trk) { return PMIX_ERR_NOMEM; } @@ -2122,28 +2303,12 @@ static pmix_status_t _hash_store_modex(void * cbdata, * the rank followed by pmix_kval_t's. The list of callbacks * contains all local participants. */ - /* setup the byte object for unpacking */ - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - /* the next step unfortunately NULLs the byte object's - * entries, so we need to ensure we restore them! */ - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, bo->bytes, bo->size); - /* unload the proc that provided this data */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, &proc, &cnt, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); - return rc; - } /* unpack the remaining values until we hit the end of the buffer */ - cnt = 1; kv = PMIX_NEW(pmix_kval_t); - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); + rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv); + while (PMIX_SUCCESS == rc) { - if (PMIX_RANK_UNDEF == proc.rank) { + if (PMIX_RANK_UNDEF == proc->rank) { /* if the rank is undefined, then we store it on the * remote table of rank=0 as we know that rank must * always exist */ @@ -2153,7 +2318,7 @@ static pmix_status_t _hash_store_modex(void * cbdata, } } else { /* store this in the hash table */ - if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->remote, proc.rank, kv))) { + if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->remote, proc->rank, kv))) { PMIX_ERROR_LOG(rc); return rc; } @@ -2161,8 +2326,7 @@ static pmix_status_t _hash_store_modex(void * cbdata, PMIX_RELEASE(kv); // maintain accounting as the hash increments the ref count /* continue along */ kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); + rc = pmix_gds_base_modex_unpack_kval(key_fmt, pbkt, kmap, kv); } PMIX_RELEASE(kv); // maintain accounting if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { @@ -2170,10 +2334,6 @@ static pmix_status_t _hash_store_modex(void * cbdata, } else { rc = PMIX_SUCCESS; } - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); return rc; } @@ -2340,6 +2500,9 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, ++n; } PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { + pmix_output_verbose(12, pmix_gds_base_framework.framework_output, + "%s gds:hash:fetch_nodearray adding key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), kp2->key); PMIX_LOAD_KEY(iptr[n].key, kp2->key); rc = pmix_value_xfer(&iptr[n].value, kp2->value); if (PMIX_SUCCESS != rc) { @@ -2356,21 +2519,16 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, } return PMIX_SUCCESS; - } else { - /* assume they want it from this node */ - hostname = pmix_globals.hostname; - goto scan; } - return PMIX_ERR_DATA_VALUE_NOT_FOUND; + /* assume they want it from this node */ + hostname = pmix_globals.hostname; } - scan: /* scan the list of nodes to find the matching entry */ nd = NULL; PMIX_LIST_FOREACH(ndptr, tgt, pmix_nodeinfo_t) { if (NULL != hostname) { - nds = strlen(hostname) < strlen(ndptr->hostname) ? strlen(hostname) : strlen(ndptr->hostname); - if (0 == strncmp(ndptr->hostname, hostname, nds)) { + if (check_nodename(ndptr, hostname)) { nd = ndptr; break; } @@ -2380,6 +2538,10 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, } } if (NULL == nd) { + if (!found) { + /* they didn't specify, so it is optional */ + return PMIX_ERR_DATA_VALUE_NOT_FOUND; + } return PMIX_ERR_NOT_FOUND; } @@ -2415,6 +2577,9 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, ++n; } PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { + pmix_output_verbose(12, pmix_gds_base_framework.framework_output, + "%s gds:hash:fetch_nodearray adding key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), kp2->key); PMIX_LOAD_KEY(iptr[n].key, kp2->key); rc = pmix_value_xfer(&iptr[n].value, kp2->value); if (PMIX_SUCCESS != rc) { @@ -2435,6 +2600,9 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, rc = PMIX_ERR_NOT_FOUND; PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { if (PMIX_CHECK_KEY(kp2, key)) { + pmix_output_verbose(12, pmix_gds_base_framework.framework_output, + "%s gds:hash:fetch_nodearray adding key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), kp2->key); /* since they only asked for one key, return just that value */ kv = PMIX_NEW(pmix_kval_t); kv->key = strdup(kp2->key); @@ -2469,7 +2637,8 @@ static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, pmix_data_array_t *darray; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, - "FETCHING APP INFO"); + "FETCHING APP INFO WITH %d APPS", + (int)pmix_list_get_size(tgt)); /* scan for the appnum to identify * which app they are asking about */ @@ -2522,9 +2691,9 @@ static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, pmix_list_append(kvs, &kv->super); } return PMIX_SUCCESS; - } - return PMIX_ERR_DATA_VALUE_NOT_FOUND; + /* assume they are asking for our app */ + appnum = pmix_globals.appnum; } /* scan the list of apps to find the matching entry */ @@ -2721,6 +2890,15 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, } } + /* check for node/app keys in the absence of corresponding qualifier */ + if (NULL != key) { + if (pmix_check_node_info(key)) { + nodeinfo = true; + } else if (pmix_check_app_info(key)) { + appinfo = true; + } + } + /* find the hash table for this nspace */ trk = get_tracker(proc->nspace, false); if (NULL == trk) { @@ -2797,7 +2975,9 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, if (NULL == key) { /* and need to add all job info just in case that was * passed via a different GDS component */ - dohash(&trk->internal, NULL, PMIX_RANK_WILDCARD, false, kvs); + rc = dohash(&trk->internal, NULL, PMIX_RANK_WILDCARD, false, kvs); + } else { + rc = PMIX_ERR_NOT_FOUND; } } else { rc = dohash(ht, key, proc->rank, false, kvs); @@ -2841,9 +3021,8 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env) return PMIX_SUCCESS; } -static pmix_status_t nspace_add(const char *nspace, - pmix_info_t info[], - size_t ninfo) +static pmix_status_t nspace_add(const char *nspace, uint32_t nlocalprocs, + pmix_info_t info[], size_t ninfo) { /* we don't need to do anything here */ return PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.h index 4d6e69a543..dc1d2084e9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -11,7 +11,7 @@ #ifndef PMIX_GDS_HASH_H #define PMIX_GDS_HASH_H -#include +#include "src/include/pmix_config.h" #include "src/mca/gds/gds.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash_component.c index f9c123963a..2afd7a5ff3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/gds/gds.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/mca.h b/opal/mca/pmix/pmix3x/pmix/src/mca/mca.h index 5970a10eb8..68a9c65de8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/mca.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/mca.h @@ -13,7 +13,7 @@ * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,7 +29,7 @@ #ifndef PMIX_MCA_H #define PMIX_MCA_H -#include +#include "src/include/pmix_config.h" /** * Common type for all MCA modules. diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/Makefile.am new file mode 100644 index 0000000000..4b9a894bda --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/Makefile.am @@ -0,0 +1,37 @@ +# +# Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# main library setup +noinst_LTLIBRARIES = libmca_pcompress.la +libmca_pcompress_la_SOURCES = + +# local files +headers = pcompress.h +libmca_pcompress_la_SOURCES += $(headers) + +# Ensure that the man pages are rebuilt if the pmix_config.h file +# changes; a "good enough" way to know if configure was run again (and +# therefore the release date or version may have changed) +$(nodist_man_MANS): $(top_builddir)/pmix/include/pmix_config.h + +# Conditionally install the header files +if WANT_INSTALL_HEADERS +pmixdir = $(pmixincludedir)/$(subdir) +nobase_pmix_HEADERS = $(headers) +endif + +include base/Makefile.am + +distclean-local: + rm -f base/static-components.h + rm -f $(nodist_man_MANS) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/Makefile.am new file mode 100644 index 0000000000..1757767227 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/Makefile.am @@ -0,0 +1,19 @@ +# +# Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers += \ + base/base.h + +libmca_pcompress_la_SOURCES += \ + base/pcompress_base_frame.c \ + base/pcompress_base_select.c diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/base.h new file mode 100644 index 0000000000..744e94c5d0 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/base.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#ifndef PMIX_COMPRESS_BASE_H +#define PMIX_COMPRESS_BASE_H + +#include "pmix_config.h" +#include "src/mca/pcompress/pcompress.h" +#include "src/util/pmix_environ.h" + +#include "src/mca/base/base.h" + +/* + * Global functions for MCA overall COMPRESS + */ + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + +/* define a macro for quickly checking if a string exceeds the + * compression limit */ +#define PMIX_STRING_SIZE_CHECK(s) \ + (PMIX_STRING == (s)->type && NULL != (s)->data.string && pmix_compress_base.compress_limit < strlen((s)->data.string)) + +#define PMIX_VALUE_COMPRESSED_STRING_UNPACK(s) \ + do { \ + char *tmp; \ + /* if this is a compressed string, then uncompress it */ \ + if (PMIX_COMPRESSED_STRING == (s)->type) { \ + pmix_compress.decompress_string(&tmp, (uint8_t*)(s)->data.bo.bytes, \ + (s)->data.bo.size); \ + if (NULL == tmp) { \ + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); \ + rc = PMIX_ERR_NOMEM; \ + PMIX_VALUE_RELEASE(s); \ + val = NULL; \ + } else { \ + PMIX_VALUE_DESTRUCT(s); \ + (s)->data.string = tmp; \ + (s)->type = PMIX_STRING; \ + } \ + } \ + } while(0) + +typedef struct { + size_t compress_limit; + bool selected; +} pmix_compress_base_t; + +PMIX_EXPORT extern pmix_compress_base_t pmix_compress_base; + + /** + * Select an available component. + * + * @retval OPAL_SUCCESS Upon Success + * @retval OPAL_NOT_FOUND If no component can be selected + * @retval OPAL_ERROR Upon other failure + * + */ + PMIX_EXPORT int pmix_compress_base_select(void); + + /** + * Globals + */ + PMIX_EXPORT extern pmix_mca_base_framework_t pmix_pcompress_base_framework; + PMIX_EXPORT extern pmix_compress_base_module_t pmix_compress; + + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif /* PMIX_COMPRESS_BASE_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_frame.c new file mode 100644 index 0000000000..48681cff2a --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_frame.c @@ -0,0 +1,97 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2011-2013 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "pmix_config.h" + +#include "src/mca/base/base.h" +#include "src/mca/pcompress/base/base.h" + +#include "src/mca/pcompress/base/static-components.h" + +/* + * Globals + */ +static bool compress_block(char *instring, + uint8_t **outbytes, + size_t *nbytes) +{ + (void)instring; + (void)outbytes; + (void)nbytes; + return false; +} + +static bool decompress_block(char **outstring, + uint8_t *inbytes, size_t len) +{ + (void)outstring; + (void)inbytes; + (void)len; + return false; +} + +pmix_compress_base_module_t pmix_compress = { + NULL, /* init */ + NULL, /* finalize */ + NULL, /* compress */ + NULL, /* compress_nb */ + NULL, /* decompress */ + NULL, /* decompress_nb */ + compress_block, + decompress_block +}; +pmix_compress_base_t pmix_compress_base = {0}; + +pmix_compress_base_component_t pmix_compress_base_selected_component = {{0}}; + +static int pmix_compress_base_register(pmix_mca_base_register_flag_t flags) +{ + (void)flags; + pmix_compress_base.compress_limit = 4096; + (void) pmix_mca_base_var_register("pmix", "compress", "base", "limit", + "Threshold beyond which data will be compressed", + PMIX_MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, PMIX_INFO_LVL_3, + PMIX_MCA_BASE_VAR_SCOPE_READONLY, &pmix_compress_base.compress_limit); + + return PMIX_SUCCESS; +} + +/** + * Function for finding and opening either all MCA components, + * or the one that was specifically requested via a MCA parameter. + */ +static int pmix_compress_base_open(pmix_mca_base_open_flag_t flags) +{ + /* Open up all available components */ + return pmix_mca_base_framework_components_open(&pmix_pcompress_base_framework, flags); +} + +static int pmix_compress_base_close(void) +{ + pmix_compress_base.selected = false; + /* Call the component's finalize routine */ + if( NULL != pmix_compress.finalize ) { + pmix_compress.finalize(); + } + + /* Close all available modules that are open */ + return pmix_mca_base_framework_components_close (&pmix_pcompress_base_framework, NULL); +} + +PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, pcompress, "PCOMPRESS MCA", + pmix_compress_base_register, pmix_compress_base_open, + pmix_compress_base_close, mca_pcompress_base_static_components, 0); + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_select.c new file mode 100644 index 0000000000..04fed7f5ad --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/base/pcompress_base_select.c @@ -0,0 +1,63 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "pmix_config.h" + +#ifdef HAVE_UNISTD_H +#include "unistd.h" +#endif + +#include "include/pmix_common.h" +#include "src/util/output.h" +#include "src/mca/mca.h" +#include "src/mca/base/base.h" +#include "src/mca/pcompress/base/base.h" + +int pmix_compress_base_select(void) +{ + int ret = PMIX_SUCCESS; + pmix_compress_base_component_t *best_component = NULL; + pmix_compress_base_module_t *best_module = NULL; + + if (pmix_compress_base.selected) { + /* ensure we don't do this twice */ + return PMIX_SUCCESS; + } + pmix_compress_base.selected = true; + /* + * Select the best component + */ + if( PMIX_SUCCESS != pmix_mca_base_select("pcompress", pmix_pcompress_base_framework.framework_output, + &pmix_pcompress_base_framework.framework_components, + (pmix_mca_base_module_t **) &best_module, + (pmix_mca_base_component_t **) &best_component, NULL) ) { + /* This will only happen if no component was selected, + * in which case we use the default one */ + goto cleanup; + } + + /* Initialize the winner */ + if (NULL != best_module) { + if (PMIX_SUCCESS != (ret = best_module->init()) ) { + goto cleanup; + } + pmix_compress = *best_module; + } + + cleanup: + return ret; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/pcompress.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/pcompress.h new file mode 100644 index 0000000000..52046540c9 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/pcompress.h @@ -0,0 +1,155 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +/** + * @file + * + * Compression Framework + * + * General Description: + * + * The PMIX Compress framework has been created to provide an abstract interface + * to the compression agent library on the host machine. This fromework is useful + * when distributing files that can be compressed before sending to dimish the + * load on the network. + * + */ + +#ifndef PMIX_MCA_COMPRESS_H +#define PMIX_MCA_COMPRESS_H + +#include "pmix_config.h" +#include "src/mca/mca.h" +#include "src/mca/base/base.h" +#include "src/class/pmix_object.h" + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + +/** + * Module initialization function. + * Returns PMIX_SUCCESS + */ +typedef int (*pmix_compress_base_module_init_fn_t) + (void); + +/** + * Module finalization function. + * Returns PMIX_SUCCESS + */ +typedef int (*pmix_compress_base_module_finalize_fn_t) + (void); + +/** + * Compress the file provided + * + * Arguments: + * fname = Filename to compress + * cname = Compressed filename + * postfix = postfix added to filename to create compressed filename + * Returns: + * PMIX_SUCCESS on success, ow PMIX_ERROR + */ +typedef int (*pmix_compress_base_module_compress_fn_t) + (char * fname, char **cname, char **postfix); + +typedef int (*pmix_compress_base_module_compress_nb_fn_t) + (char * fname, char **cname, char **postfix, pid_t *child_pid); + +/** + * Decompress the file provided + * + * Arguments: + * fname = Filename to compress + * cname = Compressed filename + * Returns: + * PMIX_SUCCESS on success, ow PMIX_ERROR + */ +typedef int (*pmix_compress_base_module_decompress_fn_t) + (char * cname, char **fname); +typedef int (*pmix_compress_base_module_decompress_nb_fn_t) + (char * cname, char **fname, pid_t *child_pid); + +/** + * Compress a string + * + * Arguments: + * + */ +typedef bool (*pmix_compress_base_module_compress_string_fn_t)(char *instring, + uint8_t **outbytes, + size_t *nbytes); +typedef bool (*pmix_compress_base_module_decompress_string_fn_t)(char **outstring, + uint8_t *inbytes, size_t len); + + +/** + * Structure for COMPRESS components. + */ +struct pmix_compress_base_component_2_0_0_t { + /** PMIX_MCA base component */ + pmix_mca_base_component_t base_version; + /** PMIX_MCA base data */ + pmix_mca_base_component_data_t base_data; + + /** Verbosity Level */ + int verbose; + /** Output Handle for pmix_output */ + int output_handle; + /** Default Priority */ + int priority; +}; +typedef struct pmix_compress_base_component_2_0_0_t pmix_compress_base_component_2_0_0_t; +typedef struct pmix_compress_base_component_2_0_0_t pmix_compress_base_component_t; + +/** + * Structure for COMPRESS modules + */ +struct pmix_compress_base_module_1_0_0_t { + /** Initialization Function */ + pmix_compress_base_module_init_fn_t init; + /** Finalization Function */ + pmix_compress_base_module_finalize_fn_t finalize; + + /** Compress interface */ + pmix_compress_base_module_compress_fn_t compress; + pmix_compress_base_module_compress_nb_fn_t compress_nb; + + /** Decompress Interface */ + pmix_compress_base_module_decompress_fn_t decompress; + pmix_compress_base_module_decompress_nb_fn_t decompress_nb; + + /* COMPRESS STRING */ + pmix_compress_base_module_compress_string_fn_t compress_string; + pmix_compress_base_module_decompress_string_fn_t decompress_string; +}; +typedef struct pmix_compress_base_module_1_0_0_t pmix_compress_base_module_1_0_0_t; +typedef struct pmix_compress_base_module_1_0_0_t pmix_compress_base_module_t; + +PMIX_EXPORT extern pmix_compress_base_module_t pmix_compress; + +/** + * Macro for use in components that are of type COMPRESS + */ +#define PMIX_COMPRESS_BASE_VERSION_2_0_0 \ + PMIX_MCA_BASE_VERSION_1_0_0("pcompress", 2, 0, 0) + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif /* PMIX_COMPRESS_H */ + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/Makefile.am new file mode 100644 index 0000000000..c54a393aba --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/Makefile.am @@ -0,0 +1,45 @@ +# +# Copyright (c) 2004-2010 The Trustees of Indiana University. +# All rights reserved. +# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2017 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AM_CPPFLAGS = $(pcompress_zlib_CPPFLAGS) + +sources = \ + compress_zlib.h \ + compress_zlib_component.c \ + compress_zlib.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_pcompress_zlib_DSO +component_noinst = +component_install = mca_pcompress_zlib.la +else +component_noinst = libmca_pcompress_zlib.la +component_install = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_pcompress_zlib_la_SOURCES = $(sources) +mca_pcompress_zlib_la_LDFLAGS = -module -avoid-version $(pcompress_zlib_LDFLAGS) +mca_pcompress_zlib_la_LIBADD = $(pcompress_zlib_LIBS) +if NEED_LIBPMIX +mca_pcompress_zlib_la_LIBADD += $(top_builddir)/src/libpmix.la +endif + +noinst_LTLIBRARIES = $(component_noinst) +libmca_pcompress_zlib_la_SOURCES = $(sources) +libmca_pcompress_zlib_la_LDFLAGS = -module -avoid-version $(pcompress_zlib_LDFLAGS) +libmca_pcompress_zlib_la_LIBADD = $(pcompress_zlib_LIBS) diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/compress.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.c similarity index 61% rename from opal/mca/pmix/pmix3x/pmix/src/util/compress.c rename to opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.c index 7089fb77c3..2a813b9212 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/compress.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.c @@ -1,6 +1,13 @@ /* - * Copyright (c) 2016 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2004-2010 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -8,24 +15,43 @@ * $HEADER$ */ -#include +#include "pmix_config.h" - -#include -#ifdef HAVE_STRING_H #include -#endif -#ifdef HAVE_ZLIB_H +#include +#include +#include +#if HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ #include -#endif -#include "src/include/pmix_globals.h" -#include "src/util/compress.h" +#include "src/util/pmix_environ.h" +#include "src/util/output.h" +#include "src/util/argv.h" +#include "src/util/pmix_environ.h" +#include "src/util/printf.h" -#if PMIX_HAVE_ZLIB -bool pmix_util_compress_string(char *instring, - uint8_t **outbytes, - size_t *nbytes) +#include "include/pmix_common.h" +#include "src/util/basename.h" + +#include "src/mca/pcompress/base/base.h" + +#include "compress_zlib.h" + +int pmix_compress_zlib_module_init(void) +{ + return PMIX_SUCCESS; +} + +int pmix_compress_zlib_module_finalize(void) +{ + return PMIX_SUCCESS; +} + +bool pmix_compress_zlib_compress_block(char *instring, + uint8_t **outbytes, + size_t *nbytes) { z_stream strm; size_t len, outlen; @@ -87,23 +113,14 @@ bool pmix_util_compress_string(char *instring, /* bring over the compressed data */ memcpy(ptr, tmp, outlen-sizeof(uint32_t)); free(tmp); - pmix_output_verbose(10, pmix_globals.debug_output, - "JOBDATA COMPRESS INPUT STRING OF LEN %d OUTPUT SIZE %lu", + pmix_output_verbose(2, pmix_pcompress_base_framework.framework_output, + "COMPRESS INPUT STRING OF LEN %d OUTPUT SIZE %lu", inlen, outlen-sizeof(uint32_t)); return true; // we did the compression } -#else -bool pmix_util_compress_string(char *instring, - uint8_t **outbytes, - size_t *nbytes) -{ - return false; // we did not compress -} -#endif -#if PMIX_HAVE_ZLIB -void pmix_util_uncompress_string(char **outstring, - uint8_t *inbytes, size_t len) +bool pmix_compress_zlib_uncompress_block(char **outstring, + uint8_t *inbytes, size_t len) { uint8_t *dest; int32_t len2; @@ -116,21 +133,21 @@ void pmix_util_uncompress_string(char **outstring, /* the first 4 bytes contains the uncompressed size */ memcpy(&len2, inbytes, sizeof(uint32_t)); - pmix_output_verbose(10, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_pcompress_base_framework.framework_output, "DECOMPRESSING INPUT OF LEN %lu OUTPUT %d", len, len2); /* setting destination to the fully decompressed size, +1 to * hold the NULL terminator */ dest = (uint8_t*)malloc(len2+1); if (NULL == dest) { - return; + return false; } memset(dest, 0, len2+1); memset (&strm, 0, sizeof (strm)); if (Z_OK != inflateInit(&strm)) { free(dest); - return; + return false; } strm.avail_in = len; strm.next_in = (uint8_t*)(inbytes + sizeof(uint32_t)); @@ -142,19 +159,7 @@ void pmix_util_uncompress_string(char **outstring, /* ensure this is NULL terminated! */ dest[len2] = '\0'; *outstring = (char*)dest; - pmix_output_verbose(10, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_pcompress_base_framework.framework_output, "\tFINAL LEN: %lu CODE: %d", strlen(*outstring), rc); - return; + return true; } -#else -/* this can never actually be used - there is no way we should - * receive a PMIX_COMPRESSED_STRING unless we compressed it, - * which means PMIX_HAVE_ZLIB must have been true. Still, we - * include the stub just to avoid requiring #if's in the rest - * of the code */ -void pmix_util_uncompress_string(char **outstring, - uint8_t *inbytes, size_t len) -{ - *outstring = NULL; -} -#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.h new file mode 100644 index 0000000000..309cd451b0 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * @file + * + * ZLIB COMPRESS component + * + * Uses the zlib library + */ + +#ifndef MCA_COMPRESS_ZLIB_EXPORT_H +#define MCA_COMPRESS_ZLIB_EXPORT_H + +#include "pmix_config.h" + +#include "src/util/output.h" + +#include "src/mca/mca.h" +#include "src/mca/pcompress/pcompress.h" + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + + extern pmix_mca_base_component_t mca_pcompress_zlib_component; + + /* + * Module functions + */ + int pmix_compress_zlib_module_init(void); + int pmix_compress_zlib_module_finalize(void); + + /* + * Actual funcationality + */ + bool pmix_compress_zlib_compress_block(char *instring, + uint8_t **outbytes, + size_t *nbytes); + bool pmix_compress_zlib_uncompress_block(char **outstring, + uint8_t *inbytes, size_t len); + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif /* MCA_COMPRESS_ZLIB_EXPORT_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib_component.c new file mode 100644 index 0000000000..a181609eaa --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/compress_zlib_component.c @@ -0,0 +1,88 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University. + * All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "pmix_config.h" + +#include "include/pmix_common.h" +#include "src/mca/pcompress/base/base.h" +#include "compress_zlib.h" + +/* + * Public string for version number + */ +const char *pmix_compress_zlib_component_version_string = +"PMIX COMPRESS zlib MCA component version " PMIX_VERSION; + +/* + * Local functionality + */ +static int compress_zlib_open(void); +static int compress_zlib_close(void); +static int compress_zlib_query(pmix_mca_base_module_t **module, int *priority); + +/* + * Instantiate the public struct with all of our public information + * and pointer to our public functions in it + */ +PMIX_EXPORT pmix_mca_base_component_t mca_pcompress_zlib_component = { + /* Handle the general mca_component_t struct containing + * meta information about the component zlib + */ + PMIX_COMPRESS_BASE_VERSION_2_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "zlib", + PMIX_MCA_BASE_MAKE_VERSION(component, PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = compress_zlib_open, + .pmix_mca_close_component = compress_zlib_close, + .pmix_mca_query_component = compress_zlib_query +}; + +/* + * Zlib module + */ +static pmix_compress_base_module_t loc_module = { + /** Initialization Function */ + .init = pmix_compress_zlib_module_init, + /** Finalization Function */ + .finalize = pmix_compress_zlib_module_finalize, + + /** Compress Function */ + .compress_string = pmix_compress_zlib_compress_block, + + /** Decompress Function */ + .decompress_string = pmix_compress_zlib_uncompress_block, +}; + +static int compress_zlib_open(void) +{ + return PMIX_SUCCESS; +} + +static int compress_zlib_close(void) +{ + return PMIX_SUCCESS; +} + +static int compress_zlib_query(pmix_mca_base_module_t **module, int *priority) +{ + *module = (pmix_mca_base_module_t *)&loc_module; + *priority = 50; + + return PMIX_SUCCESS; +} + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/configure.m4 new file mode 100644 index 0000000000..1d26347937 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pcompress/zlib/configure.m4 @@ -0,0 +1,107 @@ +# -*- shell-script -*- +# +# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_pcompress_zlib_CONFIG([action-if-can-compile], +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_pmix_pcompress_zlib_CONFIG],[ + AC_CONFIG_FILES([src/mca/pcompress/zlib/Makefile]) + + PMIX_VAR_SCOPE_PUSH([pmix_zlib_dir pmix_zlib_libdir pmix_zlib_standard_lib_location pmix_zlib_standard_header_location pmix_check_zlib_save_CPPFLAGS pmix_check_zlib_save_LDFLAGS pmix_check_zlib_save_LIBS]) + + AC_ARG_WITH([zlib], + [AC_HELP_STRING([--with-zlib=DIR], + [Search for zlib headers and libraries in DIR ])]) + + AC_ARG_WITH([zlib-libdir], + [AC_HELP_STRING([--with-zlib-libdir=DIR], + [Search for zlib libraries in DIR ])]) + + pmix_check_zlib_save_CPPFLAGS="$CPPFLAGS" + pmix_check_zlib_save_LDFLAGS="$LDFLAGS" + pmix_check_zlib_save_LIBS="$LIBS" + + pmix_zlib_support=0 + + if test "$with_zlib" != "no"; then + AC_MSG_CHECKING([for zlib in]) + if test ! -z "$with_zlib" && test "$with_zlib" != "yes"; then + pmix_zlib_dir=$with_zlib + pmix_zlib_source=$with_zlib + pmix_zlib_standard_header_location=no + pmix_zlib_standard_lib_location=no + AS_IF([test -z "$with_zlib_libdir" || test "$with_zlib_libdir" = "yes"], + [if test -d $with_zlib/lib; then + pmix_zlib_libdir=$with_zlib/lib + elif test -d $with_zlib/lib64; then + pmix_zlib_libdir=$with_zlib/lib64 + else + AC_MSG_RESULT([Could not find $with_zlib/lib or $with_zlib/lib64]) + AC_MSG_ERROR([Can not continue]) + fi + AC_MSG_RESULT([$pmix_zlib_dir and $pmix_zlib_libdir])], + [AC_MSG_RESULT([$with_zlib_libdir])]) + else + AC_MSG_RESULT([(default search paths)]) + pmix_zlib_source=standard + pmix_zlib_standard_header_location=yes + pmix_zlib_standard_lib_location=yes + fi + AS_IF([test ! -z "$with_zlib_libdir" && test "$with_zlib_libdir" != "yes"], + [pmix_zlib_libdir="$with_zlib_libdir" + pmix_zlib_standard_lib_location=no]) + + PMIX_CHECK_PACKAGE([pcompress_zlib], + [zlib.h], + [z], + [deflate], + [-lz], + [$pmix_zlib_dir], + [$pmix_zlib_libdir], + [pmix_zlib_support=1], + [pmix_zlib_support=0]) + fi + + if test ! -z "$with_zlib" && test "$with_zlib" != "no" && test "$pmix_zlib_support" != "1"; then + AC_MSG_WARN([ZLIB SUPPORT REQUESTED AND NOT FOUND]) + AC_MSG_ERROR([CANNOT CONTINUE]) + fi + + AC_MSG_CHECKING([will zlib support be built]) + if test "$pmix_zlib_support" != "1"; then + AC_MSG_RESULT([no]) + else + AC_MSG_RESULT([yes]) + fi + + CPPFLAGS="$pmix_check_zlib_save_CPPFLAGS" + LDFLAGS="$pmix_check_zlib_save_LDFLAGS" + LIBS="$pmix_check_zlib_save_LIBS" + + AS_IF([test "$pmix_zlib_support" = "1"], + [$1 + pcompress_zlib_LIBS=-lz + PMIX_SUMMARY_ADD([[External Packages]],[[ZLIB]], [pmix_zlib], [yes ($pmix_zlib_source)])], + [$2]) + + # substitute in the things needed to build pcompress/zlib + AC_SUBST([pcompress_zlib_CFLAGS]) + AC_SUBST([pcompress_zlib_CPPFLAGS]) + AC_SUBST([pcompress_zlib_LDFLAGS]) + AC_SUBST([pcompress_zlib_LIBS]) + + PMIX_EMBEDDED_LIBS="$PMIX_EMBEDDED_LIBS $pcompress_zlib_LIBS" + PMIX_EMBEDDED_LDFLAGS="$PMIX_EMBEDDED_LDFLAGS $pcompress_zlib_LDFLAGS" + PMIX_EMBEDDED_CPPFLAGS="$PMIX_EMBEDDED_CPPFLAGS $pcompress_zlib_CPPFLAGS" + + PMIX_VAR_SCOPE_POP +])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/base.h index 6a3f13f785..bdcf6c82a1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/base.h @@ -3,7 +3,7 @@ * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -14,7 +14,7 @@ #ifndef PMIX_PDL_BASE_H #define PMIX_PDL_BASE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/pdl/pdl.h" #include "src/util/pmix_environ.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_close.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_close.c index 7c6f5456a4..5437b9cb6b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_close.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_close.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2010 The Trustees of Indiana University. * All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +10,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_fns.c index 091715dadc..c9d0de0c8e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_fns.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2010 The Trustees of Indiana University. * All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -16,9 +16,9 @@ * component; see pdl.h for details). */ -#include +#include "src/include/pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/output.h" #include "src/mca/pdl/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_open.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_open.c index 22b6cd4c47..95b94514a9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_open.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_open.c @@ -4,7 +4,7 @@ * Copyright (c) 2011-2013 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/mca/pdl/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_select.c index e42db673be..97cc11d676 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/base/pdl_base_select.c @@ -4,6 +4,7 @@ * All rights reserved. * * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. @@ -13,13 +14,13 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_UNISTD_H #include "unistd.h" #endif -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/output.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdl.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdl.h index e34ac5bd6b..7435d78325 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdl.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdl.h @@ -3,6 +3,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +48,7 @@ #ifndef PMIX_MCA_PDL_PDL_H #define PMIX_MCA_PDL_PDL_H -#include +#include "src/include/pmix_config.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen.h index 7ba3e24760..6ff4bb00dd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,7 +11,7 @@ #ifndef PMIX_PDL_PDLOPEN #define PMIX_PDL_PDLOPEN -#include +#include "src/include/pmix_config.h" #include "src/mca/pdl/pdl.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c index 8e061d5ca9..b8247e581c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_component.c @@ -3,6 +3,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,9 +11,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/mca/pdl/pdl.h" #include "src/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_module.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_module.c index f9a61287a8..a8f2b78607 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_module.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/pdlopen/pdl_pdlopen_module.c @@ -4,7 +4,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -21,7 +21,7 @@ #include #include -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/mca/pdl/pdl.h" #include "src/util/argv.h" #include "src/util/error.h" @@ -88,11 +88,16 @@ static int pdlopen_open(const char *fname, bool use_ext, bool private_namespace, /* Does the file exist? */ struct stat buf; + /* coverity[toctou] */ if (stat(name, &buf) < 0) { - free(name); if (NULL != err_msg) { - *err_msg = "File not found"; + rc = asprintf(err_msg, "File %s not found", name); + if (0 > rc) { + free(name); + return PMIX_ERR_NOMEM; + } } + free(name); continue; } @@ -200,6 +205,7 @@ static int pdlopen_foreachfile(const char *search_path, /* Stat the file */ struct stat buf; + /* coverity[toctou] */ if (stat(abs_name, &buf) < 0) { free(abs_name); ret = PMIX_ERR_IN_ERRNO; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_component.c index 6b1fd02d3e..7e95c5b359 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_component.c @@ -3,7 +3,7 @@ * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, Inc. All rights * reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,7 +13,7 @@ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "pmix/mca/pdl/pdl.h" #include "pmix/mca/base/pmix_mca_base_var.h" #include "pmix/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_module.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_module.c index 4a0f2d1330..da45a4ed6a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_module.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/plibltdl/pdl_libltdl_module.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -66,7 +66,7 @@ static int plibltpdl_open(const char *fname, bool use_ext, bool private_namespac } if (NULL != err_msg) { - *err_msg = (char*) lt_dlerror(); + *err_msg = strdup((char*) lt_dlerror()); } return PMIX_ERROR; } @@ -90,7 +90,7 @@ static int plibltpdl_lookup(pmix_pdl_handle_t *handle, const char *symbol, } if (NULL != err_msg) { - *err_msg = (char*) lt_dlerror(); + *err_msg = strdup((char*) lt_dlerror()); } return PMIX_ERROR; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/Makefile.am index f444a5ca9b..f04901382d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/Makefile.am @@ -1,5 +1,6 @@ # # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -17,7 +18,7 @@ libmca_pif_la_SOURCES += $(headers) # Conditionally install the header files if WANT_INSTALL_HEADERS -pmixdir = $(pmixincludedir)/pmix/mca/pif +pmixdir = $(pmixincludedir)/$(subdir) nobase_pmix_HEADERS = $(headers) endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/base/pif_base_components.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/base/pif_base_components.c index 803e45c2a0..f1ab0e4113 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/base/pif_base_components.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/base/pif_base_components.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -13,7 +13,7 @@ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/output.h" #include "src/mca/mca.h" #include "src/mca/pif/pif.h" @@ -40,6 +40,7 @@ PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, pif, NULL, pmix_pif_base_register, pmix_pi static int pmix_pif_base_register (pmix_mca_base_register_flag_t flags) { + (void)flags; pmix_if_do_not_resolve = false; (void) pmix_mca_base_framework_var_register (&pmix_pif_base_framework, "do_not_resolve", "If nonzero, do not attempt to resolve interfaces", diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c index 1d48b46277..1c49741845 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +10,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c index ff30d73500..623f03f5e9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +10,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c index 53bec6fb04..723d7325f0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +10,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c index 095a3027e7..87f5e6c6d9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c @@ -4,7 +4,7 @@ * Copyright (c) 2013 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,7 +13,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c index c9895cb661..72915b830e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c @@ -3,7 +3,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/base.h index 4661a5a356..6b24b9df44 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/base.h @@ -3,7 +3,7 @@ * reserved. * Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,7 +15,7 @@ #ifndef PMIX_PINSTALLDIRS_BASE_H #define PMIX_PINSTALLDIRS_BASE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/base/pmix_mca_base_framework.h" #include "src/mca/pinstalldirs/pinstalldirs.h" @@ -33,7 +33,9 @@ PMIX_EXPORT extern pmix_mca_base_framework_t pmix_pinstalldirs_base_framework; also insert the value of the environment variable $PMIX_DESTDIR, if it exists/is set. This function should *only* be used during the setup routines of pinstalldirs. */ -char * pmix_pinstall_dirs_expand_setup(const char* input); +PMIX_EXPORT char * pmix_pinstall_dirs_expand_setup(const char* input); + +PMIX_EXPORT int pmix_pinstall_dirs_base_init(pmix_info_t info[], size_t ninfo); END_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_components.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_components.c index 5a8902886e..235e330c3c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_components.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_components.c @@ -5,7 +5,7 @@ * Copyright (c) 2010 Sandia National Laboratories. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -14,9 +14,9 @@ * */ -#include +#include "src/include/pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/mca/mca.h" #include "src/mca/pinstalldirs/pinstalldirs.h" #include "src/mca/pinstalldirs/base/base.h" @@ -34,18 +34,21 @@ pmix_pinstall_dirs_t pmix_pinstall_dirs = {0}; static int pmix_pinstalldirs_base_open(pmix_mca_base_open_flag_t flags) { - pmix_mca_base_component_list_item_t *component_item; - int ret; + return pmix_mca_base_framework_components_open(&pmix_pinstalldirs_base_framework, flags); +} - ret = pmix_mca_base_framework_components_open(&pmix_pinstalldirs_base_framework, flags); - if (PMIX_SUCCESS != ret) { - return ret; - } +int pmix_pinstall_dirs_base_init(pmix_info_t info[], size_t ninfo) +{ + pmix_mca_base_component_list_item_t *component_item; PMIX_LIST_FOREACH(component_item, &pmix_pinstalldirs_base_framework.framework_components, pmix_mca_base_component_list_item_t) { const pmix_pinstalldirs_base_component_t *component = (const pmix_pinstalldirs_base_component_t *) component_item->cli_component; + if (NULL != component->init) { + component->init(info, ninfo); + } + /* copy over the data, if something isn't already there */ CONDITIONAL_COPY(pmix_pinstall_dirs, component->install_dirs_data, prefix); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_expand.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_expand.c index 0b72be7d4b..f86225c1ca 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_expand.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/base/pinstalldirs_base_expand.c @@ -4,7 +4,7 @@ * Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007 Sun Microsystem, Inc. All rights reserved. * Copyright (c) 2010 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,7 +13,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/pmix_pinstalldirs_config.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/pmix_pinstalldirs_config.c index f48de36bd8..47a3e9c596 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/pmix_pinstalldirs_config.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/pmix_pinstalldirs_config.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,7 +9,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "src/mca/pinstalldirs/pinstalldirs.h" #include "src/mca/pinstalldirs/config/pinstall_dirs.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/env/pmix_pinstalldirs_env.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/env/pmix_pinstalldirs_env.c index 9ee499b079..999ebdd12c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/env/pmix_pinstalldirs_env.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/env/pmix_pinstalldirs_env.c @@ -2,7 +2,7 @@ * Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,15 +10,15 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/mca/pinstalldirs/pinstalldirs.h" -static int pinstalldirs_env_open(void); +static void pinstalldirs_env_init(pmix_info_t info[], size_t ninfo); pmix_pinstalldirs_base_component_t mca_pinstalldirs_env_component = { @@ -32,10 +32,6 @@ pmix_pinstalldirs_base_component_t mca_pinstalldirs_env_component = { PMIX_MAJOR_VERSION, PMIX_MINOR_VERSION, PMIX_RELEASE_VERSION, - - /* Component open and close functions */ - pinstalldirs_env_open, - NULL }, { /* This component is checkpointable */ @@ -46,6 +42,7 @@ pmix_pinstalldirs_base_component_t mca_pinstalldirs_env_component = { { NULL, }, + .init = pinstalldirs_env_init }; @@ -55,14 +52,27 @@ pmix_pinstalldirs_base_component_t mca_pinstalldirs_env_component = { if (NULL != tmp && 0 == strlen(tmp)) { \ tmp = NULL; \ } \ - mca_pinstalldirs_env_component.install_dirs_data.field = tmp; \ + mca_pinstalldirs_env_component.install_dirs_data.field = tmp; \ } while (0) -static int -pinstalldirs_env_open(void) +static void pinstalldirs_env_init(pmix_info_t info[], size_t ninfo) { - SET_FIELD(prefix, "PMIX_INSTALL_PREFIX"); + size_t n; + bool prefix_given = false; + + /* check for a prefix value */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_PREFIX)) { + mca_pinstalldirs_env_component.install_dirs_data.prefix = info[n].value.data.string; + prefix_given = true; + break; + } + } + + if (!prefix_given) { + SET_FIELD(prefix, "PMIX_INSTALL_PREFIX"); + } SET_FIELD(exec_prefix, "PMIX_EXEC_PREFIX"); SET_FIELD(bindir, "PMIX_BINDIR"); SET_FIELD(sbindir, "PMIX_SBINDIR"); @@ -79,6 +89,4 @@ pinstalldirs_env_open(void) SET_FIELD(pmixdatadir, "PMIX_PKGDATADIR"); SET_FIELD(pmixlibdir, "PMIX_PKGLIBDIR"); SET_FIELD(pmixincludedir, "PMIX_PKGINCLUDEDIR"); - - return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/pinstalldirs.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/pinstalldirs.h index 159fae893c..5181cb79ec 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/pinstalldirs.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/pinstalldirs.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,7 +13,9 @@ #ifndef PMIX_MCA_PINSTALLDIRS_PINSTALLDIRS_H #define PMIX_MCA_PINSTALLDIRS_PINSTALLDIRS_H -#include +#include "src/include/pmix_config.h" + +#include "include/pmix_common.h" #include "src/mca/mca.h" #include "src/mca/base/base.h" @@ -59,9 +61,12 @@ PMIX_EXPORT extern pmix_pinstall_dirs_t pmix_pinstall_dirs; /** * Expand out path variables (such as ${prefix}) in the input string * using the current pmix_pinstall_dirs structure */ -char * pmix_pinstall_dirs_expand(const char* input); +PMIX_EXPORT char * pmix_pinstall_dirs_expand(const char* input); +/* optional initialization function */ +typedef void (*pmix_install_dirs_init_fn_t)(pmix_info_t info[], size_t ninfo); + /** * Structure for pinstalldirs components. */ @@ -72,6 +77,8 @@ struct pmix_pinstalldirs_base_component_2_0_0_t { pmix_mca_base_component_data_t component_data; /** install directories provided by the given component */ pmix_pinstall_dirs_t install_dirs_data; + /* optional init function */ + pmix_install_dirs_init_fn_t init; }; /** * Convenience typedef diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/base.h index 6c865731ef..8c100d8550 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/base.h @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #ifndef PMIX_PLOG_BASE_H_ #define PMIX_PLOG_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -77,6 +77,7 @@ struct pmix_plog_globals_t { pmix_lock_t lock; pmix_pointer_array_t actives; bool initialized; + bool selected; char **channels; }; typedef struct pmix_plog_globals_t pmix_plog_globals_t; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_frame.c index 906b8ccaa7..eb3332113b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_frame.c @@ -1,15 +1,17 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -38,6 +40,7 @@ pmix_plog_API_module_t pmix_plog = { static char *order = NULL; static int pmix_plog_register(pmix_mca_base_register_flag_t flags) { + (void)flags; pmix_mca_base_var_register("pmix", "plog", "base", "order", "Comma-delimited, prioritized list of logging channels", PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, @@ -59,6 +62,7 @@ static pmix_status_t pmix_plog_close(void) return PMIX_SUCCESS; } pmix_plog_globals.initialized = false; + pmix_plog_globals.selected = false; for (n=0; n < pmix_plog_globals.actives.size; n++) { if (NULL == (active = (pmix_plog_base_active_module_t*)pmix_pointer_array_get_item(&pmix_plog_globals.actives, n))) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_select.c index fe947938e4..a90321e893 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -28,8 +30,6 @@ #include "src/mca/plog/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized array of components * from all those that are available. */ int pmix_plog_base_select(void) @@ -45,11 +45,11 @@ int pmix_plog_base_select(void) char *ptr; size_t len; - if (selected) { + if (pmix_plog_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_plog_globals.selected = true; PMIX_CONSTRUCT(&actives, pmix_list_t); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c index 5d3419a616..e8d6060d34 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -9,9 +9,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default.c index ac4cf4fec0..96d8a4277b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_SYS_TIME_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default_component.c index c475e7c697..4a88a87787 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/plog_default_component.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ * includes */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "plog_default.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/plog.h b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/plog.h index 3c1ba6defb..6552d18f8a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/plog.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/plog.h @@ -1,7 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -26,8 +26,8 @@ #ifndef PMIX_PLOG_H #define PMIX_PLOG_H -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/class/pmix_list.h" #include "src/mca/mca.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c index f7dfc65c7f..f0108517e8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_SYS_TIME_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd_component.c index 9fb69c18c3..dde6a1411e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd_component.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ * includes */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "plog_stdfd.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c index 3da5dea649..14ff3f721d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_TIME_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog_component.c index 814c15d0db..0b7ba27c88 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog_component.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +12,7 @@ * includes */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #ifdef HAVE_SYSLOG_H #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h index d832bf5478..3c5a868056 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #ifndef PMIX_PNET_BASE_H_ #define PMIX_PNET_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -99,11 +99,27 @@ typedef struct { } pmix_pnet_job_t; PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_pnet_job_t); +typedef struct { + pmix_list_item_t super; + char *name; + size_t index; + /* provide access to the component + * APIs that are managing this + * fabric plane */ + pmix_pnet_module_t *module; + /* allow the component to add + * whatever structures it needs */ + void *payload; +} pmix_pnet_fabric_t; +PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_pnet_fabric_t); + /* framework globals */ struct pmix_pnet_globals_t { pmix_lock_t lock; pmix_list_t actives; + pmix_list_t fabrics; bool initialized; + bool selected; pmix_list_t jobs; pmix_list_t nodes; }; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c index adc11e9e4a..27c0190d85 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 Research Organization for Information Science @@ -13,9 +13,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" @@ -28,7 +28,7 @@ #include "src/mca/pnet/base/base.h" -static pmix_status_t process_maps(char *nspace, char *nregex, char *pregex); +static pmix_status_t process_maps(char *nspace, char **nodes, char **procs); /* NOTE: a tool (e.g., prun) may call this function to * harvest local envars for inclusion in a call to @@ -39,11 +39,10 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, pmix_list_t *ilist) { pmix_pnet_base_active_module_t *active; - pmix_status_t rc = PMIX_SUCCESS; + pmix_status_t rc; pmix_namespace_t *nptr, *ns; size_t n; - char *nregex, *pregex; - char *params[2] = {"PMIX_MCA_", NULL}; + char **nodes, **procs; if (!pmix_pnet_globals.initialized) { return PMIX_ERR_INIT; @@ -56,7 +55,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, if (NULL == nspace || NULL == ilist) { return PMIX_ERR_BAD_PARAM; } - if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SCHEDULER(pmix_globals.mypeer)) { nptr = NULL; /* find this nspace - note that it may not have * been registered yet */ @@ -78,16 +77,22 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, if (NULL != info) { /* check for description of the node and proc maps */ - nregex = NULL; - pregex = NULL; + nodes = NULL; + procs = NULL; for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN)) { - nregex = info[n].value.data.string; - } else if (0 == strncmp(info[n].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN)) { - pregex = info[n].value.data.string; + if (PMIX_CHECK_KEY(&info[n], PMIX_NODE_MAP)) { + rc = pmix_preg.parse_nodes(info[n].value.data.bo.bytes, &nodes); + if (PMIX_SUCCESS != rc) { + return rc; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_PROC_MAP)) { + rc = pmix_preg.parse_procs(info[n].value.data.bo.bytes, &procs); + if (PMIX_SUCCESS != rc) { + return rc; + } } } - if (NULL != nregex && NULL != pregex) { + if (NULL != nodes && NULL != procs) { /* assemble the pnet node and proc descriptions * NOTE: this will eventually be folded into the * new shared memory system, but we do it here @@ -95,32 +100,29 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, * the host will not have registered the clients * and nspace prior to calling allocate */ - rc = process_maps(nspace, nregex, pregex); + rc = process_maps(nspace, nodes, procs); + pmix_argv_free(nodes); + pmix_argv_free(procs); if (PMIX_SUCCESS != rc) { return rc; } } /* process the allocation request */ - for (n=0; n < ninfo; n++) { - PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { - if (NULL != active->module->allocate) { - if (PMIX_SUCCESS == (rc = active->module->allocate(nptr, &info[n], ilist))) { - break; - } - if (PMIX_ERR_TAKE_NEXT_OPTION != rc) { - /* true error */ - return rc; - } + PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { + if (NULL != active->module->allocate) { + if (PMIX_SUCCESS == (rc = active->module->allocate(nptr, info, ninfo, ilist))) { + break; + } + if (PMIX_ERR_TAKE_NEXT_OPTION != rc) { + /* true error */ + return rc; } } } } } - /* add any local PMIx MCA params */ - rc = pmix_pnet_base_harvest_envars(params, NULL, ilist); - - return rc; + return PMIX_SUCCESS; } /* can only be called by a server */ @@ -531,76 +533,10 @@ void pmix_pnet_base_deliver_inventory(pmix_info_t info[], size_t ninfo, return; } -pmix_status_t pmix_pnet_base_harvest_envars(char **incvars, char **excvars, - pmix_list_t *ilist) + +static pmix_status_t process_maps(char *nspace, char **nodes, char **procs) { - int i, j; - size_t len; - pmix_kval_t *kv, *next; - char *cs_env, *string_key; - - /* harvest envars to pass along */ - for (j=0; NULL != incvars[j]; j++) { - len = strlen(incvars[j]); - if ('*' == incvars[j][len-1]) { - --len; - } - for (i = 0; NULL != environ[i]; ++i) { - if (0 == strncmp(environ[i], incvars[j], len)) { - cs_env = strdup(environ[i]); - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - free(cs_env); - return PMIX_ERR_OUT_OF_RESOURCE; - } - kv->key = strdup(PMIX_SET_ENVAR); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - free(cs_env); - return PMIX_ERR_OUT_OF_RESOURCE; - } - kv->value->type = PMIX_ENVAR; - string_key = strchr(cs_env, '='); - if (NULL == string_key) { - free(cs_env); - PMIX_RELEASE(kv); - return PMIX_ERR_BAD_PARAM; - } - *string_key = '\0'; - ++string_key; - pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, - "pnet: adding envar %s", cs_env); - PMIX_ENVAR_LOAD(&kv->value->data.envar, cs_env, string_key, ':'); - pmix_list_append(ilist, &kv->super); - free(cs_env); - } - } - } - - /* now check the exclusions and remove any that match */ - if (NULL != excvars) { - for (j=0; NULL != excvars[j]; j++) { - len = strlen(excvars[j]); - if ('*' == excvars[j][len-1]) { - --len; - } - PMIX_LIST_FOREACH_SAFE(kv, next, ilist, pmix_kval_t) { - if (0 == strncmp(kv->value->data.envar.envar, excvars[j], len)) { - pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, - "pnet: excluding envar %s", kv->value->data.envar.envar); - pmix_list_remove_item(ilist, &kv->super); - PMIX_RELEASE(kv); - } - } - } - } - return PMIX_SUCCESS; -} - -static pmix_status_t process_maps(char *nspace, char *nregex, char *pregex) -{ - char **nodes, **procs, **ranks; + char **ranks; pmix_status_t rc; size_t m, n; pmix_pnet_job_t *jptr, *job; @@ -610,21 +546,14 @@ static pmix_status_t process_maps(char *nspace, char *nregex, char *pregex) PMIX_ACQUIRE_THREAD(&pmix_pnet_globals.lock); - /* parse the regex to get the argv array of node names */ - if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(nregex, &nodes))) { + /* bozo check */ + if (pmix_argv_count(nodes) != pmix_argv_count(procs)) { + rc = PMIX_ERR_BAD_PARAM; PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_pnet_globals.lock); return rc; } - /* parse the regex to get the argv array of proc ranks on each node */ - if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(pregex, &procs))) { - PMIX_ERROR_LOG(rc); - pmix_argv_free(nodes); - PMIX_RELEASE_THREAD(&pmix_pnet_globals.lock); - return rc; - } - /* see if we already know about this job */ job = NULL; if (0 < pmix_list_get_size(&pmix_pnet_globals.jobs)) { @@ -697,9 +626,6 @@ static pmix_status_t process_maps(char *nspace, char *nregex, char *pregex) pmix_argv_free(ranks); } - pmix_argv_free(nodes); - pmix_argv_free(procs); - PMIX_RELEASE_THREAD(&pmix_pnet_globals.lock); return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_frame.c index 0c8295fae7..759e3762e0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +23,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -64,6 +64,7 @@ static pmix_status_t pmix_pnet_close(void) return PMIX_SUCCESS; } pmix_pnet_globals.initialized = false; + pmix_pnet_globals.selected = false; PMIX_LIST_FOREACH_SAFE(active, prev, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { pmix_list_remove_item(&pmix_pnet_globals.actives, &active->super); @@ -73,6 +74,7 @@ static pmix_status_t pmix_pnet_close(void) PMIX_RELEASE(active); } PMIX_DESTRUCT(&pmix_pnet_globals.actives); + PMIX_DESTRUCT(&pmix_pnet_globals.fabrics); PMIX_LIST_DESTRUCT(&pmix_pnet_globals.jobs); PMIX_LIST_DESTRUCT(&pmix_pnet_globals.nodes); @@ -88,6 +90,7 @@ static pmix_status_t pmix_pnet_open(pmix_mca_base_open_flag_t flags) PMIX_CONSTRUCT_LOCK(&pmix_pnet_globals.lock); pmix_pnet_globals.lock.active = false; PMIX_CONSTRUCT(&pmix_pnet_globals.actives, pmix_list_t); + PMIX_CONSTRUCT(&pmix_pnet_globals.fabrics, pmix_list_t); PMIX_CONSTRUCT(&pmix_pnet_globals.jobs, pmix_list_t); PMIX_CONSTRUCT(&pmix_pnet_globals.nodes, pmix_list_t); @@ -181,3 +184,20 @@ static void rdes(pmix_pnet_resource_t *p) PMIX_CLASS_INSTANCE(pmix_pnet_resource_t, pmix_list_item_t, rcon, rdes); + +static void ftcon(pmix_pnet_fabric_t *p) +{ + p->name = NULL; + p->index = 0; + p->module = NULL; + p->payload = NULL; +} +static void ftdes(pmix_pnet_fabric_t *p) +{ + if (NULL != p->name) { + free(p->name); + } +} +PMIX_CLASS_INSTANCE(pmix_pnet_fabric_t, + pmix_list_item_t, + ftcon, ftdes); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_select.c index f751146948..b1da2aaf97 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -27,8 +29,6 @@ #include "src/mca/pnet/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_pnet_base_select(void) @@ -41,11 +41,11 @@ int pmix_pnet_base_select(void) int rc, priority; bool inserted; - if (selected) { + if (pmix_pnet_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_pnet_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_pnet_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am deleted file mode 100644 index fe01cde836..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am +++ /dev/null @@ -1,59 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = $(pnet_opa_CPPFLAGS) - -headers = pnet_opa.h -sources = \ - pnet_opa_component.c \ - pnet_opa.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_pmix_pnet_opa_DSO -lib = -lib_sources = -component = mca_pnet_opa.la -component_sources = $(headers) $(sources) -else -lib = libmca_pnet_opa.la -lib_sources = $(headers) $(sources) -component = -component_sources = -endif - -mcacomponentdir = $(pmixlibdir) -mcacomponent_LTLIBRARIES = $(component) -mca_pnet_opa_la_SOURCES = $(component_sources) -mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) -mca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS) -if NEED_LIBPMIX -mca_pnet_opa_la_LIBADD += $(top_builddir)/src/libpmix.la -endif - -noinst_LTLIBRARIES = $(lib) -libmca_pnet_opa_la_SOURCES = $(lib_sources) -libmca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) -libmca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 deleted file mode 100644 index f613cba102..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 +++ /dev/null @@ -1,110 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2013 Sandia National Laboratories. All rights reserved. -# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_pnet_opa_CONFIG([action-if-can-compile], -# [action-if-cant-compile]) -# ------------------------------------------------ -AC_DEFUN([MCA_pmix_pnet_opa_CONFIG],[ - AC_CONFIG_FILES([src/mca/pnet/opa/Makefile]) - - PMIX_CHECK_PSM2([pnet_opa], - [pnet_opa_happy="yes"], - [pnet_opa_happy="no"]) - - AC_ARG_WITH([opamgt], - [AC_HELP_STRING([--with-opamgt(=DIR)], - [Build OmniPath Fabric Management support (optionally adding DIR/include, DIR/include/opamgt, DIR/lib, and DIR/lib64 to the search path for headers and libraries])], [], [with_opamgt=no]) - - AC_ARG_WITH([opamgt-libdir], - [AC_HELP_STRING([--with-opamgt-libdir=DIR], - [Search for OmniPath Fabric Management libraries in DIR])]) - - pmix_check_opamgt_save_CPPFLAGS="$CPPFLAGS" - pmix_check_opamgt_save_LDFLAGS="$LDFLAGS" - pmix_check_opamgt_save_LIBS="$LIBS" - - pmix_check_opamgt_libdir= - pmix_check_opamgt_dir= - - AC_MSG_CHECKING([if opamgt requested]) - AS_IF([test "$with_opamgt" = "no"], - [AC_MSG_RESULT([no]) - pmix_check_opamgt_happy=no], - [AC_MSG_RESULT([yes]) - PMIX_CHECK_WITHDIR([opamgt-libdir], [$with_opamgt_libdir], [libopamgt.*]) - AS_IF([test ! -z "$with_opamgt" && test "$with_opamgt" != "yes"], - [pmix_check_opamgt_dir="$with_opamgt" - AS_IF([test ! -d "$pmix_check_opamgt_dir" || test ! -f "$pmix_check_opamgt_dir/opamgt.h"], - [$pmix_check_opamgt_dir=$pmix_check_opamgt_dir/include - AS_IF([test ! -d "$pmix_check_opamgt_dir" || test ! -f "$pmix_check_opamgt_dir/opamgt.h"], - [$pmix_check_opamgt_dir=$pmix_check_opamgt_dir/opamgt - AS_IF([test ! -d "$pmix_check_opamgt_dir" || test ! -f "$pmix_check_opamgt_dir/opamgt.h"], - [AC_MSG_WARN([OmniPath Fabric Management support requested, but]) - AC_MSG_WARN([required header file opamgt.h not found. Locations tested:]) - AC_MSG_WARN([ $with_opamgt]) - AC_MSG_WARN([ $with_opamgt/include]) - AC_MSG_WARN([ $with_opamgt/include/opamgt]) - AC_MSG_ERROR([Cannot continue])])])])], - [pmix_check_opamgt_dir="/usr/include/opamgt"]) - - AS_IF([test ! -z "$with_opamgt_libdir" && test "$with_opamgt_libdir" != "yes"], - [pmix_check_opamgt_libdir="$with_opamgt_libdir"]) - - # no easy way to check this, so let's ensure that the - # full opamgt install was done, including the iba support - AS_IF([test ! -d "$pmix_check_opamgt_dir/iba" || test ! -f "$pmix_check_opamgt_dir/iba/vpi.h"], - [pmix_check_opamgt_happy="no"], - [PMIX_CHECK_PACKAGE([pnet_opamgt], - [opamgt.h], - [opamgt], - [omgt_query_sa], - [], - [$pmix_check_opamgt_dir], - [$pmix_check_opamgt_libdir], - [pmix_check_opamgt_happy="yes" - pnet_opa_CFLAGS="$pnet_opa_CFLAGS $pnet_opamgt_CFLAGS" - pnet_opa_CPPFLAGS="$pnet_opa_CPPFLAGS $pnet_opamgt_CPPFLAGS" - pnet_opa_LDFLAGS="$pnet_opa_LDFLAGS $pnet_opamgt_LDFLAGS" - pnet_opa_LIBS="$pnet_opa_LIBS $pnet_opamgt_LIBS"], - [pmix_check_opamgt_happy="no"])]) - ]) - - AS_IF([test "$pmix_check_opamgt_happy" = "yes"], - [pmix_want_opamgt=1], - [pmix_want_opamgt=0]) - AC_DEFINE_UNQUOTED([PMIX_WANT_OPAMGT], [$pmix_want_opamgt], - [Whether or not to include OmniPath Fabric Manager support]) - - CPPFLAGS="$pmix_check_opamgt_save_CPPFLAGS" - LDFLAGS="$pmix_check_opamgt_save_LDFLAGS" - LIBS="$pmix_check_opamgt_save_LIBS" - - AS_IF([test "$pnet_opa_happy" = "yes"], - [$1], - [$2]) - - # substitute in the things needed to build psm2 - AC_SUBST([pnet_opa_CFLAGS]) - AC_SUBST([pnet_opa_CPPFLAGS]) - AC_SUBST([pnet_opa_LDFLAGS]) - AC_SUBST([pnet_opa_LIBS]) -])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c deleted file mode 100644 index c7ae927625..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c +++ /dev/null @@ -1,738 +0,0 @@ -/* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include - -#if PMIX_WANT_OPAMGT -#include -#include -#endif - -#include - -#include "src/mca/base/pmix_mca_base_var.h" -#include "src/class/pmix_list.h" -#include "src/include/pmix_socket_errno.h" -#include "src/include/pmix_globals.h" -#include "src/class/pmix_list.h" -#include "src/util/alfg.h" -#include "src/util/argv.h" -#include "src/util/error.h" -#include "src/util/output.h" -#include "src/util/pmix_environ.h" -#include "src/mca/preg/preg.h" -#include "src/hwloc/hwloc-internal.h" - -#include "src/mca/pnet/pnet.h" -#include "src/mca/pnet/base/base.h" -#include "pnet_opa.h" - -static pmix_status_t opa_init(void); -static void opa_finalize(void); -static pmix_status_t allocate(pmix_namespace_t *nptr, - pmix_info_t *info, - pmix_list_t *ilist); -static pmix_status_t setup_local_network(pmix_namespace_t *nptr, - pmix_info_t info[], - size_t ninfo); -static pmix_status_t setup_fork(pmix_namespace_t *nptr, - const pmix_proc_t *proc, - char ***env); -static void child_finalized(pmix_proc_t *peer); -static void local_app_finalized(pmix_namespace_t *nptr); -static void deregister_nspace(pmix_namespace_t *nptr); -static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, - pmix_inventory_cbfunc_t cbfunc, void *cbdata); -static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, - pmix_info_t directives[], size_t ndirs, - pmix_op_cbfunc_t cbfunc, void *cbdata); - -pmix_pnet_module_t pmix_opa_module = { - .name = "opa", - .init = opa_init, - .finalize = opa_finalize, - .allocate = allocate, - .setup_local_network = setup_local_network, - .setup_fork = setup_fork, - .child_finalized = child_finalized, - .local_app_finalized = local_app_finalized, - .deregister_nspace = deregister_nspace, - .collect_inventory = collect_inventory, - .deliver_inventory = deliver_inventory -}; - -/* local object definitions */ -typedef struct { - pmix_list_item_t super; - char *name; - char *value; -} opa_attr_t; -static void atcon(opa_attr_t *p) -{ - p->name = NULL; - p->value = NULL; -} -static void atdes(opa_attr_t *p) -{ - if (NULL != p->name) { - free(p->name); - } - if (NULL != p->value) { - free(p->value); - } -} -static PMIX_CLASS_INSTANCE(opa_attr_t, - pmix_list_item_t, - atcon, atdes); - -typedef struct { - pmix_list_item_t super; - char *device; - pmix_list_t attributes; -} opa_resource_t; -static void rcon(opa_resource_t *p) -{ - p->device = NULL; - PMIX_CONSTRUCT(&p->attributes, pmix_list_t); -} -static void rdes(opa_resource_t *p) -{ - if (NULL != p->device) { - free(p->device); - } - PMIX_LIST_DESTRUCT(&p->attributes); -} -static PMIX_CLASS_INSTANCE(opa_resource_t, - pmix_list_item_t, - rcon, rdes); - - -static pmix_status_t opa_init(void) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: opa init"); - return PMIX_SUCCESS; -} - -static void opa_finalize(void) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: opa finalize"); -} - -/* some network transports require a little bit of information to - * "pre-condition" them - i.e., to setup their individual transport - * connections so they can generate their endpoint addresses. This - * function provides a means for doing so. The resulting info is placed - * into the app_context's env array so it will automatically be pushed - * into the environment of every MPI process when launched. - */ - -static inline void transports_use_rand(uint64_t* unique_key) { - pmix_rng_buff_t rng; - pmix_srand(&rng,(unsigned int)time(NULL)); - unique_key[0] = pmix_rand(&rng); - unique_key[1] = pmix_rand(&rng); -} - -static char* transports_print(uint64_t *unique_key) -{ - unsigned int *int_ptr; - size_t i, j, string_key_len, written_len; - char *string_key = NULL, *format = NULL; - - /* string is two 64 bit numbers printed in hex with a dash between - * and zero padding. - */ - string_key_len = (sizeof(uint64_t) * 2) * 2 + strlen("-") + 1; - string_key = (char*) malloc(string_key_len); - if (NULL == string_key) { - return NULL; - } - - string_key[0] = '\0'; - written_len = 0; - - /* get a format string based on the length of an unsigned int. We - * want to have zero padding for sizeof(unsigned int) * 2 - * characters -- when printing as a hex number, each byte is - * represented by 2 hex characters. Format will contain something - * that looks like %08lx, where the number 8 might be a different - * number if the system has a different sized long (8 would be for - * sizeof(int) == 4)). - */ - if (0 > asprintf(&format, "%%0%dx", (int)(sizeof(unsigned int)) * 2)) { - return NULL; - } - - /* print the first number */ - int_ptr = (unsigned int*) &unique_key[0]; - for (i = 0 ; i < sizeof(uint64_t) / sizeof(unsigned int) ; ++i) { - if (0 == int_ptr[i]) { - /* inject some energy */ - for (j=0; j < sizeof(unsigned int); j++) { - int_ptr[i] |= j << j; - } - } - snprintf(string_key + written_len, - string_key_len - written_len, - format, int_ptr[i]); - written_len = strlen(string_key); - } - - /* print the middle dash */ - snprintf(string_key + written_len, string_key_len - written_len, "-"); - written_len = strlen(string_key); - - /* print the second number */ - int_ptr = (unsigned int*) &unique_key[1]; - for (i = 0 ; i < sizeof(uint64_t) / sizeof(unsigned int) ; ++i) { - if (0 == int_ptr[i]) { - /* inject some energy */ - for (j=0; j < sizeof(unsigned int); j++) { - int_ptr[i] |= j << j; - } - } - snprintf(string_key + written_len, - string_key_len - written_len, - format, int_ptr[i]); - written_len = strlen(string_key); - } - free(format); - - return string_key; -} - -/* NOTE: if there is any binary data to be transferred, then - * this function MUST pack it for transport as the host will - * not know how to do so */ -static pmix_status_t allocate(pmix_namespace_t *nptr, - pmix_info_t *info, - pmix_list_t *ilist) -{ - uint64_t unique_key[2]; - char *string_key, *cs_env; - int fd_rand; - size_t bytes_read; - pmix_kval_t *kv; - bool envars, seckeys; - pmix_status_t rc; - - envars = false; - seckeys = false; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa:allocate for nspace %s", nptr->nspace); - - if (NULL == info) { - return PMIX_ERR_TAKE_NEXT_OPTION; - } - - if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ENVARS)) { - envars = PMIX_INFO_TRUE(info); - } else if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ALL)) { - envars = PMIX_INFO_TRUE(info); - seckeys = PMIX_INFO_TRUE(info); - } else if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_NONENVARS) || - PMIX_CHECK_KEY(info, PMIX_ALLOC_NETWORK_SEC_KEY)) { - seckeys = PMIX_INFO_TRUE(info); - } - - if (seckeys) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: opa providing seckeys"); - /* put the number here - or else create an appropriate string. this just needs to - * eventually be a string variable - */ - if(-1 == (fd_rand = open("/dev/urandom", O_RDONLY))) { - transports_use_rand(unique_key); - } else { - bytes_read = read(fd_rand, (char *) unique_key, 16); - if(bytes_read != 16) { - transports_use_rand(unique_key); - } - close(fd_rand); - } - - if (NULL == (string_key = transports_print(unique_key))) { - PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); - return PMIX_ERR_OUT_OF_RESOURCE; - } - - if (PMIX_SUCCESS != pmix_mca_base_var_env_name("opa_precondition_transports", &cs_env)) { - PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); - free(string_key); - return PMIX_ERR_OUT_OF_RESOURCE; - } - - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - free(string_key); - free(cs_env); - return PMIX_ERR_OUT_OF_RESOURCE; - } - kv->key = strdup(PMIX_SET_ENVAR); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - free(string_key); - free(cs_env); - PMIX_RELEASE(kv); - return PMIX_ERR_OUT_OF_RESOURCE; - } - kv->value->type = PMIX_ENVAR; - PMIX_ENVAR_LOAD(&kv->value->data.envar, cs_env, string_key, ':'); - pmix_list_append(ilist, &kv->super); - free(cs_env); - free(string_key); - if (!envars) { - /* providing envars does not constitute allocating resources */ - return PMIX_ERR_TAKE_NEXT_OPTION; - } - } - - if (envars) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: opa harvesting envars %s excluding %s", - (NULL == mca_pnet_opa_component.incparms) ? "NONE" : mca_pnet_opa_component.incparms, - (NULL == mca_pnet_opa_component.excparms) ? "NONE" : mca_pnet_opa_component.excparms); - /* harvest envars to pass along */ - if (NULL != mca_pnet_opa_component.include) { - rc = pmix_pnet_base_harvest_envars(mca_pnet_opa_component.include, - mca_pnet_opa_component.exclude, - ilist); - if (PMIX_SUCCESS == rc) { - return PMIX_ERR_TAKE_NEXT_OPTION; - } - return rc; - } - } - - /* we don't currently manage OPA resources */ - return PMIX_ERR_TAKE_NEXT_OPTION; -} - -static pmix_status_t setup_local_network(pmix_namespace_t *nptr, - pmix_info_t info[], - size_t ninfo) -{ - size_t n; - pmix_kval_t *kv; - - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: opa setup_local_network"); - - if (NULL != info) { - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_PNET_OPA_BLOB, PMIX_MAX_KEYLEN)) { - /* the byte object contains a packed blob that needs to be - * cached until we determine we have local procs for this - * nspace, and then delivered to the local OPA driver when - * we have a means for doing so */ - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(info[n].key); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - pmix_value_xfer(kv->value, &info[n].value); - if (PMIX_ENVAR == kv->value->type) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa:setup_local_network adding %s=%s to environment", - kv->value->data.envar.envar, kv->value->data.envar.value); - } else { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa:setup_local_network loading blob"); - } - pmix_list_append(&nptr->setup_data, &kv->super); - } - } - } - - return PMIX_SUCCESS; -} - -static pmix_status_t setup_fork(pmix_namespace_t *nptr, - const pmix_proc_t *proc, - char ***env) -{ - pmix_kval_t *kv, *next; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: opa setup fork"); - - /* if there are any cached nspace prep blobs, execute them, - * ensuring that we only do so once per nspace - note that - * we don't expect to find any envars here, though we could - * have included some if we needed to set them per-client */ - PMIX_LIST_FOREACH_SAFE(kv, next, &nptr->setup_data, pmix_kval_t) { - if (0 == strcmp(kv->key, PMIX_PNET_OPA_BLOB)) { - pmix_list_remove_item(&nptr->setup_data, &kv->super); - /* deliver to the local lib */ - PMIX_RELEASE(kv); - } - } - return PMIX_SUCCESS; -} - -static void child_finalized(pmix_proc_t *peer) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa child finalized"); -} - -static void local_app_finalized(pmix_namespace_t *nptr) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa app finalized"); - -} - -static void deregister_nspace(pmix_namespace_t *nptr) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa deregister nspace"); - -} - -static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, - pmix_inventory_cbfunc_t cbfunc, void *cbdata) -{ - pmix_inventory_rollup_t *cd = (pmix_inventory_rollup_t*)cbdata; -#if PMIX_HAVE_HWLOC - hwloc_obj_t obj; -#endif - unsigned n; - pmix_status_t rc; - pmix_kval_t *kv; - pmix_buffer_t bucket, pbkt; - bool found = false; - pmix_byte_object_t pbo; - char nodename[PMIX_MAXHOSTNAMELEN] = {0}, *foo; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa collect inventory"); - - /* setup the bucket - we will pass the results as a blob */ - PMIX_CONSTRUCT(&bucket, pmix_buffer_t); - /* pack our node name */ - gethostname(nodename, sizeof(nodename)-1); - foo = &nodename[0]; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &foo, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&bucket); - return rc; - } - -#if PMIX_HAVE_HWLOC - if (NULL == pmix_hwloc_topology) { - goto query; - } - - /* search the topology for OPA devices */ - obj = hwloc_get_next_osdev(pmix_hwloc_topology, NULL); - while (NULL != obj) { - if (obj->attr->osdev.type != HWLOC_OBJ_OSDEV_OPENFABRICS || - 0 != strncmp(obj->name, "hfi", 3)) { - obj = hwloc_get_next_osdev(pmix_hwloc_topology, obj); - continue; - } - found = true; - if (9 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) { - /* dump the discovered node resources */ - pmix_output(0, "OPA resource discovered on node: %s", nodename); - pmix_output(0, "\tDevice name: %s", obj->name); - for (n=0; n < obj->infos_count; n++) { - pmix_output(0, "\t\t%s: %s", obj->infos[n].name, obj->infos[n].value); - } - } - /* pack the name of the device */ - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &obj->name, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&bucket); - return rc; - } - /* pack the number of attributes */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &obj->infos_count, 1, PMIX_UINT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&bucket); - return rc; - } - /* pack each descriptive object */ - for (n=0; n < obj->infos_count; n++) { - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &obj->infos[n].name, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&bucket); - return rc; - } - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &obj->infos[n].value, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&bucket); - return rc; - } - } - /* extract the resulting blob - this is a device unit */ - PMIX_UNLOAD_BUFFER(&pbkt, pbo.bytes, pbo.size); - /* now load that into the blob */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &pbo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_BYTE_OBJECT_DESTRUCT(&pbo); - PMIX_DESTRUCT(&bucket); - return rc; - } - obj = hwloc_get_next_osdev(pmix_hwloc_topology, obj); - } - - query: -#if 0 -#if PMIX_WANT_OPAMGT - if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - /* collect the switch information from the FM */ - OMGT_STATUS_T status = OMGT_STATUS_SUCCESS; - struct omgt_port * port = NULL; - omgt_sa_selector_t selector; - - /* create a session */ - status = omgt_open_port_by_num(&port, 1 /* hfi */, 1 /* port */, NULL); - if (OMGT_STATUS_SUCCESS != status) { - pmix_output_verbose(1, pmix_pnet_base_framework.framework_output, - "Unable to open port to FM"); - goto complete; - } - /* specify how and what we want to query by */ - selector.InputType = InputTypeLid; - selector.InputValue.PortInfoRecord.Lid = 1; - - } -#endif -#endif - /* if we found any devices, then return the blob */ - if (!found) { - PMIX_DESTRUCT(&bucket); - return PMIX_ERR_TAKE_NEXT_OPTION; - } - - /* extract the resulting blob */ - PMIX_UNLOAD_BUFFER(&bucket, pbo.bytes, pbo.size); - kv = PMIX_NEW(pmix_kval_t); - kv->key = strdup(PMIX_OPA_INVENTORY_KEY); - PMIX_VALUE_CREATE(kv->value, 1); - pmix_value_load(kv->value, &pbo, PMIX_BYTE_OBJECT); - PMIX_BYTE_OBJECT_DESTRUCT(&pbo); - pmix_list_append(&cd->payload, &kv->super); - -#else // have_hwloc -#if 0 -#if PMIX_WANT_OPAMGT - if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - /* query the FM for the inventory */ - } - - complete: - /* if we found any devices, then return the blob */ - if (!found) { - PMIX_DESTRUCT(&bucket); - return PMIX_ERR_TAKE_NEXT_OPTION; - } - - /* extract the resulting blob */ - PMIX_UNLOAD_BUFFER(&bucket, pbo.bytes, pbo.size); - kv = PMIX_NEW(pmix_kval_t); - kv->key = strdup(PMIX_OPA_INVENTORY_KEY); - PMIX_VALUE_CREATE(kv->value, 1); - pmix_value_load(kv->value, &pbo, PMIX_BYTE_OBJECT); - PMIX_BYTE_OBJECT_DESTRUCT(&pbo); - pmix_list_append(&cd->payload, &kv->super); - -#endif -#endif - return PMIX_ERR_TAKE_NEXT_OPTION; -#endif // have_hwloc - - return PMIX_SUCCESS; -} - -static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, - pmix_info_t directives[], size_t ndirs, - pmix_op_cbfunc_t cbfunc, void *cbdata) -{ - pmix_buffer_t bkt, pbkt; - size_t n; - int32_t cnt; - unsigned m, nattrs; - char *hostname; - pmix_byte_object_t pbo; - pmix_pnet_node_t *nd, *ndptr; - pmix_pnet_resource_t *lt, *lst; - opa_attr_t *attr; - opa_resource_t *res; - pmix_status_t rc; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:opa deliver inventory"); - - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_OPA_INVENTORY_KEY, PMIX_MAX_KEYLEN)) { - /* this is our inventory in the form of a blob */ - PMIX_CONSTRUCT(&bkt,pmix_buffer_t); - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, - info[n].value.data.bo.bytes, - info[n].value.data.bo.size); - /* first is the host this came from */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &hostname, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - /* must _not_ destruct bkt as we don't - * own the bytes! */ - return rc; - } - /* do we already have this node? */ - nd = NULL; - PMIX_LIST_FOREACH(ndptr, &pmix_pnet_globals.nodes, pmix_pnet_node_t) { - if (0 == strcmp(hostname, ndptr->name)) { - nd = ndptr; - break; - } - } - if (NULL == nd) { - nd = PMIX_NEW(pmix_pnet_node_t); - nd->name = strdup(hostname); - pmix_list_append(&pmix_pnet_globals.nodes, &nd->super); - } - /* does this node already have an OPA entry? */ - lst = NULL; - PMIX_LIST_FOREACH(lt, &nd->resources, pmix_pnet_resource_t) { - if (0 == strcmp(lt->name, "opa")) { - lst = lt; - break; - } - } - if (NULL == lst) { - lst = PMIX_NEW(pmix_pnet_resource_t); - lst->name = strdup("opa"); - pmix_list_append(&nd->resources, &lst->super); - } - /* each device was packed as a "blob" */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &pbo, &cnt, PMIX_BYTE_OBJECT); - while (PMIX_SUCCESS == rc) { - /* load the blob for unpacking */ - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, - pbo.bytes, pbo.size); - - res = PMIX_NEW(opa_resource_t); - /* starts with the name of the device */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &pbkt, &res->device, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_RELEASE(res); - return rc; - } - /* next comes the numbers of attributes for that device */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &pbkt, &nattrs, &cnt, PMIX_UINT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_RELEASE(res); - return rc; - } - for (m=0; m < nattrs; m++) { - attr = PMIX_NEW(opa_attr_t); - /* unpack the name of the attribute */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &pbkt, &attr->name, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_RELEASE(attr); - PMIX_RELEASE(res); - return rc; - } - /* unpack the attribute value */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &pbkt, &attr->value, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_RELEASE(attr); - PMIX_RELEASE(res); - return rc; - } - pmix_list_append(&res->attributes, &attr->super); - } - pmix_list_append(&lst->resources, &res->super); - PMIX_DESTRUCT(&pbkt); - - /* get the next device unit */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &pbo, &cnt, PMIX_BYTE_OBJECT); - } - if (5 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) { - /* dump the resulting node resources */ - pmix_output(0, "OPA resources for node: %s", nd->name); - PMIX_LIST_FOREACH(lt, &nd->resources, pmix_pnet_resource_t) { - if (0 == strcmp(lt->name, "opa")) { - PMIX_LIST_FOREACH(res, <->resources, opa_resource_t) { - pmix_output(0, "\tDevice: %s", res->device); - PMIX_LIST_FOREACH(attr, &res->attributes, opa_attr_t) { - pmix_output(0, "\t\t%s: %s", attr->name, attr->value); - } - } - } - } - } - } - } - - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h deleted file mode 100644 index 6340d9f225..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_PNET_OPA_H -#define PMIX_PNET_OPA_H - -#include - - -#include "src/mca/pnet/pnet.h" - -BEGIN_C_DECLS - -typedef struct { - pmix_pnet_base_component_t super; - char *incparms; - char *excparms; - char **include; - char **exclude; -} pmix_pnet_opa_component_t; - -/* the component must be visible data for the linker to find it */ -PMIX_EXPORT extern pmix_pnet_opa_component_t mca_pnet_opa_component; -extern pmix_pnet_module_t pmix_opa_module; - -/* define a key for any blob we need to send in a launch msg */ -#define PMIX_PNET_OPA_BLOB "pmix.pnet.opa.blob" - -/* define an inventory key */ -#define PMIX_OPA_INVENTORY_KEY "pmix.opa.inventory" - -END_C_DECLS - -#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c deleted file mode 100644 index 5ef1572239..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * These symbols are in a file by themselves to provide nice linker - * semantics. Since linkers generally pull in symbols by object - * files, keeping these symbols as the only symbols in this file - * prevents utility programs such as "ompi_info" from having to import - * entire components just to query their version and parameters. - */ - -#include -#include "pmix_common.h" - -#include "src/util/argv.h" -#include "src/mca/pnet/pnet.h" -#include "pnet_opa.h" - -static pmix_status_t component_open(void); -static pmix_status_t component_close(void); -static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); -static pmix_status_t component_register(void); - -/* - * Instantiate the public struct with all of our public information - * and pointers to our public functions in it - */ -pmix_pnet_opa_component_t mca_pnet_opa_component = { - .super = { - .base = { - PMIX_PNET_BASE_VERSION_1_0_0, - - /* Component name and version */ - .pmix_mca_component_name = "opa", - PMIX_MCA_BASE_MAKE_VERSION(component, - PMIX_MAJOR_VERSION, - PMIX_MINOR_VERSION, - PMIX_RELEASE_VERSION), - - /* Component open and close functions */ - .pmix_mca_open_component = component_open, - .pmix_mca_close_component = component_close, - .pmix_mca_register_component_params = component_register, - .pmix_mca_query_component = component_query, - }, - .data = { - /* The component is checkpoint ready */ - PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT - } - }, - .include = NULL, - .exclude = NULL -}; - -static pmix_status_t component_register(void) -{ - pmix_mca_base_component_t *component = &mca_pnet_opa_component.super.base; - - mca_pnet_opa_component.incparms = "HFI_*,PSM2_*"; - (void)pmix_mca_base_component_var_register(component, "include_envars", - "Comma-delimited list of envars to harvest (\'*\' and \'?\' supported)", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - PMIX_INFO_LVL_2, - PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &mca_pnet_opa_component.incparms); - if (NULL != mca_pnet_opa_component.incparms) { - mca_pnet_opa_component.include = pmix_argv_split(mca_pnet_opa_component.incparms, ','); - } - - mca_pnet_opa_component.excparms = NULL; - (void)pmix_mca_base_component_var_register(component, "exclude_envars", - "Comma-delimited list of envars to exclude (\'*\' and \'?\' supported)", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - PMIX_INFO_LVL_2, - PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &mca_pnet_opa_component.excparms); - if (NULL != mca_pnet_opa_component.excparms) { - mca_pnet_opa_component.exclude = pmix_argv_split(mca_pnet_opa_component.excparms, ','); - } - - return PMIX_SUCCESS; -} - -static pmix_status_t component_open(void) -{ - return PMIX_SUCCESS; -} - - -static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority) -{ - *priority = 10; - *module = (pmix_mca_base_module_t *)&pmix_opa_module; - return PMIX_SUCCESS; -} - - -static pmix_status_t component_close(void) -{ - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h index fb5cc7d363..6d5b1e4acb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h @@ -4,7 +4,7 @@ * * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,7 +26,8 @@ #ifndef PMIX_PNET_H #define PMIX_PNET_H -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include "src/class/pmix_list.h" #include "src/mca/mca.h" @@ -61,7 +62,7 @@ typedef void (*pmix_pnet_base_module_fini_fn_t)(void); * for forwarding to compute nodes, or allocation of static endpts */ typedef pmix_status_t (*pmix_pnet_base_module_allocate_fn_t)(pmix_namespace_t *nptr, - pmix_info_t *info, + pmix_info_t info[], size_t ninfo, pmix_list_t *ilist); /** @@ -145,12 +146,14 @@ typedef pmix_status_t (*pmix_pnet_base_module_deliver_inventory_fn_t)(pmix_info_ pmix_info_t directives[], size_t ndirs, pmix_op_cbfunc_t cbfunc, void *cbdata); - /** - * Base structure for a PNET module + * Base structure for a PNET module. Each component should malloc a + * copy of the module structure for each fabric plane they support. */ typedef struct { char *name; + /* provide a pointer to plane-specific metadata */ + void *plane; /* init/finalize */ pmix_pnet_base_module_init_fn_t init; pmix_pnet_base_module_fini_fn_t finalize; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am deleted file mode 100644 index 048f34b0b6..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am +++ /dev/null @@ -1,59 +0,0 @@ -# -*- makefile -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = $(pnet_tcp_CPPFLAGS) - -headers = pnet_tcp.h -sources = \ - pnet_tcp_component.c \ - pnet_tcp.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_pmix_pnet_tcp_DSO -lib = -lib_sources = -component = mca_pnet_tcp.la -component_sources = $(headers) $(sources) -else -lib = libmca_pnet_tcp.la -lib_sources = $(headers) $(sources) -component = -component_sources = -endif - -mcacomponentdir = $(pmixlibdir) -mcacomponent_LTLIBRARIES = $(component) -mca_pnet_tcp_la_SOURCES = $(component_sources) -mca_pnet_tcp_la_LIBADD = $(pnet_tcp_LIBS) -mca_pnet_tcp_la_LDFLAGS = -module -avoid-version $(pnet_tcp_LDFLAGS) -if NEED_LIBPMIX -mca_pnet_tcp_la_LIBADD += $(top_builddir)/src/libpmix.la -endif - -noinst_LTLIBRARIES = $(lib) -libmca_pnet_tcp_la_SOURCES = $(lib_sources) -libmca_pnet_tcp_la_LIBADD = $(pnet_tcp_LIBS) -libmca_pnet_tcp_la_LDFLAGS = -module -avoid-version $(pnet_tcp_LDFLAGS) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c deleted file mode 100644 index 617a1c0455..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c +++ /dev/null @@ -1,1198 +0,0 @@ -/* - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include - -#include - -#include "src/include/pmix_socket_errno.h" -#include "src/include/pmix_globals.h" -#include "src/class/pmix_list.h" -#include "src/util/alfg.h" -#include "src/util/argv.h" -#include "src/util/error.h" -#include "src/util/output.h" -#include "src/util/parse_options.h" -#include "src/util/pif.h" -#include "src/util/pmix_environ.h" -#include "src/mca/preg/preg.h" - -#include "src/mca/pnet/base/base.h" -#include "pnet_tcp.h" - -#define PMIX_TCP_SETUP_APP_KEY "pmix.tcp.setup.app.key" -#define PMIX_TCP_INVENTORY_KEY "pmix.tcp.inventory" - -static pmix_status_t tcp_init(void); -static void tcp_finalize(void); -static pmix_status_t allocate(pmix_namespace_t *nptr, - pmix_info_t *info, - pmix_list_t *ilist); -static pmix_status_t setup_local_network(pmix_namespace_t *nptr, - pmix_info_t info[], - size_t ninfo); -static pmix_status_t setup_fork(pmix_namespace_t *nptr, - const pmix_proc_t *peer, char ***env); -static void child_finalized(pmix_proc_t *peer); -static void local_app_finalized(pmix_namespace_t *nptr); -static void deregister_nspace(pmix_namespace_t *nptr); -static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, - pmix_inventory_cbfunc_t cbfunc, void *cbdata); -static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, - pmix_info_t directives[], size_t ndirs, - pmix_op_cbfunc_t cbfunc, void *cbdata); - -pmix_pnet_module_t pmix_tcp_module = { - .name = "tcp", - .init = tcp_init, - .finalize = tcp_finalize, - .allocate = allocate, - .setup_local_network = setup_local_network, - .setup_fork = setup_fork, - .child_finalized = child_finalized, - .local_app_finalized = local_app_finalized, - .deregister_nspace = deregister_nspace, - .collect_inventory = collect_inventory, - .deliver_inventory = deliver_inventory -}; - -typedef struct { - pmix_list_item_t super; - char *device; - char *address; -} tcp_device_t; - -/* local tracker objects */ -typedef struct { - pmix_list_item_t super; - pmix_list_t devices; - char *type; - char *plane; - char **ports; - size_t nports; -} tcp_available_ports_t; - -typedef struct { - pmix_list_item_t super; - char *nspace; - char **ports; - tcp_available_ports_t *src; // source of the allocated ports -} tcp_port_tracker_t; - -static pmix_list_t allocations, available; -static pmix_status_t process_request(pmix_namespace_t *nptr, - char *idkey, int ports_per_node, - tcp_port_tracker_t *trk, - pmix_list_t *ilist); - -static void dcon(tcp_device_t *p) -{ - p->device = NULL; - p->address = NULL; -} -static void ddes(tcp_device_t *p) -{ - if (NULL != p->device) { - free(p->device); - } - if (NULL != p->address) { - free(p->address); - } -} -static PMIX_CLASS_INSTANCE(tcp_device_t, - pmix_list_item_t, - dcon, ddes); - -static void tacon(tcp_available_ports_t *p) -{ - PMIX_CONSTRUCT(&p->devices, pmix_list_t); - p->type = NULL; - p->plane = NULL; - p->ports = NULL; - p->nports = 0; -} -static void tades(tcp_available_ports_t *p) -{ - PMIX_LIST_DESTRUCT(&p->devices); - if (NULL != p->type) { - free(p->type); - } - if (NULL != p->plane) { - free(p->plane); - } - if (NULL != p->ports) { - pmix_argv_free(p->ports); - } -} -static PMIX_CLASS_INSTANCE(tcp_available_ports_t, - pmix_list_item_t, - tacon, tades); - -static void ttcon(tcp_port_tracker_t *p) -{ - p->nspace = NULL; - p->ports = NULL; - p->src = NULL; -} -static void ttdes(tcp_port_tracker_t *p) -{ - size_t n, m, mstart; - - if (NULL != p->nspace) { - free(p->nspace); - } - if (NULL != p->src) { - if (NULL != p->ports) { - mstart = 0; - for (n=0; NULL != p->ports[n]; n++) { - /* find an empty position */ - for (m=mstart; m < p->src->nports; m++) { - if (NULL == p->src->ports[m]) { - p->src->ports[m] = strdup(p->ports[n]); - mstart = m + 1; - break; - } - } - } - pmix_argv_free(p->ports); - } - PMIX_RELEASE(p->src); // maintain accounting - } else if (NULL != p->ports) { - pmix_argv_free(p->ports); - } -} -static PMIX_CLASS_INSTANCE(tcp_port_tracker_t, - pmix_list_item_t, - ttcon, ttdes); - -static pmix_status_t tcp_init(void) -{ - tcp_available_ports_t *trk; - char *p, **grps; - size_t n; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: tcp init"); - - /* if we are not the "gateway", then there is nothing - * for us to do */ - if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - return PMIX_SUCCESS; - } - - PMIX_CONSTRUCT(&allocations, pmix_list_t); - PMIX_CONSTRUCT(&available, pmix_list_t); - - /* if we have no static ports, then we don't have - * anything to manage. However, we cannot just disqualify - * ourselves as we may still need to provide inventory. - * - * NOTE: need to check inventory in addition to MCA param as - * the inventory may have reported back static ports */ - if (NULL == mca_pnet_tcp_component.static_ports) { - return PMIX_SUCCESS; - } - - /* split on semi-colons */ - grps = pmix_argv_split(mca_pnet_tcp_component.static_ports, ';'); - for (n=0; NULL != grps[n]; n++) { - trk = PMIX_NEW(tcp_available_ports_t); - if (NULL == trk) { - pmix_argv_free(grps); - return PMIX_ERR_NOMEM; - } - /* there must be at least one colon */ - if (NULL == (p = strrchr(grps[n], ':'))) { - pmix_argv_free(grps); - return PMIX_ERR_BAD_PARAM; - } - /* extract the ports */ - *p = '\0'; - ++p; - pmix_util_parse_range_options(p, &trk->ports); - trk->nports = pmix_argv_count(trk->ports); - /* see if they provided a plane */ - if (NULL != (p = strchr(grps[n], ':'))) { - /* yep - save the plane */ - *p = '\0'; - ++p; - trk->plane = strdup(p); - } - /* the type is just what is left at the front */ - trk->type = strdup(grps[n]); - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "TYPE: %s PLANE %s", trk->type, - (NULL == trk->plane) ? "NULL" : trk->plane); - pmix_list_append(&available, &trk->super); - } - pmix_argv_free(grps); - - return PMIX_SUCCESS; -} - -static void tcp_finalize(void) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: tcp finalize"); - if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - PMIX_LIST_DESTRUCT(&allocations); - PMIX_LIST_DESTRUCT(&available); - } -} - -/* some network users may want to encrypt their communications - * as a means of securing them, or include a token in their - * messaging headers for some minimal level of security. This - * is far from perfect, but is provided to illustrate how it - * can be done. The resulting info is placed into the - * app_context's env array so it will automatically be pushed - * into the environment of every MPI process when launched. - * - * In a more perfect world, there would be some privileged place - * to store the crypto key and the encryption would occur - * in a non-visible driver - but we don't have a mechanism - * for doing so. - */ - -static inline void generate_key(uint64_t* unique_key) { - pmix_rng_buff_t rng; - pmix_srand(&rng,(unsigned int)time(NULL)); - unique_key[0] = pmix_rand(&rng); - unique_key[1] = pmix_rand(&rng); -} - -/* when allocate is called, we look at our table of available static addresses - * and assign an address to each process on a node based on its node rank. - * This will prevent collisions as the host RM is responsible for correctly - * setting the node rank. Note that node ranks will "rollover" when they - * hit whatever maximum value the host RM supports, and that they will - * increase monotonically as new jobs are launched until hitting that - * max value. So we need to take into account the number of static - * ports we were given and check to ensure we have enough to hand out - * - * NOTE: this implementation is offered as an example that can - * undoubtedly be vastly improved/optimized */ - -static pmix_status_t allocate(pmix_namespace_t *nptr, - pmix_info_t *info, - pmix_list_t *ilist) -{ - uint64_t unique_key[2]; - size_t n, nreqs=0; - int ports_per_node=0; - pmix_kval_t *kv; - pmix_status_t rc; - pmix_info_t *requests = NULL; - char **reqs, *cptr; - bool allocated = false, seckey = false; - tcp_port_tracker_t *trk; - tcp_available_ports_t *avail, *aptr; - pmix_list_t mylist; - pmix_buffer_t buf; - char *type = NULL, *plane = NULL, *idkey = NULL; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate for nspace %s", nptr->nspace); - - /* if I am not the gateway, then ignore this call - should never - * happen, but check to be safe */ - if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - return PMIX_SUCCESS; - } - - if (NULL == info) { - return PMIX_ERR_TAKE_NEXT_OPTION; - } - - /* check directives to see if a crypto key and/or - * network resource allocations requested */ - PMIX_CONSTRUCT(&mylist, pmix_list_t); - if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ENVARS) || - PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ALL)) { - if (NULL != mca_pnet_tcp_component.include) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: tcp harvesting envars %s excluding %s", - (NULL == mca_pnet_tcp_component.incparms) ? "NONE" : mca_pnet_tcp_component.incparms, - (NULL == mca_pnet_tcp_component.excparms) ? "NONE" : mca_pnet_tcp_component.excparms); - rc = pmix_pnet_base_harvest_envars(mca_pnet_tcp_component.include, - mca_pnet_tcp_component.exclude, - ilist); - return rc; - } - return PMIX_SUCCESS; - } else if (!PMIX_CHECK_KEY(info, PMIX_ALLOC_NETWORK)) { - /* not a network allocation request */ - return PMIX_SUCCESS; - } - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate alloc_network for nspace %s", - nptr->nspace); - /* this info key includes an array of pmix_info_t, each providing - * a key (that is to be used as the key for the allocated ports) and - * a number of ports to allocate for that key */ - if (PMIX_DATA_ARRAY != info->value.type || - NULL == info->value.data.darray || - PMIX_INFO != info->value.data.darray->type || - NULL == info->value.data.darray->array) { - /* they made an error */ - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - requests = (pmix_info_t*)info->value.data.darray->array; - nreqs = info->value.data.darray->size; - /* cycle thru the provided array and see if this refers to - * tcp/udp-based resources - there is no required ordering - * of the keys, so just have to do a search */ - for (n=0; n < nreqs; n++) { - if (0 == strncasecmp(requests[n].key, PMIX_ALLOC_NETWORK_TYPE, PMIX_MAX_KEYLEN)) { - /* check for bozo error */ - if (PMIX_STRING != requests[n].value.type || - NULL == requests[n].value.data.string) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - type = requests[n].value.data.string; - } else if (0 == strncasecmp(requests[n].key, PMIX_ALLOC_NETWORK_PLANE, PMIX_MAX_KEYLEN)) { - /* check for bozo error */ - if (PMIX_STRING != requests[n].value.type || - NULL == requests[n].value.data.string) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - plane = requests[n].value.data.string; - } else if (0 == strncasecmp(requests[n].key, PMIX_ALLOC_NETWORK_ENDPTS, PMIX_MAX_KEYLEN)) { - PMIX_VALUE_GET_NUMBER(rc, &requests[n].value, ports_per_node, int); - if (PMIX_SUCCESS != rc) { - return rc; - } - } else if (0 == strncmp(requests[n].key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) { - /* check for bozo error */ - if (PMIX_STRING != requests[n].value.type || - NULL == requests[n].value.data.string) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - idkey = requests[n].value.data.string; - } else if (0 == strncasecmp(requests[n].key, PMIX_ALLOC_NETWORK_SEC_KEY, PMIX_MAX_KEYLEN)) { - seckey = PMIX_INFO_TRUE(&requests[n]); - } - } - - /* we at least require an attribute key for the response */ - if (NULL == idkey) { - return PMIX_ERR_BAD_PARAM; - } - - /* must include the idkey */ - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(PMIX_ALLOC_NETWORK_ID); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_STRING; - kv->value->data.string = strdup(idkey); - pmix_list_append(&mylist, &kv->super); - - /* note that they might not provide - * the network type (letting it fall to a default component - * based on priority), and they are not required to provide - * a plane. In addition, they are allowed to simply request - * a network security key without asking for endpts */ - - if (NULL != type) { - /* if it is tcp or udp, then this is something we should process */ - if (0 == strcasecmp(type, "tcp")) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate allocating TCP ports for nspace %s", - nptr->nspace); - /* do we have static tcp ports? */ - avail = NULL; - PMIX_LIST_FOREACH(aptr, &available, tcp_available_ports_t) { - if (0 == strcmp(aptr->type, "tcp")) { - /* if they specified a plane, then require it */ - if (NULL != plane && (NULL == aptr->plane || 0 != strcmp(aptr->plane, plane))) { - continue; - } - avail = aptr; - break; - } - } - /* nope - they asked for something that we cannot do */ - if (NULL == avail) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOT_AVAILABLE; - } - /* setup to track the assignment */ - trk = PMIX_NEW(tcp_port_tracker_t); - if (NULL == trk) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - trk->nspace = strdup(nptr->nspace); - PMIX_RETAIN(avail); - trk->src = avail; - pmix_list_append(&allocations, &trk->super); - rc = process_request(nptr, idkey, ports_per_node, trk, &mylist); - if (PMIX_SUCCESS != rc) { - /* return the allocated ports */ - pmix_list_remove_item(&allocations, &trk->super); - PMIX_RELEASE(trk); - PMIX_LIST_DESTRUCT(&mylist); - return rc; - } - allocated = true; - - } else if (0 == strcasecmp(requests[n].value.data.string, "udp")) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate allocating UDP ports for nspace %s", - nptr->nspace); - /* do we have static udp ports? */ - avail = NULL; - PMIX_LIST_FOREACH(aptr, &available, tcp_available_ports_t) { - if (0 == strcmp(aptr->type, "udp")) { - /* if they specified a plane, then require it */ - if (NULL != plane && (NULL == aptr->plane || 0 != strcmp(aptr->plane, plane))) { - continue; - } - avail = aptr; - break; - } - } - /* nope - they asked for something that we cannot do */ - if (NULL == avail) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOT_AVAILABLE; - } - /* setup to track the assignment */ - trk = PMIX_NEW(tcp_port_tracker_t); - if (NULL == trk) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - trk->nspace = strdup(nptr->nspace); - PMIX_RETAIN(avail); - trk->src = avail; - pmix_list_append(&allocations, &trk->super); - rc = process_request(nptr, idkey, ports_per_node, trk, &mylist); - if (PMIX_SUCCESS != rc) { - /* return the allocated ports */ - pmix_list_remove_item(&allocations, &trk->super); - PMIX_RELEASE(trk); - PMIX_LIST_DESTRUCT(&mylist); - return rc; - } - allocated = true; - } else { - /* unsupported type */ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate unsupported type %s for nspace %s", - type, nptr->nspace); - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_TAKE_NEXT_OPTION; - } - - } else { - if (NULL != plane) { - /* if they didn't specify a type, but they did specify a plane, we can - * see if that is a plane we recognize */ - PMIX_LIST_FOREACH(aptr, &available, tcp_available_ports_t) { - if (0 != strcmp(aptr->plane, plane)) { - continue; - } - /* setup to track the assignment */ - trk = PMIX_NEW(tcp_port_tracker_t); - if (NULL == trk) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - trk->nspace = strdup(nptr->nspace); - PMIX_RETAIN(aptr); - trk->src = aptr; - pmix_list_append(&allocations, &trk->super); - rc = process_request(nptr, idkey, ports_per_node, trk, &mylist); - if (PMIX_SUCCESS != rc) { - /* return the allocated ports */ - pmix_list_remove_item(&allocations, &trk->super); - PMIX_RELEASE(trk); - PMIX_LIST_DESTRUCT(&mylist); - return rc; - } - allocated = true; - break; - } - } else { - /* if they didn't specify either type or plane, then we got here because - * nobody of a higher priority could act as a default transport - so try - * to provide something here, starting by looking at any provided setting */ - if (NULL != mca_pnet_tcp_component.default_request) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate allocating default ports %s for nspace %s", - mca_pnet_tcp_component.default_request, nptr->nspace); - reqs = pmix_argv_split(mca_pnet_tcp_component.default_request, ';'); - for (n=0; NULL != reqs[n]; n++) { - /* if there is no colon, then it is just - * a number of ports to use */ - type = NULL; - plane = NULL; - if (NULL == (cptr = strrchr(reqs[n], ':'))) { - avail = (tcp_available_ports_t*)pmix_list_get_first(&available); - } else { - *cptr = '\0'; - ++cptr; - ports_per_node = strtoul(cptr, NULL, 10); - /* look for the plane */ - cptr -= 2; - if (NULL != (cptr = strrchr(cptr, ':'))) { - *cptr = '\0'; - ++cptr; - plane = cptr; - } - type = reqs[n]; - avail = NULL; - PMIX_LIST_FOREACH(aptr, &available, tcp_available_ports_t) { - if (0 == strcmp(aptr->type, type)) { - /* if they specified a plane, then require it */ - if (NULL != plane && (NULL == aptr->plane || 0 != strcmp(aptr->plane, plane))) { - continue; - } - avail = aptr; - break; - } - } - /* if we didn't find it, that isn't an error - just ignore */ - if (NULL == avail) { - continue; - } - } - /* setup to track the assignment */ - trk = PMIX_NEW(tcp_port_tracker_t); - if (NULL == trk) { - pmix_argv_free(reqs); - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - trk->nspace = strdup(nptr->nspace); - PMIX_RETAIN(avail); - trk->src = avail; - pmix_list_append(&allocations, &trk->super); - rc = process_request(nptr, idkey, ports_per_node, trk, &mylist); - if (PMIX_SUCCESS != rc) { - /* return the allocated ports */ - pmix_list_remove_item(&allocations, &trk->super); - PMIX_RELEASE(trk); - PMIX_LIST_DESTRUCT(&mylist); - return rc; - } - allocated = true; - } - } else { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:allocate allocating %d ports/node for nspace %s", - ports_per_node, nptr->nspace); - if (0 == ports_per_node) { - /* nothing to allocate */ - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_TAKE_NEXT_OPTION; - } - avail = (tcp_available_ports_t*)pmix_list_get_first(&available); - if (NULL != avail) { - /* setup to track the assignment */ - trk = PMIX_NEW(tcp_port_tracker_t); - if (NULL == trk) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - trk->nspace = strdup(nptr->nspace); - PMIX_RETAIN(avail); - trk->src = avail; - pmix_list_append(&allocations, &trk->super); - rc = process_request(nptr, idkey, ports_per_node, trk, &mylist); - if (PMIX_SUCCESS != rc) { - /* return the allocated ports */ - pmix_list_remove_item(&allocations, &trk->super); - PMIX_RELEASE(trk); - } else { - allocated = true; - } - } - } - } - if (!allocated) { - /* nope - we cannot help */ - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_TAKE_NEXT_OPTION; - } - } - - if (seckey) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp: generate seckey"); - generate_key(unique_key); - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - kv->key = strdup(PMIX_ALLOC_NETWORK_SEC_KEY); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_BYTE_OBJECT; - kv->value->data.bo.bytes = (char*)malloc(2 * sizeof(uint64_t)); - if (NULL == kv->value->data.bo.bytes) { - PMIX_RELEASE(kv); - PMIX_LIST_DESTRUCT(&mylist); - return PMIX_ERR_NOMEM; - } - memcpy(kv->value->data.bo.bytes, unique_key, 2 * sizeof(uint64_t)); - kv->value->data.bo.size = 2 * sizeof(uint64_t); - pmix_list_append(&mylist, &kv->super); - } - - - n = pmix_list_get_size(&mylist); - if (0 < n) { - PMIX_CONSTRUCT(&buf, pmix_buffer_t); - /* pack the number of kvals for ease on the remote end */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &n, 1, PMIX_SIZE); - /* cycle across the list and pack the kvals */ - while (NULL != (kv = (pmix_kval_t*)pmix_list_remove_first(&mylist))) { - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv, 1, PMIX_KVAL); - PMIX_RELEASE(kv); - if (PMIX_SUCCESS != rc) { - PMIX_DESTRUCT(&buf); - PMIX_LIST_DESTRUCT(&mylist); - return rc; - } - } - PMIX_LIST_DESTRUCT(&mylist); - kv = PMIX_NEW(pmix_kval_t); - kv->key = strdup(PMIX_TCP_SETUP_APP_KEY); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - PMIX_DESTRUCT(&buf); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_BYTE_OBJECT; - PMIX_UNLOAD_BUFFER(&buf, kv->value->data.bo.bytes, kv->value->data.bo.size); - PMIX_DESTRUCT(&buf); - pmix_list_append(ilist, &kv->super); - } - - /* if we got here, then we processed this specific request, so - * indicate that by returning success */ - return PMIX_SUCCESS; -} - -/* upon receipt of the launch message, each daemon adds the - * static address assignments to the job-level info cache - * for that job */ -static pmix_status_t setup_local_network(pmix_namespace_t *nptr, - pmix_info_t info[], - size_t ninfo) -{ - size_t n, m, nkvals; - pmix_buffer_t bkt; - int32_t cnt; - pmix_kval_t *kv; - pmix_status_t rc; - pmix_info_t *jinfo, stinfo; - char *idkey = NULL; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:setup_local_network"); - - if (NULL != info) { - idkey = strdup("default"); - for (n=0; n < ninfo; n++) { - /* look for my key */ - if (0 == strncmp(info[n].key, PMIX_TCP_SETUP_APP_KEY, PMIX_MAX_KEYLEN)) { - /* this macro NULLs and zero's the incoming bo */ - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, - info[n].value.data.bo.bytes, - info[n].value.data.bo.size); - /* unpack the number of kvals */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &nkvals, &cnt, PMIX_SIZE); - /* setup the info array */ - PMIX_INFO_CONSTRUCT(&stinfo); - pmix_strncpy(stinfo.key, idkey, PMIX_MAX_KEYLEN); - stinfo.value.type = PMIX_DATA_ARRAY; - PMIX_DATA_ARRAY_CREATE(stinfo.value.data.darray, nkvals, PMIX_INFO); - jinfo = (pmix_info_t*)stinfo.value.data.darray->array; - - /* cycle thru the blob and extract the kvals */ - kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, kv, &cnt, PMIX_KVAL); - m = 0; - while (PMIX_SUCCESS == rc) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "recvd KEY %s %s", kv->key, - (PMIX_STRING == kv->value->type) ? kv->value->data.string : "NON-STRING"); - /* xfer the value to the info */ - pmix_strncpy(jinfo[m].key, kv->key, PMIX_MAX_KEYLEN); - PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, - &jinfo[m].value, kv->value); - /* if this is the ID key, save it */ - if (NULL == idkey && - 0 == strncmp(kv->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) { - idkey = strdup(kv->value->data.string); - } - ++m; - PMIX_RELEASE(kv); - kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, kv, &cnt, PMIX_KVAL); - } - /* restore the incoming data */ - info[n].value.data.bo.bytes = bkt.base_ptr; - info[n].value.data.bo.size = bkt.bytes_used; - bkt.base_ptr = NULL; - bkt.bytes_used = 0; - - /* if they didn't include a network ID, then this is an error */ - if (NULL == idkey) { - PMIX_INFO_FREE(jinfo, nkvals); - return PMIX_ERR_BAD_PARAM; - } - - /* cache the info on the job */ - PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, - &stinfo, 1); - PMIX_INFO_DESTRUCT(&stinfo); - } - } - } - if (NULL != idkey) { - free(idkey); - } - return PMIX_SUCCESS; -} - -static pmix_status_t setup_fork(pmix_namespace_t *nptr, - const pmix_proc_t *peer, char ***env) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:setup_fork"); - return PMIX_SUCCESS; -} - -/* when a local client finalizes, the server gives us a chance - * to do any required local cleanup for that peer. We don't - * have anything we need to do */ -static void child_finalized(pmix_proc_t *peer) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp child finalized"); -} - -/* when all local clients for a given job finalize, the server - * provides an opportunity for the local network to cleanup - * any resources consumed locally by the clients of that job. - * We don't have anything we need to do */ -static void local_app_finalized(pmix_namespace_t *nptr) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp app finalized"); -} - -/* when the job completes, the scheduler calls the "deregister nspace" - * PMix function, which in turn calls my TCP component to release the - * assignments for that job. The addresses are marked as "available" - * for reuse on the next job. */ -static void deregister_nspace(pmix_namespace_t *nptr) -{ - tcp_port_tracker_t *trk; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp deregister nspace %s", nptr->nspace); - - /* if we are not the "gateway", then there is nothing - * for us to do */ - if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - return; - } - - /* find this tracker */ - PMIX_LIST_FOREACH(trk, &allocations, tcp_port_tracker_t) { - if (0 == strcmp(nptr->nspace, trk->nspace)) { - pmix_list_remove_item(&allocations, &trk->super); - PMIX_RELEASE(trk); - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp released tracker for nspace %s", nptr->nspace); - return; - } - } -} - -static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, - pmix_inventory_cbfunc_t cbfunc, void *cbdata) -{ - pmix_inventory_rollup_t *cd = (pmix_inventory_rollup_t*)cbdata; - char *prefix, myhost[PMIX_MAXHOSTNAMELEN] = {0}; - char myconnhost[PMIX_MAXHOSTNAMELEN] = {0}; - char name[32], uri[2048]; - struct sockaddr_storage my_ss; - char *foo; - pmix_buffer_t bucket, pbkt; - int i; - pmix_status_t rc; - bool found = false; - pmix_byte_object_t pbo; - pmix_kval_t *kv; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp:collect_inventory"); - - /* setup the bucket - we will pass the results as a blob */ - PMIX_CONSTRUCT(&bucket, pmix_buffer_t); - /* add our hostname */ - gethostname(myhost, sizeof(myhost)-1); - foo = &myhost[0]; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &foo, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&bucket); - return rc; - } - - /* look at all available interfaces */ - for (i = pmix_ifbegin(); i >= 0; i = pmix_ifnext(i)) { - if (PMIX_SUCCESS != pmix_ifindextoaddr(i, (struct sockaddr*)&my_ss, sizeof(my_ss))) { - pmix_output (0, "ptl_tcp: problems getting address for index %i (kernel index %i)\n", - i, pmix_ifindextokindex(i)); - continue; - } - /* ignore non-ip4/6 interfaces */ - if (AF_INET != my_ss.ss_family && - AF_INET6 != my_ss.ss_family) { - continue; - } - /* get the name for diagnostic purposes */ - pmix_ifindextoname(i, name, sizeof(name)); - - /* ignore any virtual interfaces */ - if (0 == strncmp(name, "vir", 3)) { - continue; - } - /* ignore the loopback device */ - if (pmix_ifisloopback(i)) { - continue; - } - if (AF_INET == my_ss.ss_family) { - prefix = "tcp4://"; - inet_ntop(AF_INET, &((struct sockaddr_in*) &my_ss)->sin_addr, - myconnhost, PMIX_MAXHOSTNAMELEN-1); - } else if (AF_INET6 == my_ss.ss_family) { - prefix = "tcp6://"; - inet_ntop(AF_INET6, &((struct sockaddr_in6*) &my_ss)->sin6_addr, - myconnhost, PMIX_MAXHOSTNAMELEN-1); - } else { - continue; - } - (void)snprintf(uri, 2048, "%s%s", prefix, myconnhost); - pmix_output_verbose(2, pmix_pnet_base_framework. framework_output, - "TCP INVENTORY ADDING: %s %s", name, uri); - found = true; - /* pack the name of the device */ - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - foo = &name[0]; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &foo, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&bucket); - return rc; - } - /* pack the address */ - foo = &uri[0]; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &foo, 1, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&bucket); - return rc; - } - /* extract the resulting blob - this is a device unit */ - PMIX_UNLOAD_BUFFER(&pbkt, pbo.bytes, pbo.size); - /* now load that into the blob */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &pbo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_BYTE_OBJECT_DESTRUCT(&pbo); - PMIX_DESTRUCT(&bucket); - return rc; - } - } - /* if we have anything to report, then package it up for transfer */ - if (!found) { - PMIX_DESTRUCT(&bucket); - return PMIX_ERR_TAKE_NEXT_OPTION; - } - /* extract the resulting blob */ - PMIX_UNLOAD_BUFFER(&bucket, pbo.bytes, pbo.size); - kv = PMIX_NEW(pmix_kval_t); - kv->key = strdup(PMIX_TCP_INVENTORY_KEY); - PMIX_VALUE_CREATE(kv->value, 1); - pmix_value_load(kv->value, &pbo, PMIX_BYTE_OBJECT); - PMIX_BYTE_OBJECT_DESTRUCT(&pbo); - pmix_list_append(&cd->payload, &kv->super); - - return PMIX_SUCCESS; -} - -static pmix_status_t process_request(pmix_namespace_t *nptr, - char *idkey, int ports_per_node, - tcp_port_tracker_t *trk, - pmix_list_t *ilist) -{ - char **plist; - pmix_kval_t *kv; - size_t m; - int p, ppn; - tcp_available_ports_t *avail = trk->src; - - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(idkey); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_STRING; - kv->value->data.string = NULL; - if (0 == ports_per_node) { - /* find the maxprocs on the nodes in this nspace and - * allocate that number of resources */ - return PMIX_ERR_NOT_SUPPORTED; - } else { - ppn = ports_per_node; - } - - /* assemble the list of ports */ - p = 0; - plist = NULL; - for (m=0; p < ppn && m < avail->nports; m++) { - if (NULL != avail->ports[m]) { - pmix_argv_append_nosize(&trk->ports, avail->ports[m]); - pmix_argv_append_nosize(&plist, avail->ports[m]); - free(avail->ports[m]); - avail->ports[m] = NULL; - ++p; - } - } - /* if we couldn't find enough, then that's an error */ - if (p < ppn) { - PMIX_RELEASE(kv); - /* the caller will release trk, and that will return - * any allocated ports back to the available list */ - return PMIX_ERR_OUT_OF_RESOURCE; - } - /* pass the value */ - kv->value->data.string = pmix_argv_join(plist, ','); - pmix_argv_free(plist); - pmix_list_append(ilist, &kv->super); - - /* track where it came from */ - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(idkey); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_STRING; - kv->value->data.string = strdup(trk->src->type); - pmix_list_append(ilist, &kv->super); - if (NULL != trk->src->plane) { - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(idkey); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_STRING; - kv->value->data.string = strdup(trk->src->plane); - pmix_list_append(ilist, &kv->super); - } - return PMIX_SUCCESS; -} - -static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, - pmix_info_t directives[], size_t ndirs, - pmix_op_cbfunc_t cbfunc, void *cbdata) -{ - pmix_buffer_t bkt, pbkt; - size_t n; - int32_t cnt; - char *hostname, *device, *address; - pmix_byte_object_t pbo; - pmix_pnet_node_t *nd, *ndptr; - pmix_pnet_resource_t *lt, *lst; - tcp_available_ports_t *prts; - tcp_device_t *res; - pmix_status_t rc; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:tcp deliver inventory"); - - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_TCP_INVENTORY_KEY, PMIX_MAX_KEYLEN)) { - /* this is our inventory in the form of a blob */ - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, - info[n].value.data.bo.bytes, - info[n].value.data.bo.size); - /* first is the host this came from */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &hostname, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - /* must _not_ destruct bkt as we don't - * own the bytes! */ - return rc; - } - /* do we already have this node? */ - nd = NULL; - PMIX_LIST_FOREACH(ndptr, &pmix_pnet_globals.nodes, pmix_pnet_node_t) { - if (0 == strcmp(hostname, ndptr->name)) { - nd = ndptr; - break; - } - } - if (NULL == nd) { - nd = PMIX_NEW(pmix_pnet_node_t); - nd->name = strdup(hostname); - pmix_list_append(&pmix_pnet_globals.nodes, &nd->super); - } - /* does this node already have a TCP entry? */ - lst = NULL; - PMIX_LIST_FOREACH(lt, &nd->resources, pmix_pnet_resource_t) { - if (0 == strcmp(lt->name, "tcp")) { - lst = lt; - break; - } - } - if (NULL == lst) { - lst = PMIX_NEW(pmix_pnet_resource_t); - lst->name = strdup("tcp"); - pmix_list_append(&nd->resources, &lst->super); - } - /* this is a list of ports and devices */ - prts = PMIX_NEW(tcp_available_ports_t); - pmix_list_append(&lst->resources, &prts->super); - /* cycle across any provided interfaces */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &pbo, &cnt, PMIX_BYTE_OBJECT); - while (PMIX_SUCCESS == rc) { - /* load the byte object for unpacking */ - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, pbo.bytes, pbo.size); - /* unpack the name of the device */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &pbkt, &device, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DATA_BUFFER_DESTRUCT(&pbkt); - /* must _not_ destruct bkt as we don't - * own the bytes! */ - return rc; - } - /* unpack the address */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &pbkt, &address, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DATA_BUFFER_DESTRUCT(&pbkt); - /* must _not_ destruct bkt as we don't - * own the bytes! */ - return rc; - } - /* store this on the node */ - res = PMIX_NEW(tcp_device_t); - res->device = device; - res->address = address; - pmix_list_append(&prts->devices, &res->super); - PMIX_DATA_BUFFER_DESTRUCT(&pbkt); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &pbo, &cnt, PMIX_BYTE_OBJECT); - } - PMIX_DATA_BUFFER_DESTRUCT(&bkt); - if (5 < pmix_output_get_verbosity(pmix_pnet_base_framework.framework_output)) { - /* dump the resulting node resources */ - pmix_output(0, "TCP resources for node: %s", nd->name); - PMIX_LIST_FOREACH(lt, &nd->resources, pmix_pnet_resource_t) { - if (0 == strcmp(lt->name, "tcp")) { - PMIX_LIST_FOREACH(prts, <->resources, tcp_available_ports_t) { - device = NULL; - if (NULL != prts->ports) { - device = pmix_argv_join(prts->ports, ','); - } - pmix_output(0, "\tPorts: %s", (NULL == device) ? "UNSPECIFIED" : device); - if (NULL != device) { - free(device); - } - PMIX_LIST_FOREACH(res, &prts->devices, tcp_device_t) { - pmix_output(0, "\tDevice: %s", res->device); - pmix_output(0, "\tAddress: %s", res->address); - } - } - } - } - } - } - } - - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h deleted file mode 100644 index 54e0fe0316..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_PNET_OPA_H -#define PMIX_PNET_OPA_H - -#include - - -#include "src/mca/pnet/pnet.h" - -BEGIN_C_DECLS - -typedef struct { - pmix_pnet_base_component_t super; - char *static_ports; - char *default_request; - char *incparms; - char *excparms; - char **include; - char **exclude; -} pmix_pnet_tcp_component_t; - -/* the component must be visible data for the linker to find it */ -PMIX_EXPORT extern pmix_pnet_tcp_component_t mca_pnet_tcp_component; -extern pmix_pnet_module_t pmix_tcp_module; - -END_C_DECLS - -#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c deleted file mode 100644 index b313ab3607..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * These symbols are in a file by themselves to provide nice linker - * semantics. Since linkers generally pull in symbols by object - * files, keeping these symbols as the only symbols in this file - * prevents utility programs such as "ompi_info" from having to import - * entire components just to query their version and parameters. - */ - -#include -#include "pmix_common.h" - -#include "src/util/argv.h" -#include "src/mca/pnet/pnet.h" -#include "pnet_tcp.h" - -static pmix_status_t component_register(void); -static pmix_status_t component_open(void); -static pmix_status_t component_close(void); -static pmix_status_t component_query(pmix_mca_base_module_t **module, - int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointers to our public functions in it - */ -pmix_pnet_tcp_component_t mca_pnet_tcp_component = { - .super = { - .base = { - PMIX_PNET_BASE_VERSION_1_0_0, - - /* Component name and version */ - .pmix_mca_component_name = "tcp", - PMIX_MCA_BASE_MAKE_VERSION(component, - PMIX_MAJOR_VERSION, - PMIX_MINOR_VERSION, - PMIX_RELEASE_VERSION), - - /* Component open and close functions */ - .pmix_mca_register_component_params = component_register, - .pmix_mca_open_component = component_open, - .pmix_mca_close_component = component_close, - .pmix_mca_query_component = component_query, - }, - .data = { - /* The component is checkpoint ready */ - PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT - } - }, - .static_ports = NULL, - .default_request = NULL, - .include = NULL, - .exclude = NULL -}; - -static pmix_status_t component_register(void) -{ - pmix_mca_base_component_t *component = &mca_pnet_tcp_component.super.base; - - mca_pnet_tcp_component.static_ports = NULL; - (void)pmix_mca_base_component_var_register(component, "static_ports", - "Static ports for procs, expressed as a semi-colon delimited " - "list of type:(optional)plane:Comma-delimited list of ranges (e.g., " - "\"tcp:10.10.10.0/24:32000-32100,33000;udp:40000,40005\")", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - PMIX_INFO_LVL_2, - PMIX_MCA_BASE_VAR_SCOPE_READONLY, - &mca_pnet_tcp_component.static_ports); - - (void)pmix_mca_base_component_var_register(component, "default_network_allocation", - "Semi-colon delimited list of (optional)type:(optional)plane:Comma-delimited list of ranges " - "(e.g., \"udp:10.10.10.0/24:3\", or \"5\" if the choice of " - "type and plane isn't critical)", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - PMIX_INFO_LVL_2, - PMIX_MCA_BASE_VAR_SCOPE_READONLY, - &mca_pnet_tcp_component.default_request); - - mca_pnet_tcp_component.incparms = NULL; - (void)pmix_mca_base_component_var_register(component, "include_envars", - "Comma-delimited list of envars to harvest (\'*\' and \'?\' supported)", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - PMIX_INFO_LVL_2, - PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &mca_pnet_tcp_component.incparms); - if (NULL != mca_pnet_tcp_component.incparms) { - mca_pnet_tcp_component.include = pmix_argv_split(mca_pnet_tcp_component.incparms, ','); - } - - mca_pnet_tcp_component.excparms = NULL; - (void)pmix_mca_base_component_var_register(component, "exclude_envars", - "Comma-delimited list of envars to exclude (\'*\' and \'?\' supported)", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - PMIX_INFO_LVL_2, - PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &mca_pnet_tcp_component.excparms); - if (NULL != mca_pnet_tcp_component.excparms) { - mca_pnet_tcp_component.exclude = pmix_argv_split(mca_pnet_tcp_component.excparms, ','); - } - - return PMIX_SUCCESS; -} - -static pmix_status_t component_open(void) -{ - return PMIX_SUCCESS; -} - - -static pmix_status_t component_query(pmix_mca_base_module_t **module, - int *priority) -{ - *priority = 5; - *module = (pmix_mca_base_module_t *)&pmix_tcp_module; - return PMIX_SUCCESS; -} - - -static pmix_status_t component_close(void) -{ - - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c deleted file mode 100644 index 119110f876..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include - -#include - -#include "src/mca/base/pmix_mca_base_var.h" -#include "src/include/pmix_socket_errno.h" -#include "src/include/pmix_globals.h" -#include "src/class/pmix_list.h" -#include "src/util/alfg.h" -#include "src/util/argv.h" -#include "src/util/error.h" -#include "src/util/name_fns.h" -#include "src/util/output.h" -#include "src/util/pmix_environ.h" -#include "src/mca/preg/preg.h" - -#include "src/mca/pnet/pnet.h" -#include "src/mca/pnet/base/base.h" -#include "pnet_test.h" - -static pmix_status_t test_init(void); -static void test_finalize(void); -static pmix_status_t allocate(pmix_namespace_t *nptr, - pmix_info_t *info, - pmix_list_t *ilist); -static pmix_status_t setup_local_network(pmix_namespace_t *nptr, - pmix_info_t info[], - size_t ninfo); -static pmix_status_t setup_fork(pmix_namespace_t *nptr, - const pmix_proc_t *proc, - char ***env); -static void child_finalized(pmix_proc_t *peer); -static void local_app_finalized(pmix_namespace_t *nptr); -static void deregister_nspace(pmix_namespace_t *nptr); -static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, - pmix_inventory_cbfunc_t cbfunc, void *cbdata); -static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, - pmix_info_t directives[], size_t ndirs, - pmix_op_cbfunc_t cbfunc, void *cbdata); - -pmix_pnet_module_t pmix_test_module = { - .name = "test", - .init = test_init, - .finalize = test_finalize, - .allocate = allocate, - .setup_local_network = setup_local_network, - .setup_fork = setup_fork, - .child_finalized = child_finalized, - .local_app_finalized = local_app_finalized, - .deregister_nspace = deregister_nspace, - .collect_inventory = collect_inventory, - .deliver_inventory = deliver_inventory -}; - -static pmix_status_t test_init(void) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: test init"); - return PMIX_SUCCESS; -} - -static void test_finalize(void) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet: test finalize"); -} - -/* NOTE: if there is any binary data to be transferred, then - * this function MUST pack it for transport as the host will - * not know how to do so */ -static pmix_status_t allocate(pmix_namespace_t *nptr, - pmix_info_t *info, - pmix_list_t *ilist) -{ - pmix_kval_t *kv; - bool seckey = false; - pmix_list_t mylist; - size_t n, nreqs=0; - pmix_info_t *requests = NULL; - char *idkey = NULL; - uint64_t unique_key = 12345; - pmix_buffer_t buf; - pmix_status_t rc; - pmix_pnet_job_t *jptr, *job; - pmix_pnet_node_t *nd; - pmix_pnet_local_procs_t *lptr, *lp; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:test:allocate for nspace %s key %s", - nptr->nspace, info->key); - - /* if I am not the gateway, then ignore this call - should never - * happen, but check to be safe */ - if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { - return PMIX_SUCCESS; - } - - if (NULL == info) { - return PMIX_ERR_TAKE_NEXT_OPTION; - } - /* check directives to see if a crypto key and/or - * network resource allocations requested */ - PMIX_CONSTRUCT(&mylist, pmix_list_t); - if (0 == strncmp(info->key, PMIX_SETUP_APP_ENVARS, PMIX_MAX_KEYLEN) || - 0 == strncmp(info->key, PMIX_SETUP_APP_ALL, PMIX_MAX_KEYLEN)) { - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(PMIX_SET_ENVAR); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_ENVAR; - PMIX_ENVAR_LOAD(&kv->value->data.envar, "PMIX_TEST_ENVAR", "1", ':'); - pmix_list_append(ilist, &kv->super); - return PMIX_SUCCESS; - } else if (0 != strncmp(info->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) { - return PMIX_SUCCESS; - } - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:test:allocate alloc_network for nspace %s", - nptr->nspace); - - /* this info key includes an array of pmix_info_t, each providing - * a key (that is to be used as the key for the allocated ports) and - * a number of ports to allocate for that key */ - if (PMIX_DATA_ARRAY != info->value.type || - NULL == info->value.data.darray || - PMIX_INFO != info->value.data.darray->type || - NULL == info->value.data.darray->array) { - /* just process something for test */ - goto process; - } - requests = (pmix_info_t*)info->value.data.darray->array; - nreqs = info->value.data.darray->size; - /* cycle thru the provided array and get the ID key */ - for (n=0; n < nreqs; n++) { - if (0 == strncmp(requests[n].key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) { - /* check for bozo error */ - if (PMIX_STRING != requests[n].value.type || - NULL == requests[n].value.data.string) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - idkey = requests[n].value.data.string; - } else if (0 == strncasecmp(requests[n].key, PMIX_ALLOC_NETWORK_SEC_KEY, PMIX_MAX_KEYLEN)) { - seckey = PMIX_INFO_TRUE(&requests[n]); - } - } - - process: - /* if they didn't give us a test key, just create one */ - if (NULL == idkey) { - idkey = "TESTKEY"; - } - - /* must include the idkey */ - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(PMIX_ALLOC_NETWORK_ID); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_STRING; - kv->value->data.string = strdup(idkey); - pmix_list_append(&mylist, &kv->super); - - if (seckey) { - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - return PMIX_ERR_NOMEM; - } - kv->key = strdup(PMIX_ALLOC_NETWORK_SEC_KEY); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_BYTE_OBJECT; - kv->value->data.bo.bytes = (char*)malloc(sizeof(uint64_t)); - if (NULL == kv->value->data.bo.bytes) { - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - memcpy(kv->value->data.bo.bytes, &unique_key, sizeof(uint64_t)); - kv->value->data.bo.size = sizeof(uint64_t); - pmix_list_append(&mylist, &kv->super); - } - - /* find the info on this job, if available */ - job = NULL; - PMIX_LIST_FOREACH(jptr, &pmix_pnet_globals.jobs, pmix_pnet_job_t) { - if (0 == strcmp(jptr->nspace, nptr->nspace)) { - job = jptr; - break; - } - } - if (NULL != job) { - pmix_output(0, "ALLOCATE RESOURCES FOR JOB %s", job->nspace); - for (n=0; (int)n < job->nodes.size; n++) { - if (NULL == (nd = (pmix_pnet_node_t*)pmix_pointer_array_get_item(&job->nodes, n))) { - continue; - } - lp = NULL; - PMIX_LIST_FOREACH(lptr, &nd->local_jobs, pmix_pnet_local_procs_t) { - if (0 == strcmp(job->nspace, lptr->nspace)) { - lp = lptr; - break; - } - } - if (NULL == lp) { - pmix_output(0, "\t NODE %s 0 RANKS", nd->name); - } else { - pmix_output(0, "\tNODE %s %d RANKS", nd->name, (int)lp->np); - } - } - } - - n = pmix_list_get_size(&mylist); - if (0 < n) { - PMIX_CONSTRUCT(&buf, pmix_buffer_t); - /* pack the number of kvals for ease on the remote end */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &n, 1, PMIX_SIZE); - /* cycle across the list and pack the kvals */ - while (NULL != (kv = (pmix_kval_t*)pmix_list_remove_first(&mylist))) { - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv, 1, PMIX_KVAL); - PMIX_RELEASE(kv); - if (PMIX_SUCCESS != rc) { - PMIX_DESTRUCT(&buf); - PMIX_LIST_DESTRUCT(&mylist); - return rc; - } - } - PMIX_LIST_DESTRUCT(&mylist); - kv = PMIX_NEW(pmix_kval_t); - kv->key = strdup("pmix-pnet-test-blob"); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_RELEASE(kv); - PMIX_DESTRUCT(&buf); - return PMIX_ERR_NOMEM; - } - kv->value->type = PMIX_BYTE_OBJECT; - PMIX_UNLOAD_BUFFER(&buf, kv->value->data.bo.bytes, kv->value->data.bo.size); - PMIX_DESTRUCT(&buf); - pmix_list_append(ilist, &kv->super); - } - - return PMIX_SUCCESS; -} - -static pmix_status_t setup_local_network(pmix_namespace_t *nptr, - pmix_info_t info[], - size_t ninfo) -{ - size_t n, m, nkvals; - char *nodestring, **nodes; - pmix_proc_t *procs; - size_t nprocs; - pmix_buffer_t bkt; - int32_t cnt; - pmix_kval_t *kv; - pmix_status_t rc; - pmix_info_t *jinfo, stinfo; - char *idkey = NULL; - - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:test:setup_local_network"); - - /* get the list of nodes in this job - returns a regex */ - pmix_output(0, "pnet:test setup_local_network NSPACE %s", (NULL == nptr) ? "NULL" : nptr->nspace); - if (NULL == nptr) { - return PMIX_SUCCESS; - } - pmix_preg.resolve_nodes(nptr->nspace, &nodestring); - if (NULL == nodestring) { - return PMIX_SUCCESS; - } - pmix_preg.parse_nodes(nodestring, &nodes); // get an argv array of node names - pmix_output(0, "pnet:test setup_local_network NODES %s", (NULL == nodes) ? "NULL" : "NON-NULL"); - if (NULL == nodes) { - free(nodestring); - return PMIX_SUCCESS; - } - for (n=0; NULL != nodes[n]; n++) { - pmix_output(0, "pnet:test setup_local_network NODE: %s", nodes[n]); - } - - for (n=0; NULL != nodes[n]; n++) { - /* get an array of pmix_proc_t containing the names of the procs on that node */ - pmix_preg.resolve_peers(nodes[n], nptr->nspace, &procs, &nprocs); - if (NULL == procs) { - continue; - } - for (m=0; m < nprocs; m++) { - pmix_output(0, "pnet:test setup_local_network NODE %s: peer %s:%d", nodes[n], procs[m].nspace, procs[m].rank); - } - /* do stuff */ - free(procs); - } - - if (NULL != info) { - for (n=0; n < ninfo; n++) { - /* look for my key */ - if (0 == strncmp(info[n].key, "pmix-pnet-test-blob", PMIX_MAX_KEYLEN)) { - /* this macro NULLs and zero's the incoming bo */ - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, - info[n].value.data.bo.bytes, - info[n].value.data.bo.size); - /* unpack the number of kvals */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &nkvals, &cnt, PMIX_SIZE); - /* the data gets stored as a pmix_data_array_t on the provided key */ - PMIX_INFO_CONSTRUCT(&stinfo); - pmix_strncpy(stinfo.key, idkey, PMIX_MAX_KEYLEN); - stinfo.value.type = PMIX_DATA_ARRAY; - PMIX_DATA_ARRAY_CREATE(stinfo.value.data.darray, nkvals, PMIX_INFO); - jinfo = (pmix_info_t*)stinfo.value.data.darray->array; - - /* cycle thru the blob and extract the kvals */ - kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, kv, &cnt, PMIX_KVAL); - m = 0; - while (PMIX_SUCCESS == rc) { - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "recvd KEY %s %s", kv->key, - (PMIX_STRING == kv->value->type) ? kv->value->data.string : "NON-STRING"); - /* xfer the value to the info */ - pmix_strncpy(jinfo[m].key, kv->key, PMIX_MAX_KEYLEN); - PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, - &jinfo[m].value, kv->value); - /* if this is the ID key, save it */ - if (NULL == idkey && - 0 == strncmp(kv->key, PMIX_ALLOC_NETWORK_ID, PMIX_MAX_KEYLEN)) { - idkey = strdup(kv->value->data.string); - } - ++m; - PMIX_RELEASE(kv); - kv = PMIX_NEW(pmix_kval_t); - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, kv, &cnt, PMIX_KVAL); - } - /* restore the incoming data */ - info[n].value.data.bo.bytes = bkt.base_ptr; - info[n].value.data.bo.size = bkt.bytes_used; - bkt.base_ptr = NULL; - bkt.bytes_used = 0; - - /* if they didn't include a network ID, then this is an error */ - if (NULL == idkey) { - PMIX_INFO_FREE(jinfo, nkvals); - return PMIX_ERR_BAD_PARAM; - } - /* cache the info on the job */ - PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, - &stinfo, 1); - PMIX_INFO_DESTRUCT(&stinfo); - } - } - } - if (NULL != idkey) { - free(idkey); - } - return PMIX_SUCCESS; -} - -static pmix_status_t setup_fork(pmix_namespace_t *nptr, - const pmix_proc_t *proc, - char ***env) -{ - pmix_cb_t cb; - pmix_status_t rc; - pmix_kval_t *kv; - uint16_t localrank; - - PMIX_CONSTRUCT(&cb, pmix_cb_t); - - cb.key = strdup(PMIX_LOCAL_RANK); - /* this data isn't going anywhere, so we don't require a copy */ - cb.copy = false; - /* scope is irrelevant as the info we seek must be local */ - cb.scope = PMIX_SCOPE_UNDEF; - /* ask for the value for the given proc */ - cb.proc = (pmix_proc_t*)proc; - - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS != rc) { - if (PMIX_ERR_INVALID_NAMESPACE != rc) { - PMIX_ERROR_LOG(rc); - } - PMIX_DESTRUCT(&cb); - return rc; - } - /* should just be the one value on the list */ - if (1 != pmix_list_get_size(&cb.kvs)) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - PMIX_DESTRUCT(&cb); - return PMIX_ERR_BAD_PARAM; - } - kv = (pmix_kval_t*)pmix_list_get_first(&cb.kvs); - if (PMIX_UINT16 != kv->value->type) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - PMIX_DESTRUCT(&cb); - return PMIX_ERR_BAD_PARAM; - } - localrank = kv->value->data.uint16; - - pmix_output(0, "pnet:test LOCAL RANK FOR PROC %s: %d", PMIX_NAME_PRINT(proc), (int)localrank); - - PMIX_DESTRUCT(&cb); - return PMIX_SUCCESS; -} - -static void child_finalized(pmix_proc_t *peer) -{ - pmix_output(0, "pnet:test CHILD %s:%d FINALIZED", - peer->nspace, peer->rank); -} - -static void local_app_finalized(pmix_namespace_t *nptr) -{ - pmix_output(0, "pnet:test NSPACE %s LOCALLY FINALIZED", nptr->nspace); -} - -static void deregister_nspace(pmix_namespace_t *nptr) -{ - pmix_output(0, "pnet:test DEREGISTER NSPACE %s", nptr->nspace); -} - -static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, - pmix_inventory_cbfunc_t cbfunc, void *cbdata) -{ - pmix_output(0, "pnet:test COLLECT INVENTORY"); - return PMIX_ERR_NOT_SUPPORTED; -} - -static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, - pmix_info_t directives[], size_t ndirs, - pmix_op_cbfunc_t cbfunc, void *cbdata) -{ - pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, - "pnet:test deliver inventory"); - - return PMIX_ERR_NOT_SUPPORTED; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.h deleted file mode 100644 index 8601bc355b..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_PNET_test_H -#define PMIX_PNET_test_H - -#include - - -#include "src/mca/pnet/pnet.h" - -BEGIN_C_DECLS - -typedef struct { - pmix_pnet_base_component_t super; - char **include; - char **exclude; -} pmix_pnet_test_component_t; - -/* the component must be visible data for the linker to find it */ -PMIX_EXPORT extern pmix_pnet_test_component_t mca_pnet_test_component; -extern pmix_pnet_module_t pmix_test_module; - -/* define a key for any blob we need to send in a launch msg */ -#define PMIX_PNET_TEST_BLOB "pmix.pnet.test.blob" - -END_C_DECLS - -#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test_component.c deleted file mode 100644 index 06e360163f..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test_component.c +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - * These symbols are in a file by themselves to provide nice linker - * semantics. Since linkers generally pull in symbols by object - * files, keeping these symbols as the only symbols in this file - * prevents utility programs such as "ompi_info" from having to import - * entire components just to query their version and parameters. - */ - -#include -#include "pmix_common.h" - -#include "src/util/argv.h" -#include "src/mca/pnet/pnet.h" -#include "pnet_test.h" - -static pmix_status_t component_open(void); -static pmix_status_t component_close(void); -static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointers to our public functions in it - */ -pmix_pnet_test_component_t mca_pnet_test_component = { - .super = { - .base = { - PMIX_PNET_BASE_VERSION_1_0_0, - - /* Component name and version */ - .pmix_mca_component_name = "test", - PMIX_MCA_BASE_MAKE_VERSION(component, - PMIX_MAJOR_VERSION, - PMIX_MINOR_VERSION, - PMIX_RELEASE_VERSION), - - /* Component open and close functions */ - .pmix_mca_open_component = component_open, - .pmix_mca_close_component = component_close, - .pmix_mca_query_component = component_query, - }, - .data = { - /* The component is checkpoint ready */ - PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT - } - }, - .include = NULL, - .exclude = NULL -}; - -static pmix_status_t component_open(void) -{ - int index; - const pmix_mca_base_var_storage_t *value=NULL; - - /* we only allow ourselves to be considered IF the user - * specifically requested so */ - if (0 > (index = pmix_mca_base_var_find("pmix", "pnet", NULL, NULL))) { - return PMIX_ERROR; - } - pmix_mca_base_var_get_value(index, &value, NULL, NULL); - if (NULL != value && NULL != value->stringval && '\0' != value->stringval[0]) { - if (NULL != strstr(value->stringval, "test")) { - return PMIX_SUCCESS; - } - } - return PMIX_ERROR; -} - - -static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority) -{ - *priority = 0; - *module = (pmix_mca_base_module_t *)&pmix_test_module; - return PMIX_SUCCESS; -} - - -static pmix_status_t component_close(void) -{ - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/base.h index 1ed424b4bd..def665a3fe 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/base.h @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #ifndef PMIX_PREG_BASE_H_ #define PMIX_PREG_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -72,6 +72,7 @@ PMIX_CLASS_DECLARATION(pmix_preg_base_active_module_t); struct pmix_preg_globals_t { pmix_list_t actives; bool initialized; + bool selected; }; typedef struct pmix_preg_globals_t pmix_preg_globals_t; @@ -85,12 +86,11 @@ PMIX_EXPORT pmix_status_t pmix_preg_base_parse_nodes(const char *regexp, char ***names); PMIX_EXPORT pmix_status_t pmix_preg_base_parse_procs(const char *regexp, char ***procs); -PMIX_EXPORT pmix_status_t pmix_preg_base_resolve_peers(const char *nodename, - const char *nspace, - pmix_proc_t **procs, size_t *nprocs); -PMIX_EXPORT pmix_status_t pmix_preg_base_resolve_nodes(const char *nspace, - char **nodelist); +PMIX_EXPORT pmix_status_t pmix_preg_base_copy(char **dest, size_t *len, const char *input); +PMIX_EXPORT pmix_status_t pmix_preg_base_pack(pmix_buffer_t *buffer, const char *input); + +PMIX_EXPORT pmix_status_t pmix_preg_base_unpack(pmix_buffer_t *buffer, char **regex); END_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c index 706c2bc8aa..393ac46738 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -24,9 +24,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -51,8 +51,9 @@ pmix_preg_module_t pmix_preg = { .generate_ppn = pmix_preg_base_generate_ppn, .parse_nodes = pmix_preg_base_parse_nodes, .parse_procs = pmix_preg_base_parse_procs, - .resolve_peers = pmix_preg_base_resolve_peers, - .resolve_nodes = pmix_preg_base_resolve_nodes + .copy = pmix_preg_base_copy, + .pack = pmix_preg_base_pack, + .unpack = pmix_preg_base_unpack }; static pmix_status_t pmix_preg_close(void) @@ -61,6 +62,7 @@ static pmix_status_t pmix_preg_close(void) return PMIX_SUCCESS; } pmix_preg_globals.initialized = false; + pmix_preg_globals.selected = false; PMIX_LIST_DESTRUCT(&pmix_preg_globals.actives); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_select.c index 5bba8958de..fa7ddc8dca 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -29,8 +31,6 @@ #include "src/mca/preg/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_preg_base_select(void) @@ -43,11 +43,11 @@ int pmix_preg_base_select(void) int rc, priority; bool inserted; - if (selected) { + if (pmix_preg_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_preg_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_preg_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_stubs.c index 5fe85bf433..c961d80d6c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_stubs.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_UNISTD_H @@ -27,7 +27,8 @@ #include "src/util/argv.h" #include "src/util/error.h" #include "src/include/pmix_globals.h" - +#include "src/client/pmix_client_ops.h" +#include "src/mca/bfrops/bfrops.h" #include "src/mca/preg/base/base.h" pmix_status_t pmix_preg_base_generate_node_regex(const char *input, @@ -43,7 +44,9 @@ pmix_status_t pmix_preg_base_generate_node_regex(const char *input, } } - return PMIX_ERR_NOT_SUPPORTED; + /* no regex could be generated */ + *regex = strdup(input); + return PMIX_SUCCESS; } pmix_status_t pmix_preg_base_generate_ppn(const char *input, @@ -59,7 +62,9 @@ pmix_status_t pmix_preg_base_generate_ppn(const char *input, } } - return PMIX_ERR_NOT_SUPPORTED; + /* no regex could be generated */ + *ppn = strdup(input); + return PMIX_SUCCESS; } pmix_status_t pmix_preg_base_parse_nodes(const char *regexp, @@ -75,7 +80,9 @@ pmix_status_t pmix_preg_base_parse_nodes(const char *regexp, } } - return PMIX_ERR_NOT_SUPPORTED; + /* nobody could parse it, so just process it here */ + *names = pmix_argv_split(regexp, ','); + return PMIX_SUCCESS; } pmix_status_t pmix_preg_base_parse_procs(const char *regexp, @@ -91,38 +98,62 @@ pmix_status_t pmix_preg_base_parse_procs(const char *regexp, } } - return PMIX_ERR_NOT_SUPPORTED; + /* nobody could parse it, so just process it here */ + *procs = pmix_argv_split(regexp, ';'); + return PMIX_SUCCESS; } -pmix_status_t pmix_preg_base_resolve_peers(const char *nodename, - const char *nspace, - pmix_proc_t **procs, size_t *nprocs) +pmix_status_t pmix_preg_base_copy(char **dest, size_t *len, const char *input) { pmix_preg_base_active_module_t *active; PMIX_LIST_FOREACH(active, &pmix_preg_globals.actives, pmix_preg_base_active_module_t) { - if (NULL != active->module->resolve_peers) { - if (PMIX_SUCCESS == active->module->resolve_peers(nodename, nspace, procs, nprocs)) { + if (NULL != active->module->copy) { + if (PMIX_SUCCESS == active->module->copy(dest, len, input)) { return PMIX_SUCCESS; } } } - return PMIX_ERR_NOT_SUPPORTED; + /* nobody could handle it, so it must just be a string */ + *dest = strdup(input); + *len = strlen(input)+1; + return PMIX_SUCCESS; } -pmix_status_t pmix_preg_base_resolve_nodes(const char *nspace, - char **nodelist) +pmix_status_t pmix_preg_base_pack(pmix_buffer_t *buffer, const char *input) { pmix_preg_base_active_module_t *active; + pmix_status_t rc; PMIX_LIST_FOREACH(active, &pmix_preg_globals.actives, pmix_preg_base_active_module_t) { - if (NULL != active->module->resolve_nodes) { - if (PMIX_SUCCESS == active->module->resolve_nodes(nspace, nodelist)) { + if (NULL != active->module->pack) { + if (PMIX_SUCCESS == active->module->pack(buffer, input)) { return PMIX_SUCCESS; } } } - return PMIX_ERR_NOT_SUPPORTED; + /* just pack it as a string */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buffer, input, 1, PMIX_STRING); + return rc; +} + +pmix_status_t pmix_preg_base_unpack(pmix_buffer_t *buffer, char **regex) +{ + pmix_preg_base_active_module_t *active; + pmix_status_t rc; + int32_t cnt = 1; + + PMIX_LIST_FOREACH(active, &pmix_preg_globals.actives, pmix_preg_base_active_module_t) { + if (NULL != active->module->unpack) { + if (PMIX_SUCCESS == active->module->unpack(buffer, regex)) { + return PMIX_SUCCESS; + } + } + } + + /* must just be a string */ + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buffer, regex, &cnt, PMIX_STRING); + return rc; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/Makefile.am similarity index 70% rename from opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am rename to opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/Makefile.am index b71000ef55..d50bf30dfc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/Makefile.am @@ -12,8 +12,6 @@ # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. # Copyright (c) 2013-2019 Intel, Inc. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -21,22 +19,22 @@ # $HEADER$ # -headers = pnet_test.h +headers = preg_compress.h sources = \ - pnet_test_component.c \ - pnet_test.c + preg_compress_component.c \ + preg_compress.c # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la # (for static builds). -if MCA_BUILD_pmix_pnet_test_DSO +if MCA_BUILD_pmix_preg_compress_DSO lib = lib_sources = -component = mca_pnet_test.la +component = mca_preg_compress.la component_sources = $(headers) $(sources) else -lib = libmca_pnet_test.la +lib = libmca_preg_compress.la lib_sources = $(headers) $(sources) component = component_sources = @@ -44,12 +42,12 @@ endif mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) -mca_pnet_test_la_SOURCES = $(component_sources) -mca_pnet_test_la_LDFLAGS = -module -avoid-version +mca_preg_compress_la_SOURCES = $(component_sources) +mca_preg_compress_la_LDFLAGS = -module -avoid-version if NEED_LIBPMIX -mca_pnet_test_la_LIBADD = $(top_builddir)/src/libpmix.la +mca_preg_compress_la_LIBADD = $(top_builddir)/src/libpmix.la endif noinst_LTLIBRARIES = $(lib) -libmca_pnet_test_la_SOURCES = $(lib_sources) -libmca_pnet_test_la_LDFLAGS = -module -avoid-version +libmca_preg_compress_la_SOURCES = $(lib_sources) +libmca_preg_compress_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.c new file mode 100644 index 0000000000..67501c2fcc --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.c @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "src/include/pmix_config.h" + +#ifdef HAVE_STRING_H +#include +#endif +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#include + + +#include "include/pmix_common.h" +#include "include/pmix.h" + +#include "src/include/pmix_socket_errno.h" +#include "src/include/pmix_globals.h" +#include "src/util/argv.h" +#include "src/util/error.h" +#include "src/util/output.h" +#include "src/class/pmix_list.h" +#include "src/mca/bfrops/base/base.h" +#include "src/mca/gds/gds.h" +#include "src/client/pmix_client_ops.h" + +#include "src/mca/pcompress/pcompress.h" +#include "src/mca/preg/base/base.h" +#include "preg_compress.h" + +static pmix_status_t generate_node_regex(const char *input, + char **regex); +static pmix_status_t generate_ppn(const char *input, + char **ppn); +static pmix_status_t parse_nodes(const char *regexp, + char ***names); +static pmix_status_t parse_procs(const char *regexp, + char ***procs); +static pmix_status_t copy(char **dest, size_t *len, const char *input); +static pmix_status_t pack(pmix_buffer_t *buffer, const char *input); +static pmix_status_t unpack(pmix_buffer_t *buffer, char **regex); + +pmix_preg_module_t pmix_preg_compress_module = { + .name = "compress", + .generate_node_regex = generate_node_regex, + .generate_ppn = generate_ppn, + .parse_nodes = parse_nodes, + .parse_procs = parse_procs, + .copy = copy, + .pack = pack, + .unpack = unpack +}; + +#define PREG_COMPRESS_PREFIX "blob: component=zlib: size=" + +static pmix_status_t pack_blob(const uint8_t *tmp, size_t len, char **regexp) +{ + char *result, *slen; + int idx; + + /* convert the length to a string */ + if (0 > asprintf(&slen, "%lu", (unsigned long)len)) { + return PMIX_ERR_NOMEM; + } + + /* create the result */ + result = calloc(len + strlen(PREG_COMPRESS_PREFIX) + strlen(slen) + strlen(":") + 1, sizeof(char)); + idx = 0; + strcpy(result, "blob:"); + idx += strlen("blob:") + 1; // step over NULL terminator + strcpy(&result[idx], "component=zlib:"); + idx += strlen("component=zlib:") + 1; // step over NULL terminator + strcpy(&result[idx], "size="); + idx += strlen("size="); + strcpy(&result[idx], slen); + idx += strlen(slen); + strcpy(&result[idx], ":"); + idx += strlen(":") + 1; // step over NULL terminator + memcpy(&result[idx], tmp, len); + free(slen); + *regexp = result; + + return PMIX_SUCCESS; +} + +static pmix_status_t generate_node_regex(const char *input, + char **regexp) +{ + size_t len; + uint8_t *tmp; + pmix_status_t rc; + + if (!pmix_compress.compress_string((char*)input, &tmp, &len)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + + if (NULL == tmp) { + return PMIX_ERR_NOMEM; + } + rc = pack_blob(tmp, len, regexp); + free(tmp); + + return rc; +} + +static pmix_status_t generate_ppn(const char *input, + char **regexp) +{ + size_t len; + uint8_t *tmp; + pmix_status_t rc; + + if (!pmix_compress.compress_string((char*)input, &tmp, &len)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + + if (NULL == tmp) { + return PMIX_ERR_NOMEM; + } + + if (NULL == tmp) { + return PMIX_ERR_NOMEM; + } + rc = pack_blob(tmp, len, regexp); + free(tmp); + + return rc; +} + +static pmix_status_t parse_nodes(const char *regexp, + char ***names) +{ + char *tmp, *ptr, **argv; + size_t len; + int idx; + + if (0 != strncmp(regexp, "blob", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx = strlen(regexp) + 1; // step over the NULL terminator + + /* ensure we were the one who generated this blob */ + if (0 != strncmp(®exp[idx], "component=zlib:", strlen("component=zlib:"))) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx += strlen("component=zlib:") + 1; // step over the NULL terminator + + len = strtoul(®exp[idx], &ptr, 10); + ptr += 2; // step over colon and NULL + + /* malloc the space */ + tmp = malloc(len); + if (NULL == tmp) { + return PMIX_ERR_NOMEM; + } + + if (!pmix_compress.decompress_string(&tmp, (uint8_t*)ptr, len)) { + free(tmp); + return PMIX_ERR_TAKE_NEXT_OPTION; + } + /* tmp now contains the comma-delimited list of node names */ + argv = pmix_argv_split(tmp, ','); + free(tmp); + *names = argv; + return PMIX_SUCCESS; +} +static pmix_status_t parse_procs(const char *regexp, + char ***procs) +{ + char *tmp, *ptr, **argv; + size_t len; + int idx; + + if (0 != strncmp(regexp, "blob", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx = strlen(regexp) + 1; // step over the NULL terminator + + /* ensure we were the one who generated this blob */ + if (0 != strncmp(®exp[idx], "component=zlib:", strlen("component=zlib:"))) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx += strlen("component=zlib:") + 1; // step over the NULL terminator + + len = strtoul(®exp[idx], &ptr, 10); + ptr += 2; // step over colon and NULL + + /* malloc the space */ + tmp = malloc(len); + if (NULL == tmp) { + return PMIX_ERR_NOMEM; + } + + if (!pmix_compress.decompress_string(&tmp, (uint8_t*)ptr, len)) { + free(tmp); + return PMIX_ERR_TAKE_NEXT_OPTION; + } + + /* tmp now contains the semicolon-delimited list of procs */ + argv = pmix_argv_split(tmp, ';'); + free(tmp); + *procs = argv; + return PMIX_SUCCESS; +} + +static pmix_status_t copy(char **dest, size_t *len, const char *input) +{ + size_t slen; + char *tmp; + int idx; + + if (0 != strncmp(input, "blob", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx = strlen(input) + 1; // step over the NULL terminator + + /* ensure we were the one who generated this blob */ + if (0 != strncmp(&input[idx], "component=zlib:", strlen("component=zlib:"))) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx += strlen("component=zlib:") + 1; // step over the NULL terminator + + /* extract the size */ + slen = strtoul(&input[idx], NULL, 10) + strlen(PREG_COMPRESS_PREFIX) + strlen(&input[idx]) + 1; + + /* malloc the space */ + tmp = calloc(slen, sizeof(char)); + if (NULL == tmp) { + return PMIX_ERR_NOMEM; + } + + /* copy the data */ + memcpy(tmp, input, slen); + *dest = tmp; + *len = slen; + return PMIX_SUCCESS; +} + +static pmix_status_t pack(pmix_buffer_t *buffer, const char *input) +{ + size_t slen; + char *ptr; + int idx; + + if (0 != strncmp(input, "blob", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx = strlen(input) + 1; // step over the NULL terminator + + /* ensure we were the one who generated this blob */ + if (0 != strncmp(&input[idx], "component=zlib:", strlen("component=zlib:"))) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx += strlen("component=zlib:") + 1; // step over the NULL terminator + + /* extract the size */ + slen = strtoul(&input[idx], NULL, 10) + strlen(PREG_COMPRESS_PREFIX) + strlen(&input[idx]) + 1; + + /* ensure the buffer has enough space */ + ptr = pmix_bfrop_buffer_extend(buffer, slen); + if (NULL == ptr) { + return PMIX_ERR_NOMEM; + } + + /* xfer the data */ + memcpy(ptr, input, slen); + buffer->bytes_used += slen; + buffer->pack_ptr += slen; + + return PMIX_SUCCESS; +} + +static pmix_status_t unpack(pmix_buffer_t *buffer, char **regex) +{ + size_t slen; + char *ptr, *output; + int idx; + + /* the value starts at the unpack_ptr */ + ptr = buffer->unpack_ptr; + + if (0 != strncmp(ptr, "blob", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx = strlen(ptr) + 1; // step over the NULL terminator + + /* ensure we were the one who generated this blob */ + if (0 != strncmp(&ptr[idx], "component=zlib:", strlen("component=zlib:"))) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } + idx += strlen("component=zlib:") + 1; // step over the NULL terminator + + /* extract the size */ + slen = strtoul(&ptr[idx], NULL, 10) + strlen(PREG_COMPRESS_PREFIX) + strlen(&ptr[idx]) + 1; + + /* get the space */ + output = (char*)malloc(slen); + if (NULL == output) { + *regex = NULL; + return PMIX_ERR_NOMEM; + } + + /* xfer the data */ + memcpy(output, ptr, slen); + buffer->unpack_ptr += slen; + *regex = output; + + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.h b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.h new file mode 100644 index 0000000000..49e66cbf66 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_PREG_compress_H +#define PMIX_PREG_compress_H + +#include "src/include/pmix_config.h" + + +#include "src/mca/preg/preg.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_mca_base_component_t mca_preg_compress_component; +extern pmix_preg_module_t pmix_preg_compress_module; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress_component.c new file mode 100644 index 0000000000..0532077617 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/compress/preg_compress_component.c @@ -0,0 +1,82 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + * These symbols are in a file by themselves to provide nice linker + * semantics. Since linkers generally pull in symbols by object + * files, keeping these symbols as the only symbols in this file + * prevents utility programs such as "ompi_info" from having to import + * entire components just to query their version and parameters. + */ + +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" + +#include "src/mca/pcompress/pcompress.h" +#include "src/mca/preg/preg.h" +#include "preg_compress.h" + +static pmix_status_t component_open(void); +static pmix_status_t component_close(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_mca_base_component_t mca_preg_compress_component = { + PMIX_PREG_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "compress", + PMIX_MCA_BASE_MAKE_VERSION(component, + PMIX_MAJOR_VERSION, + PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, +}; + + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + if (NULL == pmix_compress.compress_string) { + return PMIX_ERROR; + } + /* we should always be first in priority */ + *priority = 100; + *module = (pmix_mca_base_module_t *)&pmix_preg_compress_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c index 8704191ecd..2b6854f8cf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -11,7 +11,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STRING_H #include @@ -26,8 +26,8 @@ #include -#include -#include +#include "include/pmix_common.h" +#include "include/pmix.h" #include "src/include/pmix_socket_errno.h" #include "src/include/pmix_globals.h" @@ -35,10 +35,11 @@ #include "src/util/error.h" #include "src/util/output.h" #include "src/class/pmix_list.h" +#include "src/mca/bfrops/base/base.h" #include "src/mca/gds/gds.h" #include "src/client/pmix_client_ops.h" -#include "src/mca/preg/preg.h" +#include "src/mca/preg/base/base.h" #include "preg_native.h" static pmix_status_t generate_node_regex(const char *input, @@ -49,11 +50,9 @@ static pmix_status_t parse_nodes(const char *regexp, char ***names); static pmix_status_t parse_procs(const char *regexp, char ***procs); -static pmix_status_t resolve_peers(const char *nodename, - const char *nspace, - pmix_proc_t **procs, size_t *nprocs); -static pmix_status_t resolve_nodes(const char *nspace, - char **nodelist); +static pmix_status_t copy(char **dest, size_t *len, const char *input); +static pmix_status_t pack(pmix_buffer_t *buffer, const char *input); +static pmix_status_t unpack(pmix_buffer_t *buffer, char **regex); pmix_preg_module_t pmix_preg_native_module = { .name = "pmix", @@ -61,8 +60,9 @@ pmix_preg_module_t pmix_preg_native_module = { .generate_ppn = generate_ppn, .parse_nodes = parse_nodes, .parse_procs = parse_procs, - .resolve_peers = resolve_peers, - .resolve_nodes = resolve_nodes + .copy = copy, + .pack = pack, + .unpack = unpack }; static pmix_status_t regex_parse_value_ranges(char *base, char *ranges, @@ -432,6 +432,13 @@ static pmix_status_t generate_ppn(const char *input, /* replace the final semi-colon */ tmp[strlen(tmp)-1] = ']'; + /* if this results in a longer answer, then don't do it */ + if (strlen(tmp) > strlen(input)) { + free(tmp); + PMIX_LIST_DESTRUCT(&nodes); + return PMIX_ERR_TAKE_NEXT_OPTION; + } + /* assemble final result */ *regexp = tmp; @@ -461,7 +468,6 @@ static pmix_status_t parse_nodes(const char *regexp, /* the regex generator used to create this regex * is tagged at the beginning of the string */ if (NULL == (ptr = strchr(tmp, '['))) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); free(tmp); return PMIX_ERR_BAD_PARAM; } @@ -503,7 +509,6 @@ static pmix_status_t parse_procs(const char *regexp, /* the regex generator used to create this regex * is tagged at the beginning of the string */ if (NULL == (ptr = strchr(tmp, '['))) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); free(tmp); return PMIX_ERR_BAD_PARAM; } @@ -523,159 +528,60 @@ static pmix_status_t parse_procs(const char *regexp, return rc; } -static pmix_status_t resolve_peers(const char *nodename, - const char *nspace, - pmix_proc_t **procs, size_t *nprocs) +static pmix_status_t copy(char **dest, size_t *len, const char *input) { - pmix_cb_t cb; - pmix_status_t rc; - pmix_kval_t *kv; - pmix_proc_t proc; - char **ptr; - pmix_info_t *info; - pmix_proc_t *p=NULL; - size_t ninfo, np=0, n, j; - - PMIX_CONSTRUCT(&cb, pmix_cb_t); - - cb.key = strdup(nodename); - /* this data isn't going anywhere, so we don't require a copy */ - cb.copy = false; - /* scope is irrelevant as the info we seek must be local */ - cb.scope = PMIX_SCOPE_UNDEF; - /* let the proc point to the nspace */ - pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - cb.proc = &proc; - - PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, &cb); - if (PMIX_SUCCESS != rc) { - if (PMIX_ERR_INVALID_NAMESPACE != rc) { - PMIX_ERROR_LOG(rc); - } - goto complete; - } - /* should just be the one value on the list */ - if (1 != pmix_list_get_size(&cb.kvs)) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - rc = PMIX_ERR_BAD_PARAM; - goto complete; - } - kv = (pmix_kval_t*)pmix_list_get_first(&cb.kvs); - /* the hostname used as a key with wildcard rank will return - * a pmix_data_array_t of pmix_info_t structs */ - if (NULL == kv->value || - PMIX_DATA_ARRAY != kv->value->type || - NULL == kv->value->data.darray || - PMIX_INFO != kv->value->data.darray->type) { - PMIX_ERROR_LOG(PMIX_ERR_DATA_VALUE_NOT_FOUND); - rc = PMIX_ERR_DATA_VALUE_NOT_FOUND; - goto complete; - } - info = (pmix_info_t*)kv->value->data.darray->array; - ninfo = kv->value->data.darray->size; - /* find the PMIX_LOCAL_PEERS key */ - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN)) { - /* split the string */ - ptr = pmix_argv_split(info[n].value.data.string, ','); - np = pmix_argv_count(ptr); - PMIX_PROC_CREATE(p, np); - if (NULL == p) { - rc = PMIX_ERR_NOMEM; - pmix_argv_free(ptr); - goto complete; - } - for (j=0; j < np; j++) { - pmix_strncpy(p[j].nspace, nspace, PMIX_MAX_NSLEN); - p[j].rank = strtoul(ptr[j], NULL, 10); - } - rc = PMIX_SUCCESS; - pmix_argv_free(ptr); - break; - } + if (0 != strncmp(input, "pmix", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; } - complete: - if (NULL != cb.info) { - PMIX_INFO_FREE(cb.info, cb.ninfo); - } - if (NULL != cb.key) { - free(cb.key); - cb.key = NULL; - } - PMIX_DESTRUCT(&cb); - *procs = p; - *nprocs = np; - - return rc; + *dest = strdup(input); + *len = strlen(input) + 1; + return PMIX_SUCCESS; } -static pmix_status_t resolve_nodes(const char *nspace, - char **nodelist) +static pmix_status_t pack(pmix_buffer_t *buffer, const char *input) { - pmix_cb_t cb; - pmix_status_t rc; - pmix_kval_t *kv; - pmix_proc_t proc; + size_t slen; + char *ptr; - PMIX_CONSTRUCT(&cb, pmix_cb_t); + if (0 != strncmp(input, "pmix", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; + } - /* setup default answer */ - *nodelist = NULL; + /* extract the size */ + slen = strlen(input) + 1; // retain the NULL terminator - /* create a pmix_info_t so we can pass the nspace - * into the fetch as a qualifier */ - PMIX_INFO_CREATE(cb.info, 1); - if (NULL == cb.info) { - PMIX_DESTRUCT(&cb); + /* ensure the buffer has enough space */ + ptr = pmix_bfrop_buffer_extend(buffer, slen); + if (NULL == ptr) { return PMIX_ERR_NOMEM; } - cb.ninfo = 1; - PMIX_INFO_LOAD(&cb.info[0], PMIX_NSPACE, nspace, PMIX_STRING); - /* tell the GDS what we want */ - cb.key = PMIX_NODE_MAP; - /* this data isn't going anywhere, so we don't require a copy */ - cb.copy = false; - /* scope is irrelevant as the info we seek must be local */ - cb.scope = PMIX_SCOPE_UNDEF; - /* put the nspace in the proc field */ - pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); - /* the info will be associated with PMIX_RANK_WILDCARD */ - proc.rank = PMIX_RANK_WILDCARD; - cb.proc = &proc; + /* xfer the data */ + memcpy(ptr, input, slen); + buffer->bytes_used += slen; + buffer->pack_ptr += slen; - PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, &cb); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - goto complete; - } - /* should just be the one value on the list */ - if (1 != pmix_list_get_size(&cb.kvs)) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - rc = PMIX_ERR_BAD_PARAM; - goto complete; - } - kv = (pmix_kval_t*)pmix_list_get_first(&cb.kvs); - /* the PMIX_NODE_MAP key is supposed to return - * a regex string - check that it did */ - if (NULL == kv->value || - PMIX_STRING != kv->value->type) { - PMIX_ERROR_LOG(PMIX_ERR_DATA_VALUE_NOT_FOUND); - rc = PMIX_ERR_DATA_VALUE_NOT_FOUND; - goto complete; - } - /* return the string */ - if (NULL != kv->value->data.string) { - *nodelist = strdup(kv->value->data.string); + return PMIX_SUCCESS; +} + +static pmix_status_t unpack(pmix_buffer_t *buffer, char **regex) +{ + char *ptr; + + ptr = buffer->unpack_ptr; + + if (0 != strncmp(ptr, "pmix", 4)) { + return PMIX_ERR_TAKE_NEXT_OPTION; } - complete: - if (NULL != cb.info) { - PMIX_INFO_FREE(cb.info, cb.ninfo); + *regex = strdup(ptr); + buffer->unpack_ptr += strlen(ptr) + 1; + + if (NULL == *regex) { + return PMIX_ERR_NOMEM; } - return rc; + return PMIX_SUCCESS; } static pmix_status_t pmix_regex_extract_nodes(char *regexp, char ***names) @@ -701,7 +607,7 @@ static pmix_status_t pmix_regex_extract_nodes(char *regexp, char ***names) return PMIX_ERR_OUT_OF_RESOURCE; } - PMIX_OUTPUT_VERBOSE((1, pmix_globals.debug_output, + PMIX_OUTPUT_VERBOSE((1, pmix_preg_base_framework.framework_output, "pmix:extract:nodes: checking list: %s", regexp)); do { @@ -777,7 +683,7 @@ static pmix_status_t pmix_regex_extract_nodes(char *regexp, char ***names) } else { suffix = NULL; } - PMIX_OUTPUT_VERBOSE((1, pmix_globals.debug_output, + PMIX_OUTPUT_VERBOSE((1, pmix_preg_base_framework.framework_output, "regex:extract:nodes: parsing range %s %s %s", base, base + i, suffix)); @@ -851,7 +757,7 @@ static pmix_status_t regex_parse_value_ranges(char *base, char *ranges, if (start < orig + len) { - PMIX_OUTPUT_VERBOSE((1, pmix_globals.debug_output, + PMIX_OUTPUT_VERBOSE((1, pmix_preg_base_framework.framework_output, "regex:parse:ranges: parse range %s (2)", start)); ret = regex_parse_value_range(base, start, num_digits, suffix, names); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.h b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.h index 7f6715a844..6540fe42ce 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -11,7 +11,7 @@ #ifndef PMIX_PREG_NATIVE_H #define PMIX_PREG_NATIVE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/preg/preg.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native_component.c index 88a850b343..912f1660e8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/preg/preg.h" @@ -66,8 +66,7 @@ static int component_open(void) static int component_query(pmix_mca_base_module_t **module, int *priority) { - /* we should always be first in priority */ - *priority = 100; + *priority = 50; *module = (pmix_mca_base_module_t *)&pmix_preg_native_module; return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg.h b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg.h index e02b512260..3ebfee1bee 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg.h @@ -1,7 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -23,11 +23,12 @@ #ifndef PMIX_PREG_H #define PMIX_PREG_H -#include +#include "src/include/pmix_config.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/base/pmix_mca_base_framework.h" +#include "src/mca/bfrops/bfrops_types.h" #include "src/mca/preg/preg_types.h" @@ -78,12 +79,11 @@ typedef pmix_status_t (*pmix_preg_base_module_parse_nodes_fn_t)(const char *rege typedef pmix_status_t (*pmix_preg_base_module_parse_procs_fn_t)(const char *regexp, char ***procs); -typedef pmix_status_t (*pmix_preg_base_module_resolve_peers_fn_t)(const char *nodename, - const char *nspace, - pmix_proc_t **procs, size_t *nprocs); +typedef pmix_status_t (*pmix_preg_base_module_copy_fn_t)(char **dest, size_t *len, const char *input); -typedef pmix_status_t (*pmix_preg_base_module_resolve_nodes_fn_t)(const char *nspace, - char **nodelist); +typedef pmix_status_t (*pmix_preg_base_module_pack_fn_t)(pmix_buffer_t *buffer, const char *regex); + +typedef pmix_status_t (*pmix_preg_base_module_unpack_fn_t)(pmix_buffer_t *buffer, char **regex); /** * Base structure for a PREG module @@ -94,8 +94,9 @@ typedef struct { pmix_preg_base_module_generate_ppn_fn_t generate_ppn; pmix_preg_base_module_parse_nodes_fn_t parse_nodes; pmix_preg_base_module_parse_procs_fn_t parse_procs; - pmix_preg_base_module_resolve_peers_fn_t resolve_peers; - pmix_preg_base_module_resolve_nodes_fn_t resolve_nodes; + pmix_preg_base_module_copy_fn_t copy; + pmix_preg_base_module_pack_fn_t pack; + pmix_preg_base_module_unpack_fn_t unpack; } pmix_preg_module_t; /* we just use the standard component definition */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h index 932d8e552c..650f4ba9f7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -29,7 +29,7 @@ #ifndef PMIX_MCA_PREG_TYPES_H_ #define PMIX_MCA_PREG_TYPES_H_ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/Makefile.am index ce2cdabab6..76a5739d1d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/Makefile.am @@ -11,8 +11,8 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved -# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/base.h index 28873caf4a..7dc7045ff2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/base.h @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #ifndef PMIX_PSEC_BASE_H_ #define PMIX_PSEC_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -72,10 +72,11 @@ PMIX_CLASS_DECLARATION(pmix_psec_base_active_module_t); struct pmix_psec_globals_t { pmix_list_t actives; bool initialized; + bool selected; }; typedef struct pmix_psec_globals_t pmix_psec_globals_t; -extern pmix_psec_globals_t pmix_psec_globals; +PMIX_EXPORT extern pmix_psec_globals_t pmix_psec_globals; PMIX_EXPORT char* pmix_psec_base_get_available_modules(void); PMIX_EXPORT pmix_psec_module_t* pmix_psec_base_assign_module(const char *options); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_fns.c index 64e875b16b..afb97eb9e8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_fns.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * @@ -11,9 +11,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_frame.c index 7acd69c5e8..85aceada61 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +23,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -54,6 +54,7 @@ static pmix_status_t pmix_psec_close(void) return PMIX_SUCCESS; } pmix_psec_globals.initialized = false; + pmix_psec_globals.selected = false; PMIX_LIST_FOREACH_SAFE(active, prev, &pmix_psec_globals.actives, pmix_psec_base_active_module_t) { pmix_list_remove_item(&pmix_psec_globals.actives, &active->super); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_select.c index 5d92f3a34f..d20288d9aa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/base/psec_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -29,8 +31,6 @@ #include "src/mca/psec/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_psec_base_select(void) @@ -43,11 +43,11 @@ int pmix_psec_base_select(void) int rc, priority; bool inserted; - if (selected) { + if (pmix_psec_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_psec_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_psec_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c index 0e707049f6..b08717062c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c @@ -2,6 +2,7 @@ /* * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,14 +10,14 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_SYS_TYPES_H #include #endif -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/util/error.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h index 5a8ea51910..564b73fdcf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h @@ -2,6 +2,7 @@ /* * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,7 +13,7 @@ #ifndef PMIX_SIMPLE_H #define PMIX_SIMPLE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c index fd826b817c..ec4d1689f1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c @@ -2,6 +2,7 @@ /* * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,8 +10,8 @@ * $HEADER$ */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.c index 2954e4a5c0..7c68fbfb7b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * NOTE: THE MUNGE CLIENT LIBRARY (libmunge) IS LICENSED AS LGPL * @@ -10,9 +10,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/util/argv.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.h index ff50bd4918..a317ab790e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -13,7 +13,7 @@ BEGIN_C_DECLS -#include +#include "src/include/pmix_config.h" /* the component must be visible data for the linker to find it */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge_component.c index c44a5232d0..f8850540e7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/psec_munge_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c index 60af0f7af1..72f5aca147 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -10,14 +10,14 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_SYS_TYPES_H #include #endif -#include +#include "include/pmix_common.h" #include "src/include/pmix_socket_errno.h" #include "src/include/pmix_globals.h" @@ -275,7 +275,7 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, } *ninfo = 3; /* mark that this came from us */ - PMIX_INFO_LOAD(info[0], PMIX_CRED_TYPE, "munge", PMIX_STRING); + PMIX_INFO_LOAD(info[0], PMIX_CRED_TYPE, "native", PMIX_STRING); /* provide the uid it contained */ u32 = euid; PMIX_INFO_LOAD(info[1], PMIX_USERID, &u32, PMIX_UINT32); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.h index 8adf0f8b11..96606c2b2c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -11,7 +11,7 @@ #ifndef PMIX_NATIVE_H #define PMIX_NATIVE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native_component.c index b392fe201f..2989fddce2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.c index 7b6311be79..6235f6cd9c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -11,9 +11,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/include/pmix_socket_errno.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.h index d443c97448..f78d98f41d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -11,7 +11,7 @@ #ifndef PMIX_NATIVE_H #define PMIX_NATIVE_H -#include +#include "src/include/pmix_config.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none_component.c index 3669c1a7f8..31e5b750dd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/psec_none_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/psec/psec.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h index e088cd5ff4..815bb27a11 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h @@ -1,7 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -29,7 +29,7 @@ #ifndef PMIX_PSEC_H #define PMIX_PSEC_H -#include +#include "src/include/pmix_config.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_var.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/base.h index a01437acff..3a85465fa1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/base.h @@ -1,8 +1,9 @@ /* * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. - * - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,7 +16,7 @@ #ifndef PMIX_PSENSOR_BASE_H_ #define PMIX_PSENSOR_BASE_H_ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" #include "src/mca/mca.h" @@ -36,6 +37,7 @@ PMIX_EXPORT int pmix_psensor_base_select(void); typedef struct { pmix_list_t actives; pmix_event_base_t *evbase; + bool selected; } pmix_psensor_base_t; typedef struct { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_frame.c index d10bab1cb1..f481f954e0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_frame.c @@ -2,8 +2,9 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,9 +13,9 @@ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include #include PMIX_EVENT_HEADER @@ -48,6 +49,7 @@ static bool use_separate_thread = false; static int pmix_psensor_register(pmix_mca_base_register_flag_t flags) { + (void)flags; (void) pmix_mca_base_var_register("pmix", "psensor", "base", "use_separate_thread", "Use a separate thread for monitoring local procs", PMIX_MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, @@ -60,6 +62,7 @@ static int pmix_psensor_register(pmix_mca_base_register_flag_t flags) static int pmix_psensor_base_close(void) { + pmix_psensor_base.selected = false; PMIX_LIST_DESTRUCT(&pmix_psensor_base.actives); if (use_separate_thread && NULL != pmix_psensor_base.evbase) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_select.c index 4a1f1f0c2a..8252300234 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -27,8 +29,6 @@ #include "src/mca/psensor/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_psensor_base_select(void) @@ -40,11 +40,11 @@ int pmix_psensor_base_select(void) int pri; bool inserted; - if (selected) { + if (pmix_psensor_base.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_psensor_base.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_psensor_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c index b959372fe0..af8bdd26a3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -11,8 +11,8 @@ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/util/error.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c index 3a050823c2..a116489007 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c @@ -6,7 +6,9 @@ * Copyright (c) 2011-2012 Los Alamos National Security, LLC. * All rights reserved. * - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -14,9 +16,8 @@ * $HEADER$ */ -#include -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #include @@ -293,6 +294,7 @@ static void file_sample(int sd, short args, void *cbdata) ft->file)); /* stat the file and get its info */ + /* coverity[toctou] */ if (0 > stat(ft->file, &buf)) { /* cannot stat file */ PMIX_OUTPUT_VERBOSE((1, pmix_psensor_base_framework.framework_output, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.h index 51f2a0e9f8..1a945fb6f3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -16,7 +16,7 @@ #ifndef PMIX_PSENSOR_FILE_H #define PMIX_PSENSOR_FILE_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file_component.c index 2b751d7199..f6246779ce 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file_component.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -8,8 +8,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c index 81de240b65..c6a6892f0b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c @@ -3,7 +3,7 @@ * Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights * reserved. * - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,8 +11,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h index 2052b0d9c6..d97290d47f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. * - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +17,8 @@ #ifndef PMIX_PSENSOR_HEARTBEAT_H #define PMIX_PSENSOR_HEARTBEAT_H -#include -#include +#include "src/include/pmix_config.h" +#include "src/include/types.h" #include "src/class/pmix_list.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c index 1f56177dee..ee5c16e798 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,8 +9,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/mca/ptl/ptl.h" #include "src/mca/psensor/base/base.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/psensor.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/psensor.h index e1c019e388..06896a2f5d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/psensor.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/psensor.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -16,7 +16,7 @@ #ifndef PMIX_PSENSOR_H_ #define PMIX_PSENSOR_H_ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" #include "src/mca/mca.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/base.h index a1c12421ef..cc0b073c69 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/base.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -24,7 +24,7 @@ #ifndef PMIX_PSHMEM_BASE_H_ #define PMIX_PSHMEM_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -55,6 +55,16 @@ PMIX_EXPORT extern pmix_mca_base_framework_t pmix_pshmem_base_framework; */ PMIX_EXPORT pmix_status_t pmix_pshmem_base_select(void); +/* framework globals */ +struct pmix_pshmem_globals_t { + bool initialized; + bool selected; +}; + +typedef struct pmix_pshmem_globals_t pmix_pshmem_globals_t; + +PMIX_EXPORT extern pmix_pshmem_globals_t pmix_pshmem_globals; + END_C_DECLS #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c index 30296755f6..059c9cfd90 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +23,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -43,28 +43,28 @@ #include "src/mca/pshmem/base/static-components.h" -static bool initialized = false; - /* Instantiate the global vars */ +pmix_pshmem_globals_t pmix_pshmem_globals = {0}; pmix_pshmem_base_module_t pmix_pshmem = {0}; static pmix_status_t pmix_pshmem_close(void) { - if (!initialized) { + if (!pmix_pshmem_globals.initialized) { return PMIX_SUCCESS; } - initialized = false; + pmix_pshmem_globals.initialized = false; + pmix_pshmem_globals.selected = false; return pmix_mca_base_framework_components_close(&pmix_pshmem_base_framework, NULL); } static pmix_status_t pmix_pshmem_open(pmix_mca_base_open_flag_t flags) { - if (initialized) { + if (pmix_pshmem_globals.initialized) { return PMIX_SUCCESS; } /* initialize globals */ - initialized = true; + pmix_pshmem_globals.initialized = true; /* Open up all available components */ return pmix_mca_base_framework_components_open(&pmix_pshmem_base_framework, flags); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_select.c index 4b54a60a4c..7f74ab1c35 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -27,8 +29,6 @@ #include "src/mca/pshmem/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_pshmem_base_select(void) @@ -40,11 +40,11 @@ int pmix_pshmem_base_select(void) int rc, priority, best_pri = -1; bool inserted = false; - if (selected) { + if (pmix_pshmem_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_pshmem_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_pshmem_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c index 6529c1fa4a..db401c080f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c @@ -3,7 +3,7 @@ * All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,45 +21,31 @@ #include #include -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" //#include "pmix_sm.h" -#include +#include "src/mca/pshmem/pshmem.h" #include "pshmem_mmap.h" #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) # define MAP_ANONYMOUS MAP_ANON #endif /* MAP_ANONYMOUS and MAP_ANON */ -static int _mmap_init(void); -static void _mmap_finalize(void); static int _mmap_segment_create(pmix_pshmem_seg_t *sm_seg, const char *file_name, size_t size); static int _mmap_segment_attach(pmix_pshmem_seg_t *sm_seg, pmix_pshmem_access_mode_t sm_mode); static int _mmap_segment_detach(pmix_pshmem_seg_t *sm_seg); static int _mmap_segment_unlink(pmix_pshmem_seg_t *sm_seg); pmix_pshmem_base_module_t pmix_mmap_module = { - "mmap", - _mmap_init, - _mmap_finalize, - _mmap_segment_create, - _mmap_segment_attach, - _mmap_segment_detach, - _mmap_segment_unlink + .name = "mmap", + .segment_create = _mmap_segment_create, + .segment_attach = _mmap_segment_attach, + .segment_detach = _mmap_segment_detach, + .segment_unlink = _mmap_segment_unlink }; -static int _mmap_init(void) -{ - return PMIX_SUCCESS; -} - -static void _mmap_finalize(void) -{ - ; -} - static int _mmap_segment_create(pmix_pshmem_seg_t *sm_seg, const char *file_name, size_t size) { int rc = PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.h index fade1af18d..d5421d4224 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,8 +12,8 @@ #ifndef PMIX_SM_MMAP_H #define PMIX_SM_MMAP_H -#include -#include +#include "src/include/pmix_config.h" +#include "src/mca/pshmem/pshmem.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap_component.c index 7ad0b072b9..14758e06ed 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -28,11 +28,11 @@ * entire components just to query their version and parameters. */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" -#include +#include "src/mca/pshmem/pshmem.h" #include "pshmem_mmap.h" static pmix_status_t component_open(void); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/pshmem.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/pshmem.h index 013bddb9ef..e89f225a41 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/pshmem.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/pshmem.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2015-2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,9 +12,9 @@ #ifndef PMIX_PSHMEM_H #define PMIX_PSHMEM_H -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/base/pmix_mca_base_framework.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/Makefile.am new file mode 100644 index 0000000000..fff34f69a3 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/Makefile.am @@ -0,0 +1,45 @@ +# -*- makefile -*- +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2005 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. +# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 IBM Corporation. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AM_CPPFLAGS = $(LTDLINCL) + +# main library setup +noinst_LTLIBRARIES = libmca_psquash.la +libmca_psquash_la_SOURCES = + +# local files +headers = psquash.h +sources = + +# Conditionally install the header files +if WANT_INSTALL_HEADERS +pmixdir = $(pmixincludedir)/$(subdir) +nobase_pmix_HEADERS = $(headers) +endif + +include base/Makefile.include + +libmca_psquash_la_SOURCES += $(headers) $(sources) + +distclean-local: + rm -f base/static-components.h diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/Makefile.include new file mode 100644 index 0000000000..da93464fb1 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/Makefile.include @@ -0,0 +1,19 @@ +# -*- makefile -*- +# +# Copyright (c) 2019 IBM Corporation. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This makefile.am does not stand on its own - it is included from +# src/Makefile.am + +headers += \ + base/base.h + +sources += \ + base/psquash_base_frame.c \ + base/psquash_base_select.c diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/base.h new file mode 100644 index 0000000000..b25ff22693 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/base.h @@ -0,0 +1,83 @@ +/* -*- C -*- + * + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ +#ifndef PMIX_PSQUASH_BASE_H_ +#define PMIX_PSQUASH_BASE_H_ + +#include "src/include/pmix_config.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#include "src/class/pmix_pointer_array.h" +#include "src/mca/mca.h" +#include "src/mca/base/pmix_mca_base_framework.h" + +#include "src/mca/psquash/psquash.h" + + +BEGIN_C_DECLS + +/** + * Sizeof by PMIx type integer values. + * + * r - return status code + * t - type (pmix_data_type_t) of integer value + * s - size of type in bytes + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define PMIX_SQUASH_TYPE_SIZEOF(r, t, s) \ +do { \ + (r) = PMIX_SUCCESS; \ + switch (t) { \ + case PMIX_INT16: \ + case PMIX_UINT16: \ + (s) = SIZEOF_SHORT; \ + break; \ + case PMIX_INT: \ + case PMIX_INT32: \ + case PMIX_UINT: \ + case PMIX_UINT32: \ + (s) = SIZEOF_INT; \ + break; \ + case PMIX_INT64: \ + case PMIX_UINT64: \ + (s) = SIZEOF_LONG; \ + break; \ + case PMIX_SIZE: \ + (s) = SIZEOF_SIZE_T; \ + break; \ + default: \ + (r) = PMIX_ERR_BAD_PARAM; \ + } \ +} while (0) + +struct pmix_psquash_globals_t { + bool initialized; + bool selected; +}; + +typedef struct pmix_psquash_globals_t pmix_psquash_globals_t; + +PMIX_EXPORT extern pmix_mca_base_framework_t pmix_psquash_base_framework; + +PMIX_EXPORT pmix_status_t pmix_psquash_base_select(void); + +PMIX_EXPORT extern pmix_psquash_globals_t pmix_psquash_globals; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_frame.c new file mode 100644 index 0000000000..3f1a1a0f52 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_frame.c @@ -0,0 +1,75 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2009 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +/** @file: + * + */ +#include "src/include/pmix_config.h" + +#include "include/pmix_common.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#include "src/class/pmix_list.h" +#include "src/mca/base/base.h" +#include "src/mca/psquash/base/base.h" + +/* + * The following file was created by configure. It contains extern + * statements and the definition of an array of pointers to each + * component's public mca_base_component_t struct. + */ + +#include "src/mca/psquash/base/static-components.h" + +pmix_psquash_base_module_t pmix_psquash = {0}; +pmix_psquash_globals_t pmix_psquash_globals = {0}; + +static pmix_status_t pmix_psquash_close(void) +{ + if (!pmix_psquash_globals.initialized) { + return PMIX_SUCCESS; + } + pmix_psquash_globals.initialized = false; + pmix_psquash_globals.selected = false; + + return pmix_mca_base_framework_components_close(&pmix_psquash_base_framework, NULL); +} + +static pmix_status_t pmix_psquash_open(pmix_mca_base_open_flag_t flags) +{ + if (pmix_psquash_globals.initialized) { + return PMIX_SUCCESS; + } + /* initialize globals */ + pmix_psquash_globals.initialized = true; + + /* Open up all available components */ + return pmix_mca_base_framework_components_open(&pmix_psquash_base_framework, flags); +} + +PMIX_MCA_BASE_FRAMEWORK_DECLARE(pmix, psquash, "PMIx Squash Operations", + NULL, pmix_psquash_open, pmix_psquash_close, + mca_psquash_base_static_components, 0); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_select.c new file mode 100644 index 0000000000..e838f7c6d2 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/base/psquash_base_select.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" + +#include + +#include "src/mca/mca.h" +#include "src/mca/base/base.h" +#include "src/util/error.h" +#include "src/util/show_help.h" + +#include "src/mca/psquash/base/base.h" + +/* Function for selecting a prioritized list of components + * from all those that are available. */ +int pmix_psquash_base_select(void) +{ + pmix_mca_base_component_list_item_t *cli; + pmix_mca_base_component_t *component; + pmix_mca_base_module_t *module; + pmix_psquash_base_module_t *nmodule; + int rc, priority, best_pri = -1; + bool inserted = false; + + if (pmix_psquash_globals.selected) { + /* ensure we don't do this twice */ + return PMIX_SUCCESS; + } + pmix_psquash_globals.selected = true; + + /* Query all available components and ask if they have a module */ + PMIX_LIST_FOREACH(cli, &pmix_psquash_base_framework.framework_components, pmix_mca_base_component_list_item_t) { + component = (pmix_mca_base_component_t *) cli->cli_component; + + pmix_output_verbose(5, pmix_psquash_base_framework.framework_output, + "mca:psquash:select: checking available component %s", component->pmix_mca_component_name); + + /* If there's no query function, skip it */ + if (NULL == component->pmix_mca_query_component) { + pmix_output_verbose(5, pmix_psquash_base_framework.framework_output, + "mca:psquash:select: Skipping component [%s]. It does not implement a query function", + component->pmix_mca_component_name ); + continue; + } + + /* Query the component */ + pmix_output_verbose(5, pmix_psquash_base_framework.framework_output, + "mca:psquash:select: Querying component [%s]", + component->pmix_mca_component_name); + rc = component->pmix_mca_query_component(&module, &priority); + + /* If no module was returned, then skip component */ + if (PMIX_SUCCESS != rc || NULL == module) { + pmix_output_verbose(5, pmix_psquash_base_framework.framework_output, + "mca:psquash:select: Skipping component [%s]. Query failed to return a module", + component->pmix_mca_component_name ); + continue; + } + + /* If we got a module, try to initialize it */ + nmodule = (pmix_psquash_base_module_t*) module; + if (NULL != nmodule->init && PMIX_SUCCESS != nmodule->init()) { + continue; + } + + /* keep only the highest priority module */ + if (best_pri < priority) { + best_pri = priority; + /* give any prior module a chance to finalize */ + if (NULL != pmix_psquash.finalize) { + pmix_psquash.finalize(); + } + pmix_psquash = *nmodule; + inserted = true; + } + } + + if (!inserted) { + return PMIX_ERR_NOT_FOUND; + } + + return PMIX_SUCCESS;; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/Makefile.am new file mode 100644 index 0000000000..367f739c87 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/Makefile.am @@ -0,0 +1,43 @@ +# -*- makefile -*- +# +# Copyright (c) 2019 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers = psquash_flex128.h +sources = \ + psquash_flex128_component.c \ + psquash_flex128.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_psquash_flex128_DSO +lib = +lib_sources = +component = mca_psquash_flex128.la +component_sources = $(headers) $(sources) +else +lib = libmca_psquash_flex128.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_psquash_flex128_la_SOURCES = $(component_sources) +mca_psquash_flex128_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psquash_flex128_la_LIBADD = $(top_builddir)/src/libpmix.la +endif + +noinst_LTLIBRARIES = $(lib) +libmca_psquash_flex128_la_SOURCES = $(lib_sources) +libmca_psquash_flex128_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.c new file mode 100644 index 0000000000..b7d31711c9 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.c @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "src/include/pmix_config.h" + +#include "include/pmix_common.h" + +#include "src/include/pmix_socket_errno.h" +#include "src/include/pmix_globals.h" +#include "src/util/argv.h" +#include "src/util/error.h" +#include "src/util/output.h" + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include "src/mca/psquash/base/base.h" +#include "psquash_flex128.h" + +/* Flexible packing constants */ +#define FLEX_BASE7_MAX_BUF_SIZE (SIZEOF_SIZE_T+1) +#define FLEX_BASE7_MASK ((1<<7) - 1) +#define FLEX_BASE7_SHIFT 7 +#define FLEX_BASE7_CONT_FLAG (1<<7) + +/** + * Packing conversion of a signed integer value to a flexible representation. + * The main idea is to split a signed negative value onto an absolute value + * and a sign bit stored in the special location. + * This allows efficient representetion of negative values in the + * flexible form. + * + * type - type (pmix_data_type_t) of integer value + * ptr - pointer to the signed integer value + * with the type defined as (type) + * out - flexible representation of *ptr, + * extended to uint64_t if needed + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define FLEX128_PACK_CONVERT_SIGNED(type, ptr, out) \ +do { \ + type __tbuf = 0; \ + size_t __tmp; \ + int __sign = 0; \ + memcpy(&__tbuf, (ptr), sizeof(type)); \ + __tmp = __tbuf; \ + (out) = (size_t)__tmp; \ + if (__tmp & (1UL << (sizeof(__tmp)*CHAR_BIT-1))) { \ + __sign = 1; \ + out = ~(out); \ + } \ + (out) = ((out) << 1) + __sign; \ +} while (0) + +/** + * Packing conversion of a signed integer value to a flexible representation. + * For unsigned types it is reduced to a memcopy. + * + * type - usual integer C-type of integer value + * ptr - pointer to the signed integer value + * with the type defined as (type) + * out - flexible representation of *ptr, + * extended to uint64_t if needed + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define FLEX128_PACK_CONVERT_UNSIGNED(type, ptr, out) \ +do { \ + type __tbuf = 0; \ + memcpy(&__tbuf, (ptr), sizeof(type)); \ + out = __tbuf; \ +} while (0) + +/** + * Packing conversion from integer value to a flexible representation. + * + * r - return status code + * t - type (pmix_data_type_t) of integer value, it is determines + * which type of integer is converted + * s - pointer to the integer value with the type defined as (t) + * d - flexible representation output value (uin64_t) + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define FLEX128_PACK_CONVERT(r, t, s, d) \ +do { \ + (r) = PMIX_SUCCESS; \ + switch (t) { \ + case PMIX_INT16: \ + FLEX128_PACK_CONVERT_SIGNED(int16_t, s, d); \ + break; \ + case PMIX_UINT16: \ + FLEX128_PACK_CONVERT_UNSIGNED(uint16_t, s, d); \ + break; \ + case PMIX_INT: \ + case PMIX_INT32: \ + FLEX128_PACK_CONVERT_SIGNED(int32_t, s, d); \ + break; \ + case PMIX_UINT: \ + case PMIX_UINT32: \ + FLEX128_PACK_CONVERT_UNSIGNED(uint32_t, s, d); \ + break; \ + case PMIX_INT64: \ + FLEX128_PACK_CONVERT_SIGNED(int64_t, s, d); \ + break; \ + case PMIX_SIZE: \ + FLEX128_PACK_CONVERT_UNSIGNED(size_t, s, d); \ + break; \ + case PMIX_UINT64: \ + FLEX128_PACK_CONVERT_UNSIGNED(uint64_t, s, d); \ + break; \ + default: \ + (r) = PMIX_ERR_BAD_PARAM; \ + } \ +} while(0) + +/** + * Unpacking conversion from a flexible representation to a + * signed integer value. + * + * type - C-type of a signed integer value + * val - flexible representation (uint64_t) + * ptr - pointer to a 64-bit output buffer for the upacked value + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define FLEX128_UNPACK_CONVERT_SIGNED(type, val, ptr) \ +do { \ + type __tbuf = 0; \ + size_t __tmp = val; \ + int sign = (__tmp) & 1; \ + __tmp >>= 1; \ + if (sign) { \ + __tmp = ~__tmp; \ + } \ + __tbuf = (type)__tmp; \ + memcpy(ptr, &__tbuf, sizeof(type)); \ +} while (0) + +/** + * Unpacking conversion of a flexible representation value + * to an unsigned integer. + * + * type - C-type of unsigned integer value + * val - flexible representation value (uint64_t) + * ptr - pointer to a 64-bit output buffer for the upacked value + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define FLEX128_UNPACK_CONVERT_UNSIGNED(type, val, ptr) \ +do { \ + type __tbuf = 0; \ + __tbuf = (type)val; \ + memcpy(ptr, &__tbuf, sizeof(type)); \ +} while (0) + +/** + * Unpacking conversion of a flexible representation value + * to an integer. + * + * r - return status code + * t - type (pmix_data_type_t) of integer value, it is determines + * which type of integer is converted + * s - flex-representation value (uin64_t) + * d - pointer to a 64-bit output buffer for the upacked value + * (see a comment to `pmix_bfrops_pack_flex` for additional details) + */ +#define FLEX128_UNPACK_CONVERT(r, t, s, d) \ +do { \ + (r) = PMIX_SUCCESS; \ + switch (t) { \ + case PMIX_INT16: \ + FLEX128_UNPACK_CONVERT_SIGNED(int16_t, s, d); \ + break; \ + case PMIX_UINT16: \ + FLEX128_UNPACK_CONVERT_UNSIGNED(uint16_t, s, d); \ + break; \ + case PMIX_INT: \ + case PMIX_INT32: \ + FLEX128_UNPACK_CONVERT_SIGNED(int32_t, s, d); \ + break; \ + case PMIX_UINT: \ + case PMIX_UINT32: \ + FLEX128_UNPACK_CONVERT_UNSIGNED(uint32_t, s, d); \ + break; \ + case PMIX_INT64: \ + FLEX128_UNPACK_CONVERT_SIGNED(int64_t, s, d); \ + break; \ + case PMIX_SIZE: \ + FLEX128_UNPACK_CONVERT_UNSIGNED(size_t, s, d); \ + break; \ + case PMIX_UINT64: \ + FLEX128_UNPACK_CONVERT_UNSIGNED(uint64_t, s, d); \ + break; \ + default: \ + (r) = PMIX_ERR_BAD_PARAM; \ + } \ +} while(0) + +static pmix_status_t flex128_init(void); + +static void flex128_finalize(void); + +static pmix_status_t flex128_get_max_size(pmix_data_type_t type, size_t *size); + +static pmix_status_t flex128_encode_int(pmix_data_type_t type, void *src, + void *dst, size_t *size); + +static pmix_status_t flex128_decode_int(pmix_data_type_t type, void *src, + size_t src_len, void *dest, + size_t *dst_size); + +static size_t flex_pack_integer(size_t val, + uint8_t out_buf[FLEX_BASE7_MAX_BUF_SIZE]); + +static size_t flex_unpack_integer(const uint8_t in_buf[], size_t buf_size, + size_t *out_val, size_t *out_val_size); + +pmix_psquash_base_module_t pmix_flex128_module = { + .name = "flex128", + .int_type_is_encoded = true, + .init = flex128_init, + .finalize = flex128_finalize, + .get_max_size = flex128_get_max_size, + .encode_int = flex128_encode_int, + .decode_int = flex128_decode_int +}; + + +static pmix_status_t flex128_init(void) +{ + pmix_output_verbose(2, pmix_globals.debug_output, + "psquash: flex128 init"); + return PMIX_SUCCESS; +} + +static void flex128_finalize(void) +{ + pmix_output_verbose(2, pmix_globals.debug_output, + "psquash: flex128 finalize"); +} + +static pmix_status_t flex128_get_max_size(pmix_data_type_t type, size_t *size) + { + pmix_status_t rc; + PMIX_SQUASH_TYPE_SIZEOF(rc, type, *size); + /* the size of the packed value can be 1B larger + * because of continuation flags */ + *size += 1; + return rc; +} + +static pmix_status_t flex128_encode_int(pmix_data_type_t type, void *src, + void *dst, size_t *size) +{ + pmix_status_t rc = PMIX_SUCCESS; + uint8_t tmp_buf[FLEX_BASE7_MAX_BUF_SIZE]; + uint64_t tmp; + + FLEX128_PACK_CONVERT(rc, type, (uint8_t*)src, tmp); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + *size = flex_pack_integer(tmp, tmp_buf); + memcpy(dst, tmp_buf, *size); + + return rc; +} + +static pmix_status_t flex128_decode_int(pmix_data_type_t type, void *src, + size_t src_len, void *dest, size_t *dst_size) +{ + pmix_status_t rc = PMIX_SUCCESS; + size_t tmp; + size_t val_size, unpack_val_size; + + PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + *dst_size = flex_unpack_integer(src, src_len, &tmp, &unpack_val_size); + + if( val_size < unpack_val_size ) { // sanity check + rc = PMIX_ERR_UNPACK_FAILURE; + PMIX_ERROR_LOG(rc); + return rc; + } + FLEX128_UNPACK_CONVERT(rc, type, tmp, (uint8_t*)dest); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + + return rc; +} + +/* + * Typical representation of a number in computer systems is: + * A[0]*B^0 + A[1]*B^1 + A[2]*B^2 + ... + A[n]*B^n + * where B called a base and B == 256 (one byte) + * + * This encoding changes the default representation by introducing an additional + * bit per each byte to store a "continuation flag". So integers are now encoded + * with the same representation, but the base B = 128 and the remaning bit is + * used to indicate whether or not the next byte contains more bits of this value. + */ +static size_t flex_pack_integer(size_t val, + uint8_t out_buf[FLEX_BASE7_MAX_BUF_SIZE]) +{ + size_t tmp = val; + size_t idx = 0; + + do { + uint8_t val = tmp & FLEX_BASE7_MASK; + tmp >>= FLEX_BASE7_SHIFT; + if (PMIX_UNLIKELY(tmp)) { + val |= FLEX_BASE7_CONT_FLAG; + } + out_buf[idx++] = val; + } while(tmp && idx < SIZEOF_SIZE_T); + + /* If we have leftover (VERY unlikely) */ + if (PMIX_UNLIKELY(SIZEOF_SIZE_T == idx && tmp)) { + out_buf[idx++] = tmp; + } + + return idx; +} + +/* + * See a comment to `pmix_bfrops_pack_flex` for additional details. + */ +static size_t flex_unpack_integer(const uint8_t in_buf[], size_t buf_size, + size_t *out_val, size_t *out_val_size) +{ + size_t value = 0, shift = 0, shift_last = 0; + size_t idx = 0; + uint8_t val = 0, val_last = 0; + uint8_t hi_bit = 0; + size_t flex_size = buf_size; + + /* restrict the buf size to max flex size */ + if (buf_size > FLEX_BASE7_MAX_BUF_SIZE) { + flex_size = FLEX_BASE7_MAX_BUF_SIZE; + } + + do { + val = in_buf[idx++]; + val_last = val; + shift_last = shift; + value = value + (((uint64_t)val & FLEX_BASE7_MASK) << shift); + shift += FLEX_BASE7_SHIFT; + } while(PMIX_UNLIKELY((val & FLEX_BASE7_CONT_FLAG) && + (idx < (flex_size-1)))); + /* If we have leftover (VERY unlikely) */ + if (PMIX_UNLIKELY((flex_size-1) == idx && + (val & FLEX_BASE7_CONT_FLAG))) { + val = in_buf[idx++]; + val_last = val; + value = value + ((uint64_t)val << shift); + shift_last = shift; + } + /* compute the most significant bit of val */ + while (val_last != 0) { + val_last >>= 1; + hi_bit++; + } + /* compute the real val size */ + *out_val_size = (hi_bit + shift_last)/CHAR_BIT + + !!((hi_bit + shift_last) & (CHAR_BIT - 1)); + *out_val = value; + + return idx; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.h new file mode 100644 index 0000000000..4002661a30 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_NATIVE_H +#define PMIX_NATIVE_H + +#include "src/include/pmix_config.h" + + +#include "src/mca/psquash/psquash.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_psquash_base_component_t mca_psquash_flex128_component; +extern pmix_psquash_base_module_t pmix_flex128_module; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128_component.c new file mode 100644 index 0000000000..e117030da7 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/flex128/psquash_flex128_component.c @@ -0,0 +1,67 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" + +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/mca/psquash/psquash.h" +#include "psquash_flex128.h" + +static pmix_status_t component_open(void); +static pmix_status_t component_close(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_psquash_base_component_t mca_psquash_flex128_component = { + .base = { + PMIX_PSQUASH_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "flex128", + PMIX_MCA_BASE_MAKE_VERSION(component, + PMIX_MAJOR_VERSION, + PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, + }, + .data = { + /* The component is checkpoint ready */ + PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT + } +}; + + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + *priority = 20; + *module = (pmix_mca_base_module_t *)&pmix_flex128_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/Makefile.am new file mode 100644 index 0000000000..01a401ae64 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/Makefile.am @@ -0,0 +1,46 @@ +# -*- makefile -*- +# +# Copyright (c) 2019 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Mellanox Technologies, Inc. +# All rights reserved. +# +# Copyright (c) 2019 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers = psquash_native.h +sources = \ + psquash_native_component.c \ + psquash_native.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_psquash_native_DSO +lib = +lib_sources = +component = mca_psquash_native.la +component_sources = $(headers) $(sources) +else +lib = libmca_psquash_native.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_psquash_native_la_SOURCES = $(component_sources) +mca_psquash_native_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psquash_native_la_LIBADD = $(top_builddir)/src/libpmix.la +endif + +noinst_LTLIBRARIES = $(lib) +libmca_psquash_native_la_SOURCES = $(lib_sources) +libmca_psquash_native_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.c new file mode 100644 index 0000000000..56d92f3cd0 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "src/include/pmix_config.h" + +#include "include/pmix_common.h" + +#include "src/include/pmix_socket_errno.h" +#include "src/include/pmix_globals.h" +#include "src/util/argv.h" +#include "src/util/error.h" +#include "src/util/output.h" + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include "src/mca/psquash/base/base.h" +#include "psquash_native.h" + +static pmix_status_t native_init(void); + +static void native_finalize(void); + +static pmix_status_t native_get_max_size(pmix_data_type_t type, size_t *size); + +static pmix_status_t native_encode_int(pmix_data_type_t type, void *src, + void *dst, size_t *size); + +static pmix_status_t native_decode_int(pmix_data_type_t type, void *src, + size_t src_len, void *dest, + size_t *dst_size); + +pmix_psquash_base_module_t pmix_psquash_native_module = { + .name = "native", + .int_type_is_encoded = false, + .init = native_init, + .finalize = native_finalize, + .get_max_size = native_get_max_size, + .encode_int = native_encode_int, + .decode_int = native_decode_int +}; + +#define NATIVE_PACK_CONVERT(ret, type, val) \ +do { \ + (ret) = PMIX_SUCCESS; \ + switch(type) { \ + case PMIX_INT16: \ + case PMIX_UINT16:{ \ + uint16_t __tmp = (uint16_t)val; \ + val = pmix_htons(__tmp); \ + break; \ + } \ + case PMIX_INT: \ + case PMIX_UINT: \ + case PMIX_INT32: \ + case PMIX_UINT32:{ \ + uint32_t __tmp = (uint32_t)val; \ + val = htonl(__tmp); \ + break; \ + } \ + case PMIX_SIZE: \ + case PMIX_INT64: \ + case PMIX_UINT64:{ \ + uint64_t __tmp = (uint64_t)val; \ + val = pmix_hton64(__tmp); \ + break; \ + } \ + default: \ + (ret) = PMIX_ERR_BAD_PARAM; \ + } \ +} while (0) + +#define NATIVE_UNPACK_CONVERT(ret, type, val) \ +do { \ + (ret) = PMIX_SUCCESS; \ + switch(type) { \ + case PMIX_INT16: \ + case PMIX_UINT16:{ \ + uint16_t __tmp = (uint16_t)val; \ + val = pmix_ntohs(__tmp); \ + break; \ + } \ + case PMIX_INT: \ + case PMIX_UINT: \ + case PMIX_INT32: \ + case PMIX_UINT32:{ \ + uint32_t __tmp = (uint32_t)val; \ + val = ntohl(__tmp); \ + break; \ + } \ + case PMIX_INT64: \ + case PMIX_SIZE: \ + case PMIX_UINT64:{ \ + uint64_t __tmp = (uint64_t)val; \ + val = pmix_ntoh64(__tmp); \ + break; \ + } \ + default: \ + (ret) = PMIX_ERR_BAD_PARAM; \ + } \ +} while (0) + +static pmix_status_t native_init(void) +{ + pmix_output_verbose(2, pmix_globals.debug_output, + "psquash: native init"); + return PMIX_SUCCESS; +} + +static void native_finalize(void) +{ + pmix_output_verbose(2, pmix_globals.debug_output, + "psquash: native finalize"); +} + +static pmix_status_t native_get_max_size(pmix_data_type_t type, size_t *size) + +{ + pmix_status_t rc; + PMIX_SQUASH_TYPE_SIZEOF(rc, type, *size); + return rc; +} + +static pmix_status_t native_encode_int(pmix_data_type_t type, void *src, + void *dst, size_t *size) +{ + pmix_status_t rc; + uint64_t tmp = 0; + size_t val_size; + + PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + memcpy(&tmp, src, val_size); + NATIVE_PACK_CONVERT(rc, type, tmp); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + memcpy(dst, &tmp, val_size); + *size = val_size; + + return PMIX_SUCCESS; +} + +static pmix_status_t native_decode_int(pmix_data_type_t type, void *src, + size_t src_len, void *dst, + size_t *dst_size) +{ + pmix_status_t rc; + uint64_t tmp = 0; + size_t val_size; + + PMIX_SQUASH_TYPE_SIZEOF(rc, type, val_size); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + /* sanity check */ + if (src_len != val_size) { + rc = PMIX_ERR_UNPACK_FAILURE; + } + + memcpy(&tmp, src, val_size); + NATIVE_UNPACK_CONVERT(rc, type, tmp); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + memcpy(dst, &tmp, val_size); + *dst_size = val_size; + + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.h new file mode 100644 index 0000000000..9ea7a60fc7 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserve + * + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_NATIVE_H +#define PMIX_NATIVE_H + +#include "src/include/pmix_config.h" + + +#include "src/mca/psquash/psquash.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_psquash_base_component_t mca_psquash_native_component; +extern pmix_psquash_base_module_t pmix_psquash_native_module; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native_component.c new file mode 100644 index 0000000000..235a9f7dc9 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/native/psquash_native_component.c @@ -0,0 +1,70 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved + * + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" + +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/mca/psquash/psquash.h" +#include "psquash_native.h" + +static pmix_status_t component_open(void); +static pmix_status_t component_close(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_psquash_base_component_t mca_psquash_native_component = { + .base = { + PMIX_PSQUASH_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "native", + PMIX_MCA_BASE_MAKE_VERSION(component, + PMIX_MAJOR_VERSION, + PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, + }, + .data = { + /* The component is checkpoint ready */ + PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT + } +}; + + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + *priority = 5; + *module = (pmix_mca_base_module_t *)&pmix_psquash_native_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/psquash.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/psquash.h new file mode 100644 index 0000000000..abbceb1b0f --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psquash/psquash.h @@ -0,0 +1,121 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * @file + * + * This interface is for the encoding/decoding of basic types and the + * compression/decompression of larger blobs of data (i.e., modex). + * + * Available plugins may be defined at runtime via the typical MCA parameter + * syntax. + */ + +#ifndef PMIX_PSQUASH_H +#define PMIX_PSQUASH_H + +#include "src/include/pmix_config.h" + +#include "src/mca/mca.h" +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/mca/base/pmix_mca_base_framework.h" + +BEGIN_C_DECLS + +/****** MODULE DEFINITION ******/ + +/** + * Initialize the module + */ +typedef pmix_status_t (*pmix_psquash_base_module_init_fn_t)(void); + +/** + * Finalize the module + */ +typedef void (*pmix_psquash_base_module_finalize_fn_t)(void); + +/** + * Maximum size of the type. + * + * type - Type (PMIX_SIZE, PMIX_INT to PMIX_UINT64) + * size - size of the type + */ +typedef pmix_status_t (*pmix_psquash_get_max_size_fn_t) (pmix_data_type_t type, + size_t *size); + +/** + * Encode a basic integer type into a contiguous destination buffer. + * + * type - Type of the 'src' pointer (PMIX_SIZE, PMIX_INT to PMIX_UINT64) + * src - pointer to a single basic integer type + * dest - pointer to buffer to store data + * dst_len - pointer to the packed size of dest, in bytes + */ + +typedef pmix_status_t (*pmix_psquash_encode_int_fn_t) (pmix_data_type_t type, + void *src, void *dest, + size_t *dst_len); + +/** + * Decode a basic a contiguous destination buffer into a basic integer type. + * + * type - Type of the 'dest' pointer (PMIX_SIZE, PMIX_INT to PMIX_UINT64) + * src - pointer to buffer where data was stored + * src_len - length, in bytes, of the src buffer + * dest - pointer to a single basic integer type + * dst_len - pointer to the unpacked size of dest, in bytes + */ +typedef pmix_status_t (*pmix_psquash_decode_int_fn_t) (pmix_data_type_t type, + void *src, size_t src_len, + void *dest, size_t *dst_len); + +/** + * Base structure for a PSQUASH module + */ +typedef struct { + const char *name; + /* flag indicating if the type is encoded within the value, otherwise, it is necessary to further pack the type with the value. */ + bool int_type_is_encoded; + + /** init/finalize */ + pmix_psquash_base_module_init_fn_t init; + pmix_psquash_base_module_finalize_fn_t finalize; + + pmix_psquash_get_max_size_fn_t get_max_size; + + /** Integer compression */ + pmix_psquash_encode_int_fn_t encode_int; + pmix_psquash_decode_int_fn_t decode_int; +} pmix_psquash_base_module_t; + +/** + * Base structure for a PSQUASH component + */ +struct pmix_psquash_base_component_t { + pmix_mca_base_component_t base; + pmix_mca_base_component_data_t data; + int priority; +}; +typedef struct pmix_psquash_base_component_t pmix_psquash_base_component_t; + +PMIX_EXPORT extern pmix_psquash_base_module_t pmix_psquash; + +/* + * Macro for use in components that are of type psquash + */ +#define PMIX_PSQUASH_BASE_VERSION_1_0_0 \ + PMIX_MCA_BASE_VERSION_1_0_0("psquash", 1, 0, 0) + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h index 197658f7f3..4f5f70cbf3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #ifndef PMIX_PTL_BASE_H_ #define PMIX_PTL_BASE_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TIME_H @@ -73,6 +73,7 @@ PMIX_CLASS_DECLARATION(pmix_ptl_base_active_t); struct pmix_ptl_globals_t { pmix_list_t actives; bool initialized; + bool selected; pmix_list_t posted_recvs; // list of pmix_ptl_posted_recv_t pmix_list_t unexpected_msgs; int stop_thread[2]; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_connect.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_connect.c index 0963ba2552..c374188a5f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_connect.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_connect.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include "include/pmix_stdint.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c index 0723e49b1f..1155b46a65 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +23,9 @@ /** @file: * */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_STRING_H #include @@ -64,6 +64,7 @@ static size_t max_msg_size = PMIX_MAX_MSG_SIZE; static int pmix_ptl_register(pmix_mca_base_register_flag_t flags) { + (void)flags; pmix_mca_base_var_register("pmix", "ptl", "base", "max_msg_size", "Max size (in Mbytes) of a client/server msg", PMIX_MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0, @@ -80,6 +81,7 @@ static pmix_status_t pmix_ptl_close(void) return PMIX_SUCCESS; } pmix_ptl_globals.initialized = false; + pmix_ptl_globals.selected = false; /* ensure the listen thread has been shut down */ pmix_ptl_base_stop_listening(); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_listener.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_listener.c index 3a5ab90263..d9ba314a05 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_listener.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_listener.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -15,13 +15,12 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include +#include "include/pmix_server.h" #include "src/include/pmix_globals.h" #ifdef HAVE_STRING_H @@ -182,6 +181,7 @@ void pmix_ptl_base_stop_listening(void) static void* listen_thread(void *obj) { + (void)obj; int rc, max, accepted_connections; socklen_t addrlen = sizeof(struct sockaddr_storage); pmix_pending_connection_t *pending_connection; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_select.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_select.c index 99e7ac6615..7b3f2cc594 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_select.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_select.c @@ -9,7 +9,9 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,8 +19,8 @@ * $HEADER$ */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -29,8 +31,6 @@ #include "src/mca/ptl/base/base.h" -static bool selected = false; - /* Function for selecting a prioritized list of components * from all those that are available. */ int pmix_ptl_base_select(void) @@ -42,11 +42,11 @@ int pmix_ptl_base_select(void) int pri; bool inserted; - if (selected) { + if (pmix_ptl_globals.selected) { /* ensure we don't do this twice */ return PMIX_SUCCESS; } - selected = true; + pmix_ptl_globals.selected = true; /* Query all available components and ask if they have a module */ PMIX_LIST_FOREACH(cli, &pmix_ptl_base_framework.framework_components, pmix_mca_base_component_list_item_t) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index 93e16ba53e..64c7da0973 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -1,9 +1,9 @@ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -13,11 +13,10 @@ * * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" #ifdef HAVE_STRING_H #include @@ -44,6 +43,7 @@ #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" #include "src/util/error.h" +#include "src/util/name_fns.h" #include "src/util/show_help.h" #include "src/mca/psensor/psensor.h" @@ -51,16 +51,11 @@ static void _notify_complete(pmix_status_t status, void *cbdata) { + (void)status; pmix_event_chain_t *chain = (pmix_event_chain_t*)cbdata; PMIX_RELEASE(chain); } -static void lcfn(pmix_status_t status, void *cbdata) -{ - pmix_peer_t *peer = (pmix_peer_t*)cbdata; - PMIX_RELEASE(peer); -} - void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) { pmix_server_trkr_t *trk, *tnxt; @@ -165,23 +160,11 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) } } - /* remove this proc from the list of ranks for this nspace if it is - * still there - we must check for multiple copies as there will be - * one for each "clone" of this peer */ - PMIX_LIST_FOREACH_SAFE(info, pinfo, &(peer->nptr->ranks), pmix_rank_info_t) { - if (info == peer->info) { - pmix_list_remove_item(&(peer->nptr->ranks), &(peer->info->super)); - } - } /* reduce the number of local procs */ if (0 < peer->nptr->nlocalprocs) { --peer->nptr->nlocalprocs; } - /* remove this client from our array */ - pmix_pointer_array_set_item(&pmix_server_globals.clients, - peer->index, NULL); - /* purge any notifications cached for this client */ pmix_server_purge_events(peer, NULL); @@ -200,8 +183,14 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) * an event. If not, then we do */ PMIX_REPORT_EVENT(err, peer, PMIX_RANGE_PROC_LOCAL, _notify_complete); } - /* now decrease the refcount - might actually free the object */ - PMIX_RELEASE(peer->info); + /* mark this rank as "dead" but do not remove it from ranks for this nspace if it is + * still there - we must check for multiple copies as there will be + * one for each "clone" of this peer */ + PMIX_LIST_FOREACH_SAFE(info, pinfo, &(peer->nptr->ranks), pmix_rank_info_t) { + if (info == peer->info) { + peer->finalized = true; + } + } /* be sure to let the host know that the tool or client * is gone - otherwise, it won't know to cleanup the @@ -210,19 +199,9 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* now tell the host server */ - rc = pmix_host_server.client_finalized(&proc, peer->info->server_object, - lcfn, peer); - if (PMIX_SUCCESS == rc) { - /* we will release the peer when the server calls us back */ - peer->finalized = true; - return; - } + pmix_host_server.client_finalized(&proc, peer->info->server_object, + NULL, NULL); } - /* mark the peer as "gone" since a release doesn't guarantee - * that the peer object doesn't persist */ - peer->finalized = true; - /* Release peer info */ - PMIX_RELEASE(peer); } else { /* if I am a client, there is only * one connection we can have */ @@ -386,6 +365,8 @@ static pmix_status_t read_bytes(int sd, char **buf, size_t *remain) */ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata) { + (void)sd; + (void)flags; pmix_peer_t *peer = (pmix_peer_t*)cbdata; pmix_ptl_send_t *msg = peer->send_msg; pmix_status_t rc; @@ -394,16 +375,16 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata) PMIX_ACQUIRE_OBJECT(peer); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "%s:%d ptl:base:send_handler SENDING TO PEER %s:%d tag %u with %s msg", - pmix_globals.myid.nspace, pmix_globals.myid.rank, - peer->info->pname.nspace, peer->info->pname.rank, + "%s ptl:base:send_handler SENDING TO PEER %s tag %u with %s msg", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_PNAME_PRINT(&peer->info->pname), (NULL == msg) ? UINT_MAX : ntohl(msg->hdr.tag), (NULL == msg) ? "NULL" : "NON-NULL"); if (NULL != msg) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:base:send_handler SENDING MSG TO %s:%d TAG %u", - peer->info->pname.nspace, peer->info->pname.rank, + "ptl:base:send_handler SENDING MSG TO %s TAG %u", + PMIX_PNAME_PRINT(&peer->info->pname), ntohl(msg->hdr.tag)); if (PMIX_SUCCESS == (rc = send_msg(peer->sd, msg))) { // message is complete @@ -422,8 +403,8 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata) return; } else { pmix_output_verbose(5, pmix_ptl_base_framework.framework_output, - "%s:%d SEND ERROR %s", - pmix_globals.myid.nspace, pmix_globals.myid.rank, + "%s SEND ERROR %s", + PMIX_NAME_PRINT(&pmix_globals.myid), PMIx_Error_string(rc)); // report the error pmix_event_del(&peer->send_event); @@ -464,6 +445,7 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata) void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) { + (void)flags; pmix_status_t rc; pmix_peer_t *peer = (pmix_peer_t*)cbdata; pmix_ptl_recv_t *msg = NULL; @@ -475,8 +457,8 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) PMIX_ACQUIRE_OBJECT(peer); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "%s:%d ptl:base:recv:handler called with peer %s:%d", - pmix_globals.myid.nspace, pmix_globals.myid.rank, + "%s ptl:base:recv:handler called with peer %s:%u", + PMIX_NAME_PRINT(&pmix_globals.myid), (NULL == peer) ? "NULL" : peer->info->pname.nspace, (NULL == peer) ? PMIX_RANK_UNDEF : peer->info->pname.rank); @@ -514,14 +496,17 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) peer->recv_msg->hdr.tag = ntohl(hdr.tag); peer->recv_msg->hdr.nbytes = ntohl(hdr.nbytes); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "RECVD MSG FOR TAG %d SIZE %d", + "%s RECVD MSG FROM %s FOR TAG %d SIZE %d", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_PNAME_PRINT(&peer->info->pname), (int)peer->recv_msg->hdr.tag, (int)peer->recv_msg->hdr.nbytes); /* if this is a zero-byte message, then we are done */ if (0 == peer->recv_msg->hdr.nbytes) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "RECVD ZERO-BYTE MESSAGE FROM %s:%u for tag %d", - peer->info->pname.nspace, peer->info->pname.rank, + "%s RECVD ZERO-BYTE MESSAGE FROM %s for tag %d", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_PNAME_PRINT(&peer->info->pname), peer->recv_msg->hdr.tag); peer->recv_msg->data = NULL; // make sure peer->recv_msg->rdptr = NULL; @@ -558,8 +543,9 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) * and let the caller know */ pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:base:msg_recv: peer %s:%d closed connection", - peer->nptr->nspace, peer->info->pname.rank); + "%s ptl:base:msg_recv: peer %s closed connection", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_PNAME_PRINT(&peer->info->pname)); goto err_close; } } @@ -626,6 +612,8 @@ void pmix_ptl_base_recv_handler(int sd, short flags, void *cbdata) void pmix_ptl_base_send(int sd, short args, void *cbdata) { + (void)sd; + (void)args; pmix_ptl_queue_t *queue = (pmix_ptl_queue_t*)cbdata; pmix_ptl_send_t *snd; @@ -682,6 +670,8 @@ void pmix_ptl_base_send(int sd, short args, void *cbdata) void pmix_ptl_base_send_recv(int fd, short args, void *cbdata) { + (void)fd; + (void)args; pmix_ptl_sr_t *ms = (pmix_ptl_sr_t*)cbdata; pmix_ptl_posted_recv_t *req; pmix_ptl_send_t *snd; @@ -760,6 +750,8 @@ void pmix_ptl_base_send_recv(int fd, short args, void *cbdata) void pmix_ptl_base_process_msg(int fd, short flags, void *cbdata) { + (void)fd; + (void)flags; pmix_ptl_recv_t *msg = (pmix_ptl_recv_t*)cbdata; pmix_ptl_posted_recv_t *rcv; pmix_buffer_t buf; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c index a653d4c852..fc8ecc19e1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_UNISTD_H @@ -170,6 +170,8 @@ pmix_status_t pmix_ptl_base_connect_to_peer(struct pmix_peer_t *peer, static void post_recv(int fd, short args, void *cbdata) { + (void)fd; + (void)args; pmix_ptl_posted_recv_t *req = (pmix_ptl_posted_recv_t*)cbdata; pmix_ptl_recv_t *msg, *nmsg; pmix_buffer_t buf; @@ -207,6 +209,7 @@ pmix_status_t pmix_ptl_base_register_recv(struct pmix_peer_t *peer, pmix_ptl_cbfunc_t cbfunc, pmix_ptl_tag_t tag) { + (void)peer; pmix_ptl_posted_recv_t *req; req = PMIX_NEW(pmix_ptl_posted_recv_t); @@ -225,6 +228,8 @@ pmix_status_t pmix_ptl_base_register_recv(struct pmix_peer_t *peer, static void cancel_recv(int fd, short args, void *cbdata) { + (void)fd; + (void)args; pmix_ptl_posted_recv_t *req = (pmix_ptl_posted_recv_t*)cbdata; pmix_ptl_posted_recv_t *rcv; @@ -242,6 +247,7 @@ static void cancel_recv(int fd, short args, void *cbdata) pmix_status_t pmix_ptl_base_cancel_recv(struct pmix_peer_t *peer, pmix_ptl_tag_t tag) { + (void)peer; pmix_ptl_posted_recv_t *req; req = PMIX_NEW(pmix_ptl_posted_recv_t); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h index d413a21004..e97a092831 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -31,9 +31,9 @@ #ifndef PMIX_PTL_H_ #define PMIX_PTL_H_ -#include +#include "src/include/pmix_config.h" -#include +#include "src/include/types.h" #include "src/mca/mca.h" #include "src/mca/base/pmix_mca_base_var.h" @@ -127,6 +127,7 @@ typedef pmix_status_t (*pmix_ptl_connect_to_peer_fn_t)(struct pmix_peer_t *peer, pmix_info_t info[], size_t ninfo); + /** * Base structure for a PTL module */ @@ -167,8 +168,8 @@ typedef struct pmix_ptl_module_t pmix_ptl_module_t; #define PMIX_PTL_CANCEL(r, p, t) \ (r) = (p)->nptr->compat.ptl->cancel((struct pmix_peer_t*)(p), t) -extern pmix_status_t pmix_ptl_base_connect_to_peer(struct pmix_peer_t* peer, - pmix_info_t info[], size_t ninfo); +PMIX_EXPORT extern pmix_status_t pmix_ptl_base_connect_to_peer(struct pmix_peer_t* peer, + pmix_info_t info[], size_t ninfo); /**** COMPONENT STRUCTURE DEFINITION ****/ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h index a0e500655c..24d3a9549d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,7 +28,7 @@ #ifndef PMIX_PTL_TYPES_H_ #define PMIX_PTL_TYPES_H_ -#include +#include "src/include/pmix_config.h" #include "src/include/types.h" #ifdef HAVE_UNISTD_H @@ -97,6 +97,8 @@ typedef struct { #define PMIX_PROC_CLIENT_TOOL (PMIX_PROC_TOOL | PMIX_PROC_CLIENT | PMIX_PROC_CLIENT_TOOL_ACT) #define PMIX_PROC_GATEWAY_ACT 0x40000000 #define PMIX_PROC_GATEWAY (PMIX_PROC_SERVER | PMIX_PROC_GATEWAY_ACT) +#define PMIX_PROC_SCHEDULER_ACT 0x80000000 +#define PMIX_PROC_SCHEDULER (PMIX_PROC_SERVER | PMIX_PROC_SCHEDULER_ACT) #define PMIX_SET_PEER_TYPE(a, b) \ (a)->proc_type.type |= (b) @@ -111,6 +113,7 @@ typedef struct { #define PMIX_PEER_IS_CLIENT_LAUNCHER(p) ((PMIX_PROC_LAUNCHER_ACT & (p)->proc_type.type) && (PMIX_PROC_CLIENT & (p)->proc_type.type)) #define PMIX_PEER_IS_CLIENT_TOOL(p) ((PMIX_PROC_CLIENT_TOOL_ACT & (p)->proc_type.type) && (PMIX_PROC_CLIENT & (p)->proc_type.type)) #define PMIX_PEER_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->proc_type.type) +#define PMIX_PEER_IS_SCHEDULER(p) (PMIX_PROC_SCHEDULER_ACT & (p)->proc_type.type) #define PMIX_PROC_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->type) #define PMIX_PROC_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->type) @@ -119,6 +122,7 @@ typedef struct { #define PMIX_PROC_IS_CLIENT_LAUNCHER(p) ((PMIX_PROC_LAUNCHER_ACT & (p)->type) && (PMIX_PROC_CLIENT & (p)->type)) #define PMIX_PROC_IS_CLIENT_TOOL(p) ((PMIX_PROC_CLIENT_TOOL_ACT & (p)->type) && (PMIX_PROC_CLIENT & (p)->type)) #define PMIX_PROC_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->type) +#define PMIX_PROC_IS_SCHEDULER(p) (PMIX_PROC_SCHEDULER_ACT & (p)->type) /* provide macros for setting the major, minor, and release values * just so people don't have to deal with the details of the struct */ @@ -180,7 +184,10 @@ typedef uint32_t pmix_ptl_tag_t; typedef struct { int32_t pindex; pmix_ptl_tag_t tag; - size_t nbytes; + uint32_t nbytes; +#if SIZEOF_SIZE_T == 8 + uint32_t padding; +#endif } pmix_ptl_hdr_t; /* define the messaging cbfunc */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index af6ccc69f1..2c4863b268 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -13,7 +13,7 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -23,7 +23,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include "src/include/pmix_globals.h" #ifdef HAVE_FCNTL_H @@ -128,7 +128,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, char *evar, **uri, *suri = NULL, *suri2 = NULL; char *filename, *nspace=NULL; pmix_rank_t rank = PMIX_RANK_WILDCARD; - char *p, *p2, *server_nspace = NULL, *rendfile = NULL; + char *p = NULL, *p2, *server_nspace = NULL, *rendfile = NULL; int sd, rc; size_t n; char myhost[PMIX_MAXHOSTNAMELEN] = {0}; @@ -269,14 +269,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, continue; } /* otherwise, we don't know which one to use */ - free(server_nspace); - if (NULL != suri) { - free(suri); - } - if (NULL != rendfile) { - free(rendfile); - } - return PMIX_ERR_BAD_PARAM; + rc = PMIX_ERR_BAD_PARAM; + goto cleanup; } server_nspace = strdup(info[n].value.data.string); } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_URI)) { @@ -287,14 +281,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, continue; } /* otherwise, we don't know which one to use */ - free(suri); - if (NULL != server_nspace) { - free(server_nspace); - } - if (NULL != rendfile) { - free(rendfile); - } - return PMIX_ERR_BAD_PARAM; + rc = PMIX_ERR_BAD_PARAM; + goto cleanup; } suri = strdup(info[n].value.data.string); } else if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_RETRY_DELAY)) { @@ -303,11 +291,6 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, mca_ptl_tcp_component.max_retries = info[n].value.data.uint32; } else if (PMIX_CHECK_KEY(&info[n], PMIX_RECONNECT_SERVER)) { reconnect = true; - } else if (PMIX_CHECK_KEY(&info[n], PMIX_LAUNCHER_RENDEZVOUS_FILE)) { - if (NULL != rendfile) { - free(rendfile); - } - rendfile = strdup(info[n].value.data.string); } else { /* need to pass this to server */ kv = PMIX_NEW(pmix_info_caddy_t); @@ -345,13 +328,16 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (sysctl(mib, 2, &argmax, &size, NULL, 0) == -1) { fprintf(stderr, "sysctl() argmax failed\n"); - return -1; + rc = PMIX_ERR_NO_PERMISSIONS; + goto cleanup; } /* Allocate space for the arguments. */ procargs = (char *)malloc(argmax); - if (procargs == NULL) - return -1; + if (procargs == NULL) { + rc = -1; + goto cleanup; + } /* Make a sysctl() call to get the raw argument space of the process. */ mib[0] = CTL_KERN; @@ -362,7 +348,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (sysctl(mib, 3, procargs, &size, NULL, 0) == -1) { fprintf(stderr, "Lacked permissions\n");; - return 0; + rc = PMIX_ERR_NO_PERMISSIONS; + goto cleanup; } memcpy(&nargs, procargs, sizeof(nargs)); @@ -435,10 +422,6 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, gethostname(myhost, sizeof(myhost)-1); /* if we were given a URI via MCA param, then look no further */ if (NULL != suri) { - if (NULL != server_nspace) { - free(server_nspace); - server_nspace = NULL; - } /* if the string starts with "file:", then they are pointing * us to a file we need to read to get the URI itself */ if (0 == strncmp(suri, "file:", 5)) { @@ -447,14 +430,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, nspace = NULL; rc = parse_uri_file(&suri[5], &suri2, &nspace, &rank); if (PMIX_SUCCESS != rc) { - free(suri); - if (NULL != rendfile) { - free(rendfile); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_UNREACH; + rc = PMIX_ERR_UNREACH; + goto cleanup; } free(suri); suri = suri2; @@ -462,14 +439,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* we need to extract the nspace/rank of the server from the string */ p = strchr(suri, ';'); if (NULL == p) { - free(suri); - if (NULL != rendfile) { - free(rendfile); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_BAD_PARAM; + rc = PMIX_ERR_BAD_PARAM; + goto cleanup; } *p = '\0'; p++; @@ -479,14 +450,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, p = strchr(suri, '.'); if (NULL == p) { free(suri2); - free(suri); - if (NULL != rendfile) { - free(rendfile); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_BAD_PARAM; + rc = PMIX_ERR_BAD_PARAM; + goto cleanup; } *p = '\0'; p++; @@ -500,27 +465,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, "ptl:tcp:tool attempt connect using given URI %s", suri); /* go ahead and try to connect */ if (PMIX_SUCCESS != (rc = try_connect(suri, &sd, iptr, niptr))) { - if (NULL != nspace) { - free(nspace); - } - free(suri); - if (NULL != rendfile) { - free(rendfile); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return rc; + goto cleanup; } /* cleanup */ - free(suri); - suri = NULL; - if (NULL != rendfile) { - free(rendfile); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } goto complete; } @@ -532,42 +479,27 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, rendfile = NULL; if (PMIX_SUCCESS == rc) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:tcp:tool attempt connect to system server at %s", suri); + "ptl:tcp:tool attempt connect to rendezvous server at %s", suri); /* go ahead and try to connect */ if (PMIX_SUCCESS == try_connect(suri, &sd, iptr, niptr)) { /* don't free nspace - we will use it below */ - if (NULL != rendfile) { - free(rendfile); - } if (NULL != iptr) { PMIX_INFO_FREE(iptr, niptr); } goto complete; } } - /* cleanup */ - if (NULL != nspace) { - free(nspace); - } - if (NULL != suri) { - free(suri); - } - free(rendfile); - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } /* since they gave us a specific rendfile and we couldn't * connect to it, return an error */ - return PMIX_ERR_UNREACH; + rc = PMIX_ERR_UNREACH; + goto cleanup; } /* if they asked for system-level first or only, we start there */ if (system_level || system_level_only) { if (0 > asprintf(&filename, "%s/pmix.sys.%s", mca_ptl_tcp_component.system_tmpdir, myhost)) { - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_NOMEM; + rc = PMIX_ERR_NOMEM; + goto cleanup; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool looking for system server at %s", @@ -581,12 +513,10 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* go ahead and try to connect */ if (PMIX_SUCCESS == try_connect(suri, &sd, iptr, niptr)) { /* don't free nspace - we will use it below */ - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } goto complete; } free(nspace); + nspace = NULL; } } @@ -596,26 +526,15 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (system_level_only) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp: connecting to system failed"); - if (NULL != suri) { - free(suri); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_UNREACH; + rc = PMIX_ERR_UNREACH; + goto cleanup; } /* if they gave us a pid, then look for it */ if (0 != pid) { - if (NULL != server_nspace) { - free(server_nspace); - server_nspace = NULL; - } if (0 > asprintf(&filename, "pmix.%s.tool.%d", myhost, pid)) { - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_NOMEM; + rc = PMIX_ERR_NOMEM; + goto cleanup; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool searching for given session server %s", @@ -627,28 +546,17 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (PMIX_SUCCESS == rc) { goto complete; } - if (NULL != suri) { - free(suri); - } - if (NULL != nspace) { - free(nspace); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } /* since they gave us a specific pid and we couldn't * connect to it, return an error */ - return PMIX_ERR_UNREACH; + rc = PMIX_ERR_UNREACH; + goto cleanup; } /* if they gave us an nspace, then look for it */ if (NULL != server_nspace) { if (0 > asprintf(&filename, "pmix.%s.tool.%s", myhost, server_nspace)) { - free(server_nspace); - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_NOMEM; + rc = PMIX_ERR_NOMEM; + goto cleanup; } free(server_nspace); server_nspace = NULL; @@ -662,18 +570,10 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (PMIX_SUCCESS == rc) { goto complete; } - if (NULL != suri) { - free(suri); - } - if (NULL != nspace) { - free(nspace); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } /* since they gave us a specific nspace and we couldn't * connect to it, return an error */ - return PMIX_ERR_UNREACH; + rc = PMIX_ERR_UNREACH; + goto cleanup; } /* they didn't give us a pid, so we will search to see what session-level @@ -682,13 +582,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, * one session per user on a node */ if (0 > asprintf(&filename, "pmix.%s.tool", myhost)) { - if (NULL != suri) { - free(suri); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_NOMEM; + rc = PMIX_ERR_NOMEM; + goto cleanup; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool searching for session server %s", @@ -698,19 +593,8 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, filename, iptr, niptr, &sd, &nspace, &rank, &suri); free(filename); if (PMIX_SUCCESS != rc) { - if (NULL != nspace){ - free(nspace); - } - if (NULL != suri) { - free(suri); - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); - } - return PMIX_ERR_UNREACH; - } - if (NULL != iptr) { - PMIX_INFO_FREE(iptr, niptr); + rc = PMIX_ERR_UNREACH; + goto cleanup; } complete: @@ -719,14 +603,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* do a final bozo check */ if (NULL == nspace || PMIX_RANK_WILDCARD == rank) { - if (NULL != nspace) { - free(nspace); - } - if (NULL != suri) { - free(suri); - } CLOSE_THE_SOCKET(sd); - return PMIX_ERR_UNREACH; + rc = PMIX_ERR_UNREACH; + goto cleanup; } /* mark the connection as made */ pmix_globals.connected = true; @@ -784,11 +663,23 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_ptl_base_send_handler, pmix_client_globals.myserver); pmix_client_globals.myserver->send_ev_active = false; - free(nspace); + cleanup: + if (NULL != nspace) { + free(nspace); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } + if (NULL != rendfile) { + free(rendfile); + } if (NULL != suri) { free(suri); } - return PMIX_SUCCESS; + if (NULL != server_nspace) { + free(server_nspace); + } + return rc; } static pmix_status_t send_recv(struct pmix_peer_t *peer, @@ -852,45 +743,79 @@ static pmix_status_t parse_uri_file(char *filename, int retries; int major, minor, release; - fp = fopen(filename, "r"); - if (NULL == fp) { - /* if we cannot open the file, then the server must not - * be configured to support tool connections, or this - * user isn't authorized to access it - or it may just - * not exist yet! Check for existence */ - if (0 != access(filename, R_OK)) { - if (ENOENT == errno && 0 < mca_ptl_tcp_component.wait_to_connect) { - /* the file does not exist, so give it - * a little time to see if the server - * is still starting up */ - retries = 0; - do { - ++retries; - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "WAITING FOR CONNECTION FILE"); - PMIX_CONSTRUCT_LOCK(&lock); + /* if we cannot open the file, then the server must not + * be configured to support tool connections, or this + * user isn't authorized to access it - or it may just + * not exist yet! Check for existence */ + /* coverity[toctou] */ + if (0 == access(filename, R_OK)) { + goto process; + } else { + if (ENOENT == errno) { + /* the file does not exist, so give it + * a little time to see if the server + * is still starting up */ + retries = 0; + do { + ++retries; + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "WAITING FOR CONNECTION FILE %s", filename); + PMIX_CONSTRUCT_LOCK(&lock); + if (0 < mca_ptl_tcp_component.wait_to_connect) { tv.tv_sec = mca_ptl_tcp_component.wait_to_connect; tv.tv_usec = 0; pmix_event_evtimer_set(pmix_globals.evbase, &ev, timeout, &lock); + PMIX_POST_OBJECT(&ev); pmix_event_evtimer_add(&ev, &tv); - PMIX_WAIT_THREAD(&lock); - PMIX_DESTRUCT_LOCK(&lock); - fp = fopen(filename, "r"); - if (NULL != fp) { - /* we found it! */ - goto process; - } - } while (retries < mca_ptl_tcp_component.max_retries); - /* otherwise, mark it as unreachable */ - } + } else { + tv.tv_sec = 0; + tv.tv_usec = 10000; // use 0.01 sec as default + pmix_event_evtimer_set(pmix_globals.evbase, &ev, + timeout, &lock); + PMIX_POST_OBJECT(&ev); + pmix_event_evtimer_add(&ev, &tv); + } + PMIX_WAIT_THREAD(&lock); + PMIX_DESTRUCT_LOCK(&lock); + /* coverity[toctou] */ + if (0 == access(filename, R_OK)) { + goto process; + } + } while (retries < mca_ptl_tcp_component.max_retries); + /* otherwise, mark it as unreachable */ } - return PMIX_ERR_UNREACH; } + return PMIX_ERR_UNREACH; process: - /* get the URI */ - srvr = pmix_getline(fp); + fp = fopen(filename, "r"); + if (NULL == fp) { + return PMIX_ERR_UNREACH; + } + /* get the URI - might seem crazy, but there is actually + * a race condition here where the server may have created + * the file but not yet finished writing into it. So give + * us a chance to get the required info */ + for (retries=0; retries < 3; retries++) { + srvr = pmix_getline(fp); + if (NULL != srvr) { + break; + } + fclose(fp); + tv.tv_sec = 0; + tv.tv_usec = 10000; // use 0.01 sec as default + pmix_event_evtimer_set(pmix_globals.evbase, &ev, + timeout, &lock); + PMIX_POST_OBJECT(&ev); + pmix_event_evtimer_add(&ev, &tv); + PMIX_WAIT_THREAD(&lock); + PMIX_DESTRUCT_LOCK(&lock); + fp = fopen(filename, "r"); + if (NULL == fp) { + return PMIX_ERR_UNREACH; + } + } if (NULL == srvr) { PMIX_ERROR_LOG(PMIX_ERR_FILE_READ_FAILURE); fclose(fp); @@ -1412,7 +1337,10 @@ static pmix_status_t recv_connect_ack(int sd, uint8_t myflag) if (NULL == pmix_client_globals.myserver->nptr) { pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t); } - pmix_ptl_base_recv_blocking(sd, (char*)nspace, PMIX_MAX_NSLEN+1); + rc = pmix_ptl_base_recv_blocking(sd, (char*)nspace, PMIX_MAX_NSLEN+1); + if (PMIX_SUCCESS != rc) { + return rc; + } if (NULL != pmix_client_globals.myserver->nptr->nspace) { free(pmix_client_globals.myserver->nptr->nspace); } @@ -1421,7 +1349,10 @@ static pmix_status_t recv_connect_ack(int sd, uint8_t myflag) free(pmix_client_globals.myserver->info->pname.nspace); } pmix_client_globals.myserver->info->pname.nspace = strdup(nspace); - pmix_ptl_base_recv_blocking(sd, (char*)&u32, sizeof(uint32_t)); + rc = pmix_ptl_base_recv_blocking(sd, (char*)&u32, sizeof(uint32_t)); + if (PMIX_SUCCESS != rc) { + return rc; + } pmix_client_globals.myserver->info->pname.rank = htonl(u32); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, @@ -1462,6 +1393,31 @@ static pmix_status_t recv_connect_ack(int sd, uint8_t myflag) return PMIX_ERR_UNREACH; } } +#if defined(TCP_NODELAY) + int optval; + optval = 1; + if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *)&optval, sizeof(optval)) < 0) { + opal_backtrace_print(stderr, NULL, 1); + pmix_output_verbose(5, pmix_ptl_base_framework.framework_output, + "[%s:%d] setsockopt(TCP_NODELAY) failed: %s (%d)", + __FILE__, __LINE__, + strerror(pmix_socket_errno), + pmix_socket_errno); + } +#endif +#if defined(SO_NOSIGPIPE) + /* Some BSD flavors generate EPIPE when we write to a disconnected peer. We need + * the prevent this signal to be able to trap socket shutdown and cleanly release + * the endpoint. + */ + int optval2 = 1; + if (setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (char *)&optval2, sizeof(optval2)) < 0) { + pmix_output_verbose(5, pmix_ptl_base_framework.framework_output, + "[%s:%d] setsockopt(SO_NOSIGPIPE) failed: %s (%d)", + __FILE__, __LINE__, + strerror(pmix_socket_errno), pmix_socket_errno); + } +#endif return PMIX_SUCCESS; } @@ -1493,6 +1449,7 @@ static pmix_status_t df_search(char *dirname, char *prefix, continue; } newdir = pmix_os_path(false, dirname, dir_entry->d_name, NULL); + /* coverity[toctou] */ if (-1 == stat(newdir, &buf)) { free(newdir); continue; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index 8032c272f3..d6b98fc3cf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -12,10 +12,10 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2020 IBM Corporation. All rights reserved. * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -30,8 +30,8 @@ * entire components just to query their version and parameters. */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #ifdef HAVE_UNISTD_H #include @@ -53,18 +53,22 @@ #include #endif #include +#include #include "src/include/pmix_socket_errno.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/fd.h" #include "src/util/net.h" +#include "src/util/name_fns.h" +#include "src/util/os_dirpath.h" #include "src/util/os_path.h" #include "src/util/parse_options.h" #include "src/util/pif.h" #include "src/util/pmix_environ.h" #include "src/util/show_help.h" #include "src/util/strnlen.h" +#include "src/event/pmix_event.h" #include "src/common/pmix_iof.h" #include "src/server/pmix_server_ops.h" #include "src/mca/bfrops/base/base.h" @@ -133,6 +137,7 @@ static char **split_and_resolve(char **orig_str, char *name); static void connection_handler(int sd, short args, void *cbdata); static void cnct_cbfunc(pmix_status_t status, pmix_proc_t *proc, void *cbdata); +static void _check_cached_events(pmix_peer_t *peer); static int component_register(void) { @@ -245,6 +250,14 @@ static int component_register(void) } static char *urifile = NULL; +static bool created_rendezvous_file = false; +static bool created_session_tmpdir = false; +static bool created_system_tmpdir = false; +static bool created_system_filename = false; +static bool created_session_filename = false; +static bool created_nspace_filename = false; +static bool created_pid_filename = false; +static bool created_urifile = false; static pmix_status_t component_open(void) { @@ -296,35 +309,56 @@ static pmix_status_t component_open(void) pmix_status_t component_close(void) { if (NULL != mca_ptl_tcp_component.system_filename) { - unlink(mca_ptl_tcp_component.system_filename); + if (created_system_filename) { + remove(mca_ptl_tcp_component.system_filename); + } free(mca_ptl_tcp_component.system_filename); } if (NULL != mca_ptl_tcp_component.session_filename) { - unlink(mca_ptl_tcp_component.session_filename); + if (created_session_filename) { + remove(mca_ptl_tcp_component.session_filename); + } free(mca_ptl_tcp_component.session_filename); } if (NULL != mca_ptl_tcp_component.nspace_filename) { - unlink(mca_ptl_tcp_component.nspace_filename); + if (created_nspace_filename) { + remove(mca_ptl_tcp_component.nspace_filename); + } free(mca_ptl_tcp_component.nspace_filename); } if (NULL != mca_ptl_tcp_component.pid_filename) { - unlink(mca_ptl_tcp_component.pid_filename); + if (created_pid_filename) { + remove(mca_ptl_tcp_component.pid_filename); + } free(mca_ptl_tcp_component.pid_filename); } if (NULL != mca_ptl_tcp_component.rendezvous_filename) { - unlink(mca_ptl_tcp_component.rendezvous_filename); + if (created_rendezvous_file) { + remove(mca_ptl_tcp_component.rendezvous_filename); + } free(mca_ptl_tcp_component.rendezvous_filename); } if (NULL != urifile) { - /* remove the file */ - unlink(urifile); + if (created_urifile) { + /* remove the file */ + remove(urifile); + } free(urifile); urifile = NULL; } if (NULL != mca_ptl_tcp_component.session_tmpdir) { + /* if I am a tool or a server, then remove my session directory if empty */ + if (created_session_tmpdir) { + pmix_os_dirpath_destroy(mca_ptl_tcp_component.session_tmpdir, + true, NULL); + } free(mca_ptl_tcp_component.session_tmpdir); } if (NULL != mca_ptl_tcp_component.system_tmpdir) { + if (created_system_tmpdir) { + pmix_os_dirpath_destroy(mca_ptl_tcp_component.system_tmpdir, + true, NULL); + } free(mca_ptl_tcp_component.system_tmpdir); } return PMIX_SUCCESS; @@ -351,6 +385,14 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env) * tool connections - in that case, we will take a non-loopback * device by default, if one is available after filtering directives * + * If we are a tool and were give a rendezvous file, then we first + * check to see if it already exists. If it does, then this is the + * connection info we are to use. If it doesn't, then this is the + * name of the file we are to use to store our listener info. + * + * If we are a server and are given a rendezvous file, then that is + * is the name of the file we are to use to store our listener info. + * * NOTE: we accept MCA parameters, but info keys override them */ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, @@ -365,13 +407,17 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, struct sockaddr_storage my_ss; int kindex; size_t n; - bool session_tool = false; bool system_tool = false; + bool tool_support = false; pmix_socklen_t addrlen; char *prefix, myhost[PMIX_MAXHOSTNAMELEN] = {0}; char myconnhost[PMIX_MAXHOSTNAMELEN] = {0}; int myport; pmix_kval_t *urikv; + FILE *fp; + pid_t mypid; + struct stat sbuf; + time_t mytime; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp setup_listener"); @@ -424,13 +470,26 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, free(mca_ptl_tcp_component.system_tmpdir); } mca_ptl_tcp_component.system_tmpdir = strdup(info[n].value.data.string); - } else if (0 == strcmp(info[n].key, PMIX_SERVER_TOOL_SUPPORT)) { - session_tool = PMIX_INFO_TRUE(&info[n]); } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_SYSTEM_SUPPORT)) { system_tool = PMIX_INFO_TRUE(&info[n]); + } else if (0 == strcmp(info[n].key, PMIX_SERVER_TOOL_SUPPORT)) { + tool_support = PMIX_INFO_TRUE(&info[n]); } else if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer) && PMIX_CHECK_KEY(&info[n], PMIX_LAUNCHER_RENDEZVOUS_FILE)) { + if (NULL != mca_ptl_tcp_component.rendezvous_filename) { + free(mca_ptl_tcp_component.rendezvous_filename); + } mca_ptl_tcp_component.rendezvous_filename = strdup(info[n].value.data.string); + } else if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_MAX_RETRIES)) { + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, mca_ptl_tcp_component.max_retries, int); + if (PMIX_SUCCESS != rc) { + return rc; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_RETRY_DELAY)) { + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, mca_ptl_tcp_component.wait_to_connect, int); + if (PMIX_SUCCESS != rc) { + return rc; + } } } } @@ -494,7 +553,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, /* if one of the network specifications isn't parseable, then * error out as we can't do what was requested */ - if (PMIX_ERR_NETWORK_NOT_PARSEABLE == rc) { + if (PMIX_ERR_FABRIC_NOT_PARSEABLE == rc) { pmix_show_help("help-ptl-tcp.txt", "not-parseable", true); pmix_argv_free(interfaces); return PMIX_ERR_BAD_PARAM; @@ -689,6 +748,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, /* add a flag that indicates we accept v2.1 protocols */ fprintf(fp, "v%s\n", PMIX_VERSION); fclose(fp); + created_urifile = true; } } @@ -731,13 +791,32 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, mca_ptl_tcp_component.rendezvous_filename = NULL; goto sockerror; } + created_rendezvous_file = true; } nextstep: /* if we are going to support tools, then drop contact file(s) */ if (system_tool) { - FILE *fp; - + if (0 == stat(mca_ptl_tcp_component.system_tmpdir, &sbuf)) { + /* already exists - check if it is a directory */ + if (! S_ISDIR(sbuf.st_mode)) { + /* nope - we are hosed */ + pmix_output(0, "System tmpdir %s is not a directory\n", mca_ptl_tcp_component.system_tmpdir); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + goto sockerror; + } + } else { + /* need to create it */ + rc = mkdir(mca_ptl_tcp_component.system_tmpdir, 0755); + if (0 != rc) { + pmix_output(0, "System tmpdir %s could not be created\n", mca_ptl_tcp_component.system_tmpdir); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + goto sockerror; + } + created_system_tmpdir = true; + } if (0 > asprintf(&mca_ptl_tcp_component.system_filename, "%s/pmix.sys.%s", mca_ptl_tcp_component.system_tmpdir, myhost)) { CLOSE_THE_SOCKET(lt->socket); @@ -760,6 +839,13 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, fprintf(fp, "%s\n", lt->uri); /* add a flag that indicates we accept v3.0 protocols */ fprintf(fp, "v%s\n", PMIX_VERSION); + /* output our pid */ + fprintf(fp, "%lu\n", (unsigned long)getpid()); + /* output our effective uid and gid */ + fprintf(fp, "%lu:%lu\n", (unsigned long)geteuid(), (unsigned long)getegid()); + /* output the time */ + mytime = time(NULL); + fprintf(fp, "%s\n", ctime(&mytime)); fclose(fp); /* set the file mode */ if (0 != chmod(mca_ptl_tcp_component.system_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) { @@ -769,45 +855,30 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, mca_ptl_tcp_component.system_filename = NULL; goto sockerror; } + created_system_filename = true; } - if (session_tool) { - FILE *fp; - pid_t mypid; - /* first output to a std file */ - mypid = getpid(); - if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool", - mca_ptl_tcp_component.session_tmpdir, myhost)) { - CLOSE_THE_SOCKET(lt->socket); - goto sockerror; + if (tool_support) { + if (0 == stat(mca_ptl_tcp_component.session_tmpdir, &sbuf)) { + /* already exists - check if it is a directory */ + if (! S_ISDIR(sbuf.st_mode)) { + /* nope - we are hosed */ + pmix_output(0, "Session tmpdir %s is not a directory\n", mca_ptl_tcp_component.session_tmpdir); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + goto sockerror; + } + } else { + /* need to create it */ + rc = mkdir(mca_ptl_tcp_component.session_tmpdir, 0755); + if (0 != rc) { + pmix_output(0, "Session tmpdir %s could not be created\n", mca_ptl_tcp_component.session_tmpdir); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + goto sockerror; + } + created_session_tmpdir = true; } - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "WRITING TOOL FILE %s", - mca_ptl_tcp_component.session_filename); - fp = fopen(mca_ptl_tcp_component.session_filename, "w"); - if (NULL == fp) { - pmix_output(0, "Impossible to open the file %s in write mode\n", mca_ptl_tcp_component.session_filename); - PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); - CLOSE_THE_SOCKET(lt->socket); - free(mca_ptl_tcp_component.session_filename); - mca_ptl_tcp_component.session_filename = NULL; - goto sockerror; - } - - /* output my URI */ - fprintf(fp, "%s\n", lt->uri); - /* add a flag that indicates we accept v2.1 protocols */ - fprintf(fp, "%s\n", PMIX_VERSION); - fclose(fp); - /* set the file mode */ - if (0 != chmod(mca_ptl_tcp_component.session_filename, S_IRUSR | S_IWUSR | S_IRGRP)) { - PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); - CLOSE_THE_SOCKET(lt->socket); - free(mca_ptl_tcp_component.session_filename); - mca_ptl_tcp_component.session_filename = NULL; - goto sockerror; - } - /* now output to a file based on pid */ mypid = getpid(); if (0 > asprintf(&mca_ptl_tcp_component.pid_filename, "%s/pmix.%s.tool.%d", @@ -816,7 +887,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, goto sockerror; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "WRITING TOOL FILE %s", + "WRITING PID TOOL FILE %s", mca_ptl_tcp_component.pid_filename); fp = fopen(mca_ptl_tcp_component.pid_filename, "w"); if (NULL == fp) { @@ -832,6 +903,13 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, fprintf(fp, "%s\n", lt->uri); /* add a flag that indicates we accept v2.1 protocols */ fprintf(fp, "%s\n", PMIX_VERSION); + /* output our pid */ + fprintf(fp, "%lu\n", (unsigned long)getpid()); + /* output our effective uid and gid */ + fprintf(fp, "%lu:%lu\n", (unsigned long)geteuid(), (unsigned long)getegid()); + /* output the time */ + mytime = time(NULL); + fprintf(fp, "%s\n", ctime(&mytime)); fclose(fp); /* set the file mode */ if (0 != chmod(mca_ptl_tcp_component.pid_filename, S_IRUSR | S_IWUSR | S_IRGRP)) { @@ -841,6 +919,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, mca_ptl_tcp_component.pid_filename = NULL; goto sockerror; } + created_pid_filename = true; /* now output it into a file based on my nspace */ @@ -850,7 +929,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, goto sockerror; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "WRITING TOOL FILE %s", + "WRITING NSPACE TOOL FILE %s", mca_ptl_tcp_component.nspace_filename); fp = fopen(mca_ptl_tcp_component.nspace_filename, "w"); if (NULL == fp) { @@ -866,6 +945,13 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, fprintf(fp, "%s\n", lt->uri); /* add a flag that indicates we accept v2.1 protocols */ fprintf(fp, "%s\n", PMIX_VERSION); + /* output our pid */ + fprintf(fp, "%lu\n", (unsigned long)getpid()); + /* output our effective uid and gid */ + fprintf(fp, "%lu:%lu\n", (unsigned long)geteuid(), (unsigned long)getegid()); + /* output the time */ + mytime = time(NULL); + fprintf(fp, "%s\n", ctime(&mytime)); fclose(fp); /* set the file mode */ if (0 != chmod(mca_ptl_tcp_component.nspace_filename, S_IRUSR | S_IWUSR | S_IRGRP)) { @@ -875,6 +961,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, mca_ptl_tcp_component.nspace_filename = NULL; goto sockerror; } + created_nspace_filename = true; } /* if we are a tool and connected, then register any rendezvous files for cleanup */ if (PMIX_PEER_IS_TOOL(pmix_globals.mypeer) && pmix_globals.connected) { @@ -1019,7 +1106,7 @@ static void connection_handler(int sd, short args, void *cbdata) char *msg, *mg, *version; char *sec, *bfrops, *gds; pmix_bfrop_buffer_type_t bftype; - char *nspace; + char *nspace = NULL; uint32_t len, u32; size_t cnt, msglen, n; pmix_namespace_t *nptr, *tmp; @@ -1749,6 +1836,10 @@ static void connection_handler(int sd, short args, void *cbdata) "pmix:server client %s:%u has connected on socket %d", peer->info->pname.nspace, peer->info->pname.rank, peer->sd); PMIX_RELEASE(pnd); + + /* check the cached events and update the client */ + _check_cached_events(peer); + return; error: @@ -1925,7 +2016,8 @@ static void process_cbfunc(int sd, short args, void *cbdata) PMIX_PROC_CREATE(req->procs, req->nprocs); PMIX_LOAD_PROCID(&req->procs[0], pmix_globals.myid.nspace, pmix_globals.myid.rank); req->channels = PMIX_FWD_STDOUT_CHANNEL | PMIX_FWD_STDERR_CHANNEL | PMIX_FWD_STDDIAG_CHANNEL; - req->refid = pmix_pointer_array_add(&pmix_globals.iof_requests, req); + req->remote_id = 0; // default ID for tool during init + req->local_id = pmix_pointer_array_add(&pmix_globals.iof_requests, req); /* validate the connection */ cred.bytes = pnd->cred; @@ -1982,6 +2074,9 @@ static void process_cbfunc(int sd, short args, void *cbdata) "pmix:server tool %s:%d has connected on socket %d", peer->info->pname.nspace, peer->info->pname.rank, peer->sd); + /* check the cached events and update the tool */ + _check_cached_events(peer); + done: PMIX_RELEASE(pnd); PMIX_RELEASE(cd); @@ -2005,8 +2100,112 @@ static void cnct_cbfunc(pmix_status_t status, return; } cd->status = status; - pmix_strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); - cd->proc.rank = proc->rank; + PMIX_LOAD_PROCID(&cd->proc, proc->nspace, proc->rank); cd->cbdata = cbdata; PMIX_THREADSHIFT(cd, process_cbfunc); } + +static void _check_cached_events(pmix_peer_t *peer) +{ + pmix_notify_caddy_t *cd; + int i; + size_t n; + pmix_range_trkr_t rngtrk; + pmix_buffer_t *relay; + pmix_proc_t proc; + pmix_status_t ret; + pmix_cmd_t cmd = PMIX_NOTIFY_CMD; + bool matched, found; + + PMIX_LOAD_PROCID(&proc, peer->info->pname.nspace, peer->info->pname.rank); + + for (i=0; i < pmix_globals.max_events; i++) { + pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&cd); + if (NULL == cd) { + continue; + } + /* check the range */ + if (NULL == cd->targets) { + rngtrk.procs = &cd->source; + rngtrk.nprocs = 1; + } else { + rngtrk.procs = cd->targets; + rngtrk.nprocs = cd->ntargets; + } + rngtrk.range = cd->range; + if (!pmix_notify_check_range(&rngtrk, &proc)) { + continue; + } + found = false; + /* if we were given specific targets, check if this is one */ + if (NULL != cd->targets) { + matched = false; + for (n=0; n < cd->ntargets; n++) { + if (PMIX_CHECK_PROCID(&proc, &cd->targets[n])) { + matched = true; + /* track the number of targets we have left to notify */ + --cd->nleft; + /* if this is the last one, then evict this event + * from the cache */ + if (0 == cd->nleft) { + pmix_hotel_checkout(&pmix_globals.notifications, cd->room); + found = true; // mark that we should release cd + } + break; + } + } + if (!matched) { + /* do not notify this one */ + continue; + } + } + + /* all matches - notify */ + relay = PMIX_NEW(pmix_buffer_t); + if (NULL == relay) { + /* nothing we can do */ + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + break; + } + /* pack the info data stored in the event */ + PMIX_BFROPS_PACK(ret, peer, relay, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + PMIX_RELEASE(relay); + break; + } + PMIX_BFROPS_PACK(ret, peer, relay, &cd->status, 1, PMIX_STATUS); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + PMIX_RELEASE(relay); + break; + } + PMIX_BFROPS_PACK(ret, peer, relay, &cd->source, 1, PMIX_PROC); + if (PMIX_SUCCESS != ret) { + PMIX_RELEASE(relay); + PMIX_ERROR_LOG(ret); + break; + } + PMIX_BFROPS_PACK(ret, peer, relay, &cd->ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + PMIX_RELEASE(relay); + break; + } + if (0 < cd->ninfo) { + PMIX_BFROPS_PACK(ret, peer, relay, cd->info, cd->ninfo, PMIX_INFO); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + PMIX_RELEASE(relay); + break; + } + } + PMIX_SERVER_QUEUE_REPLY(ret, peer, 0, relay); + if (PMIX_SUCCESS != ret) { + PMIX_RELEASE(relay); + } + if (found) { + PMIX_RELEASE(cd); + } + } +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c index 9e748e426e..8e081bd70d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c @@ -13,7 +13,7 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -24,8 +24,8 @@ * */ -#include -#include "pmix_common.h" +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #ifdef HAVE_FCNTL_H #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c index 1a0716a896..312030250a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. @@ -30,8 +30,8 @@ * entire components just to query their version and parameters. */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #ifdef HAVE_FCNTL_H #include @@ -154,8 +154,8 @@ static int component_query(pmix_mca_base_module_t **module, int *priority) if (PMIX_PEER_IS_TOOL(pmix_globals.mypeer)) { return PMIX_ERR_NOT_SUPPORTED; } - *module = (pmix_mca_base_module_t*)&pmix_ptl_usock_module; + *priority = mca_ptl_usock_component.super.priority; return PMIX_SUCCESS; } @@ -650,13 +650,9 @@ static void connection_handler(int sd, short args, void *cbdata) nptr->compat.type = bftype; /* set the gds module to match this peer */ - if (NULL != gds) { - PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, gds, PMIX_STRING); - nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1); - PMIX_INFO_DESTRUCT(&ginfo); - } else { - nptr->compat.gds = pmix_gds_base_assign_module(NULL, 0); - } + PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, gds, PMIX_STRING); + nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1); + PMIX_INFO_DESTRUCT(&ginfo); if (NULL == nptr->compat.gds) { free(msg); info->proc_cnt--; diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c index 828987884b..45a9fb48ca 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c @@ -12,7 +12,7 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -24,7 +24,7 @@ /** @file **/ -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_object.h" #include "src/client/pmix_client_ops.h" @@ -34,6 +34,7 @@ #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/bfrops/base/base.h" +#include "src/mca/pcompress/base/base.h" #include "src/mca/gds/base/base.h" #include "src/mca/pif/base/base.h" #include "src/mca/pinstalldirs/base/base.h" @@ -41,6 +42,7 @@ #include "src/mca/pnet/base/base.h" #include "src/mca/preg/base/base.h" #include "src/mca/psec/base/base.h" +#include "src/mca/psquash/base/base.h" #include "src/mca/ptl/base/base.h" #include PMIX_EVENT_HEADER @@ -80,6 +82,13 @@ void pmix_rte_finalize(void) /* close bfrops */ (void)pmix_mca_base_framework_close(&pmix_bfrops_base_framework); + /* close the psquash framework */ + pmix_psquash.finalize(); + pmix_mca_base_framework_close(&pmix_psquash_base_framework); + + /* close compress */ + (void)pmix_mca_base_framework_close(&pmix_pcompress_base_framework); + /* close GDS */ (void)pmix_mca_base_framework_close(&pmix_gds_base_framework); @@ -123,7 +132,9 @@ void pmix_rte_finalize(void) } PMIX_DESTRUCT(&pmix_globals.iof_requests); PMIX_LIST_DESTRUCT(&pmix_globals.stdin_targets); - free(pmix_globals.hostname); + if (NULL != pmix_globals.hostname) { + free(pmix_globals.hostname); + } PMIX_LIST_DESTRUCT(&pmix_globals.nspaces); /* now safe to release the event base */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c index 368256cfc2..f79c9a9209 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c @@ -15,7 +15,7 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -27,30 +27,28 @@ /** @file **/ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_UNISTD_H #include #endif -#include PMIX_EVENT_HEADER -#if ! PMIX_HAVE_LIBEV -#include PMIX_EVENT2_THREAD_HEADER -#endif - -#include +#include "src/include/pmix_globals.h" #include "src/util/output.h" +#include "src/util/pmix_environ.h" #include "src/util/show_help.h" #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/bfrops/base/base.h" +#include "src/mca/pcompress/base/base.h" #include "src/mca/gds/base/base.h" #include "src/mca/pif/base/base.h" #include "src/mca/pinstalldirs/base/base.h" #include "src/mca/plog/base/base.h" #include "src/mca/pnet/base/base.h" -#include "src/mca/psec/base/base.h" #include "src/mca/preg/base/base.h" +#include "src/mca/psec/base/base.h" +#include "src/mca/psquash/base/base.h" #include "src/mca/ptl/base/base.h" #include "src/client/pmix_client_ops.h" @@ -68,7 +66,10 @@ PMIX_EXPORT int pmix_initialized = 0; PMIX_EXPORT bool pmix_init_called = false; /* we have to export the pmix_globals object so * all plugins can access it. However, it is included - * in the pmix_rename.h file for external protection */ + * in the pmix_rename.h file for external protection. + * Initialize only those entries that are not covered + * by MCA params or are complex structures initialized + * below */ PMIX_EXPORT pmix_globals_t pmix_globals = { .init_cntr = 0, .mypeer = NULL, @@ -80,7 +81,8 @@ PMIX_EXPORT pmix_globals_t pmix_globals = { .debug_output = -1, .connected = false, .commits_pending = false, - .mygds = NULL + .mygds = NULL, + .pushstdin = false }; @@ -101,6 +103,7 @@ int pmix_rte_init(uint32_t type, char *error = NULL, *evar; size_t n; char hostname[PMIX_MAXHOSTNAMELEN] = {0}; + char *gds = NULL; if( ++pmix_initialized != 1 ) { if( pmix_initialized < 1 ) { @@ -132,6 +135,11 @@ int pmix_rte_init(uint32_t type, __FILE__, __LINE__, ret); return ret; } + if (PMIX_SUCCESS != (ret = pmix_pinstall_dirs_base_init(info, ninfo))) { + fprintf(stderr, "pmix_pinstalldirs_base_init() failed -- process will likely abort (%s:%d, returned %d instead of PMIX_SUCCESS)\n", + __FILE__, __LINE__, ret); + return ret; + } /* initialize the help system */ pmix_show_help_init(); @@ -160,7 +168,21 @@ int pmix_rte_init(uint32_t type, goto return_error; } + /* if an external event base wasn't provide, create one */ + if (!pmix_globals.external_evbase) { + /* tell libevent that we need thread support */ + pmix_event_use_threads(); + + /* create an event base and progress thread for us */ + if (NULL == (pmix_globals.evbase = pmix_progress_thread_init(NULL))) { + error = "progress thread"; + ret = PMIX_ERROR; + goto return_error; + } + } + /* setup the globals structure */ + pmix_globals.pid = getpid(); memset(&pmix_globals.myid.nspace, 0, PMIX_MAX_NSLEN+1); pmix_globals.myid.rank = PMIX_RANK_INVALID; PMIX_CONSTRUCT(&pmix_globals.events, pmix_events_t); @@ -173,6 +195,13 @@ int pmix_rte_init(uint32_t type, pmix_globals.evbase, pmix_globals.event_eviction_time, _notification_eviction_cbfunc); PMIX_CONSTRUCT(&pmix_globals.nspaces, pmix_list_t); + /* need to hold off checking the hotel init return code + * until after we construct all the globals so they can + * correct finalize */ + if (PMIX_SUCCESS != ret) { + error = "notification hotel init"; + goto return_error; + } /* if we were given a hostname in our environment, use it */ if (NULL != (evar = getenv("PMIX_HOSTNAME"))) { pmix_globals.hostname = strdup(evar); @@ -181,11 +210,6 @@ int pmix_rte_init(uint32_t type, pmix_globals.hostname = strdup(hostname); } - if (PMIX_SUCCESS != ret) { - error = "notification hotel init"; - goto return_error; - } - /* and setup the iof request tracking list */ PMIX_CONSTRUCT(&pmix_globals.iof_requests, pmix_pointer_array_t); pmix_pointer_array_init(&pmix_globals.iof_requests, 128, INT_MAX, 128); @@ -282,6 +306,8 @@ int pmix_rte_init(uint32_t type, if (PMIX_SUCCESS != ret) { goto return_error; } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_GDS_MODULE)) { + gds = info[n].value.data.string; } } } @@ -290,6 +316,22 @@ int pmix_rte_init(uint32_t type, * will be done by the individual init functions and at the * time of connection to that peer */ + if( PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_psquash_base_framework, 0)) ) { + error = "pmix_psquash_base_open"; + goto return_error; + } + + if( PMIX_SUCCESS != (ret = pmix_psquash_base_select()) ) { + error = "pmix_psquash_base_select"; + goto return_error; + } + + ret = pmix_psquash.init(); + if (PMIX_SUCCESS != ret) { + error = "psquash_init"; + goto return_error; + } + /* open the bfrops and select the active plugins */ if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_bfrops_base_framework, 0)) ) { error = "pmix_bfrops_base_open"; @@ -300,7 +342,21 @@ int pmix_rte_init(uint32_t type, goto return_error; } + /* open and select the compress framework */ + if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_pcompress_base_framework, 0)) ) { + error = "pmix_pcompress_base_open"; + goto return_error; + } + if (PMIX_SUCCESS != (ret = pmix_compress_base_select()) ) { + error = "pmix_pcompress_base_select"; + goto return_error; + } + /* open the ptl and select the active plugins */ + if (NULL != (evar = getenv("PMIX_PTL_MODULE"))) { + /* convert to an MCA param, but don't overwrite something already there */ + pmix_setenv("PMIX_MCA_ptl", evar, false, &environ); + } if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_ptl_base_framework, 0)) ) { error = "pmix_ptl_base_open"; goto return_error; @@ -316,6 +372,10 @@ int pmix_rte_init(uint32_t type, } /* open the psec and select the active plugins */ + if (NULL != (evar = getenv("PMIX_SECURITY_MODE"))) { + /* convert to an MCA param, but don't overwrite something already there */ + pmix_setenv("PMIX_MCA_psec", evar, false, &environ); + } if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_psec_base_framework, 0))) { error = "pmix_psec_base_open"; goto return_error; @@ -326,6 +386,12 @@ int pmix_rte_init(uint32_t type, } /* open the gds and select the active plugins */ + if (NULL != gds) { + pmix_setenv("PMIX_MCA_gds", gds, true, &environ); + } else if (NULL != (evar = getenv("PMIX_GDS_MODULE"))) { + /* convert to an MCA param, but don't overwrite something already there */ + pmix_setenv("PMIX_MCA_gds", evar, false, &environ); + } if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_gds_base_framework, 0)) ) { error = "pmix_gds_base_open"; goto return_error; @@ -341,7 +407,7 @@ int pmix_rte_init(uint32_t type, return ret; } - /* open the preg and select the active plugins */ + /* open the preg and select the active plugins - must come after pcompress! */ if (PMIX_SUCCESS != (ret = pmix_mca_base_framework_open(&pmix_preg_base_framework, 0)) ) { error = "pmix_preg_base_open"; goto return_error; @@ -361,15 +427,10 @@ int pmix_rte_init(uint32_t type, goto return_error; } - /* if an external event base wasn't provide, create one */ if (!pmix_globals.external_evbase) { - /* tell libevent that we need thread support */ - pmix_event_use_threads(); - - /* create an event base and progress thread for us */ - if (NULL == (pmix_globals.evbase = pmix_progress_thread_init(NULL))) { - error = "progress thread"; - ret = PMIX_ERROR; + /* start progressing the event library */ + if (PMIX_SUCCESS != (ret = pmix_progress_thread_start(NULL))) { + error = "pmix_progress_thread_start"; goto return_error; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c index 8d49e8bdaa..6cfa0de653 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c @@ -17,11 +17,12 @@ * Copyright (c) 2010-2014 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2014 Hochschule Esslingen. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +32,6 @@ #include "pmix_config.h" -#include "src/include/types.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/runtime/pmix_rte.h" #include "src/util/timings.h" @@ -206,6 +206,13 @@ pmix_status_t pmix_register_params(void) PMIX_INFO_LVL_1, PMIX_MCA_BASE_VAR_SCOPE_ALL, &pmix_server_globals.base_verbose); + pmix_server_globals.fence_localonly_opt = true; + (void) pmix_mca_base_var_register ("pmix", "pmix", "server", "fence_localonly_opt", + "Optimize local-only fence opteration by eliminating the upcall to the RM (default: true)", + PMIX_MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + PMIX_INFO_LVL_1, PMIX_MCA_BASE_VAR_SCOPE_ALL, + &pmix_server_globals.fence_localonly_opt); + /* check for maximum number of pending output messages */ pmix_globals.output_limit = (size_t) INT_MAX; (void) pmix_mca_base_var_register("pmix", "iof", NULL, "output_limit", diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c index 7e40422a0b..8a7096228e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -12,7 +12,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_UNISTD_H #include @@ -266,7 +266,6 @@ static int start_progress_engine(pmix_progress_tracker_t *trk) pmix_event_base_t *pmix_progress_thread_init(const char *name) { pmix_progress_tracker_t *trk; - int rc; if (!inited) { PMIX_CONSTRUCT(&tracking, pmix_list_t); @@ -320,17 +319,45 @@ pmix_event_base_t *pmix_progress_thread_init(const char *name) /* construct the thread object */ PMIX_CONSTRUCT(&trk->engine, pmix_thread_t); trk->engine_constructed = true; - if (PMIX_SUCCESS != (rc = start_progress_engine(trk))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(trk); - return NULL; - } pmix_list_append(&tracking, &trk->super); return trk->ev_base; } -int pmix_progress_thread_stop(const char *name) +pmix_status_t pmix_progress_thread_start(const char *name) +{ + pmix_progress_tracker_t *trk; + pmix_status_t rc; + + if (!inited) { + /* nothing we can do */ + return PMIX_ERR_NOT_FOUND; + } + + if (NULL == name) { + name = shared_thread_name; + } + + /* find the specified engine */ + PMIX_LIST_FOREACH(trk, &tracking, pmix_progress_tracker_t) { + if (0 == strcmp(name, trk->name)) { + /* If the progress thread is active, ignore the request */ + if (trk->ev_active) { + return PMIX_SUCCESS; + } + if (PMIX_SUCCESS != (rc = start_progress_engine(trk))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(trk); + } + return rc; + } + } + + return PMIX_ERR_NOT_FOUND; +} + + +pmix_status_t pmix_progress_thread_stop(const char *name) { pmix_progress_tracker_t *trk; @@ -367,7 +394,7 @@ int pmix_progress_thread_stop(const char *name) return PMIX_ERR_NOT_FOUND; } -int pmix_progress_thread_finalize(const char *name) +pmix_status_t pmix_progress_thread_finalize(const char *name) { pmix_progress_tracker_t *trk; @@ -400,7 +427,7 @@ int pmix_progress_thread_finalize(const char *name) /* * Stop the progress thread, but don't delete the tracker (or event base) */ -int pmix_progress_thread_pause(const char *name) +pmix_status_t pmix_progress_thread_pause(const char *name) { pmix_progress_tracker_t *trk; @@ -442,7 +469,7 @@ static pmix_progress_tracker_t* pmix_progress_tracker_get_by_base(pmix_event_bas } #endif -int pmix_progress_thread_resume(const char *name) +pmix_status_t pmix_progress_thread_resume(const char *name) { pmix_progress_tracker_t *trk; diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.h b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.h index 1dfb1df48b..d7ef11d8d3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.h +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -32,7 +32,9 @@ * already-running progress thread will be returned (i.e., no new * progress thread will be started). */ -pmix_event_base_t *pmix_progress_thread_init(const char *name); +PMIX_EXPORT pmix_event_base_t *pmix_progress_thread_init(const char *name); + +PMIX_EXPORT pmix_status_t pmix_progress_thread_start(const char *name); /** * Stop a progress thread name (reference counted). @@ -45,7 +47,7 @@ pmix_event_base_t *pmix_progress_thread_init(const char *name); * Will return PMIX_ERR_NOT_FOUND if the progress thread name does not * exist; PMIX_SUCCESS otherwise. */ -int pmix_progress_thread_stop(const char *name); +PMIX_EXPORT pmix_status_t pmix_progress_thread_stop(const char *name); /** * Finalize a progress thread name (reference counted). @@ -57,7 +59,7 @@ int pmix_progress_thread_stop(const char *name); * Will return PMIX_ERR_NOT_FOUND if the progress thread name does not * exist; PMIX_SUCCESS otherwise. */ -int pmix_progress_thread_finalize(const char *name); +PMIX_EXPORT pmix_status_t pmix_progress_thread_finalize(const char *name); /** * Temporarily pause the progress thread associated with this name. @@ -70,7 +72,7 @@ int pmix_progress_thread_finalize(const char *name); * Will return PMIX_ERR_NOT_FOUND if the progress thread name does not * exist; PMIX_SUCCESS otherwise. */ -int pmix_progress_thread_pause(const char *name); +PMIX_EXPORT pmix_status_t pmix_progress_thread_pause(const char *name); /** * Restart a previously-paused progress thread associated with this @@ -79,6 +81,6 @@ int pmix_progress_thread_pause(const char *name); * Will return PMIX_ERR_NOT_FOUND if the progress thread name does not * exist; PMIX_SUCCESS otherwise. */ -int pmix_progress_thread_resume(const char *name); +PMIX_EXPORT pmix_status_t pmix_progress_thread_resume(const char *name); #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h index f7768e3942..94c3430c86 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +25,7 @@ #define PMIX_RTE_H #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/class/pmix_object.h" #include @@ -39,18 +39,18 @@ BEGIN_C_DECLS #if PMIX_ENABLE_TIMING -extern char *pmix_timing_sync_file; -extern char *pmix_timing_output; -extern bool pmix_timing_overhead; +PMIX_EXPORT extern char *pmix_timing_sync_file; +PMIX_EXPORT extern char *pmix_timing_output; +PMIX_EXPORT extern bool pmix_timing_overhead; #endif -extern int pmix_initialized; -extern char *pmix_net_private_ipv4; -extern int pmix_event_caching_window; -extern bool pmix_suppress_missing_data_warning; +PMIX_EXPORT extern int pmix_initialized; +PMIX_EXPORT extern char *pmix_net_private_ipv4; +PMIX_EXPORT extern int pmix_event_caching_window; +PMIX_EXPORT extern bool pmix_suppress_missing_data_warning; /** version string of pmix */ -extern const char pmix_version_string[]; +PMIX_EXPORT extern const char pmix_version_string[]; /** * Initialize the PMIX layer, including the MCA system. diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/server/Makefile.include index c2d9301125..231a77c250 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/server/Makefile.include @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2020 Intel, Inc. All rights reserved. # Copyright (c) 2014 Artem Y. Polyakov . # All rights reserved. # Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index fe1cfc593b..9f948f8671 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -1,11 +1,11 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2016-2020 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved @@ -16,15 +16,13 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include -#include +#include "include/pmix_server.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" @@ -49,10 +47,7 @@ #endif #include #include -#include PMIX_EVENT_HEADER -#if ! PMIX_HAVE_LIBEV -#include PMIX_EVENT2_THREAD_HEADER -#endif + #include "src/util/argv.h" #include "src/util/error.h" @@ -63,11 +58,11 @@ #include "src/mca/base/base.h" #include "src/mca/base/pmix_mca_base_var.h" #include "src/mca/pinstalldirs/base/base.h" -#include "src/mca/pnet/base/base.h" #include "src/runtime/pmix_progress_threads.h" #include "src/runtime/pmix_rte.h" #include "src/mca/bfrops/base/base.h" #include "src/mca/gds/base/base.h" +#include "src/mca/pnet/base/base.h" #include "src/mca/preg/preg.h" #include "src/mca/psensor/base/base.h" #include "src/mca/ptl/base/base.h" @@ -99,6 +94,7 @@ pmix_status_t pmix_server_initialize(void) PMIX_CONSTRUCT(&pmix_server_globals.gdata, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.events, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.local_reqs, pmix_list_t); + PMIX_CONSTRUCT(&pmix_server_globals.groups, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.iof, pmix_list_t); pmix_output_verbose(2, pmix_server_globals.base_output, @@ -155,6 +151,18 @@ pmix_status_t pmix_server_initialize(void) pmix_server_globals.base_verbose); } + /* get our available security modules */ + security_mode = pmix_psec_base_get_available_modules(); + + /* get our available ptl modules */ + ptl_mode = pmix_ptl_base_get_available_modules(); + + /* get our available bfrop modules */ + bfrops_mode = pmix_bfrops_base_get_available_modules(); + + /* get available gds modules */ + gds_mode = pmix_gds_base_get_available_modules(); + return PMIX_SUCCESS; } @@ -197,13 +205,13 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, if (NULL != info) { for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_SERVER_GATEWAY, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_GATEWAY)) { if (PMIX_INFO_TRUE(&info[n])) { PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_GATEWAY); } } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_TMPDIR)) { pmix_server_globals.tmpdir = strdup(info[n].value.data.string); - } else if (0 == strncmp(info[n].key, PMIX_SYSTEM_TMPDIR, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SYSTEM_TMPDIR)) { pmix_server_globals.system_tmpdir = strdup(info[n].value.data.string); } } @@ -231,13 +239,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, return rc; } - /* setup the server-specific globals */ - if (PMIX_SUCCESS != (rc = pmix_server_initialize())) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* assign our internal bfrops module */ pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(NULL); if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) { @@ -280,17 +281,12 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, PMIX_RETAIN(pmix_globals.mypeer->nptr); pmix_client_globals.myserver->nptr = pmix_globals.mypeer->nptr; - /* get our available security modules */ - security_mode = pmix_psec_base_get_available_modules(); - - /* get our available ptl modules */ - ptl_mode = pmix_ptl_base_get_available_modules(); - - /* get our available bfrop modules */ - bfrops_mode = pmix_bfrops_base_get_available_modules(); - - /* get available gds modules */ - gds_mode = pmix_gds_base_get_available_modules(); + /* setup the server-specific globals */ + if (PMIX_SUCCESS != (rc = pmix_server_initialize())) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } /* check the info keys for info we * need to provide to every client and @@ -298,7 +294,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, if (NULL != info) { for (n=0; n < ninfo; n++) { if (0 == strncmp(info[n].key, PMIX_SERVER_NSPACE, PMIX_MAX_KEYLEN)) { - pmix_strncpy(pmix_globals.myid.nspace, info[n].value.data.string, PMIX_MAX_NSLEN); + PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, info[n].value.data.string); nspace_given = true; } else if (0 == strncmp(info[n].key, PMIX_SERVER_RANK, PMIX_MAX_KEYLEN)) { pmix_globals.myid.rank = info[n].value.data.rank; @@ -336,9 +332,10 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, /* look for our namespace, if one was given */ if (NULL == (evar = getenv("PMIX_SERVER_NAMESPACE"))) { /* use a fake namespace */ - pmix_strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN); + PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, "pmix-server"); } else { - pmix_strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN); + pmix_output(0, "NSPACE FROM ENV %s", evar); + PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, evar); } } if (!rank_given) { @@ -415,6 +412,18 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, 2, PMIX_FWD_STDERR_CHANNEL, pmix_iof_write_handler); } +#if PMIX_HAVE_HWLOC + /* if we don't know our topology, we better get it now as we + * increasingly rely on it - note that our host will hopefully + * have passed it to us so we don't duplicate their storage! */ + if (NULL == pmix_hwloc_topology) { + if (PMIX_SUCCESS != (rc = pmix_hwloc_get_topology(info, ninfo))) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + } +#endif + /* start listening for connections */ if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) { pmix_show_help("help-pmix-server.txt", "listener-thread-start", true); @@ -459,6 +468,10 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) (void)pmix_progress_thread_pause(NULL); } + /* flush anything that is still trying to be written out */ + pmix_iof_static_dump_output(&pmix_client_globals.iof_stdout); + pmix_iof_static_dump_output(&pmix_client_globals.iof_stderr); + pmix_ptl_base_stop_listening(); for (i=0; i < pmix_server_globals.clients.size; i++) { @@ -482,6 +495,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) * at zero refcount */ pmix_execute_epilog(&ns->epilog); } + PMIX_LIST_DESTRUCT(&pmix_server_globals.groups); PMIX_LIST_DESTRUCT(&pmix_server_globals.iof); pmix_hwloc_cleanup(); @@ -509,7 +523,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) /* close the pnet framework */ (void)pmix_mca_base_framework_close(&pmix_pnet_base_framework); - PMIX_RELEASE_THREAD(&pmix_global_lock); PMIX_DESTRUCT_LOCK(&pmix_global_lock); @@ -584,7 +597,7 @@ static void _register_nspace(int sd, short args, void *cbdata) } /* register nspace for each activate components */ - PMIX_GDS_ADD_NSPACE(rc, nptr->nspace, cd->info, cd->ninfo); + PMIX_GDS_ADD_NSPACE(rc, nptr->nspace, cd->nlocalprocs, cd->info, cd->ninfo); if (PMIX_SUCCESS != rc) { goto release; } @@ -595,6 +608,9 @@ static void _register_nspace(int sd, short args, void *cbdata) * are using */ PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, cd->info, cd->ninfo); + if (PMIX_SUCCESS != rc) { + goto release; + } /* check any pending trackers to see if they are * waiting for us. There is a slight race condition whereby @@ -1501,7 +1517,7 @@ static void _dmodex_req(int sd, short args, void *cbdata) } /* They are asking for job level data for this process */ - if (cd->proc.rank == PMIX_RANK_WILDCARD) { + if (PMIX_RANK_WILDCARD == cd->proc.rank) { /* fetch the job-level info for this nspace */ /* this is going to a remote peer, so inform the gds * that we need an actual copy of the data */ @@ -2035,17 +2051,6 @@ static void clct(int sd, short args, void *cbdata) { pmix_inventory_rollup_t *cd = (pmix_inventory_rollup_t*)cbdata; -#if PMIX_HAVE_HWLOC - /* if we don't know our topology, we better get it now */ - pmix_status_t rc; - if (NULL == pmix_hwloc_topology) { - if (PMIX_SUCCESS != (rc = pmix_hwloc_get_topology(NULL, 0))) { - PMIX_ERROR_LOG(rc); - return; - } - } -#endif - /* we only have one source at this time */ cd->requests = 1; @@ -2282,28 +2287,29 @@ static void _spcb(int sd, short args, void *cbdata) PMIX_RELEASE(reply); goto cleanup; } - /* add the job-level info, if we have it */ - pmix_strncpy(proc.nspace, cd->pname.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - /* this is going to a local client, so let the gds - * have the option of returning a copy of the data, - * or a pointer to local storage */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - cb.proc = &proc; - cb.scope = PMIX_SCOPE_UNDEF; - cb.copy = false; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS == rc) { - PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, kv, 1, PMIX_KVAL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(reply); - PMIX_DESTRUCT(&cb); - goto cleanup; + if (PMIX_SUCCESS == cd->status) { + /* add the job-level info, if we have it */ + PMIX_LOAD_PROCID(&proc, cd->pname.nspace, PMIX_RANK_WILDCARD); + /* this is going to a local client, so let the gds + * have the option of returning a copy of the data, + * or a pointer to local storage */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.proc = &proc; + cb.scope = PMIX_SCOPE_UNDEF; + cb.copy = false; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS == rc) { + PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { + PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, kv, 1, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(reply); + PMIX_DESTRUCT(&cb); + goto cleanup; + } } + PMIX_DESTRUCT(&cb); } - PMIX_DESTRUCT(&cb); } /* the function that created the server_caddy did a @@ -2327,7 +2333,9 @@ static void spawn_cbfunc(pmix_status_t status, char *nspace, void *cbdata) /* need to thread-shift this request */ cd = PMIX_NEW(pmix_shift_caddy_t); cd->status = status; - cd->pname.nspace = strdup(nspace); + if (NULL != nspace) { + cd->pname.nspace = strdup(nspace); + } cd->cd = (pmix_server_caddy_t*)cbdata;; PMIX_THREADSHIFT(cd, _spcb); @@ -2418,7 +2426,6 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) /* pass the blobs being returned */ PMIX_CONSTRUCT(&xfer, pmix_buffer_t); - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, scd->data, scd->ndata); PMIX_CONSTRUCT(&nslist, pmix_list_t); if (PMIX_SUCCESS != scd->status) { @@ -2432,17 +2439,20 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) } // Skip the data if we didn't collect it - if (PMIX_COLLECT_YES != tracker->collect_type) { + if (PMIX_COLLECT_YES != tracker->collect_type || NULL == scd->data) { rc = PMIX_SUCCESS; goto finish_collective; } - // collect the pmix_namespace_t's of all local participants + /* Collect the nptr list with uniq GDS components of all local + * participants. It does not allow multiple storing to the + * same GDS if participants have mutual GDS. */ PMIX_LIST_FOREACH(cd, &tracker->local_cbs, pmix_server_caddy_t) { // see if we already have this nspace found = false; PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) { - if (nptr->ns == cd->peer->nptr) { + if (0 == strcmp(nptr->ns->compat.gds->name, + cd->peer->nptr->compat.gds->name)) { found = true; break; } @@ -2455,9 +2465,10 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) pmix_list_append(&nslist, &nptr->super); } } - PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) { - PMIX_GDS_STORE_MODEX(rc, nptr->ns, &tracker->local_cbs, &xfer); + /* pass the blobs being returned */ + PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, scd->data, scd->ndata); + PMIX_GDS_STORE_MODEX(rc, nptr->ns, &xfer, tracker); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); break; @@ -2983,7 +2994,7 @@ static void query_cbfunc(pmix_status_t status, pmix_status_t rc; pmix_output_verbose(2, pmix_server_globals.base_output, - "pmix:query callback with status %d", status); + "pmix:query callback with status %s", PMIx_Error_string(status)); reply = PMIX_NEW(pmix_buffer_t); if (NULL == reply) { @@ -3295,10 +3306,12 @@ static void _iofreg(int sd, short args, void *cbdata) if (PMIX_SUCCESS != cd->status) { /* find and remove the tracker */ req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, cd->ncodes); - PMIX_RELEASE(req); + if (NULL != req) { + PMIX_RELEASE(req); + } pmix_pointer_array_set_item(&pmix_globals.iof_requests, cd->ncodes, NULL); } else { - /* return the reference ID for this handler */ + /* return our reference ID for this handler */ PMIX_BFROPS_PACK(rc, scd->peer, reply, &cd->ncodes, 1, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -3321,11 +3334,13 @@ static void _iofreg(int sd, short args, void *cbdata) if (PMIX_SUCCESS == cd->status) { /* get the request */ req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, cd->ncodes); - PMIX_LIST_FOREACH_SAFE(iof, inxt, &pmix_server_globals.iof, pmix_iof_cache_t) { - if (PMIX_OPERATION_SUCCEEDED == pmix_iof_process_iof(iof->channel, &iof->source, iof->bo, - iof->info, iof->ninfo, req)) { - pmix_list_remove_item(&pmix_server_globals.iof, &iof->super); - PMIX_RELEASE(iof); + if (NULL != req) { + PMIX_LIST_FOREACH_SAFE(iof, inxt, &pmix_server_globals.iof, pmix_iof_cache_t) { + if (PMIX_OPERATION_SUCCEEDED == pmix_iof_process_iof(iof->channel, &iof->source, iof->bo, + iof->info, iof->ninfo, req)) { + pmix_list_remove_item(&pmix_server_globals.iof, &iof->super); + PMIX_RELEASE(iof); + } } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c index a968dddf20..ccf1b08a04 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c @@ -15,14 +15,12 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include -#include +#include "include/pmix_server.h" #include "src/include/pmix_globals.h" #ifdef HAVE_STRING_H @@ -49,12 +47,14 @@ #include "src/class/pmix_list.h" #include "src/mca/bfrops/bfrops.h" #include "src/mca/gds/gds.h" +#include "src/mca/ptl/base/base.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/name_fns.h" #include "src/util/output.h" #include "src/util/pmix_environ.h" +#include "src/client/pmix_client_ops.h" #include "pmix_server_ops.h" extern pmix_server_module_t pmix_host_server; @@ -85,16 +85,19 @@ PMIX_CLASS_INSTANCE(pmix_dmdx_reply_caddy_t, static void dmdx_cbfunc(pmix_status_t status, const char *data, size_t ndata, void *cbdata, pmix_release_cbfunc_t relfn, void *relcbdata); -static pmix_status_t _satisfy_request(pmix_namespace_t *ns, pmix_rank_t rank, +static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, pmix_server_caddy_t *cd, - pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *scope); + bool diffnspace, pmix_scope_t scope, + pmix_modex_cbfunc_t cbfunc, void *cbdata); static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, pmix_info_t info[], size_t ninfo, pmix_modex_cbfunc_t cbfunc, void *cbdata, pmix_dmdx_local_t **lcd, pmix_dmdx_request_t **rq); - +static pmix_status_t get_job_data(char *nspace, + pmix_server_caddy_t *cd, + pmix_buffer_t *pbkt); static void get_timeout(int sd, short args, void *cbdata); @@ -109,7 +112,52 @@ static void relfn(void *cbdata) } } +static pmix_status_t defer_response(char *nspace, pmix_rank_t rank, + pmix_server_caddy_t *cd, + bool localonly, + pmix_modex_cbfunc_t cbfunc, + void *cbdata, + struct timeval *tv, + pmix_dmdx_local_t **locald) +{ + pmix_status_t rc; + pmix_dmdx_request_t *req; + pmix_dmdx_local_t *lcd; + *locald = NULL; + + if (localonly) { + /* the client asked that we not wait, so return now */ + pmix_output_verbose(2, pmix_server_globals.get_output, + "%s:%d CLIENT REQUESTED IMMEDIATE", + pmix_globals.myid.nspace, + pmix_globals.myid.rank); + return PMIX_ERR_NOT_AVAILABLE; + } + /* we cannot do anything further, so just track this request + * for now */ + rc = create_local_tracker(nspace, rank, cd->info, cd->ninfo, + cbfunc, cbdata, &lcd, &req); + if (PMIX_ERR_NOMEM == rc || NULL == lcd) { + return rc; + } + pmix_output_verbose(2, pmix_server_globals.get_output, + "%s:%d TRACKER CREATED - WAITING", + pmix_globals.myid.nspace, + pmix_globals.myid.rank); + /* if they specified a timeout, set it up now */ + if (NULL != tv && 0 < tv->tv_sec) { + pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, + get_timeout, req); + pmix_event_evtimer_add(&req->ev, tv); + req->event_active = true; + } + /* the peer object has been added to the new lcd tracker, + * so return success here */ + *locald = lcd; + return rc; + +} pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_modex_cbfunc_t cbfunc, void *cbdata) @@ -118,28 +166,31 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, int32_t cnt; pmix_status_t rc; pmix_rank_t rank; - char *cptr; + char *cptr, *key=NULL; char nspace[PMIX_MAX_NSLEN+1]; pmix_namespace_t *ns, *nptr; pmix_dmdx_local_t *lcd; - pmix_dmdx_request_t *req; - bool local; + bool local = false; bool localonly = false; bool diffnspace = false; + bool refresh_cache = false; + bool scope_given = false; struct timeval tv = {0, 0}; - pmix_buffer_t pbkt, pkt; - pmix_byte_object_t bo; + pmix_buffer_t pbkt; pmix_cb_t cb; pmix_proc_t proc; char *data; size_t sz, n; + pmix_info_t *info; + pmix_scope_t scope = PMIX_SCOPE_UNDEF; + pmix_rank_info_t *iptr; pmix_output_verbose(2, pmix_server_globals.get_output, "%s recvd GET", PMIX_NAME_PRINT(&pmix_globals.myid)); /* setup */ - memset(nspace, 0, sizeof(nspace)); + PMIX_LOAD_NSPACE(nspace, NULL); /* retrieve the nspace and rank of the requested proc */ cnt = 1; @@ -148,7 +199,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, PMIX_ERROR_LOG(rc); return rc; } - pmix_strncpy(nspace, cptr, PMIX_MAX_NSLEN); + PMIX_LOAD_NSPACE(nspace, cptr); free(cptr); cnt = 1; PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &rank, &cnt, PMIX_PROC_RANK); @@ -176,6 +227,13 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, return rc; } } + /* if they provided a specific key, get it */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &key, &cnt, PMIX_STRING); + if (PMIX_SUCCESS != rc && PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } /* search for directives we can deal with here */ for (n=0; n < cd->ninfo; n++) { @@ -185,10 +243,15 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, localonly = PMIX_INFO_TRUE(&cd->info[n]); } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_TIMEOUT)) { tv.tv_sec = cd->info[n].value.data.uint32; + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_GET_REFRESH_CACHE)) { + refresh_cache = PMIX_INFO_TRUE(&cd->info[n]); + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_DATA_SCOPE)) { + scope = cd->info[n].value.data.scope; + scope_given = true; } } - /* find the nspace object for this client */ + /* find the nspace object for the target proc */ nptr = NULL; PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(nspace, ns->nspace)) { @@ -197,17 +260,13 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, } } - /* check if the nspace of the requestor is different from - * the nspace of the target process */ - diffnspace = !PMIX_CHECK_NSPACE(nspace, cd->peer->info->pname.nspace); - pmix_output_verbose(2, pmix_server_globals.get_output, - "%s EXECUTE GET FOR %s:%d ON BEHALF OF %s", + "%s EXECUTE GET FOR %s:%d WITH KEY %s ON BEHALF OF %s", PMIX_NAME_PRINT(&pmix_globals.myid), - nspace, rank, + nspace, rank, (NULL == key) ? "NULL" : key, PMIX_PNAME_PRINT(&cd->peer->info->pname)); - /* This call flows upward from a local client If we don't + /* This call flows upward from a local client. If we don't * know about this nspace, then it cannot refer to the * nspace of the requestor - i.e., they aren't asking * about one of their peers. There are two reasons why we @@ -238,181 +297,24 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, return PMIX_ERR_NOT_FOUND; } /* this is for an nspace we don't know about yet, so - * record the request for data from this process and * give the host server a chance to tell us about it. * The cbdata passed here is the pmix_server_caddy_t * we were passed - it contains the pmix_peer_t of * the original requestor so they will get the data * back when we receive it */ - rc = create_local_tracker(nspace, rank, - cd->info, cd->ninfo, - cbfunc, cbdata, &lcd, &req); - if (PMIX_ERR_NOMEM == rc) { - return rc; - } - if (PMIX_SUCCESS == rc) { - pmix_output_verbose(5, pmix_server_globals.get_output, - "%s UNKNOWN NSPACE: DUPLICATE REQUEST - WAITING", - PMIX_NAME_PRINT(&pmix_globals.myid)); - /* if they specified a timeout for this specific - * request, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; - } - /* we already asked for this info - no need to - * do it again */ - return PMIX_SUCCESS; - } - /* only other return code is NOT_FOUND, indicating that - * we created a new tracker */ - - /* Its possible there will be no local processes on this - * host, so lets ask for this explicitly. There can - * be a race condition here if this information shows - * up on its own, but at worst the direct modex - * will simply overwrite the info later */ - if (NULL != pmix_host_server.direct_modex) { - pmix_output_verbose(5, pmix_server_globals.get_output, - "%s UNKNOWN NSPACE: REQUEST PASSED TO HOST", - PMIX_NAME_PRINT(&pmix_globals.myid)); - rc = pmix_host_server.direct_modex(&lcd->proc, cd->info, cd->ninfo, dmdx_cbfunc, lcd); - if (PMIX_SUCCESS != rc) { - pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); - PMIX_RELEASE(lcd); - return rc; - } - /* if they specified a timeout for this specific - * request, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; - } - } else { - /* if we don't have direct modex feature, just respond with "not found" */ - pmix_output_verbose(5, pmix_server_globals.get_output, - "%s UNKNOWN NSPACE: NO DMODEX AVAILABLE - NOT FOUND", - PMIX_NAME_PRINT(&pmix_globals.myid)); - pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); - PMIX_RELEASE(lcd); - return PMIX_ERR_NOT_FOUND; - } - - return PMIX_SUCCESS; + goto request; } /* the target nspace is known, so we can process the request. - * if the rank is wildcard, or the nspace is different, then - * they are asking for the job-level info for this nspace - provide it */ - if (PMIX_RANK_WILDCARD == rank || diffnspace) { - pmix_output_verbose(5, pmix_server_globals.get_output, - "%s LOOKING FOR %s", - PMIX_NAME_PRINT(&pmix_globals.myid), - diffnspace ? "WILDCARD RANK" : "DIFF NSPACE"); - /* see if we have the job-level info - we won't have it - * if we have no local procs and haven't already asked - * for it, so there is no guarantee we have it */ - data = NULL; - sz = 0; - pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - /* if we have local procs for this nspace, then we - * can retrieve the info from that GDS. Otherwise, - * we need to retrieve it from our own */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - pmix_output_verbose(5, pmix_server_globals.get_output, - "%s GETTING JOB-DATA FOR %s", - PMIX_NAME_PRINT(&pmix_globals.myid), - PMIX_NAME_PRINT(&proc)); - /* this data is for a local client, so give the gds the - * option of returning a complete copy of the data, - * or returning a pointer to local storage */ - cb.proc = &proc; - cb.scope = PMIX_SCOPE_UNDEF; - cb.copy = false; - cb.info = cd->info; - cb.ninfo = cd->ninfo; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS != rc) { - cb.info = NULL; - cb.ninfo = 0; - PMIX_DESTRUCT(&cb); - return rc; - } - /* store this as a byte object in the eventual data to - * be returned */ + * if the rank is wildcard, then they are asking for the job-level + * info for this nspace - provide it */ + if (PMIX_RANK_WILDCARD == rank) { PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - cb.info = NULL; - cb.ninfo = 0; - PMIX_CONSTRUCT(&pkt, pmix_buffer_t); - /* assemble the provided data into a byte object */ - PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); + rc = get_job_data(nptr->nspace, cd, &pbkt); if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); - return rc; - } - PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); - PMIX_DESTRUCT(&pkt); - /* pack it into the payload */ - PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); - free(bo.bytes); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&cb); return rc; } - PMIX_DESTRUCT(&cb); - /* if the requested rank is not WILDCARD, then retrieve any - * posted data for that rank. Anything found will - * be added to the cb.kvs list */ - if (PMIX_RANK_WILDCARD != rank) { - PMIX_CONSTRUCT(&cb, pmix_cb_t); - proc.rank = rank; - cb.proc = &proc; - cb.scope = PMIX_LOCAL; - cb.copy = false; - cb.info = cd->info; - cb.ninfo = cd->ninfo; - pmix_output_verbose(5, pmix_server_globals.get_output, - "%s GETTING DATA FOR %s", - PMIX_NAME_PRINT(&pmix_globals.myid), - PMIX_NAME_PRINT(&proc)); - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS != rc) { - cb.info = NULL; - cb.ninfo = 0; - PMIX_DESTRUCT(&cb); - return rc; - } - cb.info = NULL; - cb.ninfo = 0; - PMIX_CONSTRUCT(&pkt, pmix_buffer_t); - /* assemble the provided data into a byte object */ - PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); - return rc; - } - PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); - PMIX_DESTRUCT(&pkt); - /* pack it into the payload */ - PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); - free(bo.bytes); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&cb); - return rc; - } - PMIX_DESTRUCT(&cb); - } /* unload the resulting payload */ PMIX_UNLOAD_BUFFER(&pbkt, data, sz); PMIX_DESTRUCT(&pbkt); @@ -435,41 +337,158 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, "%s:%d NSPACE %s not all registered", pmix_globals.myid.nspace, pmix_globals.myid.rank, nspace); - - if (localonly) { - /* the client asked that we not wait, so return now */ - pmix_output_verbose(2, pmix_server_globals.get_output, - "%s:%d CLIENT REQUESTED IMMEDIATE", - pmix_globals.myid.nspace, - pmix_globals.myid.rank); - return PMIX_ERR_NOT_FOUND; + rc = defer_response(nspace, rank, cd, localonly, cbfunc, cbdata, &tv, &lcd); + if (PMIX_ERR_NOT_FOUND == rc) { + /* just means we created a tracker */ + rc = PMIX_SUCCESS; + } else if (PMIX_ERR_NOT_AVAILABLE == rc) { + /* means they requested "immediate" */ + rc = PMIX_ERR_NOT_FOUND; } - /* we cannot do anything further, so just track this request - * for now */ - rc = create_local_tracker(nspace, rank, cd->info, cd->ninfo, - cbfunc, cbdata, &lcd, &req); - if (PMIX_ERR_NOMEM == rc) { - return rc; - } - pmix_output_verbose(2, pmix_server_globals.get_output, - "%s:%d TRACKER CREATED - WAITING", - pmix_globals.myid.nspace, - pmix_globals.myid.rank); - /* if they specified a timeout, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; - } - /* the peer object has been added to the new lcd tracker, - * so return success here */ - return PMIX_SUCCESS; + return rc; } - /* if everyone has registered, see if we already have this data */ - rc = _satisfy_request(nptr, rank, cd, cbfunc, cbdata, &local); - if( PMIX_SUCCESS == rc ){ + /* everyone has been registered, so we know who our local procs + * are - see if this target is one of them. Note that we cannot reach + * this point if rank = WILDCARD */ + if (0 < nptr->nlocalprocs) { + /* if all the procs are local, then this must be a local proc */ + if (nptr->nprocs == nptr->nlocalprocs) { + local = true; + } else { + /* see if this proc is one of our local ones */ + PMIX_LIST_FOREACH(iptr, &nptr->ranks, pmix_rank_info_t) { + if (rank == iptr->pname.rank) { + if (0 > iptr->peerid) { + /* this rank has not connected yet, so this request needs to be held */ + rc = defer_response(nspace, rank, cd, localonly, cbfunc, cbdata, &tv, &lcd); + if (PMIX_ERR_NOT_FOUND == rc) { + /* just means we created a tracker */ + rc = PMIX_SUCCESS; + } else if (PMIX_ERR_NOT_AVAILABLE == rc) { + /* means they requested "immediate" */ + rc = PMIX_ERR_NOT_FOUND; + } + return rc; + } + local = true; + break; + } + } + if (NULL == pmix_pointer_array_get_item(&pmix_server_globals.clients, iptr->peerid)) { + /* this must be a remote rank */ + local = false; + } + } + } else { + local = false; + } + + /* if the proc is local, then we assume that the host/server maintains + * updated info - there is no need to ask the host to refresh a cache */ + if (local && refresh_cache) { + return PMIX_OPERATION_SUCCEEDED; + } else if (refresh_cache) { + if (NULL != key) { + free(key); + key = NULL; + } + goto request; + } + + /* the target nspace is known - if they asked us to wait for a specific + * key to be available, check if it is present. NOTE: key is only + * NULL if the request came from an older version */ + if (NULL != key) { + PMIX_LOAD_PROCID(&proc, nspace, rank); + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.proc = &proc; + if (scope_given) { + cb.scope = scope; + } else if (local) { + cb.scope = PMIX_LOCAL; + } else { + cb.scope = PMIX_REMOTE; + } + cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; + cb.key = key; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + /* A local client may send a get request concurrently with + * a commit request from another client, but the server may + * have processed the commit request earlyer than the get + * request. In this case, we create a local tracker for + * possibly existing keys that are added with the completed + * commit request. Thus, the get request will be pended in + * tracker and will be deffered. This scenario is possible + * when the non-fence commit-get scheme is used and when + * the peer GDS component is `dstore`. + * Checking the peer storage for local keys to avoid creating + * a local tracker for existing keys. */ + if ((PMIX_SUCCESS != rc) && local) { + PMIX_GDS_FETCH_KV(rc, cd->peer, &cb); + if (PMIX_SUCCESS == rc) { + cbfunc(rc, NULL, 0, cbdata, NULL, NULL); + PMIX_DESTRUCT(&cb); + return rc; + } + } + PMIX_DESTRUCT(&cb); // does not release info or key + if (PMIX_SUCCESS != rc) { + /* if the target proc is local, then we just need to wait */ + if (local) { + /* if they provided a timeout, we need to execute it here + * as we are not going to pass it upwards for the host + * to perform - we default it to 2 sec */ + if (0 == tv.tv_sec) { + tv.tv_sec = 2; + } + rc = defer_response(nspace, rank, cd, localonly, cbfunc, cbdata, &tv, &lcd); + if (PMIX_ERR_NOT_FOUND == rc) { + /* just means we created a tracker */ + rc = PMIX_SUCCESS; + } else if (PMIX_ERR_NOT_AVAILABLE == rc) { + /* means they requested "immediate" */ + rc = PMIX_ERR_NOT_FOUND; + } + return rc; + } + /* otherwise, we need to request the info */ + goto request; + } + /* we did find it, so go ahead and collect the payload */ + } else if (PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 4, 0, 0)) { + PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); + rc = get_job_data(nspace, cd, &pbkt); + if (PMIX_SUCCESS != rc) { + PMIX_DESTRUCT(&pbkt); + return rc; + } + /* pass it back */ + PMIX_UNLOAD_BUFFER(&pbkt, data, sz); + PMIX_DESTRUCT(&pbkt); + cbfunc(rc, data, sz, cbdata, relfn, data); + return rc; + } + + /* check if the nspace of the requestor is different from + * the nspace of the target process */ + diffnspace = !PMIX_CHECK_NSPACE(nptr->nspace, cd->peer->info->pname.nspace); + + if (!scope_given) { + if (PMIX_RANK_UNDEF == rank || diffnspace) { + scope = PMIX_GLOBAL; + } else if (local) { + scope = PMIX_LOCAL; + } else { + scope = PMIX_REMOTE; + } + } + + /* since everyone has registered, see if we already have this data */ + rc = _satisfy_request(nptr, rank, cd, diffnspace, scope, cbfunc, cbdata); + if (PMIX_SUCCESS == rc) { /* return success as the satisfy_request function * calls the cbfunc for us, and it will have * released the cbdata object */ @@ -481,36 +500,19 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_globals.myid.nspace, pmix_globals.myid.rank); - /* If we get here, then we don't have the data at this time. If - * the user doesn't want to look for it, then we are done */ - if (localonly) { - pmix_output_verbose(2, pmix_server_globals.get_output, - "%s:%d CLIENT REQUESTED IMMEDIATE", - pmix_globals.myid.nspace, - pmix_globals.myid.rank); - return PMIX_ERR_NOT_FOUND; - } - - /* Check to see if we already have a pending request for the data - if - * we do, then we can just wait for it to arrive */ - rc = create_local_tracker(nspace, rank, cd->info, cd->ninfo, - cbfunc, cbdata, &lcd, &req); - if (PMIX_ERR_NOMEM == rc || NULL == lcd) { - /* we have a problem */ - return PMIX_ERR_NOMEM; - } - /* if they specified a timeout, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; - } + request: + /* setup to handle this remote request, but don't set any timeout as + * this might create a race condition with our host if they also + * support the timeout */ + rc = defer_response(nspace, rank, cd, localonly, cbfunc, cbdata, NULL, &lcd); if (PMIX_SUCCESS == rc) { /* we are already waiting for the data - nothing more * for us to do as the function added the new request * to the tracker for us */ return PMIX_SUCCESS; + } else if (PMIX_ERR_NOT_AVAILABLE == rc) { + /* means they requested "immediate" */ + return PMIX_ERR_NOT_FOUND; } /* Getting here means that we didn't already have a request for @@ -526,6 +528,19 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * resource manager server to please get the info for us from * whomever is hosting the target process */ if (NULL != pmix_host_server.direct_modex) { + if (NULL != key) { + sz = cd->ninfo; + PMIX_INFO_CREATE(info, sz+1); + for (n=0; n < sz; n++) { + PMIX_INFO_XFER(&info[n], &cd->info[n]); + } + PMIX_INFO_LOAD(&info[sz], PMIX_REQUIRED_KEY, key, PMIX_STRING); + if (NULL != cd->info) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + } + cd->info = info; + cd->ninfo = sz + 1; + } rc = pmix_host_server.direct_modex(&lcd->proc, cd->info, cd->ninfo, dmdx_cbfunc, lcd); if (PMIX_SUCCESS != rc) { /* may have a function entry but not support the request */ @@ -556,6 +571,7 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, pmix_dmdx_local_t *lcd, *cd; pmix_dmdx_request_t *req; pmix_status_t rc; + size_t n; /* define default */ *ld = NULL; @@ -565,8 +581,7 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, * from this namespace/rank */ lcd = NULL; PMIX_LIST_FOREACH(cd, &pmix_server_globals.local_reqs, pmix_dmdx_local_t) { - if (0 != strncmp(nspace, cd->proc.nspace, PMIX_MAX_NSLEN) || - rank != cd->proc.rank ) { + if (!PMIX_CHECK_NSPACE(nspace, cd->proc.nspace) || rank != cd->proc.rank ) { continue; } lcd = cd; @@ -576,6 +591,7 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, /* we already have a request, so just track that someone * else wants data from the same target */ rc = PMIX_SUCCESS; // indicates we found an existing request + PMIX_RETAIN(lcd); goto complete; } /* we do not have an existing request, so let's create @@ -584,15 +600,19 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, if (NULL == lcd){ return PMIX_ERR_NOMEM; } - pmix_strncpy(lcd->proc.nspace, nspace, PMIX_MAX_NSLEN); - lcd->proc.rank = rank; - lcd->info = info; - lcd->ninfo = ninfo; + PMIX_LOAD_PROCID(&lcd->proc, nspace, rank); + if (0 < ninfo) { + lcd->ninfo = ninfo; + PMIX_INFO_CREATE(lcd->info, lcd->ninfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&lcd->info[n], &info[n]); + } + } pmix_list_append(&pmix_server_globals.local_reqs, &lcd->super); rc = PMIX_ERR_NOT_FOUND; // indicates that we created a new request tracker complete: - /* track this specific requestor so we return the + /* track this specific requester so we return the * data to them */ req = PMIX_NEW(pmix_dmdx_request_t); if (NULL == req) { @@ -602,8 +622,14 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, PMIX_RETAIN(lcd); req->lcd = lcd; req->cbfunc = cbfunc; - req->cbdata = cbdata; pmix_list_append(&lcd->loc_reqs, &req->super); + /* if provided, the cbdata is always a pmix_server_caddy_t. Since + * it will be released by every req when it completes, we have to + * up the refcount on it to avoid multiple free's of its contents */ + if (NULL != cbdata && 1 < pmix_list_get_size(&lcd->loc_reqs)) { + PMIX_RETAIN(cbdata); + } + req->cbdata = cbdata; *ld = lcd; *rq = req; return rc; @@ -654,134 +680,162 @@ void pmix_pending_nspace_requests(pmix_namespace_t *nptr) } } +static pmix_status_t get_job_data(char *nspace, + pmix_server_caddy_t *cd, + pmix_buffer_t *pbkt) +{ + pmix_status_t rc; + pmix_buffer_t pkt; + pmix_proc_t proc; + pmix_cb_t cb; + pmix_byte_object_t bo; + + PMIX_LOAD_PROCID(&proc, nspace, PMIX_RANK_WILDCARD); + PMIX_CONSTRUCT(&cb, pmix_cb_t); + /* this data is requested by a local client, so give the gds the option + * of returning a copy of the data, or a pointer to + * local storage */ + cb.proc = &proc; + cb.scope = PMIX_INTERNAL; + cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + cb.info = NULL; + cb.ninfo = 0; + if (PMIX_SUCCESS == rc) { + PMIX_CONSTRUCT(&pkt, pmix_buffer_t); + /* assemble the provided data into a byte object */ + PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&pkt); + PMIX_DESTRUCT(&pbkt); + PMIX_DESTRUCT(&cb); + return rc; + } + if (PMIX_PEER_IS_V1(cd->peer)) { + /* if the client is using v1, then it expects the + * data returned to it as the rank followed by abyte object containing + * a buffer - so we have to do a little gyration */ + pmix_buffer_t xfer; + PMIX_CONSTRUCT(&xfer, pmix_buffer_t); + PMIX_BFROPS_PACK(rc, cd->peer, &xfer, &pkt, 1, PMIX_BUFFER); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&pkt); + PMIX_DESTRUCT(&xfer); + PMIX_DESTRUCT(&cb); + return rc; + } + PMIX_UNLOAD_BUFFER(&xfer, bo.bytes, bo.size); + PMIX_DESTRUCT(&xfer); + } else { + PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); + } + PMIX_DESTRUCT(&pkt); + /* pack it for transmission */ + PMIX_BFROPS_PACK(rc, cd->peer, pbkt, &bo, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&cb); + return rc; + } + } + PMIX_DESTRUCT(&cb); + + return PMIX_SUCCESS; +} + static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, pmix_server_caddy_t *cd, - pmix_modex_cbfunc_t cbfunc, - void *cbdata, bool *local) + bool diffnspace, pmix_scope_t scope, + pmix_modex_cbfunc_t cbfunc, void *cbdata) { pmix_status_t rc; bool found = false; pmix_buffer_t pbkt, pkt; - pmix_rank_info_t *iptr; pmix_proc_t proc; pmix_cb_t cb; - pmix_peer_t *peer = NULL; pmix_byte_object_t bo; char *data = NULL; size_t sz = 0; - pmix_scope_t scope = PMIX_SCOPE_UNDEF; - bool diffnspace = false; pmix_output_verbose(2, pmix_server_globals.get_output, - "%s:%d SATISFY REQUEST CALLED", + "%s:%d SATISFY REQUEST CALLED FOR %s:%d", pmix_globals.myid.nspace, - pmix_globals.myid.rank); + pmix_globals.myid.rank, + nptr->nspace, rank); - /* check to see if this data already has been - * obtained as a result of a prior direct modex request from - * a remote peer, or due to data from a local client - * having been committed */ PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); PMIX_LOAD_NSPACE(proc.nspace, nptr->nspace); - if (!PMIX_CHECK_NSPACE(nptr->nspace, cd->peer->info->pname.nspace)) { - diffnspace = true; - } - - /* if rank is PMIX_RANK_UNDEF or is from a different nspace, - * then it was stored in our GDS */ - if (PMIX_RANK_UNDEF == rank || diffnspace) { - scope = PMIX_GLOBAL; // we have to search everywhere - peer = pmix_globals.mypeer; - } else if (0 < nptr->nlocalprocs) { - /* if we have local clients of this nspace, then we use - * the corresponding GDS to retrieve the data. Otherwise, - * the data will have been stored under our GDS */ - if (NULL != local) { - *local = true; - } - if (PMIX_RANK_WILDCARD != rank) { - peer = NULL; - /* see if the requested rank is local */ - PMIX_LIST_FOREACH(iptr, &nptr->ranks, pmix_rank_info_t) { - if (rank == iptr->pname.rank) { - scope = PMIX_LOCAL; - if (0 <= iptr->peerid) { - peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, iptr->peerid); - } - if (NULL == peer) { - /* this rank has not connected yet, so this request needs to be held */ - return PMIX_ERR_NOT_FOUND; - } - break; - } - } - if (NULL == peer) { - /* this must be a remote rank */ - if (NULL != local) { - *local = false; - } - scope = PMIX_REMOTE; - peer = pmix_globals.mypeer; - } - } - } else { - if (NULL != local) { - *local = false; - } - peer = pmix_globals.mypeer; - scope = PMIX_REMOTE; - } - - /* if they are asking about a rank from an nspace different - * from their own, or they gave a rank of "wildcard", then - * include a copy of the job-level info */ + /* if the rank is WILDCARD or the target is in an nspace different + * from the requester, include a copy of the job-level data */ if (PMIX_RANK_WILDCARD == rank || diffnspace) { - proc.rank = PMIX_RANK_WILDCARD; - PMIX_CONSTRUCT(&cb, pmix_cb_t); - /* this data is requested by a local client, so give the gds the option - * of returning a copy of the data, or a pointer to - * local storage */ - cb.proc = &proc; - cb.scope = PMIX_INTERNAL; - cb.copy = false; - cb.info = cd->info; - cb.ninfo = cd->ninfo; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - cb.info = NULL; - cb.ninfo = 0; - if (PMIX_SUCCESS == rc) { - PMIX_CONSTRUCT(&pkt, pmix_buffer_t); - /* assemble the provided data into a byte object */ + rc = get_job_data(nptr->nspace, cd, &pbkt); + if (PMIX_SUCCESS != rc) { + PMIX_DESTRUCT(&pbkt); + return rc; + } + } + + /* retrieve the data for the specific rank they are asking about */ + proc.rank = rank; + PMIX_CONSTRUCT(&cb, pmix_cb_t); + /* this is a local request, so give the gds the option + * of returning a copy of the data, or a pointer to + * local storage */ + cb.proc = &proc; + cb.scope = scope; + cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + cb.info = NULL; + cb.ninfo = 0; + if (PMIX_SUCCESS == rc) { + found = true; + PMIX_CONSTRUCT(&pkt, pmix_buffer_t); + /* assemble the provided data into a byte object */ + if (PMIX_RANK_UNDEF == rank || diffnspace) { PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); - if (rc != PMIX_SUCCESS) { + } else { + PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd); + } + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&pkt); + PMIX_DESTRUCT(&pbkt); + PMIX_DESTRUCT(&cb); + return rc; + } + if (PMIX_PEER_IS_V1(cd->peer)) { + /* if the client is using v1, then it expects the + * data returned to it in a different order than v2 + * - so we have to do a little gyration */ + /* pack the rank */ + PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &rank, 1, PMIX_PROC_RANK); + if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&pkt); PMIX_DESTRUCT(&pbkt); PMIX_DESTRUCT(&cb); return rc; } - if (PMIX_PEER_IS_V1(cd->peer)) { - /* if the client is using v1, then it expects the - * data returned to it as the rank followed by abyte object containing - * a buffer - so we have to do a little gyration */ - pmix_buffer_t xfer; - PMIX_CONSTRUCT(&xfer, pmix_buffer_t); - PMIX_BFROPS_PACK(rc, cd->peer, &xfer, &pkt, 1, PMIX_BUFFER); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pkt); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&xfer); - PMIX_DESTRUCT(&cb); - return rc; - } - PMIX_UNLOAD_BUFFER(&xfer, bo.bytes, bo.size); - PMIX_DESTRUCT(&xfer); - } else { - PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); + /* now pack the data itself as a buffer */ + PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &pkt, 1, PMIX_BUFFER); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&pkt); + PMIX_DESTRUCT(&pbkt); + PMIX_DESTRUCT(&cb); + return rc; } PMIX_DESTRUCT(&pkt); + } else { + PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); + PMIX_DESTRUCT(&pkt); /* pack it for transmission */ PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); if (PMIX_SUCCESS != rc) { @@ -791,91 +845,8 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, return rc; } } - PMIX_DESTRUCT(&cb); - if (rank == PMIX_RANK_WILDCARD) { - found = true; - } - } - - /* retrieve the data for the specific rank they are asking about */ - if (PMIX_RANK_WILDCARD != rank) { - if (!PMIX_PEER_IS_SERVER(peer) && 0 == peer->commit_cnt) { - /* this condition works only for local requests, server does - * count commits for local ranks, and check this count when - * local request. - * if that request performs for remote rank on the remote - * node (by direct modex) so `peer->commit_cnt` should be ignored, - * it is can not be counted for the remote side and this condition - * does not matter for remote case */ - return PMIX_ERR_NOT_FOUND; - } - proc.rank = rank; - PMIX_CONSTRUCT(&cb, pmix_cb_t); - /* this is a local request, so give the gds the option - * of returning a copy of the data, or a pointer to - * local storage */ - cb.proc = &proc; - cb.scope = scope; - cb.copy = false; - cb.info = cd->info; - cb.ninfo = cd->ninfo; - PMIX_GDS_FETCH_KV(rc, peer, &cb); - cb.info = NULL; - cb.ninfo = 0; - if (PMIX_SUCCESS == rc) { - found = true; - PMIX_CONSTRUCT(&pkt, pmix_buffer_t); - /* assemble the provided data into a byte object */ - if (PMIX_RANK_UNDEF == rank || diffnspace) { - PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); - } else { - PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd); - } - if (rc != PMIX_SUCCESS) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pkt); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&cb); - return rc; - } - if (PMIX_PEER_IS_V1(cd->peer)) { - /* if the client is using v1, then it expects the - * data returned to it in a different order than v2 - * - so we have to do a little gyration */ - /* pack the rank */ - PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &rank, 1, PMIX_PROC_RANK); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pkt); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&cb); - return rc; - } - /* now pack the data itself as a buffer */ - PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &pkt, 1, PMIX_BUFFER); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pkt); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&cb); - return rc; - } - PMIX_DESTRUCT(&pkt); - } else { - PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); - PMIX_DESTRUCT(&pkt); - /* pack it for transmission */ - PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&pbkt); - PMIX_DESTRUCT(&cb); - return rc; - } - } - } - PMIX_DESTRUCT(&cb); } + PMIX_DESTRUCT(&cb); PMIX_UNLOAD_BUFFER(&pbkt, data, sz); PMIX_DESTRUCT(&pbkt); @@ -894,8 +865,8 @@ pmix_status_t pmix_pending_resolve(pmix_namespace_t *nptr, pmix_rank_t rank, pmix_status_t status, pmix_dmdx_local_t *lcd) { pmix_dmdx_local_t *cd, *ptr; - pmix_dmdx_request_t *req; - pmix_server_caddy_t *scd; + pmix_dmdx_request_t *req, *rnext; + pmix_server_caddy_t scd; /* find corresponding request (if exists) */ if (NULL == lcd) { @@ -932,26 +903,37 @@ pmix_status_t pmix_pending_resolve(pmix_namespace_t *nptr, pmix_rank_t rank, } } else if (NULL != nptr) { /* if we've got the blob - try to satisfy requests */ - /* run through all the requests to this rank */ + /* run through all the requests for this rank */ /* this info is going back to one of our peers, so provide a server * caddy with our peer in it so the data gets packed correctly */ - scd = PMIX_NEW(pmix_server_caddy_t); + PMIX_CONSTRUCT(&scd, pmix_server_caddy_t); PMIX_RETAIN(pmix_globals.mypeer); - scd->peer = pmix_globals.mypeer; + scd.peer = pmix_globals.mypeer; PMIX_LIST_FOREACH(req, &ptr->loc_reqs, pmix_dmdx_request_t) { pmix_status_t rc; - rc = _satisfy_request(nptr, rank, scd, req->cbfunc, req->cbdata, NULL); + bool diffnspace = !PMIX_CHECK_NSPACE(nptr->nspace, req->lcd->proc.nspace); + rc = _satisfy_request(nptr, rank, &scd, diffnspace, PMIX_REMOTE, req->cbfunc, req->cbdata); if( PMIX_SUCCESS != rc ){ /* if we can't satisfy this particular request (missing key?) */ req->cbfunc(rc, NULL, 0, req->cbdata, NULL, NULL); } } - PMIX_RELEASE(scd); + PMIX_DESTRUCT(&scd); } cleanup: /* remove all requests to this rank and cleanup the corresponding structure */ pmix_list_remove_item(&pmix_server_globals.local_reqs, &ptr->super); + /* the dmdx request is linked back to its local request for ease + * of lookup upon return from the server. However, this means that + * the refcount of the local request has been increased by the number + * dmdx requests attached to it. In order to release the local request's + * storage, we first have to drive the refcount down by releasing all + * of the associated dmdx requests */ + PMIX_LIST_FOREACH_SAFE(req, rnext, &ptr->loc_reqs, pmix_dmdx_request_t) { + pmix_list_remove_item(&ptr->loc_reqs, &req->super); + PMIX_RELEASE(req); // decrements refcount of ptr + } PMIX_RELEASE(ptr); return PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 31de2c365d..6ef870a956 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -1,13 +1,13 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science + * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. - * Copyright (c) 2016-2017 Mellanox Technologies, Inc. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,13 +15,12 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/pmix_socket_errno.h" -#include +#include "include/pmix_server.h" #include "src/include/pmix_globals.h" #ifdef HAVE_STRING_H @@ -55,15 +54,32 @@ #include "src/class/pmix_list.h" #include "src/mca/bfrops/bfrops.h" #include "src/mca/plog/plog.h" +#include "src/mca/pnet/pnet.h" #include "src/mca/psensor/psensor.h" #include "src/mca/ptl/base/base.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" #include "src/util/pmix_environ.h" +#include "src/mca/gds/base/base.h" #include "pmix_server_ops.h" +/* The rank_blob_t type to collect processes blobs, + * this list afterward will form a node modex blob. */ +typedef struct { + pmix_list_item_t super; + pmix_buffer_t *buf; +} rank_blob_t; + +static void bufdes(rank_blob_t *p) +{ + PMIX_RELEASE(p); +} +static PMIX_CLASS_INSTANCE(rank_blob_t, + pmix_list_item_t, + NULL, bufdes); + pmix_server_module_t pmix_host_server = {0}; pmix_status_t pmix_server_abort(pmix_peer_t *peer, pmix_buffer_t *buf, @@ -159,7 +175,7 @@ pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf) pmix_strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); proc.rank = info->pname.rank; - pmix_output_verbose(2, pmix_server_globals.base_output, + pmix_output_verbose(2, pmix_server_globals.fence_output, "%s:%d EXECUTE COMMIT FOR %s:%d", pmix_globals.myid.nspace, pmix_globals.myid.rank, @@ -403,19 +419,17 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, trk->id = strdup(id); } - if (NULL != procs) { - /* copy the procs */ - PMIX_PROC_CREATE(trk->pcs, nprocs); - if (NULL == trk->pcs) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - PMIX_RELEASE(trk); - return NULL; - } - memcpy(trk->pcs, procs, nprocs * sizeof(pmix_proc_t)); - trk->npcs = nprocs; + /* copy the procs */ + PMIX_PROC_CREATE(trk->pcs, nprocs); + if (NULL == trk->pcs) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_RELEASE(trk); + return NULL; } + memcpy(trk->pcs, procs, nprocs * sizeof(pmix_proc_t)); + trk->npcs = nprocs; trk->type = type; - trk->local = false; + trk->local = true; trk->nlocal = 0; all_def = true; @@ -481,8 +495,10 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, pmix_output_verbose(5, pmix_server_globals.base_output, "new_tracker: unknown nspace %s", procs[i].nspace); + trk->local = false; continue; } + /* check and add uniq ns into trk nslist */ found = false; PMIX_LIST_FOREACH(nm, &trk->nslist, pmix_nspace_caddy_t) { @@ -571,6 +587,262 @@ static void fence_timeout(int sd, short args, void *cbdata) PMIX_RELEASE(cd); } +static pmix_status_t _collect_data(pmix_server_trkr_t *trk, + pmix_buffer_t *buf) +{ + pmix_buffer_t bucket, *pbkt = NULL; + pmix_cb_t cb; + pmix_kval_t *kv; + pmix_byte_object_t bo; + pmix_server_caddy_t *scd; + pmix_proc_t pcs; + pmix_status_t rc = PMIX_SUCCESS; + pmix_rank_t rel_rank; + pmix_nspace_caddy_t *nm; + bool found; + pmix_list_t rank_blobs; + rank_blob_t *blob; + uint32_t kmap_size; + /* key names map, the position of the key name + * in the array determines the unique key index */ + char **kmap = NULL; + int i; + pmix_gds_modex_blob_info_t blob_info_byte = 0; + pmix_gds_modex_key_fmt_t kmap_type = PMIX_MODEX_KEY_INVALID; + + PMIX_CONSTRUCT(&bucket, pmix_buffer_t); + + if (PMIX_COLLECT_YES == trk->collect_type) { + pmix_output_verbose(2, pmix_server_globals.fence_output, + "fence - assembling data"); + + /* Evaluate key names sizes and their count to select + * a format to store key names: + * - keymap: use key-map in blob header for key-name resolve + * from idx: key names stored as indexes (avoid key duplication) + * - regular: key-names stored as is */ + if (PMIX_MODEX_KEY_INVALID == kmap_type) { + size_t key_fmt_size[PMIX_MODEX_KEY_MAX] = {0}; + pmix_value_array_t *key_count_array = PMIX_NEW(pmix_value_array_t); + uint32_t *key_count = NULL; + + pmix_value_array_init(key_count_array, sizeof(uint32_t)); + + PMIX_LIST_FOREACH(scd, &trk->local_cbs, pmix_server_caddy_t) { + pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace, + PMIX_MAX_NSLEN); + pcs.rank = scd->peer->info->pname.rank; + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.proc = &pcs; + cb.scope = PMIX_REMOTE; + cb.copy = true; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS == rc) { + int key_idx; + PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { + rc = pmix_argv_append_unique_idx(&key_idx, &kmap, + kv->key); + if (pmix_value_array_get_size(key_count_array) < + (size_t)(key_idx+1)) { + size_t new_size; + size_t old_size = + pmix_value_array_get_size(key_count_array); + + pmix_value_array_set_size(key_count_array, + key_idx+1); + new_size = + pmix_value_array_get_size(key_count_array); + key_count = + PMIX_VALUE_ARRAY_GET_BASE(key_count_array, + uint32_t); + memset(key_count + old_size, 0, sizeof(uint32_t) * + (new_size - old_size)); + } + key_count = PMIX_VALUE_ARRAY_GET_BASE(key_count_array, + uint32_t); + key_count[key_idx]++; + } + } + } + + key_count = PMIX_VALUE_ARRAY_GET_BASE(key_count_array, uint32_t); + + for (i = 0; i < pmix_argv_count(kmap); i++) { + pmix_buffer_t tmp; + size_t kname_size; + size_t kidx_size; + + PMIX_CONSTRUCT(&tmp, pmix_buffer_t); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, &kmap[i], 1, + PMIX_STRING); + kname_size = tmp.bytes_used; + PMIX_DESTRUCT(&tmp); + PMIX_CONSTRUCT(&tmp, pmix_buffer_t); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, &i, 1, + PMIX_UINT32); + kidx_size = tmp.bytes_used; + PMIX_DESTRUCT(&tmp); + + /* calculate the key names sizes */ + key_fmt_size[PMIX_MODEX_KEY_NATIVE_FMT] = + kname_size * key_count[i]; + key_fmt_size[PMIX_MODEX_KEY_KEYMAP_FMT] = + kname_size + key_count[i]*kidx_size; + } + PMIX_RELEASE(key_count_array); + + /* select the most efficient key-name pack format */ + kmap_type = key_fmt_size[PMIX_MODEX_KEY_NATIVE_FMT] > + key_fmt_size[PMIX_MODEX_KEY_KEYMAP_FMT] ? + PMIX_MODEX_KEY_KEYMAP_FMT : PMIX_MODEX_KEY_NATIVE_FMT; + pmix_output_verbose(5, pmix_server_globals.base_output, + "key packing type %s", + kmap_type == PMIX_MODEX_KEY_KEYMAP_FMT ? + "kmap" : "native"); + } + PMIX_CONSTRUCT(&rank_blobs, pmix_list_t); + PMIX_LIST_FOREACH(scd, &trk->local_cbs, pmix_server_caddy_t) { + /* get any remote contribution - note that there + * may not be a contribution */ + pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace, + PMIX_MAX_NSLEN); + pcs.rank = scd->peer->info->pname.rank; + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.proc = &pcs; + cb.scope = PMIX_REMOTE; + cb.copy = true; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS == rc) { + /* calculate the throughout rank */ + rel_rank = 0; + found = false; + if (pmix_list_get_size(&trk->nslist) == 1) { + found = true; + } else { + PMIX_LIST_FOREACH(nm, &trk->nslist, pmix_nspace_caddy_t) { + if (0 == strcmp(nm->ns->nspace, pcs.nspace)) { + found = true; + break; + } + rel_rank += nm->ns->nprocs; + } + } + if (false == found) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&cb); + PMIX_DESTRUCT(&rank_blobs); + goto cleanup; + } + rel_rank += pcs.rank; + + /* pack the relative rank */ + pbkt = PMIX_NEW(pmix_buffer_t); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, pbkt, + &rel_rank, 1, PMIX_PROC_RANK); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&cb); + PMIX_DESTRUCT(&rank_blobs); + PMIX_RELEASE(pbkt); + goto cleanup; + } + /* pack the returned kval's */ + PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { + rc = pmix_gds_base_modex_pack_kval(kmap_type, pbkt, &kmap, + kv); + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&cb); + PMIX_DESTRUCT(&rank_blobs); + PMIX_RELEASE(pbkt); + goto cleanup; + } + } + + /* add part of the process modex to the list */ + blob = PMIX_NEW(rank_blob_t); + blob->buf = pbkt; + pmix_list_append(&rank_blobs, &blob->super); + pbkt = NULL; + } + PMIX_DESTRUCT(&cb); + } + /* mark the collection type so we can check on the + * receiving end that all participants did the same. Note + * that if the receiving end thinks that the collect flag + * is false, then store_modex will not be called on that + * node and this information (and the flag) will be ignored, + * meaning that no error is generated! */ + blob_info_byte |= PMIX_GDS_COLLECT_BIT; + if (PMIX_MODEX_KEY_KEYMAP_FMT == kmap_type) { + blob_info_byte |= PMIX_GDS_KEYMAP_BIT; + } + /* pack the modex blob info byte */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, + &blob_info_byte, 1, PMIX_BYTE); + + if (PMIX_MODEX_KEY_KEYMAP_FMT == kmap_type) { + /* pack node part of modex to `bucket` */ + /* pack the key names map for the remote server can + * use it to match key names by index */ + kmap_size = pmix_argv_count(kmap); + if (0 < kmap_size) { + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, + &kmap_size, 1, PMIX_UINT32); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, + kmap, kmap_size, PMIX_STRING); + } + } + /* pack the collected blobs of processes */ + PMIX_LIST_FOREACH(blob, &rank_blobs, rank_blob_t) { + /* extract the blob */ + PMIX_UNLOAD_BUFFER(blob->buf, bo.bytes, bo.size); + /* pack the returned blob */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, + &bo, 1, PMIX_BYTE_OBJECT); + PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + } + PMIX_DESTRUCT(&rank_blobs); + } else { + /* mark the collection type so we can check on the + * receiving end that all participants did the same. + * Don't do it for non-debug mode so we don't unnecessarily + * send the collection bucket. The mdxcbfunc in the + * server only calls store_modex if the local collect + * flag is set to true. In debug mode, this check will + * cause the store_modex function to see that this node + * thought the collect flag was not set, and therefore + * generate an error */ +#if PMIX_ENABLE_DEBUG + /* pack the modex blob info byte */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, + &blob_info_byte, 1, PMIX_BYTE); +#endif + } + if (!PMIX_BUFFER_IS_EMPTY(&bucket)) { + /* because the remote servers have to unpack things + * in chunks, we have to pack the bucket as a single + * byte object to allow remote unpack */ + PMIX_UNLOAD_BUFFER(&bucket, bo.bytes, bo.size); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, buf, + &bo, 1, PMIX_BYTE_OBJECT); + PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + } + + cleanup: + PMIX_DESTRUCT(&bucket); + pmix_argv_free(kmap); + return rc; +} + pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, pmix_buffer_t *buf, pmix_modex_cbfunc_t modexcbfunc, @@ -579,28 +851,22 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, int32_t cnt; pmix_status_t rc; size_t nprocs; - pmix_proc_t *procs=NULL, pcs; + pmix_proc_t *procs=NULL, *newprocs; bool collect_data = false; pmix_server_trkr_t *trk; char *data = NULL; size_t sz = 0; - pmix_buffer_t bucket, pbkt; - pmix_server_caddy_t *scd; - pmix_cb_t cb; - pmix_kval_t *kv; - pmix_byte_object_t bo; + pmix_buffer_t bucket; pmix_info_t *info = NULL; - size_t ninfo=0, n; + size_t ninfo=0, n, nmbrs, idx; struct timeval tv = {0, 0}; + pmix_list_t expand; + pmix_group_caddy_t *gcd; + pmix_group_t *grp; pmix_output_verbose(2, pmix_server_globals.fence_output, "recvd FENCE"); - if (NULL == pmix_host_server.fence_nb) { - PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); - return PMIX_ERR_NOT_SUPPORTED; - } - /* unpack the number of procs */ cnt = 1; PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &nprocs, &cnt, PMIX_SIZE); @@ -628,6 +894,60 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, goto cleanup; } + /* cycle thru the procs and check to see if any reference + * a PMIx group */ + nmbrs = nprocs; + PMIX_CONSTRUCT(&expand, pmix_list_t); + /* use groups as the outer-most loop as there will + * usually not be any */ + PMIX_LIST_FOREACH(grp, &pmix_server_globals.groups, pmix_group_t) { + for (n=0; n < nprocs; n++) { + if (PMIX_CHECK_NSPACE(procs[n].nspace, grp->grpid)) { + /* we need to replace this proc with grp members */ + gcd = PMIX_NEW(pmix_group_caddy_t); + gcd->grp = grp; + gcd->idx = n; + gcd->rank = procs[n].rank; + pmix_list_append(&expand, &gcd->super); + /* see how many need to come across */ + if (PMIX_RANK_WILDCARD == procs[n].rank) { + nmbrs += grp->nmbrs - 1; // account for replacing current proc + } + break; + } + } + } + + if (0 < pmix_list_get_size(&expand)) { + PMIX_PROC_CREATE(newprocs, nmbrs); + gcd = (pmix_group_caddy_t*)pmix_list_remove_first(&expand); + n=0; + idx = 0; + while (n < nmbrs) { + if (idx != gcd->idx) { + memcpy(&newprocs[n], &procs[idx], sizeof(pmix_proc_t)); + ++n; + } else { + /* if we are bringing over just one, then simply replace */ + if (PMIX_RANK_WILDCARD != gcd->rank) { + memcpy(&newprocs[n], &gcd->grp->members[gcd->rank], sizeof(pmix_proc_t)); + ++n; + } else { + /* take them all */ + memcpy(&newprocs[n], gcd->grp->members, gcd->grp->nmbrs * sizeof(pmix_proc_t)); + n += gcd->grp->nmbrs; + } + PMIX_RELEASE(gcd); + gcd = (pmix_group_caddy_t*)pmix_list_remove_first(&expand); + } + ++idx; + } + PMIX_PROC_FREE(procs, nprocs); + procs = newprocs; + nprocs = nmbrs; + } + PMIX_LIST_DESTRUCT(&expand); + /* unpack the number of provided info structs */ cnt = 1; PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &ninfo, &cnt, PMIX_SIZE); @@ -699,6 +1019,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, break; } } + /* we only save the info structs from the first caller * who provides them - it is a user error to provide * different values from different participants */ @@ -734,7 +1055,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, "fence LOCALLY complete"); /* if this is a purely local fence (i.e., all participants are local), * then it is done and we notify accordingly */ - if (trk->local) { + if (pmix_server_globals.fence_localonly_opt && trk->local) { /* the modexcbfunc thread-shifts the call prior to processing, * so it is okay to call it directly from here. The switchyard * will acknowledge successful acceptance of the fence request, @@ -771,71 +1092,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, * or global distribution */ PMIX_CONSTRUCT(&bucket, pmix_buffer_t); - - /* mark the collection type so we can check on the - * receiving end that all participants did the same */ - unsigned char tmp = (unsigned char)trk->collect_type; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, - &tmp, 1, PMIX_BYTE); - - if (PMIX_COLLECT_YES == trk->collect_type) { - pmix_output_verbose(2, pmix_server_globals.fence_output, - "fence - assembling data"); - PMIX_LIST_FOREACH(scd, &trk->local_cbs, pmix_server_caddy_t) { - /* get any remote contribution - note that there - * may not be a contribution */ - pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace, PMIX_MAX_NSLEN); - pcs.rank = scd->peer->info->pname.rank; - PMIX_CONSTRUCT(&cb, pmix_cb_t); - cb.proc = &pcs; - cb.scope = PMIX_REMOTE; - cb.copy = true; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS == rc) { - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - /* pack the proc so we know the source */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, - &pcs, 1, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); - goto cleanup; - } - /* pack the returned kval's */ - PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, kv, 1, PMIX_KVAL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); - goto cleanup; - } - } - /* extract the blob */ - PMIX_UNLOAD_BUFFER(&pbkt, bo.bytes, bo.size); - PMIX_DESTRUCT(&pbkt); - /* pack the returned blob */ - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, - &bo, 1, PMIX_BYTE_OBJECT); - PMIX_BYTE_OBJECT_DESTRUCT(&bo); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); - goto cleanup; - } - } - PMIX_DESTRUCT(&cb); - } - } - /* because the remote servers have to unpack things - * in chunks, we have to pack the bucket as a single - * byte object to allow remote unpack */ - PMIX_UNLOAD_BUFFER(&bucket, bo.bytes, bo.size); - PMIX_DESTRUCT(&bucket); - PMIX_CONSTRUCT(&bucket, pmix_buffer_t); - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, - &bo, 1, PMIX_BYTE_OBJECT); - PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != (rc = _collect_data(trk, &bucket))) { PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&bucket); /* clear the caddy from this tracker so it can be @@ -1219,7 +1476,7 @@ static void spcbfunc(pmix_status_t status, PMIX_PROC_CREATE(req->procs, req->nprocs); PMIX_LOAD_PROCID(&req->procs[0], nspace, PMIX_RANK_WILDCARD); req->channels = cd->channels; - req->refid = pmix_pointer_array_add(&pmix_globals.iof_requests, req); + req->local_id = pmix_pointer_array_add(&pmix_globals.iof_requests, req); /* process any cached IO */ PMIX_LIST_FOREACH_SAFE(iof, ionext, &pmix_server_globals.iof, pmix_iof_cache_t) { /* if the channels don't match, then ignore it */ @@ -1260,6 +1517,28 @@ static void spcbfunc(pmix_status_t status, PMIX_RELEASE(msg); break; } + /* provide their local id */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, &req->remote_id, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + /* provide any cached info */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, &iof->ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + if (0 < iof->ninfo) { + PMIX_BFROPS_PACK(rc, req->requestor, msg, iof->info, iof->ninfo, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + } /* pack the data */ PMIX_BFROPS_PACK(rc, req->requestor, msg, iof->bo, 1, PMIX_BYTE_OBJECT); if (PMIX_SUCCESS != rc) { @@ -1417,8 +1696,7 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, } } /* call the local server */ - pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); - proc.rank = peer->info->pname.rank; + PMIX_LOAD_PROCID(&proc, peer->info->pname.nspace, peer->info->pname.rank); rc = pmix_host_server.spawn(&proc, cd->info, cd->ninfo, cd->apps, cd->napps, spcbfunc, cd); cleanup: @@ -2056,21 +2334,11 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, for (n=0; n < ncodes; n++) { found = false; PMIX_LIST_FOREACH(reginfo, &pmix_server_globals.events, pmix_regevents_info_t) { - if (NULL == codes) { - if (PMIX_MAX_ERR_CONSTANT == reginfo->code) { - /* both are default handlers */ - found = true; - break; - } else { - continue; - } - } else { - if (PMIX_MAX_ERR_CONSTANT == reginfo->code) { - continue; - } else if (codes[n] == reginfo->code) { - found = true; - break; - } + if (PMIX_MAX_ERR_CONSTANT == reginfo->code) { + continue; + } else if (codes[n] == reginfo->code) { + found = true; + break; } } if (found) { @@ -2096,11 +2364,7 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, rc = PMIX_ERR_NOMEM; goto cleanup; } - if (NULL == codes) { - reginfo->code = PMIX_MAX_ERR_CONSTANT; - } else { - reginfo->code = codes[n]; - } + reginfo->code = codes[n]; pmix_list_append(&pmix_server_globals.events, ®info->super); prev = PMIX_NEW(pmix_peer_events_info_t); if (NULL == prev) { @@ -2393,7 +2657,8 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, } /* add an info object to mark that we recvd this internally */ - PMIX_INFO_LOAD(&cd->info[ninfo], PMIX_SERVER_INTERNAL_NOTIFY, NULL, PMIX_BOOL); + PMIX_INFO_LOAD(&cd->info[cd->ninfo-1], PMIX_SERVER_INTERNAL_NOTIFY, NULL, PMIX_BOOL); + /* process it */ if (PMIX_SUCCESS != (rc = pmix_server_notify_client_of_event(cd->status, &cd->source, @@ -2402,9 +2667,6 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, intermed_step, cd))) { goto exit; } - if (PMIX_SUCCESS != rc) { - PMIX_RELEASE(cd); - } return rc; exit: @@ -2412,6 +2674,7 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, return rc; } + pmix_status_t pmix_server_query(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_info_cbfunc_t cbfunc, @@ -3279,6 +3542,7 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, pmix_status_t rc; pmix_setup_caddy_t *cd; pmix_iof_req_t *req; + size_t refid; pmix_output_verbose(2, pmix_server_globals.iof_output, "recvd IOF PULL request from client"); @@ -3337,6 +3601,14 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, goto exit; } + /* unpack their local reference id */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &refid, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } + /* add this peer/source/channel combination */ req = PMIX_NEW(pmix_iof_req_t); if (NULL == req) { @@ -3351,8 +3623,9 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, memcpy(req->procs, cd->procs, req->nprocs * sizeof(pmix_proc_t)); } req->channels = cd->channels; - req->refid = pmix_pointer_array_add(&pmix_globals.iof_requests, req); - cd->ncodes = req->refid; + req->remote_id = refid; + req->local_id = pmix_pointer_array_add(&pmix_globals.iof_requests, req); + cd->ncodes = req->local_id; /* ask the host to execute the request */ if (PMIX_SUCCESS != (rc = pmix_host_server.iof_pull(cd->procs, cd->nprocs, @@ -3429,6 +3702,9 @@ pmix_status_t pmix_server_iofdereg(pmix_peer_t *peer, rc = PMIX_ERR_NOT_FOUND; goto exit; } + pmix_pointer_array_set_item(&pmix_globals.iof_requests, refid, NULL); + PMIX_RELEASE(req); + /* tell the server to stop */ if (PMIX_SUCCESS != (rc = pmix_host_server.iof_pull(cd->procs, cd->nprocs, cd->info, cd->ninfo, @@ -3537,7 +3813,10 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, cnt = 1; PMIX_BFROPS_UNPACK(rc, peer, buf, cd->bo, &cnt, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { + /* it is okay for them to not send data */ + PMIX_BYTE_OBJECT_FREE(cd->bo, 1); + } else if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto error; } @@ -3548,20 +3827,24 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, if (PMIX_SUCCESS != (rc = pmix_host_server.push_stdin(&source, cd->procs, cd->nprocs, cd->info, cd->ninfo, cd->bo, stdcbfunc, cd))) { - goto error; + if (PMIX_OPERATION_SUCCEEDED != rc) { + goto error; + } } - return PMIX_SUCCESS; + return rc; error: PMIX_RELEASE(cd); return rc; } + /***** INSTANCE SERVER LIBRARY CLASSES *****/ static void tcon(pmix_server_trkr_t *t) { t->event_active = false; t->host_called = false; + t->local = true; t->id = NULL; memset(t->pname.nspace, 0, PMIX_MAX_NSLEN+1); t->pname.rank = PMIX_RANK_UNDEF; @@ -3580,13 +3863,13 @@ static void tcon(pmix_server_trkr_t *t) t->modexcbfunc = NULL; t->op_cbfunc = NULL; t->hybrid = false; + t->cbdata = NULL; } static void tdes(pmix_server_trkr_t *t) { if (NULL != t->id) { free(t->id); } - PMIX_LIST_DESTRUCT(&t->nslist); PMIX_DESTRUCT_LOCK(&t->lock); if (NULL != t->pcs) { free(t->pcs); @@ -3595,6 +3878,7 @@ static void tdes(pmix_server_trkr_t *t) if (NULL != t->info) { PMIX_INFO_FREE(t->info, t->ninfo); } + PMIX_DESTRUCT(&t->nslist); } PMIX_CLASS_INSTANCE(pmix_server_trkr_t, pmix_list_item_t, @@ -3620,11 +3904,15 @@ static void cddes(pmix_server_caddy_t *cd) if (NULL != cd->peer) { PMIX_RELEASE(cd->peer); } + if (NULL != cd->info) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + } } PMIX_CLASS_INSTANCE(pmix_server_caddy_t, pmix_list_item_t, cdcon, cddes); + static void scadcon(pmix_setup_caddy_t *p) { p->peer = NULL; @@ -3670,47 +3958,6 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_setup_caddy_t, pmix_object_t, scadcon, scaddes); -static void ncon(pmix_notify_caddy_t *p) -{ - PMIX_CONSTRUCT_LOCK(&p->lock); -#if defined(__linux__) && OPAL_HAVE_CLOCK_GETTIME - struct timespec tp; - (void) clock_gettime(CLOCK_MONOTONIC, &tp); - p->ts = tp.tv_sec; -#else - /* Fall back to gettimeofday() if we have nothing else */ - struct timeval tv; - gettimeofday(&tv, NULL); - p->ts = tv.tv_sec; -#endif - p->room = -1; - memset(p->source.nspace, 0, PMIX_MAX_NSLEN+1); - p->source.rank = PMIX_RANK_UNDEF; - p->range = PMIX_RANGE_UNDEF; - p->targets = NULL; - p->ntargets = 0; - p->nleft = SIZE_MAX; - p->affected = NULL; - p->naffected = 0; - p->nondefault = false; - p->info = NULL; - p->ninfo = 0; -} -static void ndes(pmix_notify_caddy_t *p) -{ - PMIX_DESTRUCT_LOCK(&p->lock); - if (NULL != p->info) { - PMIX_INFO_FREE(p->info, p->ninfo); - } - PMIX_PROC_FREE(p->affected, p->naffected); - if (NULL != p->targets) { - free(p->targets); - } -} -PMIX_CLASS_INSTANCE(pmix_notify_caddy_t, - pmix_object_t, - ncon, ndes); - PMIX_CLASS_INSTANCE(pmix_trkr_caddy_t, pmix_object_t, @@ -3822,6 +4069,29 @@ PMIX_CLASS_INSTANCE(pmix_inventory_rollup_t, pmix_object_t, ilcon, ildes); +static void grcon(pmix_group_t *p) +{ + p->grpid = NULL; + p->members = NULL; + p->nmbrs = 0; +} +static void grdes(pmix_group_t *p) +{ + if (NULL != p->grpid) { + free(p->grpid); + } + if (NULL != p->members) { + PMIX_PROC_FREE(p->members, p->nmbrs); + } +} +PMIX_CLASS_INSTANCE(pmix_group_t, + pmix_list_item_t, + grcon, grdes); + +PMIX_CLASS_INSTANCE(pmix_group_caddy_t, + pmix_list_item_t, + NULL, NULL); + static void iocon(pmix_iof_cache_t *p) { p->bo = NULL; diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h index a7f0be96ec..e495e4964c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h @@ -1,11 +1,11 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2020 IBM Corporation. All rights reserved. * Copyright (c) 2016-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -19,12 +19,12 @@ #include #endif -#include +#include "src/include/pmix_config.h" #include "src/include/types.h" -#include +#include "include/pmix_common.h" -#include -#include +#include "src/class/pmix_hotel.h" +#include "include/pmix_server.h" #include "src/threads/threads.h" #include "src/include/pmix_globals.h" #include "src/util/hash.h" @@ -109,7 +109,7 @@ PMIX_CLASS_DECLARATION(pmix_dmdx_remote_t); typedef struct { pmix_list_item_t super; pmix_proc_t proc; // id of proc whose data is being requested - pmix_list_t loc_reqs; // list of pmix_dmdx_request_t elem's keeping track of + pmix_list_t loc_reqs; // list of pmix_dmdx_request_t elem is keeping track of // all local ranks that are interested in this namespace-rank pmix_info_t *info; // array of info structs for this request size_t ninfo; // number of info structs @@ -143,6 +143,22 @@ typedef struct { } pmix_regevents_info_t; PMIX_CLASS_DECLARATION(pmix_regevents_info_t); +typedef struct { + pmix_list_item_t super; + char *grpid; + pmix_proc_t *members; + size_t nmbrs; +} pmix_group_t; +PMIX_CLASS_DECLARATION(pmix_group_t); + +typedef struct { + pmix_list_item_t super; + pmix_group_t *grp; + pmix_rank_t rank; + size_t idx; +} pmix_group_caddy_t; +PMIX_CLASS_DECLARATION(pmix_group_caddy_t); + typedef struct { pmix_list_item_t super; pmix_proc_t source; @@ -161,11 +177,13 @@ typedef struct { pmix_list_t local_reqs; // list of pmix_dmdx_local_t awaiting arrival of data from local neighbours pmix_list_t gdata; // cache of data given to me for passing to all clients pmix_list_t events; // list of pmix_regevents_info_t registered events + pmix_list_t groups; // list of pmix_group_t group memberships pmix_list_t iof; // IO to be forwarded to clients size_t max_iof_cache; // max number of IOF messages to cache bool tool_connections_allowed; char *tmpdir; // temporary directory for this server char *system_tmpdir; // system tmpdir + bool fence_localonly_opt; // local-only fence optimization // verbosity for server get operations int get_output; int get_verbose; @@ -217,133 +235,133 @@ typedef struct { -bool pmix_server_trk_update(pmix_server_trkr_t *trk); +PMIX_EXPORT bool pmix_server_trk_update(pmix_server_trkr_t *trk); -void pmix_pending_nspace_requests(pmix_namespace_t *nptr); -pmix_status_t pmix_pending_resolve(pmix_namespace_t *nptr, pmix_rank_t rank, - pmix_status_t status, pmix_dmdx_local_t *lcd); +PMIX_EXPORT void pmix_pending_nspace_requests(pmix_namespace_t *nptr); +PMIX_EXPORT pmix_status_t pmix_pending_resolve(pmix_namespace_t *nptr, pmix_rank_t rank, + pmix_status_t status, pmix_dmdx_local_t *lcd); -pmix_status_t pmix_server_abort(pmix_peer_t *peer, pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_abort(pmix_peer_t *peer, pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, void *cbdata); -pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf); +PMIX_EXPORT pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf); -pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, - pmix_buffer_t *buf, - pmix_modex_cbfunc_t modexcbfunc, - pmix_op_cbfunc_t opcbfunc); +PMIX_EXPORT pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, + pmix_buffer_t *buf, + pmix_modex_cbfunc_t modexcbfunc, + pmix_op_cbfunc_t opcbfunc); -pmix_status_t pmix_server_get(pmix_buffer_t *buf, - pmix_modex_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_get(pmix_buffer_t *buf, + pmix_modex_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_publish(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_publish(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_lookup(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_lookup_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_lookup(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_lookup_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_unpublish(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_unpublish(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_spawn(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_spawn_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_spawn(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_spawn_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc); +PMIX_EXPORT pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc); -pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc); +PMIX_EXPORT pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc); -pmix_status_t pmix_server_notify_error(pmix_status_t status, - pmix_proc_t procs[], size_t nprocs, - pmix_proc_t error_procs[], size_t error_nprocs, - pmix_info_t info[], size_t ninfo, - pmix_op_cbfunc_t cbfunc, void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_notify_error(pmix_status_t status, + pmix_proc_t procs[], size_t nprocs, + pmix_proc_t error_procs[], size_t error_nprocs, + pmix_info_t info[], size_t ninfo, + pmix_op_cbfunc_t cbfunc, void *cbdata); -pmix_status_t pmix_server_register_events(pmix_peer_t *peer, +PMIX_EXPORT pmix_status_t pmix_server_register_events(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); + +PMIX_EXPORT void pmix_server_deregister_events(pmix_peer_t *peer, + pmix_buffer_t *buf); + +PMIX_EXPORT pmix_status_t pmix_server_query(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_info_cbfunc_t cbfunc, + void *cbdata); + +PMIX_EXPORT pmix_status_t pmix_server_log(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_op_cbfunc_t cbfunc, void *cbdata); -void pmix_server_deregister_events(pmix_peer_t *peer, - pmix_buffer_t *buf); +PMIX_EXPORT pmix_status_t pmix_server_alloc(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_info_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_query(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_info_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_info_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_log(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); - -pmix_status_t pmix_server_alloc(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_info_cbfunc_t cbfunc, - void *cbdata); - -pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_info_cbfunc_t cbfunc, - void *cbdata); - -pmix_status_t pmix_server_monitor(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_info_cbfunc_t cbfunc, - void *cbdata); - -pmix_status_t pmix_server_get_credential(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_credential_cbfunc_t cbfunc, - void *cbdata); - -pmix_status_t pmix_server_validate_credential(pmix_peer_t *peer, +PMIX_EXPORT pmix_status_t pmix_server_monitor(pmix_peer_t *peer, pmix_buffer_t *buf, - pmix_validation_cbfunc_t cbfunc, + pmix_info_cbfunc_t cbfunc, void *cbdata); -pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_get_credential(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_credential_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_validate_credential(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_validation_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_iofdereg(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, - pmix_buffer_t *buf, - pmix_op_cbfunc_t cbfunc, - void *cbdata); -void pmix_server_execute_collective(int sd, short args, void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); -pmix_status_t pmix_server_initialize(void); +PMIX_EXPORT pmix_status_t pmix_server_iofdereg(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); -void pmix_server_message_handler(struct pmix_peer_t *pr, - pmix_ptl_hdr_t *hdr, - pmix_buffer_t *buf, void *cbdata); +PMIX_EXPORT pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); +PMIX_EXPORT void pmix_server_execute_collective(int sd, short args, void *cbdata); -void pmix_server_purge_events(pmix_peer_t *peer, - pmix_proc_t *proc); +PMIX_EXPORT pmix_status_t pmix_server_initialize(void); + +PMIX_EXPORT void pmix_server_message_handler(struct pmix_peer_t *pr, + pmix_ptl_hdr_t *hdr, + pmix_buffer_t *buf, void *cbdata); + +PMIX_EXPORT void pmix_server_purge_events(pmix_peer_t *peer, + pmix_proc_t *proc); PMIX_EXPORT extern pmix_server_module_t pmix_host_server; PMIX_EXPORT extern pmix_server_globals_t pmix_server_globals; diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/threads/Makefile.include index 8e1562dd65..1c47f2b0c1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/Makefile.include @@ -13,7 +13,7 @@ # Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -30,7 +30,7 @@ headers += \ threads/threads.h \ threads/tsd.h \ threads/wait_sync.h \ - threads/thread_usage.h + threads/thread_usage.h sources += \ threads/mutex.c \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h b/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h index 229be8f177..ba563b9981 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h @@ -14,7 +14,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,14 +77,14 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_recursive_mutex_t); .m_lock_debug = 0, \ .m_lock_file = NULL, \ .m_lock_line = 0, \ - .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ + .m_lock_atomic = PMIX_ATOMIC_LOCK_INIT, \ } #else #define PMIX_MUTEX_STATIC_INIT \ { \ .super = PMIX_OBJ_STATIC_INIT(pmix_mutex_t), \ .m_lock_pthread = PTHREAD_MUTEX_INITIALIZER, \ - .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ + .m_lock_atomic = PMIX_ATOMIC_LOCK_INIT, \ } #endif @@ -98,14 +98,14 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_recursive_mutex_t); .m_lock_debug = 0, \ .m_lock_file = NULL, \ .m_lock_line = 0, \ - .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ + .m_lock_atomic = PMIX_ATOMIC_LOCK_INIT, \ } #else #define PMIX_RECURSIVE_MUTEX_STATIC_INIT \ { \ .super = PMIX_OBJ_STATIC_INIT(pmix_mutex_t), \ .m_lock_pthread = PMIX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER, \ - .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ + .m_lock_atomic = PMIX_ATOMIC_LOCK_INIT, \ } #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/thread.c b/opal/mca/pmix/pmix3x/pmix/src/threads/thread.c index 6513cc9e49..2a9aa23a6b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/thread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/thread.c @@ -12,7 +12,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #include "src/threads/threads.h" #include "src/threads/tsd.h" -#include "pmix_common.h" +#include "include/pmix_common.h" bool pmix_debug_threads = false; diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h b/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h index ff3e504180..e44661f9df 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h @@ -15,7 +15,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,7 +26,7 @@ #if !defined(PMIX_THREAD_USAGE_H) #define PMIX_THREAD_USAGE_H -#include "pmix_config.h" +#include "src/include/pmix_config.h" #include "src/atomics/sys/atomic.h" #include "src/include/prefetch.h" @@ -37,24 +37,24 @@ */ #define PMIX_THREAD_DEFINE_ATOMIC_OP(type, name, operator, suffix) \ -static inline type pmix_thread_ ## name ## _fetch_ ## suffix (pmix_atomic_ ## type *addr, type delta) \ +__pmix_attribute_always_inline__ static inline type pmix_thread_ ## name ## _fetch_ ## suffix (pmix_atomic_ ## type *addr, type delta) \ { \ return pmix_atomic_ ## name ## _fetch_ ## suffix (addr, delta); \ } \ \ -static inline type pmix_thread_fetch_ ## name ## _ ## suffix (pmix_atomic_ ## type *addr, type delta) \ +__pmix_attribute_always_inline__ static inline type pmix_thread_fetch_ ## name ## _ ## suffix (pmix_atomic_ ## type *addr, type delta) \ { \ return pmix_atomic_fetch_ ## name ## _ ## suffix (addr, delta); \ } #define PMIX_THREAD_DEFINE_ATOMIC_COMPARE_EXCHANGE(type, addr_type, suffix) \ -static inline bool pmix_thread_compare_exchange_strong_ ## suffix (pmix_atomic_ ## addr_type *addr, type *compare, type value) \ +__pmix_attribute_always_inline__ static inline bool pmix_thread_compare_exchange_strong_ ## suffix (pmix_atomic_ ## addr_type *addr, type *compare, type value) \ { \ return pmix_atomic_compare_exchange_strong_ ## suffix (addr, (addr_type *) compare, (addr_type) value); \ } #define PMIX_THREAD_DEFINE_ATOMIC_SWAP(type, addr_type, suffix) \ -static inline type pmix_thread_swap_ ## suffix (pmix_atomic_ ## addr_type *ptr, type newvalue) \ +__pmix_attribute_always_inline__ static inline type pmix_thread_swap_ ## suffix (pmix_atomic_ ## addr_type *ptr, type newvalue) \ { \ return (type) pmix_atomic_swap_ ## suffix (ptr, (addr_type) newvalue); \ } diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/threads.h b/opal/mca/pmix/pmix3x/pmix/src/threads/threads.h index 84c8c15150..b9785a7fa6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/threads.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/threads.h @@ -13,7 +13,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -75,6 +75,7 @@ typedef struct { do { \ PMIX_CONSTRUCT(&(l)->mutex, pmix_mutex_t); \ pthread_cond_init(&(l)->cond, NULL); \ + /* coverity[missing_lock : FALSE] */ \ (l)->active = true; \ } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/tsd.h b/opal/mca/pmix/pmix3x/pmix/src/threads/tsd.h index faa6f955a0..c72b661994 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/tsd.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/tsd.h @@ -4,7 +4,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +20,7 @@ #include -#include "pmix_common.h" +#include "include/pmix_common.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index eee9793514..0fcf7dabdb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -15,14 +15,12 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_socket_errno.h" #include "src/client/pmix_client_ops.h" -#include -#include +#include "include/pmix_tool.h" #include "src/include/pmix_globals.h" @@ -49,11 +47,6 @@ #include #endif /* HAVE_DIRENT_H */ -#include PMIX_EVENT_HEADER -#if ! PMIX_HAVE_LIBEV -#include PMIX_EVENT2_THREAD_HEADER -#endif - #include "src/class/pmix_list.h" #include "src/util/argv.h" #include "src/util/error.h" @@ -70,17 +63,64 @@ #include "src/mca/psec/psec.h" #include "src/include/pmix_globals.h" #include "src/common/pmix_iof.h" +#include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" #define PMIX_MAX_RETRIES 10 -extern pmix_client_globals_t pmix_client_globals; static pmix_event_t stdinsig; static pmix_iof_read_event_t stdinev; static void _notify_complete(pmix_status_t status, void *cbdata) { pmix_event_chain_t *chain = (pmix_event_chain_t*)cbdata; + pmix_notify_caddy_t *cd; + size_t n; + pmix_status_t rc; + + PMIX_ACQUIRE_OBJECT(chain); + + /* if the event wasn't found, then cache it as it might + * be registered later */ + if (PMIX_ERR_NOT_FOUND == status && !chain->cached) { + cd = PMIX_NEW(pmix_notify_caddy_t); + cd->status = chain->status; + PMIX_LOAD_PROCID(&cd->source, chain->source.nspace, chain->source.rank); + cd->range = chain->range; + if (0 < chain->ninfo) { + cd->ninfo = chain->ninfo; + PMIX_INFO_CREATE(cd->info, cd->ninfo); + cd->nondefault = chain->nondefault; + /* need to copy the info */ + for (n=0; n < cd->ninfo; n++) { + PMIX_INFO_XFER(&cd->info[n], &chain->info[n]); + } + } + if (NULL != chain->targets) { + cd->ntargets = chain->ntargets; + PMIX_PROC_CREATE(cd->targets, cd->ntargets); + memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); + } + if (NULL != chain->affected) { + cd->naffected = chain->naffected; + PMIX_PROC_CREATE(cd->affected, cd->naffected); + if (NULL == cd->affected) { + cd->naffected = 0; + goto cleanup; + } + memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); + } + /* cache it */ + rc = pmix_notify_event_cache(cd); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(cd); + goto cleanup; + } + chain->cached = true; + } + + cleanup: PMIX_RELEASE(chain); } @@ -198,7 +238,7 @@ static void tool_iof_handler(struct pmix_peer_t *pr, pmix_status_t rc; size_t refid, ninfo=0; pmix_iof_req_t *req; - pmix_info_t *info; + pmix_info_t *info=NULL; pmix_output_verbose(2, pmix_client_globals.iof_output, "recvd IOF with %d bytes", (int)buf->bytes_used); @@ -308,6 +348,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, bool nspace_in_enviro = false; bool rank_given = false; bool fwd_stdin = false; + bool connect_optional = false; pmix_info_t ginfo; size_t n; pmix_ptl_posted_recv_t *rcv; @@ -317,6 +358,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_cb_t cb; pmix_buffer_t *req; pmix_cmd_t cmd = PMIX_REQ_CMD; + pmix_iof_req_t *iofreq; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -329,8 +371,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, * rank should be known. So return them here if * requested */ if (NULL != proc) { - pmix_strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); - proc->rank = pmix_globals.myid.rank; + PMIX_LOAD_PROCID(proc, pmix_globals.myid.nspace, pmix_globals.myid.rank); } ++pmix_globals.init_cntr; PMIX_RELEASE_THREAD(&pmix_global_lock); @@ -364,7 +405,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, rank_given = true; } else if (0 == strncmp(info[n].key, PMIX_FWD_STDIN, PMIX_MAX_KEYLEN)) { /* they want us to forward our stdin to someone */ - fwd_stdin = true; + fwd_stdin = PMIX_INFO_TRUE(&info[n]); } else if (0 == strncmp(info[n].key, PMIX_LAUNCHER, PMIX_MAX_KEYLEN)) { if (PMIX_INFO_TRUE(&info[n])) { PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_LAUNCHER); @@ -449,24 +490,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, } } - /* if we are a launcher, then we also need to act as a server, - * so setup the server-related structures here */ - if (PMIX_PROC_IS_LAUNCHER(&ptype)) { - if (PMIX_SUCCESS != (rc = pmix_server_initialize())) { - PMIX_ERROR_LOG(rc); - if (NULL != nspace) { - free(nspace); - } - if (gdsfound) { - PMIX_INFO_DESTRUCT(&ginfo); - } - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* setup the function pointers */ - memset(&pmix_host_server, 0, sizeof(pmix_server_module_t)); - } - /* setup the runtime - this init's the globals, * opens and initializes the required frameworks */ if (PMIX_SUCCESS != (rc = pmix_rte_init(ptype.type, info, ninfo, @@ -645,24 +668,36 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* it is an error if we were not given an nspace/rank */ if (!nspace_given || !rank_given) { PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_INIT; + return PMIX_ERR_UNREACH; } } else { /* connect to the server */ rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo); - if (PMIX_SUCCESS != rc){ - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; + if (PMIX_SUCCESS != rc) { + if (!connect_optional) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* if connection was optional, then we need to self-assign + * a namespace and rank for ourselves. Use our hostname:pid + * for the nspace, and rank clearly is 0 */ + snprintf(pmix_globals.myid.nspace, PMIX_MAX_NSLEN-1, "%s:%lu", pmix_globals.hostname, (unsigned long)pmix_globals.pid); + pmix_globals.myid.rank = 0; + nspace_given = false; + rank_given = false; + /* also setup the client myserver to point to ourselves */ + pmix_client_globals.myserver->nptr->nspace = strdup(pmix_globals.myid.nspace); + pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); + pmix_client_globals.myserver->info->pname.nspace = strdup(pmix_globals.myid.nspace); + pmix_client_globals.myserver->info->pname.rank = pmix_globals.myid.rank; + pmix_client_globals.myserver->info->uid = pmix_globals.uid; + pmix_client_globals.myserver->info->gid = pmix_globals.gid; } } - if (!nspace_given) { - /* Success, so copy the nspace and rank to the proc struct they gave us */ - pmix_strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); - } - if (!rank_given) { - proc->rank = pmix_globals.myid.rank; - } - /* and into our own peer object */ + /* pass back the ID */ + PMIX_LOAD_PROCID(proc, pmix_globals.myid.nspace, pmix_globals.myid.rank); + + /* load into our own peer object */ if (NULL == pmix_globals.mypeer->nptr->nspace) { pmix_globals.mypeer->nptr->nspace = strdup(pmix_globals.myid.nspace); } @@ -674,7 +709,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, } pmix_globals.mypeer->info->pname.nspace = strdup(pmix_globals.myid.nspace); pmix_globals.mypeer->info->pname.rank = pmix_globals.myid.rank; - /* if we are acting as a server, then start listening */ if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* setup the wildcard recv for inbound messages from clients */ @@ -683,13 +717,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, rcv->cbfunc = pmix_server_message_handler; /* add it to the end of the list of recvs */ pmix_list_append(&pmix_ptl_globals.posted_recvs, &rcv->super); - /* open the pnet framework so we can harvest envars */ - rc = pmix_mca_base_framework_open(&pmix_pnet_base_framework, 0); - if (PMIX_SUCCESS != rc){ - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* note that we do not select active plugins as we don't need them */ } /* setup IOF */ @@ -697,6 +724,11 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, 1, PMIX_FWD_STDOUT_CHANNEL, pmix_iof_write_handler); PMIX_IOF_SINK_DEFINE(&pmix_client_globals.iof_stderr, &pmix_globals.myid, 2, PMIX_FWD_STDERR_CHANNEL, pmix_iof_write_handler); + /* create the default iof handler */ + iofreq = PMIX_NEW(pmix_iof_req_t); + iofreq->channels = PMIX_FWD_STDOUT_CHANNEL | PMIX_FWD_STDERR_CHANNEL | PMIX_FWD_STDDIAG_CHANNEL; + pmix_pointer_array_set_item(&pmix_globals.iof_requests, 0, iofreq); + if (fwd_stdin) { /* setup the read - we don't want to set nonblocking on our * stdio stream. If we do so, we set the file descriptor to @@ -804,7 +836,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* quick check to see if we got something back. If this * is a launcher that is being executed multiple times * in a job-script, then the original registration data - * will have been deleted after the first invocation. In + * may have been deleted after the first invocation. In * such a case, we simply regenerate it locally as it is * well-known */ pmix_cb_t cb; @@ -814,7 +846,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, cb.proc = &wildcard; cb.copy = true; PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - PMIX_DESTRUCT(&cb); if (PMIX_SUCCESS != rc) { pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:tool:client data not found in internal storage"); @@ -839,6 +870,16 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* if we are acting as a server, then start listening */ if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { + /* open the pnet framework and select the active modules for this environment */ + if (PMIX_SUCCESS != (rc = pmix_mca_base_framework_open(&pmix_pnet_base_framework, 0))) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + if (PMIX_SUCCESS != (rc = pmix_pnet_base_select())) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* start listening for connections */ if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) { pmix_show_help("help-pmix-server.txt", "listener-thread-start", true); @@ -846,10 +887,10 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, } } - return rc; + return PMIX_SUCCESS; } -pmix_status_t pmix_tool_init_info(void) +PMIX_EXPORT pmix_status_t pmix_tool_init_info(void) { pmix_kval_t *kptr; pmix_status_t rc; @@ -857,7 +898,7 @@ pmix_status_t pmix_tool_init_info(void) char hostname[PMIX_MAXHOSTNAMELEN] = {0}; pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); - wildcard.rank = pmix_globals.myid.rank; + wildcard.rank = PMIX_RANK_WILDCARD; /* the jobid is just our nspace */ kptr = PMIX_NEW(pmix_kval_t); @@ -1146,6 +1187,38 @@ pmix_status_t pmix_tool_init_info(void) } PMIX_RELEASE(kptr); // maintain accounting + /* store our server's ID */ + if (NULL != pmix_client_globals.myserver && + NULL != pmix_client_globals.myserver->info && + NULL != pmix_client_globals.myserver->info->pname.nspace) { + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_SERVER_NSPACE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(pmix_client_globals.myserver->info->pname.nspace); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_SERVER_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_PROC_RANK; + kptr->value->data.rank = pmix_client_globals.myserver->info->pname.rank; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + } + return PMIX_SUCCESS; } @@ -1212,8 +1285,6 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) /* flush anything that is still trying to be written out */ pmix_iof_static_dump_output(&pmix_client_globals.iof_stdout); pmix_iof_static_dump_output(&pmix_client_globals.iof_stderr); - PMIX_DESTRUCT(&pmix_client_globals.iof_stdout); - PMIX_DESTRUCT(&pmix_client_globals.iof_stderr); /* if we are connected, then disconnect */ if (pmix_globals.connected) { @@ -1268,7 +1339,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) (void)pmix_progress_thread_pause(NULL); } -// PMIX_RELEASE(pmix_client_globals.myserver); + PMIX_RELEASE(pmix_client_globals.myserver); PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests); for (n=0; n < pmix_client_globals.peers.size; n++) { if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_client_globals.peers, n))) { @@ -1293,9 +1364,10 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) PMIX_LIST_DESTRUCT(&pmix_server_globals.gdata); PMIX_LIST_DESTRUCT(&pmix_server_globals.events); PMIX_LIST_DESTRUCT(&pmix_server_globals.iof); + + (void)pmix_mca_base_framework_close(&pmix_pnet_base_framework); } - /* shutdown services */ pmix_rte_finalize(); if (NULL != pmix_globals.mypeer) { PMIX_RELEASE(pmix_globals.mypeer); @@ -1315,6 +1387,8 @@ pmix_status_t PMIx_tool_connect_to_server(pmix_proc_t *proc, pmix_status_t rc; pmix_tool_timeout_t tev; struct timeval tv = {2, 0}; + pmix_event_base_t *evbase_save; + pmix_kval_t *kptr; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1375,7 +1449,86 @@ pmix_status_t PMIx_tool_connect_to_server(pmix_proc_t *proc, "pmix:tool:reconnect finalize sync received"); } + /* stop the existing progress thread */ + (void)pmix_progress_thread_pause(NULL); + + /* save that event base */ + evbase_save = pmix_globals.evbase; + + /* create a new progress thread */ + pmix_globals.evbase = pmix_progress_thread_init("reconnect"); + pmix_progress_thread_start("reconnect"); + /* now ask the ptl to establish connection to the new server */ rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo); - return rc; + + /* once that activity has all completed, then stop the new progress thread */ + pmix_progress_thread_stop("reconnect"); + pmix_progress_thread_finalize("reconnect"); + + /* restore the original progress thread */ + pmix_globals.evbase = evbase_save; + /* restore the communication events */ + pmix_event_assign(&pmix_client_globals.myserver->recv_event, + pmix_globals.evbase, + pmix_client_globals.myserver->sd, + EV_READ | EV_PERSIST, + pmix_ptl_base_recv_handler, pmix_client_globals.myserver); + pmix_client_globals.myserver->recv_ev_active = true; + PMIX_POST_OBJECT(pmix_client_globals.myserver); + pmix_event_add(&pmix_client_globals.myserver->recv_event, 0); + + /* setup send event */ + pmix_event_assign(&pmix_client_globals.myserver->send_event, + pmix_globals.evbase, + pmix_client_globals.myserver->sd, + EV_WRITE|EV_PERSIST, + pmix_ptl_base_send_handler, pmix_client_globals.myserver); + pmix_client_globals.myserver->send_ev_active = false; + /* resume processing events */ + pmix_progress_thread_resume(NULL); + + /* if they gave us an address, we pass back our name */ + if (NULL != proc) { + memcpy(proc, &pmix_globals.myid, sizeof(pmix_proc_t)); + } + + /* if the transition didn't succeed, then return at this point */ + if (PMIX_SUCCESS != rc) { + return rc; + } + + /* update our server's ID */ + if (NULL != pmix_client_globals.myserver && + NULL != pmix_client_globals.myserver->info && + NULL != pmix_client_globals.myserver->info->pname.nspace) { + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_SERVER_NSPACE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(pmix_client_globals.myserver->info->pname.nspace); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_SERVER_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_PROC_RANK; + kptr->value->data.rank = pmix_client_globals.myserver->info->pname.rank; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + } + + return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/tools/Makefile.include index 58bfa148fd..6f0a192f40 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/Makefile.include @@ -13,7 +13,7 @@ # Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c b/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c index a5eccb8666..5eb588cc9c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -24,7 +24,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #include @@ -32,7 +32,7 @@ #include #include -#include +#include "include/pmix_tool.h" #include "src/mca/base/base.h" #include "src/mca/pinstalldirs/base/base.h" #include "src/threads/threads.h" @@ -172,6 +172,11 @@ int main(int argc, char **argv) __FILE__, __LINE__, rc); return rc; } + if (PMIX_SUCCESS != (rc = pmix_pinstall_dirs_base_init(NULL, 0))) { + fprintf(stderr, "pmix_pinstalldirs_base_init() failed -- process will likely abort (%s:%d, returned %d instead of PMIX_SUCCESS)\n", + __FILE__, __LINE__, rc); + return rc; + } /* initialize the help system */ pmix_show_help_init(); diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c b/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c index d206ace840..55366b4f41 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -30,7 +30,7 @@ #include #include -#include +#include "include/pmix_tool.h" #include "src/mca/base/base.h" #include "src/mca/pinstalldirs/base/base.h" #include "src/threads/threads.h" @@ -165,6 +165,11 @@ int main(int argc, char **argv) __FILE__, __LINE__, rc); return rc; } + if (PMIX_SUCCESS != (rc = pmix_pinstall_dirs_base_init(NULL, 0))) { + fprintf(stderr, "pmix_pinstalldirs_base_init() failed -- process will likely abort (%s:%d, returned %d instead of PMIX_SUCCESS)\n", + __FILE__, __LINE__, rc); + return rc; + } /* initialize the help system */ pmix_show_help_init(); diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/pmix_info.c b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/pmix_info.c index 972cf1c7c5..f147ec69f2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/pmix_info.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/pmix_info.c @@ -13,7 +13,7 @@ * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010-2016 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -89,6 +89,11 @@ int main(int argc, char *argv[]) __FILE__, __LINE__, ret); return ret; } + if (PMIX_SUCCESS != (ret = pmix_pinstall_dirs_base_init(NULL, 0))) { + fprintf(stderr, "pmix_pinstalldirs_base_init() failed -- process will likely abort (%s:%d, returned %d instead of PMIX_SUCCESS)\n", + __FILE__, __LINE__, ret); + return ret; + } /* initialize the help system */ pmix_show_help_init(); diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/support.c b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/support.c index 66a06106f7..e85fc7bc3b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/support.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/support.c @@ -14,7 +14,7 @@ * Copyright (c) 2010-2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -1327,11 +1327,13 @@ void pmix_info_do_config(bool want_all) char *debug; char *have_dl; char *symbol_visibility; + char *manpages; /* setup the strings that don't require allocations*/ debug = PMIX_ENABLE_DEBUG ? "yes" : "no"; have_dl = PMIX_HAVE_PDL_SUPPORT ? "yes" : "no"; symbol_visibility = PMIX_HAVE_VISIBILITY ? "yes" : "no"; + manpages = PMIX_ENABLE_MAN_PAGES ? "yes" : "no"; /* output values */ pmix_info_out("Configured by", "config:user", PMIX_CONFIGURE_USER); @@ -1373,4 +1375,5 @@ void pmix_info_do_config(bool want_all) pmix_info_out("Internal debug support", "option:debug", debug); pmix_info_out("dl support", "option:dlopen", have_dl); pmix_info_out("Symbol vis. support", "options:visibility", symbol_visibility); + pmix_info_out("Manpages built", "options:man-pages", manpages); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pps/pps.c b/opal/mca/pmix/pmix3x/pmix/src/tools/pps/pps.c index d17038c041..6a4e95e558 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pps/pps.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pps/pps.c @@ -15,7 +15,7 @@ * Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -32,7 +32,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #include @@ -66,8 +66,8 @@ #include "src/runtime/pmix_rte.h" #include "src/include/pmix_globals.h" -#include -#include +#include "include/pmix_tool.h" +#include "include/pmix.h" typedef struct { pmix_lock_t lock; @@ -263,6 +263,11 @@ main(int argc, char *argv[]) __FILE__, __LINE__, rc); return rc; } + if (PMIX_SUCCESS != (rc = pmix_pinstall_dirs_base_init(NULL, 0))) { + fprintf(stderr, "pmix_pinstalldirs_base_init() failed -- process will likely abort (%s:%d, returned %d instead of PMIX_SUCCESS)\n", + __FILE__, __LINE__, rc); + return rc; + } /* initialize the help system */ pmix_show_help_init(); diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/util/Makefile.include index 771b59bc52..b50eb803d6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/util/Makefile.include @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -38,6 +38,7 @@ headers += \ util/crc.h \ util/fd.h \ util/timings.h \ + util/os_dirpath.h \ util/os_path.h \ util/basename.h \ util/keyval_parse.h \ @@ -51,7 +52,9 @@ headers += \ util/net.h \ util/pif.h \ util/parse_options.h \ - util/compress.h + util/context_fns.h \ + util/pmix_pty.h \ + util/few.h sources += \ util/alfg.c \ @@ -64,6 +67,7 @@ sources += \ util/crc.c \ util/fd.c \ util/timings.c \ + util/os_dirpath.c \ util/os_path.c \ util/basename.c \ util/keyval_parse.c \ @@ -76,7 +80,9 @@ sources += \ util/net.c \ util/pif.c \ util/parse_options.c \ - util/compress.c + util/context_fns.c \ + util/pmix_pty.c \ + util/few.c libpmix_la_LIBADD += \ util/keyval/libpmixutilkeyval.la diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/alfg.c b/opal/mca/pmix/pmix3x/pmix/src/util/alfg.c index 87e0e85172..fb99205864 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/alfg.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/alfg.c @@ -3,7 +3,7 @@ * All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -11,7 +11,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/alfg.h b/opal/mca/pmix/pmix3x/pmix/src/util/alfg.h index 8011ec6b34..aec133f388 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/alfg.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/alfg.h @@ -2,7 +2,7 @@ * Copyright (c) 2014 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -13,8 +13,8 @@ #ifndef PMIX_ALFG_H #define PMIX_ALFG_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include "src/include/pmix_stdint.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/argv.c b/opal/mca/pmix/pmix3x/pmix/src/util/argv.c index 8eb1e3f6dc..6c7265bf02 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/argv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/argv.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Voltaire. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -22,7 +22,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STDLIB_H @@ -128,6 +128,34 @@ pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg) return PMIX_SUCCESS; } +pmix_status_t pmix_argv_append_unique_idx(int *idx, char ***argv, const char *arg) +{ + int i; + pmix_status_t rc; + + /* if the provided array is NULL, then the arg cannot be present, + * so just go ahead and append + */ + if (NULL == *argv) { + goto add; + } + /* see if this arg is already present in the array */ + for (i=0; NULL != (*argv)[i]; i++) { + if (0 == strcmp(arg, (*argv)[i])) { + /* already exists */ + *idx = i; + return PMIX_SUCCESS; + } + } +add: + if (PMIX_SUCCESS != (rc = pmix_argv_append_nosize(argv, arg))) { + return rc; + } + *idx = pmix_argv_count(*argv)-1; + + return PMIX_SUCCESS; +} + pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite) { int i; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/argv.h b/opal/mca/pmix/pmix3x/pmix/src/util/argv.h index 44d83e7562..ec7c0ce22a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/argv.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/argv.h @@ -13,10 +13,10 @@ * All rights reserved. * Copyright (c) 2007 Voltaire. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,14 +34,14 @@ #ifndef PMIX_ARGV_H #define PMIX_ARGV_H -#include +#include "src/include/pmix_config.h" #ifdef HAVE_SYS_TYPES_H #include #endif -#include +#include "include/pmix_common.h" BEGIN_C_DECLS @@ -117,10 +117,27 @@ PMIX_EXPORT pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg * * This function is identical to the pmix_argv_append_nosize() function * except that it only appends the provided argument if it does not already - * exist in the provided array, or overwrites it if it is. + * exist in the provided array. */ PMIX_EXPORT pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite); +/** + * Append to an argv-style array, but only if the provided argument + * doesn't already exist somewhere in the array. Ignore the size of the array. + * Defines the index of the found/added item in the array. + * + * @param idx Index the found/added item in the array. + * @param argv Pointer to an argv array. + * @param str Pointer to the string to append. + * + * @retval PMIX_SUCCESS On success + * @retval PMIX_ERROR On failure + * + * This function is identical to the pmix_argv_append_unique_nosize() function + * but it has an extra argument defining the index of the item in the array. + */ +PMIX_EXPORT pmix_status_t pmix_argv_append_unique_idx(int *idx, char ***argv, const char *arg); + /** * Free a NULL-terminated argv array. * @@ -146,7 +163,7 @@ PMIX_EXPORT void pmix_argv_free(char **argv); * @retval argv pointer to new argv array on success * @retval NULL on error * - * All strings are insertted into the argv array by value; the + * All strings are inserted into the argv array by value; the * newly-allocated array makes no references to the src_string * argument (i.e., it can be freed after calling this function * without invalidating the output argv). @@ -163,7 +180,7 @@ PMIX_EXPORT char **pmix_argv_split(const char *src_string, int delimiter) __pmix * @retval argv pointer to new argv array on success * @retval NULL on error * - * All strings are insertted into the argv array by value; the + * All strings are inserted into the argv array by value; the * newly-allocated array makes no references to the src_string * argument (i.e., it can be freed after calling this function * without invalidating the output argv). @@ -266,7 +283,7 @@ PMIX_EXPORT pmix_status_t pmix_argv_delete(int *argc, char ***argv, * @retval PMIX_BAD_PARAM if any parameters are non-sensical * * This function takes one arg and inserts it in the middle of - * another. The first token in source will be insertted at index + * another. The first token in source will be inserted at index * start in the target argv; all other tokens will follow it. * Similar to pmix_argv_append(), the target may be realloc()'ed * to accomodate the new storage requirements. diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/basename.c b/opal/mca/pmix/pmix3x/pmix/src/util/basename.c index aa2076d7ea..fa2bdcf7a2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/basename.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/basename.c @@ -12,7 +12,7 @@ * Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +20,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/basename.h b/opal/mca/pmix/pmix3x/pmix/src/util/basename.h index 3e0851c0f1..e2b14136e0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/basename.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/basename.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,8 +26,8 @@ #ifndef PMIX_BASENAME_H #define PMIX_BASENAME_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/cmd_line.c b/opal/mca/pmix/pmix3x/pmix/src/util/cmd_line.c index 15a2b61207..13817c4b74 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/cmd_line.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/cmd_line.c @@ -15,7 +15,7 @@ * Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -39,7 +39,7 @@ #include "src/util/pmix_environ.h" #include "src/mca/base/pmix_mca_base_var.h" -#include "pmix_common.h" +#include "include/pmix_common.h" /* @@ -383,7 +383,7 @@ int pmix_cmd_line_parse(pmix_cmd_line_t *cmd, bool ignore_unknown, bool ignore_u /* Suck down the following parameters that belong to this option. If we run out of parameters, or find that any of them are the special_empty_param - (insertted by split_shorts()), then print an error + (inserted by split_shorts()), then print an error and return. */ param = PMIX_NEW(pmix_cmd_line_param_t); @@ -533,7 +533,7 @@ char *pmix_cmd_line_get_usage_msg(pmix_cmd_line_t *cmd) int argc; size_t j; char **argv; - char *ret, temp[MAX_WIDTH * 2], line[MAX_WIDTH * 2]; + char *ret, temp[MAX_WIDTH * 2 - 1], line[MAX_WIDTH * 2]; char *start, *desc, *ptr; pmix_list_item_t *item; pmix_cmd_line_option_t *option, **sorted; @@ -726,11 +726,6 @@ char *pmix_cmd_line_get_usage_msg(pmix_cmd_line_t *cmd) } } } - if(otype == PMIX_CMD_LINE_OTYPE_NULL || otype == PMIX_CMD_LINE_OTYPE_GENERAL) { - char *argument_line = "\nFor additional mpirun arguments, run 'mpirun --help '\n\nThe following categories exist: general (Defaults to this option), debug,\n output, input, mapping, ranking, binding, devel (arguments useful to PMIX\n Developers), compatibility (arguments supported for backwards compatibility),\n launch (arguments to modify launch options), and dvm (Distributed Virtual\n Machine arguments)."; - - pmix_argv_append(&argc, &argv, argument_line); - } if (NULL != argv) { ret = pmix_argv_join(argv, '\n'); pmix_argv_free(argv); diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/compress.h b/opal/mca/pmix/pmix3x/pmix/src/util/compress.h deleted file mode 100644 index b07b0d2ea7..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/util/compress.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * Compress/decompress long strings - */ - -#ifndef PMIX_COMPRESS_H -#define PMIX_COMPRESS_H - -#include - - -BEGIN_C_DECLS - -/* define a limit for storing raw strings */ -#define PMIX_STRING_LIMIT 512 - -/* define a macro for quickly checking if a string exceeds the - * compression limit */ -#define PMIX_STRING_SIZE_CHECK(s) \ - (PMIX_STRING == (s)->type && NULL != (s)->data.string && PMIX_STRING_LIMIT < strlen((s)->data.string)) - -/** - * Compress a string into a byte object using Zlib - */ -PMIX_EXPORT bool pmix_util_compress_string(char *instring, - uint8_t **outbytes, - size_t *nbytes); - -/** - * Decompress a byte object into a string using Zlib - */ -PMIX_EXPORT void pmix_util_uncompress_string(char **outstring, - uint8_t *inbytes, size_t len); - -END_C_DECLS - -#endif /* PMIX_COMPRESS_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/context_fns.c b/opal/mca/pmix/pmix3x/pmix/src/util/context_fns.c new file mode 100644 index 0000000000..9275e56dfb --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/context_fns.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2008 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +#include "pmix_config.h" +#include "include/pmix_common.h" + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#include + +#include "src/util/basename.h" +#include "src/util/path.h" +#include "src/util/pmix_environ.h" + +#include "src/util/context_fns.h" + +int pmix_util_check_context_cwd(pmix_app_t *app) +{ + /* If we want to chdir and the chdir fails (for any reason -- such + as if the dir doesn't exist, it isn't a dir, we don't have + permissions, etc.), then return error. */ + if (NULL != app->cwd && 0 != chdir(app->cwd)) { + return PMIX_ERR_BAD_PARAM; + } + + /* All happy */ + return PMIX_SUCCESS; +} + +int pmix_util_check_context_app(pmix_app_t *app, char **env) +{ + char *tmp; + + /* Here's the possibilities: + + 1. The caller specified an absolute pathname for the executable. + We simply need to verify that it exists and we can run it. + + 2. The caller specified a relative pathname for the executable. + Ditto with #1 -- based on the cwd, we need to verify that it + exists and we can run it. + + 3. The caller specified a naked filename. We need to search the + path, find a match, and verify that we can run it. + */ + + tmp = pmix_basename(app->cmd); + if (strlen(tmp) == strlen(app->cmd)) { + /* If this is a naked executable -- no relative or absolute + pathname -- then search the PATH for it */ + free(tmp); + tmp = pmix_path_findv(app->cmd, X_OK, env, app->cwd); + if (NULL == tmp) { + return PMIX_ERR_NOT_FOUND; + } + free(app->cmd); + app->cmd = tmp; + } else { + free(tmp); + if (0 != access(app->cmd, X_OK)) { + return PMIX_ERR_NO_PERMISSIONS; + } + } + + /* All was good */ + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/context_fns.h b/opal/mca/pmix/pmix3x/pmix/src/util/context_fns.h new file mode 100644 index 0000000000..2a6764278e --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/context_fns.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2006 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file: + * + */ + +#ifndef _PMIX_CONTEXT_FNS_H_ +#define _PMIX_CONTEXT_FNS_H_ + +#include "pmix_config.h" +#include "include/pmix_common.h" + +BEGIN_C_DECLS + +PMIX_EXPORT int pmix_util_check_context_app(pmix_app_t *app, char **env); + +PMIX_EXPORT int pmix_util_check_context_cwd(pmix_app_t *app); + +END_C_DECLS +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/crc.c b/opal/mca/pmix/pmix3x/pmix/src/util/crc.c index 5045e4509c..bfb031e46d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/crc.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/crc.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,7 +18,7 @@ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STDIO_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/crc.h b/opal/mca/pmix/pmix3x/pmix/src/util/crc.h index ed1e43d01c..036b91b9e7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/crc.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/crc.h @@ -12,7 +12,7 @@ * Copyright (c) 2009 IBM Corporation. All rights reserved. * Copyright (c) 2009 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,7 +23,7 @@ #ifndef _PMIX_CRC_H_ #define _PMIX_CRC_H_ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/error.c b/opal/mca/pmix/pmix3x/pmix/src/util/error.c index 7930be1c33..e7cc3a051b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/error.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/error.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,7 +19,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STRING_H @@ -31,7 +31,7 @@ #include #endif -#include +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" #include "src/util/error.h" @@ -152,7 +152,6 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum) case PMIX_ERR_CONFLICTING_CLEANUP_DIRECTIVES: return "PMIX CONFLICTING CLEANUP DIRECTIVES"; - case PMIX_ERR_LOST_CONNECTION_TO_SERVER: return "LOST_CONNECTION_TO_SERVER"; case PMIX_ERR_LOST_PEER_CONNECTION: @@ -233,8 +232,8 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum) return "PMIX_ERR_VALUE_OUT_OF_BOUNDS"; case PMIX_ERR_PERM: return "PMIX_ERR_PERM"; - case PMIX_ERR_NETWORK_NOT_PARSEABLE: - return "PMIX_ERR_NETWORK_NOT_PARSEABLE"; + case PMIX_ERR_FABRIC_NOT_PARSEABLE: + return "PMIX_ERR_FABRIC_NOT_PARSEABLE"; case PMIX_ERR_FILE_OPEN_FAILURE: return "PMIX_ERR_FILE_OPEN_FAILURE"; case PMIX_ERR_FILE_READ_FAILURE: @@ -244,11 +243,9 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum) case PMIX_ERR_TEMP_UNAVAILABLE: return "PMIX TEMPORARILY UNAVAILABLE"; - case PMIX_MAX_ERR_CONSTANT: return "PMIX_ERR_WILDCARD"; - default: return "ERROR STRING NOT FOUND"; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/error.h b/opal/mca/pmix/pmix3x/pmix/src/util/error.h index e899e0368a..cfa4a55a9e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/error.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/error.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,10 +20,10 @@ #ifndef PMIX_UTIL_ERROR_H #define PMIX_UTIL_ERROR_H -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix.h" #include "src/util/output.h" BEGIN_C_DECLS @@ -33,7 +33,7 @@ #define PMIX_ERR_FATAL (PMIX_INTERNAL_ERR_BASE - 29) #define PMIX_ERR_VALUE_OUT_OF_BOUNDS (PMIX_INTERNAL_ERR_BASE - 30) #define PMIX_ERR_PERM (PMIX_INTERNAL_ERR_BASE - 31) -#define PMIX_ERR_NETWORK_NOT_PARSEABLE (PMIX_INTERNAL_ERR_BASE - 33) +#define PMIX_ERR_FABRIC_NOT_PARSEABLE (PMIX_INTERNAL_ERR_BASE - 33) #define PMIX_ERR_FILE_OPEN_FAILURE (PMIX_INTERNAL_ERR_BASE - 34) #define PMIX_ERR_FILE_READ_FAILURE (PMIX_INTERNAL_ERR_BASE - 35) #define PMIX_ERR_TAKE_NEXT_OPTION (PMIX_INTERNAL_ERR_BASE - 36) diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/fd.c b/opal/mca/pmix/pmix3x/pmix/src/util/fd.c index c4f033f9da..9cf0baf6e3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/fd.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/fd.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -11,9 +11,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #ifdef HAVE_UNISTD_H #include @@ -104,6 +104,7 @@ pmix_status_t pmix_fd_set_cloexec(int fd) bool pmix_fd_is_regular(int fd) { struct stat buf; + /* coverity[toctou] */ if (fstat(fd, &buf)) { return false; } @@ -113,6 +114,7 @@ bool pmix_fd_is_regular(int fd) bool pmix_fd_is_chardev(int fd) { struct stat buf; + /* coverity[toctou] */ if (fstat(fd, &buf)) { return false; } @@ -122,6 +124,7 @@ bool pmix_fd_is_chardev(int fd) bool pmix_fd_is_blkdev(int fd) { struct stat buf; + /* coverity[toctou] */ if (fstat(fd, &buf)) { return false; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/fd.h b/opal/mca/pmix/pmix3x/pmix/src/util/fd.h index 58c7edfe01..a4e7da0dda 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/fd.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/fd.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -17,7 +17,7 @@ #ifndef PMIX_UTIL_FD_H_ #define PMIX_UTIL_FD_H_ -#include +#include "src/include/pmix_config.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/few.c b/opal/mca/pmix/pmix3x/pmix/src/util/few.c new file mode 100644 index 0000000000..5a5f7da2cc --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/few.c @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "pmix_config.h" + +#include +#include +#ifdef HAVE_SYS_WAIT_H +#include +#endif +#include +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "src/util/few.h" +#include "src/util/basename.h" +#include "src/util/argv.h" +#include "include/pmix_common.h" + +int pmix_few(char *argv[], int *status) +{ +#if defined(HAVE_FORK) && defined(HAVE_EXECVE) && defined(HAVE_WAITPID) + pid_t pid, ret; + + if ((pid = fork()) < 0) { + return PMIX_ERROR; + } + + /* Child execs. If it fails to exec, exit. */ + + else if (0 == pid) { + execvp(argv[0], argv); + exit(errno); + } + + /* Parent loops waiting for the child to die. */ + + else { + do { + /* If the child exited, return */ + + if (pid == (ret = waitpid(pid, status, 0))) { + break; + } + + /* If waitpid was interrupted, loop around again */ + + else if (ret < 0) { + if (EINTR == errno) { + continue; + } + + /* Otherwise, some bad juju happened -- need to quit */ + + return PMIX_ERROR; + } + } while (true); + } + + /* Return the status to the caller */ + + return PMIX_SUCCESS; +#else + return PMIX_ERR_NOT_SUPPORTED; +#endif +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/few.h b/opal/mca/pmix/pmix3x/pmix/src/util/few.h new file mode 100644 index 0000000000..4f8fb2d45b --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/few.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_FEW_H +#define PMIX_FEW_H + +#include "pmix_config.h" + +#include "include/pmix_common.h" + +BEGIN_C_DECLS + +/** + * Forks, execs, and waits for a subordinate program + * + * @param argv Null-terminated argument vector; argv[0] is the program + * (same as arguments to execvp()) + * + * @param status Upon success, will be filled with the return status + * from waitpid(2). The WIF* macros can be used to examine the value + * (see waitpid(2)). + * + * @retval PMIX_SUCCESS If the child launched and exited. + * @retval PMIX_ERROR If a failure occurred, errno should be + * examined for the specific error. + * + * This function forks, execs, and waits for an executable to + * complete. The input argv must be a NULL-terminated array (perhaps + * built with the pmix_arr_*() interface). Upon success, PMIX_SUCCESS + * is returned. This function will wait either until the child + * process has exited or waitpid() returns an error other than EINTR. + * + * Note that a return of PMIX_SUCCESS does \em not imply that the child + * process exited successfully -- it simply indicates that the child + * process exited. The WIF* macros (see waitpid(2)) should be used to + * examine the status to see hold the child exited. + * + * \warning This function should not be called if \c orte_init() + * or \c MPI_Init() have been called. This function is not + * safe in a multi-threaded environment in which a handler + * for \c SIGCHLD has been registered. + */ +PMIX_EXPORT pmix_status_t pmix_few(char *argv[], int *status); + +END_C_DECLS +#endif /* PMIX_FEW_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/getid.c b/opal/mca/pmix/pmix3x/pmix/src/util/getid.c index f3ad8a9dd4..148367fb0c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/getid.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/getid.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +22,7 @@ * Buffer safe printf functions for portability to archaic platforms. */ -#include +#include "src/include/pmix_config.h" #include "include/pmix_common.h" #include "src/include/pmix_socket_errno.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/getid.h b/opal/mca/pmix/pmix3x/pmix/src/util/getid.h index cc95371f6f..30ad4ff5dc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/getid.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/getid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,7 +10,7 @@ #ifndef PMIX_GETID_H #define PMIX_GETID_H -#include +#include "src/include/pmix_config.h" #include "include/pmix_common.h" #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/hash.c b/opal/mca/pmix/pmix3x/pmix/src/util/hash.c index 806781186b..e8e9e3cb42 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/hash.c @@ -6,7 +6,7 @@ * reserved. * Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -20,10 +20,10 @@ * */ -#include +#include "src/include/pmix_config.h" -#include -#include +#include "src/include/pmix_stdint.h" +#include "src/include/hash_string.h" #include @@ -130,8 +130,8 @@ pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, pmix_rank_t rank, (void**)&proc_data, (void**)&node); if (PMIX_SUCCESS != rc) { pmix_output_verbose(10, pmix_globals.debug_output, - "HASH:FETCH proc data for rank %d not found", - rank); + "HASH:FETCH[%s:%d] proc data for rank %d not found", + __func__, __LINE__, rank); return PMIX_ERR_PROC_ENTRY_NOT_FOUND; } } @@ -140,8 +140,8 @@ pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, pmix_rank_t rank, proc_data = lookup_proc(table, id, false); if (NULL == proc_data) { pmix_output_verbose(10, pmix_globals.debug_output, - "HASH:FETCH proc data for rank %d not found", - rank); + "HASH:FETCH[%s:%d] proc data for rank %d not found", + __func__, __LINE__, rank); return PMIX_ERR_PROC_ENTRY_NOT_FOUND; } @@ -203,7 +203,7 @@ pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, pmix_rank_t rank, (void**)&proc_data, node, (void**)&node); if (PMIX_SUCCESS != rc) { pmix_output_verbose(10, pmix_globals.debug_output, - "HASH:FETCH data for key %s not found", key); + "%s:%d HASH:FETCH data for key %s not found", __func__, __LINE__, key); return PMIX_ERR_PROC_ENTRY_NOT_FOUND; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/hash.h b/opal/mca/pmix/pmix3x/pmix/src/util/hash.h index 9685311a55..d7adb5bc36 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/hash.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/hash.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -14,7 +14,7 @@ #ifndef PMIX_HASH_H #define PMIX_HASH_H -#include +#include "src/include/pmix_config.h" #include "src/mca/bfrops/bfrops_types.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.h b/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.h index 778982711d..da01d0a35b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - # Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ #ifndef PMIX_UTIL_KEYVAL_LEX_H_ #define PMIX_UTIL_KEYVAL_LEX_H_ -#include +#include "src/include/pmix_config.h" #ifdef malloc #undef malloc diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.l b/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.l index 9b9d0d6d14..fc488b567c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.l +++ b/opal/mca/pmix/pmix3x/pmix/src/util/keyval/keyval_lex.l @@ -16,6 +16,7 @@ * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,7 +24,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c b/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c index 52c68fa50d..07a02a0b72 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +20,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/util/keyval_parse.h" #include "src/util/keyval/keyval_lex.h" #include "src/util/output.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.h b/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.h index 239511ea25..19853aaa9f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +22,7 @@ #ifndef PMIX_UTIL_KEYVAL_PARSE_H #define PMIX_UTIL_KEYVAL_PARSE_H -#include +#include "src/include/pmix_config.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c index 7e51f7461e..5354852175 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c @@ -12,7 +12,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -24,7 +24,7 @@ #include #include -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/threads/tsd.h" #include "src/include/pmix_globals.h" diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h index e03e4da3b6..a766daf9de 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h @@ -12,7 +12,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,7 +29,7 @@ #include #endif -#include "pmix_common.h" +#include "include/pmix_common.h" #include "src/include/pmix_globals.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/net.c b/opal/mca/pmix/pmix3x/pmix/src/util/net.c index 34661df3f2..0a1412d745 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/net.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/net.c @@ -12,7 +12,7 @@ * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -23,7 +23,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.c b/opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.c new file mode 100644 index 0000000000..aa798ceeb2 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.c @@ -0,0 +1,316 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2015-2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "pmix_config.h" + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#include +#if HAVE_SYS_STAT_H +#include +#endif /* HAVE_SYS_STAT_H */ +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#ifdef HAVE_DIRENT_H +#include +#endif /* HAVE_DIRENT_H */ + +#include "src/util/error.h" +#include "src/util/output.h" +#include "src/util/os_dirpath.h" +#include "src/util/show_help.h" +#include "src/util/argv.h" +#include "src/util/os_path.h" +#include "include/pmix_common.h" + +static const char path_sep[] = PMIX_PATH_SEP; + +int pmix_os_dirpath_create(const char *path, const mode_t mode) +{ + struct stat buf; + char **parts, *tmp; + int i, len; + int ret; + + if (NULL == path) { /* protect ourselves from errors */ + return(PMIX_ERR_BAD_PARAM); + } + + /* coverity[toctou] */ + if (0 == (ret = stat(path, &buf))) { /* already exists */ + if (mode == (mode & buf.st_mode)) { /* has correct mode */ + return(PMIX_SUCCESS); + } + if (0 == (ret = chmod(path, (buf.st_mode | mode)))) { /* successfully change mode */ + return(PMIX_SUCCESS); + } + pmix_show_help("help-pmix-util.txt", "dir-mode", true, + path, mode, strerror(errno)); + return(PMIX_ERR_PERM); /* can't set correct mode */ + } + + /* quick -- try to make directory */ + if (0 == mkdir(path, mode)) { + return(PMIX_SUCCESS); + } + + /* didnt work, so now have to build our way down the tree */ + /* Split the requested path up into its individual parts */ + + parts = pmix_argv_split(path, path_sep[0]); + + /* Ensure to allocate enough space for tmp: the strlen of the + incoming path + 1 (for \0) */ + + tmp = (char*)malloc(strlen(path) + 1); + tmp[0] = '\0'; + + /* Iterate through all the subdirectory names in the path, + building up a directory name. Check to see if that dirname + exists. If it doesn't, create it. */ + + len = pmix_argv_count(parts); + for (i = 0; i < len; ++i) { + if (i == 0) { + /* If in POSIX-land, ensure that we never end a directory + name with path_sep */ + + if ('/' == path[0]) { + strcat(tmp, path_sep); + } + strcat(tmp, parts[i]); + } + + /* If it's not the first part, ensure that there's a + preceeding path_sep and then append this part */ + + else { + if (path_sep[0] != tmp[strlen(tmp) - 1]) { + strcat(tmp, path_sep); + } + strcat(tmp, parts[i]); + } + + /* Now that we have the name, try to create it */ + mkdir(tmp, mode); + ret = errno; // save the errno for an error msg, if needed + /* coverity[toctou] */ + if (0 != stat(tmp, &buf)) { + pmix_show_help("help-pmix-util.txt", "mkdir-failed", true, + tmp, strerror(ret)); + pmix_argv_free(parts); + free(tmp); + return PMIX_ERROR; + } else if (i == (len-1) && (mode != (mode & buf.st_mode)) && (0 > chmod(tmp, (buf.st_mode | mode)))) { + pmix_show_help("help-pmix-util.txt", "dir-mode", true, + tmp, mode, strerror(errno)); + pmix_argv_free(parts); + free(tmp); + return(PMIX_ERR_PERM); /* can't set correct mode */ + } + } + + /* All done */ + + pmix_argv_free(parts); + free(tmp); + return PMIX_SUCCESS; +} + +/** + * This function attempts to remove a directory along with all the + * files in it. If the recursive variable is non-zero, then it will + * try to recursively remove all directories. If provided, the + * callback function is executed prior to the directory or file being + * removed. If the callback returns non-zero, then no removal is + * done. + */ +int pmix_os_dirpath_destroy(const char *path, + bool recursive, + pmix_os_dirpath_destroy_callback_fn_t cbfunc) +{ + int rc, exit_status = PMIX_SUCCESS; + bool is_dir = false; + DIR *dp; + struct dirent *ep; + char *filenm; + struct stat buf; + + if (NULL == path) { /* protect against error */ + return PMIX_ERROR; + } + + /* + * Make sure we have access to the the base directory + */ + if (PMIX_SUCCESS != (rc = pmix_os_dirpath_access(path, 0))) { + exit_status = rc; + goto cleanup; + } + + /* Open up the directory */ + dp = opendir(path); + if (NULL == dp) { + return PMIX_ERROR; + } + + while (NULL != (ep = readdir(dp))) { + /* skip: + * - . and .. + */ + if ((0 == strcmp(ep->d_name, ".")) || + (0 == strcmp(ep->d_name, ".."))) { + continue; + } + + /* Check to see if it is a directory */ + is_dir = false; + + /* Create a pathname. This is not always needed, but it makes + * for cleaner code just to create it here. Note that we are + * allocating memory here, so we need to free it later on. + */ + filenm = pmix_os_path(false, path, ep->d_name, NULL); + + /* coverity[toctou] */ + rc = stat(filenm, &buf); + if (0 > rc) { + /* Handle a race condition. filenm might have been deleted by an + * other process running on the same node. That typically occurs + * when one task is removing the job_session_dir and an other task + * is still removing its proc_session_dir. + */ + free(filenm); + continue; + } + if (S_ISDIR(buf.st_mode)) { + is_dir = true; + } + + /* + * If not recursively decending, then if we find a directory then fail + * since we were not told to remove it. + */ + if (is_dir && !recursive) { + /* Set the error indicating that we found a directory, + * but continue removing files + */ + exit_status = PMIX_ERROR; + free(filenm); + continue; + } + + /* Will the caller allow us to remove this file/directory? */ + if (NULL != cbfunc) { + /* + * Caller does not wish to remove this file/directory, + * continue with the rest of the entries + */ + if (!(cbfunc(path, ep->d_name))) { + free(filenm); + continue; + } + } + /* Directories are recursively destroyed */ + if (is_dir) { + rc = pmix_os_dirpath_destroy(filenm, recursive, cbfunc); + free(filenm); + if (PMIX_SUCCESS != rc) { + exit_status = rc; + closedir(dp); + goto cleanup; + } + } else { + /* Files are removed right here */ + if (0 != (rc = unlink(filenm))) { + exit_status = PMIX_ERROR; + } + free(filenm); + } + } + + /* Done with this directory */ + closedir(dp); + + cleanup: + + /* + * If the directory is empty, them remove it + */ + if(pmix_os_dirpath_is_empty(path)) { + rmdir(path); + } + + return exit_status; +} + +bool pmix_os_dirpath_is_empty(const char *path ) { + DIR *dp; + struct dirent *ep; + + if (NULL != path) { /* protect against error */ + dp = opendir(path); + if (NULL != dp) { + while ((ep = readdir(dp))) { + if ((0 != strcmp(ep->d_name, ".")) && + (0 != strcmp(ep->d_name, ".."))) { + closedir(dp); + return false; + } + } + closedir(dp); + return true; + } + return false; + } + + return true; +} + +int pmix_os_dirpath_access(const char *path, const mode_t in_mode ) { + struct stat buf; + mode_t loc_mode = S_IRWXU; /* looking for full rights */ + + /* + * If there was no mode specified, use the default mode + */ + if (0 != in_mode) { + loc_mode = in_mode; + } + + /* coverity[toctou] */ + if (0 == stat(path, &buf)) { /* exists - check access */ + if ((buf.st_mode & loc_mode) == loc_mode) { /* okay, I can work here */ + return(PMIX_SUCCESS); + } else { + /* Don't have access rights to the existing path */ + return(PMIX_ERROR); + } + } else { + /* We could not find the path */ + return( PMIX_ERR_NOT_FOUND ); + } +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.h b/opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.h new file mode 100644 index 0000000000..c6865bd396 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/os_dirpath.h @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file: + * Creates a directory tree set to the specified permissions. + * + * The pmix_os_dirpath_create() function creates a directory + * tree, with each directory that is created in the tree having the specified + * access permissions. Existing directories within the tree are left + * untouched - however, if they do not permit the user to create a directory + * within them, the function will return an error condition. + * + * If the specified full path name already exists, the + * pmix_os_dirpath_create() function will check to ensure that + * the final directory in the tree has at least the specified access permission. In other + * words, if the directory has read-write-execute for all, and the user + * has requested read-write access for just the user, then the function + * will consider the directory acceptable. If the minimal permissions are + * not currently provided, the function will attempt to change the + * access permissions of the directory to add the specified + * permissions. The function will return PMIX_ERROR if this cannot + * be done. + **/ + +#ifndef PMIX_OS_DIRPATH_CREATE_H +#define PMIX_OS_DIRPATH_CREATE_H + +#include "pmix_config.h" +#ifdef HAVE_SYS_STAT_H +#include +#endif + +BEGIN_C_DECLS + +/** + * @param path A pointer to a string that contains the path name to be built. + * @param mode A mode_t bit mask that specifies the access permissions for the + * directories being constructed. + * @retval PMIX_SUCCESS If the directory tree has been successfully created with + * the specified access permissions. + * @retval PMIX_ERROR If the directory tree could not be created with the + * specified access permissions. + */ + +PMIX_EXPORT int pmix_os_dirpath_create(const char *path, const mode_t mode); + +/** + * Check to see if a directory is empty + * + * @param path A pointer to a string that contains the path name to be checked. + * + * @retval true If the directory is empty + * @retval false If the directory is not empty + */ +PMIX_EXPORT bool pmix_os_dirpath_is_empty(const char *path); + +/** + * Check access to the directory + * + * @param path A pointer to a string that contains the path name to be checked. + * @param mode A mode_t bit mask that specifies the access permissions for the + * directory to be accessed. + * + * @retval PMIX_SUCCESS If directory exists, and permissions match + * @retval PMIX_ERR_NOT_FOUND If directory does not exist + * @retval PMIX_ERROR If directory exists, and permissions do not match + */ +PMIX_EXPORT int pmix_os_dirpath_access(const char *path, const mode_t mode ); + +/** + * Callback for pmix_os_dirpath_destroy(). Call for every file/directory before + * taking action to remove/unlink it. + * + * @param root A pointer to a string that contains the base path name (e.g., /tmp/foo from /tmp/foo/bar) + * @param path A pointer to a string that contains the file or directory (e.g., bar from /tmp/foo/bar) + * + * @retval true Allow the program to remove the file/directory + * @retval false Do not allow the program to remove the file/directory + */ +typedef bool (*pmix_os_dirpath_destroy_callback_fn_t)(const char *root, const char *path); + +/** + * Destroy a directory + * + * @param path A pointer to a string that contains the path name to be destroyed + * @param recursive Recursively descend the directory removing all files and directories. + * if set to 'false' then the directory must be empty to succeed. + * @param cbfunc A function that will be called before removing a file or directory. + * If NULL, then assume all remove. + * + * @retval PMIX_SUCCESS If the directory was successfully removed or removed to the + * specification of the user (i.e., obeyed the callback function). + * @retval PMIX_ERR_NOT_FOUND If directory does not exist. + * @retval PMIX_ERROR If the directory cannnot be removed, accessed properly, or contains + * directories that could not be removed.. + */ +PMIX_EXPORT int pmix_os_dirpath_destroy(const char *path, + bool recursive, + pmix_os_dirpath_destroy_callback_fn_t cbfunc); + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c index 3f94f9bb7d..cac9906970 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,7 +17,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h index 3933d04630..e00519649a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,8 +42,8 @@ #ifndef PMIX_OS_PATH_H #define PMIX_OS_PATH_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.c b/opal/mca/pmix/pmix3x/pmix/src/util/output.c index 4e90280c8a..513d2d6a27 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -20,9 +20,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include #include @@ -454,6 +454,7 @@ void pmix_output_finalize(void) free (output_prefix); free (output_dir); PMIX_DESTRUCT(&verbose); + initialized = false; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.h b/opal/mca/pmix/pmix3x/pmix/src/util/output.h index 5e8fa677b5..4a753c0172 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -66,14 +66,13 @@ #ifndef PMIX_OUTPUT_H_ #define PMIX_OUTPUT_H_ -#include +#include "src/include/pmix_config.h" #ifdef HAVE_STDARG_H #include #endif -#include "pmix_rename.h" #include "src/class/pmix_object.h" BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/parse_options.c b/opal/mca/pmix/pmix3x/pmix/src/util/parse_options.c index d7679af6ac..49f0dffaf1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/parse_options.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/parse_options.c @@ -13,7 +13,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ * $HEADER$ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/path.c b/opal/mca/pmix/pmix3x/pmix/src/util/path.c index 8705759c3b..abea8716d0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/path.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/path.c @@ -13,7 +13,7 @@ * Copyright (c) 2010 IBM Corporation. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -24,7 +24,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -245,6 +245,7 @@ char *pmix_path_access(char *fname, char *path, int mode) /* first check to see - is this a file or a directory? We * only want files */ + /* coverity[toctou] */ if (0 != stat(fullpath, &buf)) { /* couldn't stat the path - obviously, this also meets the * existence check, if that was requested @@ -295,7 +296,7 @@ char *pmix_path_access(char *fname, char *path, int mode) * Loads argument array with $PATH env var. * * Accepts - * -path String contiaing the $PATH + * -path String containing the $PATH * -argc Pointer to argc * -argv Pointer to list of argv */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/path.h b/opal/mca/pmix/pmix3x/pmix/src/util/path.h index eebda6dadc..c1d80dbd15 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/path.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/path.h @@ -12,7 +12,7 @@ * Copyright (c) 2012 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,9 +25,9 @@ #ifndef PMIX_PATH_H #define PMIX_PATH_H -#include +#include "src/include/pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #ifdef HAVE_UNISTD_H #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pif.c b/opal/mca/pmix/pmix3x/pmix/src/util/pif.c index 9696502f4b..db4f35f113 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pif.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pif.c @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,7 +25,7 @@ */ #include "pmix_config.h" -#include "pmix_common.h" +#include "include/pmix_common.h" #include #ifdef HAVE_UNISTD_H @@ -539,14 +539,14 @@ static int parse_ipv4_dots(const char *addr, uint32_t* net, int* dots) } /* did we read something sensible? */ if( n[i] > 255 ) { - return PMIX_ERR_NETWORK_NOT_PARSEABLE; + return PMIX_ERR_FABRIC_NOT_PARSEABLE; } /* skip all the . */ for( start = end; '\0' != *start; start++ ) if( '.' != *start ) break; } *dots = i; - *net = PMIX_PIF_ASSEMBLE_NETWORK(n[0], n[1], n[2], n[3]); + *net = PMIX_PIF_ASSEMBLE_FABRIC(n[0], n[1], n[2], n[3]); return PMIX_SUCCESS; } @@ -575,7 +575,7 @@ pmix_iftupletoaddr(const char *inaddr, uint32_t *net, uint32_t *mask) pval = strtol(ptr, NULL, 10); if ((pval > 31) || (pval < 1)) { pmix_output(0, "pmix_iftupletoaddr: unknown mask"); - return PMIX_ERR_NETWORK_NOT_PARSEABLE; + return PMIX_ERR_FABRIC_NOT_PARSEABLE; } *mask = 0xFFFFFFFF << (32 - pval); } @@ -600,7 +600,7 @@ pmix_iftupletoaddr(const char *inaddr, uint32_t *net, uint32_t *mask) *mask = 0xFF000000; } else { pmix_output(0, "pmix_iftupletoaddr: unknown mask"); - return PMIX_ERR_NETWORK_NOT_PARSEABLE; + return PMIX_ERR_FABRIC_NOT_PARSEABLE; } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pif.h b/opal/mca/pmix/pmix3x/pmix/src/util/pif.h index 57ed1bfd74..fa85771b27 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pif.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pif.h @@ -13,7 +13,7 @@ * reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -46,7 +46,7 @@ BEGIN_C_DECLS (((n) >> 24) & 0x000000FF), (((n) >> 16) & 0x000000FF), \ (((n) >> 8) & 0x000000FF), ((n) & 0x000000FF) -#define PMIX_PIF_ASSEMBLE_NETWORK(n1, n2, n3, n4) \ +#define PMIX_PIF_ASSEMBLE_FABRIC(n1, n2, n3, n4) \ (((n1) << 24) & 0xFF000000) | \ (((n2) << 16) & 0x00FF0000) | \ (((n3) << 8) & 0x0000FF00) | \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c index 2662a86bff..0abde91637 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c @@ -12,7 +12,7 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -23,18 +23,21 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include #include #include +#include +#include "src/class/pmix_list.h" #include "src/util/printf.h" #include "src/util/error.h" #include "src/util/argv.h" #include "src/util/pmix_environ.h" +#include "src/include/pmix_globals.h" #define PMIX_DEFAULT_TMPDIR "/tmp" #define PMIX_MAX_ENVAR_LENGTH 100000 @@ -260,20 +263,109 @@ char **pmix_environ_merge(char **minor, char **major) return (found) ? PMIX_SUCCESS : PMIX_ERR_NOT_FOUND; } -const char* pmix_tmp_directory( void ) +const char* pmix_tmp_directory(void) { const char* str; - if( NULL == (str = getenv("TMPDIR")) ) - if( NULL == (str = getenv("TEMP")) ) - if( NULL == (str = getenv("TMP")) ) + if (NULL == (str = getenv("TMPDIR"))) + if (NULL == (str = getenv("TEMP"))) + if (NULL == (str = getenv("TMP"))) str = PMIX_DEFAULT_TMPDIR; return str; } -const char* pmix_home_directory( void ) +const char* pmix_home_directory(uid_t uid) { - char* home = getenv("HOME"); + const char *home = NULL; + + if (uid == geteuid()) { + home = getenv("HOME"); + } + if (NULL == home) { + struct passwd *pw = getpwuid(uid); + home = pw->pw_dir; + } return home; } + +pmix_status_t pmix_util_harvest_envars(char **incvars, char **excvars, + pmix_list_t *ilist) +{ + int i, j; + size_t len; + pmix_kval_t *kv, *next; + char *cs_env, *string_key; + bool duplicate; + + /* harvest envars to pass along */ + for (j=0; NULL != incvars[j]; j++) { + len = strlen(incvars[j]); + if ('*' == incvars[j][len-1]) { + --len; + } + for (i = 0; NULL != environ[i]; ++i) { + if (0 == strncmp(environ[i], incvars[j], len)) { + cs_env = strdup(environ[i]); + string_key = strchr(cs_env, '='); + if (NULL == string_key) { + free(cs_env); + return PMIX_ERR_BAD_PARAM; + } + *string_key = '\0'; + ++string_key; + /* see if we already have this envar on the list */ + duplicate = false; + PMIX_LIST_FOREACH(kv, ilist, pmix_kval_t) { + if (0 == strcmp(kv->value->data.envar.envar, cs_env)) { + /* if the value is the same, then ignore it */ + if (0 != strcmp(kv->value->data.envar.value, string_key)) { + /* otherwise, overwrite the value */ + free(kv->value->data.envar.value); + kv->value->data.envar.value = strdup(string_key); + } + duplicate = true; + break; + } + } + if (duplicate) { + free(cs_env); + continue; + } + kv = PMIX_NEW(pmix_kval_t); + if (NULL == kv) { + free(cs_env); + return PMIX_ERR_OUT_OF_RESOURCE; + } + kv->key = strdup(PMIX_SET_ENVAR); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + PMIX_RELEASE(kv); + free(cs_env); + return PMIX_ERR_OUT_OF_RESOURCE; + } + kv->value->type = PMIX_ENVAR; + PMIX_ENVAR_LOAD(&kv->value->data.envar, cs_env, string_key, ':'); + pmix_list_append(ilist, &kv->super); + free(cs_env); + } + } + } + + /* now check the exclusions and remove any that match */ + if (NULL != excvars) { + for (j=0; NULL != excvars[j]; j++) { + len = strlen(excvars[j]); + if ('*' == excvars[j][len-1]) { + --len; + } + PMIX_LIST_FOREACH_SAFE(kv, next, ilist, pmix_kval_t) { + if (0 == strncmp(kv->value->data.envar.envar, excvars[j], len)) { + pmix_list_remove_item(ilist, &kv->super); + PMIX_RELEASE(kv); + } + } + } + } + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.h b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.h index 0848116b3e..6f6aa8d70f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -31,14 +31,15 @@ #ifndef PMIX_ENVIRON_H #define PMIX_ENVIRON_H -#include - +#include "src/include/pmix_config.h" +#include #ifdef HAVE_CRT_EXTERNS_H #include #endif -#include +#include "include/pmix_common.h" +#include "src/class/pmix_list.h" BEGIN_C_DECLS @@ -86,7 +87,7 @@ PMIX_EXPORT char **pmix_environ_merge(char **minor, char **major) __pmix_attribu * * \em env is expected to be a NULL-terminated array of pointers * (argv-style). Note that unlike some implementations of - * putenv(3), if \em value is insertted in \em env, it is copied. + * putenv(3), if \em value is inserted in \em env, it is copied. * So the caller can modify/free both \em name and \em value after * pmix_setenv() returns. * @@ -135,8 +136,12 @@ PMIX_EXPORT pmix_status_t pmix_unsetenv(const char *name, char ***env) __pmix_at /* A consistent way to retrieve the home and tmp directory on all supported * platforms. */ -PMIX_EXPORT const char* pmix_home_directory( void ); -PMIX_EXPORT const char* pmix_tmp_directory( void ); +PMIX_EXPORT const char* pmix_home_directory(uid_t uid); +PMIX_EXPORT const char* pmix_tmp_directory(void); + +/* Provide a utility for harvesting envars */ +PMIX_EXPORT pmix_status_t pmix_util_harvest_envars(char **incvars, char **excvars, + pmix_list_t *ilist); /* Some care is needed with environ on OS X when dealing with shared libraries. Handle that care here... */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.c b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.c new file mode 100644 index 0000000000..58e8d5143e --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.c @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2005 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "src/include/pmix_config.h" + +#ifdef HAVE_SYS_CDEFS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#include +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_TERMIOS_H +# include +#else +# ifdef HAVE_TERMIO_H +# include +# endif +#endif +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#include +# include +#ifdef HAVE_GRP_H +#include +#endif +#ifdef HAVE_PTY_H +#include +#endif +#ifdef HAVE_UTMP_H +#include +#endif + +#ifdef HAVE_PTSNAME +# include +# ifdef HAVE_STROPTS_H +# include +# endif +#endif + +#ifdef HAVE_UTIL_H +#include +#endif + +#include "src/util/pmix_pty.h" + +/* The only public interface is openpty - all others are to support + openpty() */ + +#if PMIX_ENABLE_PTY_SUPPORT == 0 + +int pmix_openpty(int *amaster, int *aslave, char *name, + void *termp, void *winpp) +{ + return -1; +} + +#elif defined(HAVE_OPENPTY) + +int pmix_openpty(int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp) +{ + return openpty(amaster, aslave, name, termp, winp); +} + +#else + +/* implement openpty in terms of ptym_open and ptys_open */ + +static int ptym_open(char *pts_name); +static int ptys_open(int fdm, char *pts_name); + +int pmix_openpty(int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp) +{ + char line[20]; + *amaster = ptym_open(line); + if (*amaster < 0) { + return -1; + } + *aslave = ptys_open(*amaster, line); + if (*aslave < 0) { + close(*amaster); + return -1; + } + if (name) { + // We don't know the max length of name, but we do know the + // max length of the source, so at least use that. + pmix_string_copy(name, line, sizeof(line)); + } +#ifndef TCSAFLUSH +#define TCSAFLUSH TCSETAF +#endif + if (termp) { + (void) tcsetattr(*aslave, TCSAFLUSH, termp); + } +#ifdef TIOCSWINSZ + if (winp) { + (void) ioctl(*aslave, TIOCSWINSZ, (char *) winp); + } +#endif + return 0; +} + + +static int ptym_open(char *pts_name) +{ + int fdm; +#ifdef HAVE_PTSNAME + char *ptr; + +#ifdef _AIX + strcpy(pts_name, "/dev/ptc"); +#else + strcpy(pts_name, "/dev/ptmx"); +#endif + fdm = open(pts_name, O_RDWR); + if (fdm < 0) { + return -1; + } + if (grantpt(fdm) < 0) { /* grant access to slave */ + close(fdm); + return -2; + } + if (unlockpt(fdm) < 0) { /* clear slave's lock flag */ + close(fdm); + return -3; + } + ptr = ptsname(fdm); + if (ptr == NULL) { /* get slave's name */ + close(fdm); + return -4; + } + strcpy(pts_name, ptr); /* return name of slave */ + return fdm; /* return fd of master */ +#else + char *ptr1, *ptr2; + + strcpy(pts_name, "/dev/ptyXY"); + /* array index: 012345689 (for references in following code) */ + for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++) { + pts_name[8] = *ptr1; + for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++) { + pts_name[9] = *ptr2; + /* try to open master */ + fdm = open(pts_name, O_RDWR); + if (fdm < 0) { + if (errno == ENOENT) { /* different from EIO */ + return -1; /* out of pty devices */ + } else { + continue; /* try next pty device */ + } + } + pts_name[5] = 't'; /* chage "pty" to "tty" */ + return fdm; /* got it, return fd of master */ + } + } + return -1; /* out of pty devices */ +#endif +} + + +static int ptys_open(int fdm, char *pts_name) +{ + int fds; +#ifdef HAVE_PTSNAME + /* following should allocate controlling terminal */ + fds = open(pts_name, O_RDWR); + if (fds < 0) { + close(fdm); + return -5; + } +#if defined(__SVR4) && defined(__sun) + if (ioctl(fds, I_PUSH, "ptem") < 0) { + close(fdm); + close(fds); + return -6; + } + if (ioctl(fds, I_PUSH, "ldterm") < 0) { + close(fdm); + close(fds); + return -7; + } +#endif + + return fds; +#else + int gid; + struct group *grptr; + + grptr = getgrnam("tty"); + if (grptr != NULL) { + gid = grptr->gr_gid; + } else { + gid = -1; /* group tty is not in the group file */ + } + /* following two functions don't work unless we're root */ + chown(pts_name, getuid(), gid); + chmod(pts_name, S_IRUSR | S_IWUSR | S_IWGRP); + fds = open(pts_name, O_RDWR); + if (fds < 0) { + close(fdm); + return -1; + } + return fds; +#endif +} + +#endif /* #ifdef HAVE_OPENPTY */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.h b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.h new file mode 100644 index 0000000000..488c992bd5 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_pty.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2006 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2019-2020 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_UTIL_PTY_H +#define PMIX_UTIL_PTY_H + +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" + +#ifdef HAVE_UTIL_H +#include +#endif +#ifdef HAVE_LIBUTIL_H +#include +#endif +#ifdef HAVE_TERMIOS_H +# include +#else +# ifdef HAVE_TERMIO_H +# include +# endif +#endif + +BEGIN_C_DECLS + +#if PMIX_ENABLE_PTY_SUPPORT + +PMIX_EXPORT int pmix_openpty(int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp); + +#else + +PMIX_EXPORT int pmix_openpty(int *amaster, int *aslave, char *name, + void *termp, void *winpp); + +#endif + +END_C_DECLS + +#endif /* PMIX_UTIL_PTY_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/printf.c b/opal/mca/pmix/pmix3x/pmix/src/util/printf.c index 410c952154..4077acf218 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/printf.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/printf.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +22,7 @@ * Buffer safe printf functions for portability to archaic platforms. */ -#include +#include "src/include/pmix_config.h" #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/printf.h b/opal/mca/pmix/pmix3x/pmix/src/util/printf.h index 9c1c9c31f7..b72e05cb53 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/printf.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/printf.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -25,8 +25,8 @@ #ifndef PMIX_PRINTF_H #define PMIX_PRINTF_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c index ae95ac691b..fae6796ba7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,7 +20,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #include @@ -34,7 +34,7 @@ #include "src/util/argv.h" #include "src/util/os_path.h" #include "src/util/output.h" -#include "pmix_common.h" +#include "include/pmix_common.h" /* @@ -48,15 +48,6 @@ static char **search_dirs = NULL; /* * Local functions */ -static int pmix_show_vhelp_internal(const char *filename, const char *topic, - int want_error_header, va_list arglist); -static int pmix_show_help_internal(const char *filename, const char *topic, - int want_error_header, ...); - -pmix_show_help_fn_t pmix_show_help = pmix_show_help_internal; -pmix_show_vhelp_fn_t pmix_show_vhelp = pmix_show_vhelp_internal; - - int pmix_show_help_init(void) { pmix_output_stream_t lds; @@ -337,8 +328,8 @@ char *pmix_show_help_string(const char *filename, const char *topic, return output; } -static int pmix_show_vhelp_internal(const char *filename, const char *topic, - int want_error_header, va_list arglist) +int pmix_show_vhelp(const char *filename, const char *topic, + int want_error_header, va_list arglist) { char *output; @@ -355,18 +346,25 @@ static int pmix_show_vhelp_internal(const char *filename, const char *topic, return (NULL == output) ? PMIX_ERROR : PMIX_SUCCESS; } -static int pmix_show_help_internal(const char *filename, const char *topic, - int want_error_header, ...) +int pmix_show_help(const char *filename, const char *topic, + int want_error_header, ...) { va_list arglist; - int rc; + char *output; - /* Convert it to a single string */ va_start(arglist, want_error_header); - rc = pmix_show_vhelp(filename, topic, want_error_header, arglist); + output = pmix_show_help_vstring(filename, topic, want_error_header, + arglist); va_end(arglist); - return rc; + /* If nothing came back, there's nothing to do */ + if (NULL == output) { + return PMIX_SUCCESS; + } + + fprintf(stderr, "%s\n", output); + free(output); + return PMIX_SUCCESS; } int pmix_show_help_add_dir(const char *directory) diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h index 1129a762a7..8f7c560509 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -90,8 +90,8 @@ #ifndef PMIX_SHOW_HELP_H #define PMIX_SHOW_HELP_H -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #include @@ -135,17 +135,15 @@ PMIX_EXPORT int pmix_show_help_finalize(void); * promotion to va_start() has undefined behavior (according to clang * warnings on MacOS High Sierra). */ -typedef int (*pmix_show_help_fn_t)(const char *filename, const char *topic, - int want_error_header, ...); -PMIX_EXPORT extern pmix_show_help_fn_t pmix_show_help; +PMIX_EXPORT int pmix_show_help(const char *filename, const char *topic, + int want_error_header, ...); /** * This function does the same thing as pmix_show_help(), but accepts * a va_list form of varargs. */ -typedef int (*pmix_show_vhelp_fn_t)(const char *filename, const char *topic, - int want_error_header, va_list ap); -PMIX_EXPORT extern pmix_show_vhelp_fn_t pmix_show_vhelp; +PMIX_EXPORT int pmix_show_vhelp(const char *filename, const char *topic, + int want_error_header, va_list ap); /** * This function does the same thing as pmix_show_help(), but returns diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.h b/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.h index a507e4ddd8..5cba249c29 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,8 @@ #ifndef PMIX_SHOW_HELP_LEX_H #define PMIX_SHOW_HELP_LEX_H -#include +#include "src/include/pmix_config.h" +#include "include/pmix_common.h" #ifdef malloc #undef malloc @@ -35,14 +36,14 @@ #include BEGIN_C_DECLS -int pmix_show_help_yylex(void); -int pmix_show_help_init_buffer(FILE *file); -int pmix_show_help_yylex_destroy(void); +PMIX_EXPORT int pmix_show_help_yylex(void); +PMIX_EXPORT int pmix_show_help_init_buffer(FILE *file); +PMIX_EXPORT int pmix_show_help_yylex_destroy(void); -extern FILE *pmix_show_help_yyin; -extern bool pmix_show_help_parse_done; -extern char *pmix_show_help_yytext; -extern int pmix_show_help_yynewlines; +PMIX_EXPORT extern FILE *pmix_show_help_yyin; +PMIX_EXPORT extern bool pmix_show_help_parse_done; +PMIX_EXPORT extern char *pmix_show_help_yytext; +PMIX_EXPORT extern int pmix_show_help_yynewlines; /* * Make lex-generated files not issue compiler warnings diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.l b/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.l index d48130f0d8..adc36a4304 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.l +++ b/opal/mca/pmix/pmix3x/pmix/src/util/show_help_lex.l @@ -13,7 +13,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,7 +21,7 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" #include #ifdef HAVE_UNISTD_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/strnlen.h b/opal/mca/pmix/pmix3x/pmix/src/util/strnlen.h index b467fbf339..bd4aca8933 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/strnlen.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/strnlen.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,7 +15,7 @@ #ifndef PMIX_STRNLEN_H #define PMIX_STRNLEN_H -#include +#include "src/include/pmix_config.h" #if defined(HAVE_STRNLEN) #define PMIX_STRNLEN(c, a, b) \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/timings.c b/opal/mca/pmix/pmix3x/pmix/src/util/timings.c index 10779bbe76..b4e1cc096f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/timings.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/timings.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2014 Artem Polyakov - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -8,9 +8,9 @@ * $HEADER$ */ -#include +#include "src/include/pmix_config.h" -#include +#include "include/pmix_common.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/timings.h b/opal/mca/pmix/pmix3x/pmix/src/util/timings.h index 87e7621430..44237682cc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/timings.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/timings.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2014 Artem Polyakov - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -13,7 +13,7 @@ #ifndef PMIX_UTIL_TIMING_H #define PMIX_UTIL_TIMING_H -#include +#include "src/include/pmix_config.h" #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am index c886e3b1fb..6a7f3708ac 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -25,6 +25,7 @@ if !WANT_HIDDEN # these tests use internal symbols # use --disable-visibility SUBDIRS = simple + endif headers = test_common.h cli_stages.h server_callbacks.h utils.h test_fence.h \ @@ -47,9 +48,9 @@ noinst_SCRIPTS = pmix_client_otheruser.sh \ run_tests10.pl \ run_tests11.pl \ run_tests12.pl \ - run_tests13.pl \ - run_tests14.pl \ - run_tests15.pl + run_tests13.pl +# run_tests14.pl \ +# run_tests15.pl noinst_PROGRAMS = @@ -81,9 +82,9 @@ TESTS = \ run_tests10.pl \ run_tests11.pl \ run_tests12.pl \ - run_tests13.pl \ - run_tests14.pl \ - run_tests15.pl + run_tests13.pl +# run_tests14.pl \ +# run_tests15.pl ########################## diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h index c66fc2ca21..2c9657c075 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h @@ -15,7 +15,7 @@ #ifndef CLI_STAGES_H #define CLI_STAGES_H -#include +#include #include #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c index dc7f54c90c..61573ec73d 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c @@ -22,7 +22,7 @@ * $HEADER$ * */ -#include +#include #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in index d472b21b1f..dc4cad95ca 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in @@ -70,12 +70,12 @@ my @paths = split(/:/, $ENV{PATH}); foreach my $p (@paths) { my $fullpath = $p . "/" . "gtimeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } else { my $fullpath = $p . "/" . "timeout"; if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + $timeout_cmd = $fullpath . " --preserve-status -k 500 450 "; last; } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in deleted file mode 100755 index d472b21b1f..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright (c) 2019 Intel, Inc. -# -# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved -# $COPYRIGHT$ -# -# Additional copyrights may follow - -use strict; - -my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", - "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", - "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", - "-n 4 --ns-dist 3:1 --fence \"[0:]\"", - "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", - "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", - "-n 4 --job-fence -c", - "-n 4 --job-fence", - "-n 2 --test-publish", - "-n 2 --test-spawn", - "-n 2 --test-connect", - "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", - "-n 5 --test-replace 100:0,1,10,50,99", - "-n 5 --test-internal 10", - "-s 1 -n 2 --job-fence", - "-s 1 -n 2 --job-fence -c"); - -my $test; -my $cmd; -my $output; -my $status = 0; -my $testnum; -my $timeout_cmd = ""; - -# We are running tests against the build tree (vs. the installation -# tree). Autogen gives us a full list of all possible component -# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each -# of those directories: 1) to see if there is actually a component -# built in there, and 2) to turn it into an absolute path name. Then -# put the new list in the "mca_bast_component_path" MCA parameter env -# variable so that the MCA base knows where to find all the -# components. -my @myfullpaths; -my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; -my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; -my @splitstr = split(':', $mypathstr); -foreach my $path (@splitstr) { - # Note that the component is actually built in the ".libs" - # subdirectory. If the component wasn't built, that subdirectory - # will not exist, so don't save it. - my $fullpath = $mybuilddir . "/" . $path . "/.libs"; - push(@myfullpaths, $fullpath) - if (-d $fullpath); -} -my $mymcapaths = join(":", @myfullpaths); -$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; - -my $wdir = $mybuilddir . "/test"; -chdir $wdir; - -$testnum = $0; -$testnum =~ s/.pl//; -$testnum = substr($testnum, -2); -$test = @tests[$testnum]; - -# find the timeout or gtimeout cmd so we can timeout the -# test if it hangs -my @paths = split(/:/, $ENV{PATH}); -foreach my $p (@paths) { - my $fullpath = $p . "/" . "gtimeout"; - if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; - last; - } else { - my $fullpath = $p . "/" . "timeout"; - if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; - last; - } - } -} - -$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; -print $cmd . "\n"; -$output = `$cmd`; -print $output . "\n"; -print "CODE $?\n"; -$status = "$?"; - -exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in deleted file mode 100755 index d472b21b1f..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env perl -# -# Copyright (c) 2019 Intel, Inc. -# -# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved -# $COPYRIGHT$ -# -# Additional copyrights may follow - -use strict; - -my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", - "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", - "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", - "-n 4 --ns-dist 3:1 --fence \"[0:]\"", - "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", - "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", - "-n 4 --job-fence -c", - "-n 4 --job-fence", - "-n 2 --test-publish", - "-n 2 --test-spawn", - "-n 2 --test-connect", - "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", - "-n 5 --test-replace 100:0,1,10,50,99", - "-n 5 --test-internal 10", - "-s 1 -n 2 --job-fence", - "-s 1 -n 2 --job-fence -c"); - -my $test; -my $cmd; -my $output; -my $status = 0; -my $testnum; -my $timeout_cmd = ""; - -# We are running tests against the build tree (vs. the installation -# tree). Autogen gives us a full list of all possible component -# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each -# of those directories: 1) to see if there is actually a component -# built in there, and 2) to turn it into an absolute path name. Then -# put the new list in the "mca_bast_component_path" MCA parameter env -# variable so that the MCA base knows where to find all the -# components. -my @myfullpaths; -my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; -my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; -my @splitstr = split(':', $mypathstr); -foreach my $path (@splitstr) { - # Note that the component is actually built in the ".libs" - # subdirectory. If the component wasn't built, that subdirectory - # will not exist, so don't save it. - my $fullpath = $mybuilddir . "/" . $path . "/.libs"; - push(@myfullpaths, $fullpath) - if (-d $fullpath); -} -my $mymcapaths = join(":", @myfullpaths); -$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; - -my $wdir = $mybuilddir . "/test"; -chdir $wdir; - -$testnum = $0; -$testnum =~ s/.pl//; -$testnum = substr($testnum, -2); -$test = @tests[$testnum]; - -# find the timeout or gtimeout cmd so we can timeout the -# test if it hangs -my @paths = split(/:/, $ENV{PATH}); -foreach my $p (@paths) { - my $fullpath = $p . "/" . "gtimeout"; - if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; - last; - } else { - my $fullpath = $p . "/" . "timeout"; - if ((-e $fullpath) && (-f $fullpath)) { - $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; - last; - } - } -} - -$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; -print $cmd . "\n"; -$output = `$cmd`; -print $output . "\n"; -print "CODE $?\n"; -$status = "$?"; - -exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am index ee02966803..25b806724f 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2020 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -28,91 +28,91 @@ noinst_PROGRAMS = simptest simpclient simppub simpdyn simpft simpdmodex \ gwtest gwclient stability quietclient simpjctrl \ pmitest -simptest_SOURCES = $(headers) \ +simptest_SOURCES = \ simptest.c simptest_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simptest_LDADD = \ $(top_builddir)/src/libpmix.la -simpclient_SOURCES = $(headers) \ +simpclient_SOURCES = \ simpclient.c simpclient_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simpclient_LDADD = \ $(top_builddir)/src/libpmix.la -simppub_SOURCES = $(headers) \ +simppub_SOURCES = \ simppub.c simppub_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simppub_LDADD = \ $(top_builddir)/src/libpmix.la -simpdmodex_SOURCES = $(headers) \ +simpdmodex_SOURCES = \ simpdmodex.c simpdmodex_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simpdmodex_LDADD = \ $(top_builddir)/src/libpmix.la -simpft_SOURCES = $(headers) \ +simpft_SOURCES = \ simpft.c simpft_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simpft_LDADD = \ $(top_builddir)/src/libpmix.la -simpdyn_SOURCES = $(headers) \ +simpdyn_SOURCES = \ simpdyn.c simpdyn_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simpdyn_LDADD = \ $(top_builddir)/src/libpmix.la -test_pmix_SOURCES = $(headers) \ +test_pmix_SOURCES = \ test_pmix.c test_pmix_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) test_pmix_LDADD = \ $(top_builddir)/src/libpmix.la -simptool_SOURCES = $(headers) \ +simptool_SOURCES = \ simptool.c simptool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simptool_LDADD = \ $(top_builddir)/src/libpmix.la -simpdie_SOURCES = $(headers) \ +simpdie_SOURCES = \ simpdie.c simpdie_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simpdie_LDADD = \ $(top_builddir)/src/libpmix.la -simplegacy_SOURCES = $(headers) \ +simplegacy_SOURCES = \ simplegacy.c simplegacy_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simplegacy_LDADD = \ $(top_builddir)/src/libpmi.la -simptimeout_SOURCES = $(headers) \ +simptimeout_SOURCES = \ simptimeout.c simptimeout_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simptimeout_LDADD = \ $(top_builddir)/src/libpmix.la -gwtest_SOURCES = $(headers) \ +gwtest_SOURCES = \ gwtest.c gwtest_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) gwtest_LDADD = \ $(top_builddir)/src/libpmix.la -gwclient_SOURCES = $(headers) \ +gwclient_SOURCES = \ gwclient.c gwclient_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) gwclient_LDADD = \ $(top_builddir)/src/libpmix.la -stability_SOURCES = $(headers) \ +stability_SOURCES = \ stability.c stability_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) stability_LDADD = \ $(top_builddir)/src/libpmix.la -quietclient_SOURCES = $(headers) \ +quietclient_SOURCES = \ quietclient.c quietclient_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) quietclient_LDADD = \ diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/gwclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/gwclient.c index 8fc3f08762..dfcf1fcdcc 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/gwclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/gwclient.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include @@ -35,7 +35,6 @@ #include "src/util/output.h" #include "src/util/printf.h" -static volatile bool completed = false; static pmix_proc_t myproc; int main(int argc, char **argv) diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c index 3d9f8ee8d7..0b15467671 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c @@ -25,10 +25,10 @@ * */ -#include +#include "src/include/pmix_config.h" #include -#include -#include +#include "src/include/types.h" +#include "src/include/pmix_globals.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c index d91e7e58e3..dd78ae8a9c 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,20 @@ * */ -#include -#include +/****** FUNCTIONS TESTED ****/ +/* + * PMIx_Init + * PMIx_Get + * PMIx_Register_event_handler + * PMIx_Store_internal + * PMIx_Put + * PMIx_Commit + * PMIx_Fence + * PMIx_Finalize + */ + +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c index 45b7429285..d6ccab3a08 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c @@ -15,6 +15,8 @@ * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,8 +25,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include @@ -56,17 +58,6 @@ static void notification_fn(size_t evhdlr_registration_id, completed = true; } -static void errhandler_reg_callbk(pmix_status_t status, - size_t errhandler_ref, - void *cbdata) -{ - volatile bool *active = (volatile bool*)cbdata; - - pmix_output(0, "Client: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu", - status, (unsigned long)errhandler_ref); - *active = false; -} - static void opcbfunc(pmix_status_t status, void *cbdata) { volatile bool *active = (volatile bool*)cbdata; @@ -109,18 +100,6 @@ static void model_callback(size_t evhdlr_registration_id, } } -/* event handler registration is done asynchronously */ -static void model_registration_callback(pmix_status_t status, - size_t evhandler_ref, - void *cbdata) -{ - volatile int *active = (volatile int*)cbdata; - - fprintf(stderr, "simpclient EVENT HANDLER REGISTRATION RETURN STATUS %d, ref=%lu\n", - status, (unsigned long)evhandler_ref); - *active = false; -} - int main(int argc, char **argv) { int rc; @@ -158,8 +137,7 @@ int main(int argc, char **argv) pmix_output(0, "Client ns %s rank %d: Running on node %s", myproc.nspace, myproc.rank, pmix_globals.hostname); /* test something */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; + PMIX_LOAD_PROCID(&proc, myproc.nspace, PMIX_RANK_WILDCARD); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); @@ -171,7 +149,7 @@ int main(int argc, char **argv) /* test something */ if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_SERVER_URI, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s", + pmix_output(0, "Client ns %s rank %d: PMIx_Get server URI failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); exit(rc); } @@ -195,26 +173,17 @@ int main(int argc, char **argv) PMIX_VALUE_RELEASE(val); /* register a handler specifically for when models declare */ - active = true; ninfo = 1; PMIX_INFO_CREATE(iptr, ninfo); PMIX_INFO_LOAD(&iptr[0], PMIX_EVENT_HDLR_NAME, "SIMPCLIENT-MODEL", PMIX_STRING); code = PMIX_MODEL_DECLARED; PMIx_Register_event_handler(&code, 1, iptr, ninfo, - model_callback, model_registration_callback, (void*)&active); - while (active) { - usleep(10); - } + model_callback, NULL, NULL); PMIX_INFO_FREE(iptr, ninfo); /* register our errhandler */ - active = true; PMIx_Register_event_handler(NULL, 0, NULL, 0, - notification_fn, errhandler_reg_callbk, (void*)&active); - while (active) { - usleep(10); - } - + notification_fn, NULL, NULL); /* put a few values */ (void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank); diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c index cb0ae49022..8f2b1730dd 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c index 2a7e067d14..877f79b1fb 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c index ef5286dd6e..b6895fa719 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c index a6acf5f89c..43a0570423 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c index 037f7eae38..596d1512e7 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -31,7 +31,7 @@ #include #include -#include +#include "include/pmix.h" #include "simptest.h" static pmix_proc_t myproc; diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c index 98f40a15dd..1b2e901725 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,7 +23,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c index 2ccf9b258f..645f94ad5a 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index 1cbb4e78ce..a714b424d2 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -25,10 +25,10 @@ * */ -#include +#include "src/include/pmix_config.h" #include -#include -#include +#include "src/include/types.h" +#include "src/include/pmix_globals.h" #include #include @@ -40,7 +40,7 @@ #include #if PMIX_HAVE_HWLOC -#include +#include "src/hwloc/hwloc-internal.h" #endif #include "src/class/pmix_list.h" @@ -258,7 +258,9 @@ static void infocbfunc(pmix_status_t status, * server */ x = PMIX_NEW(myxfer_t); x->ninfo = ninfo; - PMIX_INFO_CREATE(x->info, x->ninfo); + if (0 < ninfo) { + PMIX_INFO_CREATE(x->info, x->ninfo); + } for (n=0; n < ninfo; n++) { PMIX_INFO_XFER(&x->info[n], &info[n]); } diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.h b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.h deleted file mode 100644 index 89f1c00dd3..0000000000 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ - -#include -#include -#include -#include -#include - -typedef struct { - pthread_mutex_t mutex; - pthread_cond_t cond; - volatile bool active; - pmix_status_t status; -} mylock_t; - -#define DEBUG_CONSTRUCT_LOCK(l) \ - do { \ - pthread_mutex_init(&(l)->mutex, NULL); \ - pthread_cond_init(&(l)->cond, NULL); \ - (l)->active = true; \ - (l)->status = PMIX_SUCCESS; \ - } while(0) - -#define DEBUG_DESTRUCT_LOCK(l) \ - do { \ - pthread_mutex_destroy(&(l)->mutex); \ - pthread_cond_destroy(&(l)->cond); \ - } while(0) - -#define DEBUG_WAIT_THREAD(lck) \ - do { \ - pthread_mutex_lock(&(lck)->mutex); \ - while ((lck)->active) { \ - pthread_cond_wait(&(lck)->cond, &(lck)->mutex); \ - } \ - pthread_mutex_unlock(&(lck)->mutex); \ - } while(0) - -#define DEBUG_WAKEUP_THREAD(lck) \ - do { \ - pthread_mutex_lock(&(lck)->mutex); \ - (lck)->active = false; \ - pthread_cond_broadcast(&(lck)->cond); \ - pthread_mutex_unlock(&(lck)->mutex); \ - } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c index 10835d68ab..ed6739cf37 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,8 +23,8 @@ * */ -#include -#include +#include "src/include/pmix_config.h" +#include "include/pmix.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c index 9e96d21ee7..631a307acc 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c @@ -23,7 +23,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c b/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c index c97df8c74f..31ec0ce44a 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c @@ -25,10 +25,10 @@ * */ -#include +#include "src/include/pmix_config.h" #include -#include -#include +#include "src/include/types.h" +#include "src/include/pmix_globals.h" #include #include @@ -41,7 +41,7 @@ #include PMIX_EVENT_HEADER #if PMIX_HAVE_HWLOC -#include +#include "src/hwloc/hwloc-internal.h" #endif #include "src/class/pmix_list.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/test_pmix.c b/opal/mca/pmix/pmix3x/pmix/test/simple/test_pmix.c index 8ecf6c1f6b..61b41c2777 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/test_pmix.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/test_pmix.c @@ -1,6 +1,6 @@ #include -#include +#include "include/pmix.h" #include int main(int argc, char **argv) diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_cd.h b/opal/mca/pmix/pmix3x/pmix/test/test_cd.h index e321e02e58..9a855d1a9a 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_cd.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_cd.h @@ -8,7 +8,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.c b/opal/mca/pmix/pmix3x/pmix/test/test_common.c index ca594bcad5..157e4eca7e 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.c @@ -12,7 +12,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.h b/opal/mca/pmix/pmix3x/pmix/test/test_common.h index 2d6a33af0f..c990d197d5 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.h @@ -17,7 +17,7 @@ #ifndef TEST_COMMON_H #define TEST_COMMON_H -#include +#include "src/include/pmix_config.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_error.h b/opal/mca/pmix/pmix3x/pmix/test/test_error.h index ed17831a08..ebb9a271bb 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_error.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_error.h @@ -8,7 +8,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_fence.h b/opal/mca/pmix/pmix3x/pmix/test/test_fence.h index ec273c2d6b..30c7a15f27 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_fence.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_fence.h @@ -10,7 +10,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_internal.h b/opal/mca/pmix/pmix3x/pmix/test/test_internal.h index 6d6095254c..5224d64609 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_internal.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_internal.h @@ -9,7 +9,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_publish.c b/opal/mca/pmix/pmix3x/pmix/test/test_publish.c index 8846cc4615..af9c332c43 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_publish.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_publish.c @@ -12,7 +12,7 @@ #include "test_publish.h" #include -#include +#include "src/include/pmix_globals.h" typedef struct { int in_progress; diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_publish.h b/opal/mca/pmix/pmix3x/pmix/test/test_publish.h index bd436b8a3c..7a2664f9a7 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_publish.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_publish.h @@ -10,7 +10,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_replace.h b/opal/mca/pmix/pmix3x/pmix/test/test_replace.h index 0d9ddef577..2d10d043bd 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_replace.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_replace.h @@ -9,7 +9,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_resolve_peers.h b/opal/mca/pmix/pmix3x/pmix/test/test_resolve_peers.h index d92883610e..95edc71550 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_resolve_peers.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_resolve_peers.h @@ -10,7 +10,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_spawn.h b/opal/mca/pmix/pmix3x/pmix/test/test_spawn.h index d074be2a3b..7e51ff2da2 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_spawn.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_spawn.h @@ -10,7 +10,7 @@ * */ -#include +#include "src/include/pmix_config.h" #include #include "test_common.h" From 60ee1332557ef2da254b17834839b9cd550efc62 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Fri, 30 Oct 2020 13:19:01 -0500 Subject: [PATCH 2/2] Disable man pages for internal OpenPMIx Signed-off-by: Joshua Hursey --- opal/mca/pmix/pmix3x/configure.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opal/mca/pmix/pmix3x/configure.m4 b/opal/mca/pmix/pmix3x/configure.m4 index 8ad5343b6a..507ec0fa4d 100644 --- a/opal/mca/pmix/pmix3x/configure.m4 +++ b/opal/mca/pmix/pmix3x/configure.m4 @@ -16,6 +16,7 @@ # Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015-2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2020 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -60,6 +61,9 @@ AC_DEFUN([MCA_opal_pmix_pmix3x_CONFIG],[ [opal_pmix_pmix3x_args="--with-devel-headers $opal_pmix_pmix3x_args"]) CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS" + # OpenPMIx Man pages are not needed when embedded. Avoids pandoc check + opal_pmix_pmix3x_args="--disable-man-pages $opal_pmix_pmix3x_args" + OPAL_CONFIG_SUBDIR([$opal_pmix_pmix3x_basedir/pmix], [$opal_pmix_pmix3x_args $opal_subdir_args 'CFLAGS=$CFLAGS' 'CPPFLAGS=$CPPFLAGS'], [opal_pmix_pmix3x_happy=1], [opal_pmix_pmix3x_happy=0])