0d52271cd6
and https://svn.open-mpi.org/trac/ompi/ticket/1853, mallopt() hints do not always work -- it is possible for memory to be returned to the OS and therefore OMPI's registration cache becomes invalid. This commit removes all use of mallopt() and uses a different way to integrate ptmalloc2 than we have done in the past. In particular, we use almost exactly the same technique as MX: * Remove all uses of mallopt, to include the opal/memory mallopt component. * Name-shift all of OMPI's internal ptmalloc2 public symbols (e.g., malloc -> opal_memory_ptmalloc2_malloc). * At run-time, use the existing glibc allocator malloc hook function pointers to fully hijack the glibc allocator with our own name-shifted ptmalloc2. * Make the decision whether to hijack the glibc allocator ''at run time'' (vs. at link time, as previous ptmalloc2 integration attempts have done). Look at the OMPI_MCA_mpi_leave_pinned and OMPI_MCA_mpi_leave_pinned_pipeline environment variables and the existence of /sys/class/infiniband to determine if we should install the hooks or not. * As an added bonus, we can now tell if libopen-pal is linked statically or dynamically, and if we're linked statically, we assume that munmap intercept support doesn't work. See the opal/mca/memory/ptmalloc2/README-open-mpi.txt file for all the gory details about the implementation. Fixes trac:1853. This commit was SVN r20921. The following Trac tickets were found above: Ticket 1853 --> https://svn.open-mpi.org/trac/ompi/ticket/1853
90 строки
2.7 KiB
Makefile
90 строки
2.7 KiB
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$
|
|
#
|
|
# Additional copyrights may follow
|
|
#
|
|
# $HEADER$
|
|
#
|
|
|
|
AM_CPPFLAGS = -DMALLOC_DEBUG=0
|
|
|
|
if OMPI_HAVE_POSIX_THREADS
|
|
AM_CPPFLAGS += \
|
|
-D_GNU_SOURCE=1 \
|
|
-DUSE_TSD_DATA_HACK=1 \
|
|
-DMALLOC_HOOKS=1 \
|
|
-I$(srcdir)/sysdeps/pthread
|
|
endif
|
|
if OMPI_HAVE_SOLARIS_THREADS
|
|
AM_CPPFLAGS += -I$(srcdir)/sysdeps/solaris
|
|
endif
|
|
# this must come *after* the threads -Is
|
|
AM_CPPFLAGS += -I$(srcdir)/sysdeps/generic
|
|
|
|
# ptmalloc requires us to include the copyright notice in the
|
|
# software. So install it in the same place that we install ROMIO's
|
|
# copyright notices.
|
|
|
|
docdir = $(datadir)/openmpi/doc
|
|
doc_DATA = ptmalloc2-COPYRIGHT
|
|
|
|
# These are the files from ptmalloc2 that we care about
|
|
ptmalloc2_sources = \
|
|
malloc.c \
|
|
malloc-stats.c \
|
|
malloc.h
|
|
|
|
# This component is only ever built statically (i.e., slurped into
|
|
# libopen-pal) -- it is never built as a DSO.
|
|
noinst_LTLIBRARIES = libmca_memory_ptmalloc2.la
|
|
libmca_memory_ptmalloc2_la_SOURCES = \
|
|
opal_ptmalloc2_component.c \
|
|
opal_ptmalloc2_munmap.c \
|
|
rename.h \
|
|
$(ptmalloc2_sources)
|
|
libmca_memory_ptmalloc2_la_LDFLAGS = \
|
|
-module -avoid-version $(memory_ptmalloc2_LDFLAGS)
|
|
libmca_memory_ptmalloc2_la_LIBADD = $(memory_ptmalloc2_LIBS)
|
|
|
|
# For hysterical raisins, we create a dummy libopenmpi_malloc.la. See
|
|
# README-open-mpi.txt for details
|
|
lib_LTLIBRARIES = libopenmpi_malloc.la
|
|
libopenmpi_malloc_la_SOURCES = dummy.c
|
|
|
|
# these are included directly and shouldn't be built solo
|
|
EXTRA_libmca_memory_ptmalloc2_la_SOURCES = \
|
|
arena.c \
|
|
hooks.c
|
|
|
|
EXTRA_DIST = \
|
|
ChangeLog \
|
|
README \
|
|
ChangeLog \
|
|
lran2.h \
|
|
opal_ptmalloc2_munmap.h \
|
|
t-test.h \
|
|
t-test1.c \
|
|
t-test2.c \
|
|
tst-mallocstate.c \
|
|
tst-mstats.c \
|
|
sysdeps/sproc/malloc-machine.h \
|
|
sysdeps/sproc/thread-st.h \
|
|
sysdeps/pthread/malloc-machine.h \
|
|
sysdeps/pthread/thread-st.h \
|
|
sysdeps/solaris/malloc-machine.h \
|
|
sysdeps/solaris/thread-st.h \
|
|
sysdeps/generic/malloc-machine.h \
|
|
sysdeps/generic/thread-st.h \
|
|
sysdeps/generic/atomic.h \
|
|
$(doc_DATA)
|