Skip to content
Snippets Groups Projects
Commit 1044f78e authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Add support for jemalloc

parent 2ab1e4d0
No related branches found
No related tags found
1 merge request!295Add support for jemalloc
......@@ -351,7 +351,7 @@ AC_ARG_WITH([tcmalloc],
[with_tcmalloc="no"]
)
if test "x$with_tcmalloc" != "xno"; then
if test "x$with_tcmalloc" != "xyes" && test "x$with_tcmalloc" != "x"; then
if test "x$with_tcmalloc" != "xyes" -a "x$with_tcmalloc" != "x"; then
tclibs="-L$with_tcmalloc -ltcmalloc"
else
tclibs="-ltcmalloc"
......@@ -361,7 +361,7 @@ if test "x$with_tcmalloc" != "xno"; then
# Could just have the minimal version.
if test "$have_tcmalloc" = "no"; then
if test "x$with_tcmalloc" != "xyes" && test "x$with_tcmalloc" != "x"; then
if test "x$with_tcmalloc" != "xyes" -a "x$with_tcmalloc" != "x"; then
tclibs="-L$with_tcmalloc -ltcmalloc_minimal"
else
tclibs="-ltcmalloc_minimal"
......@@ -394,7 +394,7 @@ AC_ARG_WITH([profiler],
[with_profiler="yes"]
)
if test "x$with_profiler" != "xno"; then
if test "x$with_profiler" != "xyes" && test "x$with_profiler" != "x"; then
if test "x$with_profiler" != "xyes" -a "x$with_profiler" != "x"; then
proflibs="-L$with_profiler -lprofiler"
else
proflibs="-lprofiler"
......@@ -411,6 +411,38 @@ fi
AC_SUBST([PROFILER_LIBS])
AM_CONDITIONAL([HAVEPROFILER],[test -n "$PROFILER_LIBS"])
# Check for jemalloc another fast malloc that is good with contention.
have_jemalloc="no"
AC_ARG_WITH([jemalloc],
[AS_HELP_STRING([--with-jemalloc],
[use jemalloc library or specify the directory with lib @<:@yes/no@:>@]
)],
[with_jemalloc="$withval"],
[with_jemalloc="no"]
)
if test "x$with_jemalloc" != "xno"; then
if test "x$with_jemalloc" != "xyes" -a "x$with_jemalloc" != "x"; then
jelibs="-L$with_jemalloc -ljemalloc"
else
jelibs="-ljemalloc"
fi
AC_CHECK_LIB([jemalloc],[malloc_usable_size],[have_jemalloc="yes"],[have_jemalloc="no"],
$jelibs)
if test "$have_jemalloc" = "yes"; then
JEMALLOC_LIBS="$jelibs"
else
JEMALLOC_LIBS=""
fi
fi
AC_SUBST([JEMALLOC_LIBS])
AM_CONDITIONAL([HAVEJEMALLOC],[test -n "$JEMALLOC_LIBS"])
# Don't allow both tcmalloc and jemalloc.
if test "x$have_tcmalloc" != "xno" -a "x$have_jemalloc" != "xno"; then
AC_MSG_ERROR([Cannot use tcmalloc at same time as jemalloc])
fi
# Check for HDF5. This is required.
AX_LIB_HDF5
......@@ -781,6 +813,7 @@ AC_MSG_RESULT([
FFTW3 enabled : $have_fftw3
libNUMA enabled : $have_numa
Using tcmalloc : $have_tcmalloc
Using jemalloc : $have_jemalloc
CPU profiler : $have_profiler
Hydro scheme : $with_hydro
......
......@@ -24,7 +24,7 @@ AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS)
AM_LDFLAGS = $(HDF5_LDFLAGS)
# Extra libraries.
EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS)
EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS)
# MPI libraries.
MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS)
......
......@@ -25,7 +25,7 @@ AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) -version-info 0:0:0
GIT_CMD = @GIT_CMD@
# Additional dependencies for shared libraries.
EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS)
EXTRA_LIBS = $(HDF5_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS)
# MPI libraries.
MPI_LIBS = $(METIS_LIBS) $(MPI_THREAD_LIBS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment