From 8b786cac04bdec0aef2e555e38e2f725ebfa836c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 27 Sep 2008 11:19:21 +0000 Subject: [PATCH] The configure test we had for checking whether openib could build (related to the presence of posix threads and ptmalloc2) is now a little outdated: since we don't build ptmalloc2 as part of libopal anymore, the openib BTL's requirements are not directly tied to ptmalloc2's anymore. Specifically, I altered the test to: 1. At compile time, if no threads are found, the ptmalloc2 component is going to be built, '''and the ptmalloc2 component is going to be inside libopal,''' then refuse to build the openib BTL. 1. At run time, if no threads were available at compile time and the ptmalloc2 component is part of the process, then refuse to use the openib BTL. Fixes trac:1537. This commit was SVN r19652. The following Trac tickets were found above: Ticket 1537 --> https://svn.open-mpi.org/trac/ompi/ticket/1537 --- config/ompi_check_openib.m4 | 16 ++++++++++++---- ompi/mca/btl/openib/btl_openib_component.c | 15 ++++++++++++++- ompi/mca/btl/openib/help-mpi-btl-openib.txt | 9 +++++++++ 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/config/ompi_check_openib.m4 b/config/ompi_check_openib.m4 index c72d0a2747..c42fb2144b 100644 --- a/config/ompi_check_openib.m4 +++ b/config/ompi_check_openib.m4 @@ -76,10 +76,18 @@ AC_DEFUN([OMPI_CHECK_OPENIB],[ AS_IF([test "$ompi_check_openib_happy" = "yes"], [AS_IF([test "$THREAD_TYPE" != "posix" -a "$memory_ptmalloc2_happy" = "yes"], - [AC_MSG_WARN([POSIX Threads disabled but PTMalloc2 enabled.]) - AC_MSG_WARN([This will cause memory corruption with OpenFabrics.]) - AC_MSG_WARN([Not building component.]) - ompi_check_openib_happy="no"])]) + [AS_IF([test "$enable_ptmalloc2_internal" = "yes"], + [AC_MSG_WARN([POSIX threads are disabled, but]) + AC_MSG_WARN([--enable-ptmalloc2-internal was specified. This will]) + AC_MSG_WARN([cause memory corruption with OpenFabrics.]) + AC_MSG_WARN([Not building component.]) + ompi_check_openib_happy="no"], + [AC_MSG_WARN([POSIX threads are disabled, but the ptmalloc2 memory]) + AC_MSG_WARN([manager is being built. Compiling MPI applications with]) + AC_MSG_WARN([-lopenmpi-malloc will result in memory corruption; Open]) + AC_MSG_WARN([MPI will disable the openib BTL at run-time if such a]) + AC_MSG_WARN([combination is detected.]) + AC_MSG_WARN([You have been warned.])])])]) AS_IF([test "$ompi_check_openib_happy" = "yes"], [AC_CHECK_HEADERS( diff --git a/ompi/mca/btl/openib/btl_openib_component.c b/ompi/mca/btl/openib/btl_openib_component.c index 1ce9ff542b..9df7f32b67 100644 --- a/ompi/mca/btl/openib/btl_openib_component.c +++ b/ompi/mca/btl/openib/btl_openib_component.c @@ -1988,6 +1988,20 @@ btl_openib_component_init(int *num_btl_modules, goto no_btls; } + /* If we are using ptmalloc2 and there are no posix threads + available, this will cause memory corruption. Refuse to run. + Right now, ptmalloc2 is the only memory manager that we have on + OS's that support OpenFabrics that provide both FREE and MUNMAP + support, so the following test is [currently] good enough... */ + value = opal_mem_hooks_support_level(); + if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == + ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & value)) { + orte_show_help("help-mpi-btl-openib.txt", + "ptmalloc2 with no threads", true, + orte_process_info.nodename); + goto no_btls; + } + /* If we have a memory manager available, and mpi_leave_pinned==-1, then unless the user explicitly set mpi_leave_pinned_pipeline==0, then set mpi_leave_pinned to 1. @@ -1995,7 +2009,6 @@ btl_openib_component_init(int *num_btl_modules, We have a memory manager if: - we have both FREE and MUNMAP support - we have MUNMAP support and the linux mallopt */ - value = opal_mem_hooks_support_level(); if (((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & value)) || (0 != (OPAL_MEMORY_MUNMAP_SUPPORT & value) && diff --git a/ompi/mca/btl/openib/help-mpi-btl-openib.txt b/ompi/mca/btl/openib/help-mpi-btl-openib.txt index 1785b69bf5..1b5d5a2691 100644 --- a/ompi/mca/btl/openib/help-mpi-btl-openib.txt +++ b/ompi/mca/btl/openib/help-mpi-btl-openib.txt @@ -543,3 +543,12 @@ support. Short eager RDMA is not yet supported with progress threads; its use has been disabled in this job. This is a warning only; you job will attempt to continue. +# +[ptmalloc2 with no threads] +WARNING: It appears that ptmalloc2 was compiled into this process via +-lopenmpi-malloc, but there is no thread support. This combination is +known to cause memory corruption in the openib BTL. Open MPI is +therefore disabling the use of the openib BTL in this process for this +run. + + Local host: %s