Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
77e916ad
Commit
77e916ad
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Add a configuration flag to link a version of TBBmalloc instead of the standard one.
parent
b00f3dca
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!552
More standard ways of linking other allocators - Correctly apply tc-malloc recommended flags.
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
configure.ac
+86
-34
86 additions, 34 deletions
configure.ac
examples/Makefile.am
+1
-1
1 addition, 1 deletion
examples/Makefile.am
src/Makefile.am
+1
-1
1 addition, 1 deletion
src/Makefile.am
tests/Makefile.am
+1
-1
1 addition, 1 deletion
tests/Makefile.am
with
89 additions
and
37 deletions
configure.ac
+
86
−
34
View file @
77e916ad
...
...
@@ -628,6 +628,38 @@ AC_SUBST([FFTW_LIBS])
AC_SUBST([FFTW_INCS])
AM_CONDITIONAL([HAVEFFTW],[test -n "$FFTW_LIBS"])
# Check for -lprofiler usually part of the gperftools along with tcmalloc.
have_profiler="no"
AC_ARG_WITH([profiler],
[AS_HELP_STRING([--with-profiler],
[use cpu profiler library or specify the directory with lib @<:@yes/no@:>@]
)],
[with_profiler="$withval"],
[with_profiler="no"]
)
if test "x$with_profiler" != "xno"; then
if test "x$with_profiler" != "xyes" -a "x$with_profiler" != "x"; then
proflibs="-L$with_profiler -lprofiler"
else
proflibs="-lprofiler"
fi
AC_CHECK_LIB([profiler],[ProfilerFlush],
[have_profiler="yes"
AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])],
[have_profiler="no"], $proflibs)
if test "$have_profiler" = "yes"; then
PROFILER_LIBS="$proflibs"
else
PROFILER_LIBS=""
fi
fi
AC_SUBST([PROFILER_LIBS])
AM_CONDITIONAL([HAVEPROFILER],[test -n "$PROFILER_LIBS"])
# Check for special allocators
have_special_allocator="no"
# Check for tcmalloc a fast malloc that is part of the gperftools.
have_tcmalloc="no"
AC_ARG_WITH([tcmalloc],
...
...
@@ -637,6 +669,10 @@ AC_ARG_WITH([tcmalloc],
[with_tcmalloc="$withval"],
[with_tcmalloc="no"]
)
if test "x$with_tcmalloc" != "xno" -a "x$have_special_allocator" != "xno"; then
AC_MSG_ERROR("Cannot activate more than one alternative malloc library")
fi
if test "x$with_tcmalloc" != "xno"; then
if test "x$with_tcmalloc" != "xyes" -a "x$with_tcmalloc" != "x"; then
tclibs="-L$with_tcmalloc -ltcmalloc"
...
...
@@ -660,7 +696,9 @@ if test "x$with_tcmalloc" != "xno"; then
if test "$have_tcmalloc" = "yes"; then
TCMALLOC_LIBS="$tclibs"
# Prevent compilers that replace the calls within built-ins (GNU 99) from doing so.
have_special_allocator="yes"
# Prevent compilers that replace the calls with built-ins (GNU 99) from doing so.
case "$ax_cv_c_compiler_vendor" in
intel | gnu | clang)
CFLAGS="$CFLAGS -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
...
...
@@ -674,35 +712,6 @@ fi
AC_SUBST([TCMALLOC_LIBS])
AM_CONDITIONAL([HAVETCMALLOC],[test -n "$TCMALLOC_LIBS"])
# Check for -lprofiler usually part of the gperftools along with tcmalloc.
have_profiler="no"
AC_ARG_WITH([profiler],
[AS_HELP_STRING([--with-profiler],
[use cpu profiler library or specify the directory with lib @<:@yes/no@:>@]
)],
[with_profiler="$withval"],
[with_profiler="no"]
)
if test "x$with_profiler" != "xno"; then
if test "x$with_profiler" != "xyes" -a "x$with_profiler" != "x"; then
proflibs="-L$with_profiler -lprofiler"
else
proflibs="-lprofiler"
fi
AC_CHECK_LIB([profiler],[ProfilerFlush],
[have_profiler="yes"
AC_DEFINE([WITH_PROFILER],1,[Link against the gperftools profiling library.])],
[have_profiler="no"], $proflibs)
if test "$have_profiler" = "yes"; then
PROFILER_LIBS="$proflibs"
else
PROFILER_LIBS=""
fi
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],
...
...
@@ -712,6 +721,10 @@ AC_ARG_WITH([jemalloc],
[with_jemalloc="$withval"],
[with_jemalloc="no"]
)
if test "x$with_jemalloc" != "xno" -a "x$have_special_allocator" != "xno"; then
AC_MSG_ERROR("Cannot activate more than one alternative malloc library")
fi
if test "x$with_jemalloc" != "xno"; then
if test "x$with_jemalloc" != "xyes" -a "x$with_jemalloc" != "x"; then
jelibs="-L$with_jemalloc -ljemalloc"
...
...
@@ -724,7 +737,9 @@ if test "x$with_jemalloc" != "xno"; then
if test "$have_jemalloc" = "yes"; then
JEMALLOC_LIBS="$jelibs"
# Prevent compilers that replace the regular calls within built-ins (GNU 99) from doing so.
have_special_allocator="yes"
# Prevent compilers that replace the regular calls with built-ins (GNU 99) from doing so.
case "$ax_cv_c_compiler_vendor" in
intel | gnu | clang)
CFLAGS="$CFLAGS -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
...
...
@@ -738,10 +753,46 @@ 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])
# Check for tbbmalloc, Intel's fast and parallel allocator
have_tbbmalloc="no"
AC_ARG_WITH([tbbmalloc],
[AS_HELP_STRING([--with-tbbmalloc],
[use tbbmalloc library or specify the directory with lib @<:@yes/no@:>@]
)],
[with_tbbmalloc="$withval"],
[with_tbbmalloc="no"]
)
if test "x$with_tbbmalloc" != "xno" -a "x$have_special_allocator" != "xno"; then
AC_MSG_ERROR("Cannot activate more than one alternative malloc library")
fi
if test "x$with_tbbmalloc" != "xno"; then
if test "x$with_tbbmalloc" != "xyes" -a "x$with_tbbmalloc" != "x"; then
tbblibs="-L$with_tbbmalloc -ltbbmalloc_proxy -ltbbmalloc"
else
tbblibs="-ltbbmalloc_proxy -ltbbmalloc"
fi
AC_CHECK_LIB([tbbmalloc],[scalable_malloc],[have_tbbmalloc="yes"],[have_tbbmalloc="no"],
$tbblibs)
if test "$have_tbbmalloc" = "yes"; then
TBBMALLOC_LIBS="$tbblibs"
have_special_allocator="yes"
# Prevent compilers that replace the calls with built-ins (GNU 99) from doing so.
case "$ax_cv_c_compiler_vendor" in
intel | gnu | clang)
CFLAGS="$CFLAGS -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
;;
esac
else
TBBMALLOC_LIBS=""
fi
fi
AC_SUBST([TBBMALLOC_LIBS])
AM_CONDITIONAL([HAVETBBMALLOC],[test -n "$TBBMALLOC_LIBS"])
# Check for HDF5. This is required.
AX_LIB_HDF5
...
...
@@ -1243,6 +1294,7 @@ AC_MSG_RESULT([
GSL enabled : $have_gsl
libNUMA enabled : $have_numa
GRACKLE enabled : $have_grackle
Using tbbmalloc : $have_tbbmalloc
Using tcmalloc : $have_tcmalloc
Using jemalloc : $have_jemalloc
CPU profiler : $have_profiler
...
...
This diff is collapsed.
Click to expand it.
examples/Makefile.am
+
1
−
1
View file @
77e916ad
...
...
@@ -24,7 +24,7 @@ AM_CFLAGS = -I$(top_srcdir)/src $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS)
AM_LDFLAGS
=
$(
HDF5_LDFLAGS
)
# Extra libraries.
EXTRA_LIBS
=
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
PROFILER_LIBS
)
$(
TCMALLOC_LIBS
)
$(
JEMALLOC_LIBS
)
$(
GRACKLE_LIBS
)
$(
GSL_LIBS
)
EXTRA_LIBS
=
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
PROFILER_LIBS
)
$(
TCMALLOC_LIBS
)
$(
JEMALLOC_LIBS
)
$(
TBBMALLOC_LIBS
)
$(
GRACKLE_LIBS
)
$(
GSL_LIBS
)
# MPI libraries.
MPI_LIBS
=
$(
METIS_LIBS
)
$(
MPI_THREAD_LIBS
)
...
...
This diff is collapsed.
Click to expand it.
src/Makefile.am
+
1
−
1
View file @
77e916ad
...
...
@@ -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
)
$(
JEMALLOC_LIBS
)
$(
GRACKLE_LIB
)
$(
GSL_LIBS
)
EXTRA_LIBS
=
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
PROFILER_LIBS
)
$(
TCMALLOC_LIBS
)
$(
JEMALLOC_LIBS
)
$(
TBBMALLOC_LIBS
)
$(
GRACKLE_LIB
)
$(
GSL_LIBS
)
# MPI libraries.
MPI_LIBS
=
$(
METIS_LIBS
)
$(
MPI_THREAD_LIBS
)
...
...
This diff is collapsed.
Click to expand it.
tests/Makefile.am
+
1
−
1
View file @
77e916ad
...
...
@@ -17,7 +17,7 @@
# Add the source directory and the non-standard paths to the included library headers to CFLAGS
AM_CFLAGS
=
-I
$(
top_srcdir
)
/src
$(
HDF5_CPPFLAGS
)
$(
GSL_INCS
)
$(
FFTW_INCS
)
AM_LDFLAGS
=
../src/.libs/libswiftsim.a
$(
HDF5_LDFLAGS
)
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
GRACKLE_LIBS
)
$(
GSL_LIBS
)
$(
PROFILER_LIBS
)
AM_LDFLAGS
=
../src/.libs/libswiftsim.a
$(
HDF5_LDFLAGS
)
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
TCMALLOC_LIBS
)
$(
JEMALLOC_LIBS
)
$(
TBBMALLOC_LIBS
)
$(
GRACKLE_LIBS
)
$(
GSL_LIBS
)
$(
PROFILER_LIBS
)
# List of programs and scripts to run in the test suite
TESTS
=
testGreetings testMaths testReading.sh testSingle testKernel testSymmetry
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment