Skip to content
Snippets Groups Projects
Commit 15be22f1 authored by James Willis's avatar James Willis
Browse files

Merge branch 'master' into FOF

parents 44ed1436 ad48800d
No related branches found
No related tags found
1 merge request!543Fof
Showing
with 222 additions and 106 deletions
......@@ -31,6 +31,7 @@ examples/*/*.txt
examples/*/*.dot
examples/*/restart/*
examples/*/used_parameters.yml
examples/*/unused_parameters.yml
examples/*/*/*.xmf
examples/*/*/*.png
examples/*/*/*.mp4
......@@ -41,6 +42,7 @@ examples/*/*/*.hdf5
examples/*/snapshots*
examples/*/restart/*
examples/*/*/used_parameters.yml
examples/*/*/unused_parameters.yml
examples/*/*.mpg
examples/*/gravity_checks_*.dat
......@@ -80,6 +82,7 @@ tests/test_nonsym_force_1_vec.dat
tests/test_nonsym_force_2_vec.dat
tests/potential.dat
tests/testGreetings
tests/testSelectOutput
tests/testReading
tests/testSingle
tests/testTimeIntegration
......@@ -102,6 +105,7 @@ tests/test125cells.sh
tests/test125cellsPerturbed.sh
tests/testParser.sh
tests/testReading.sh
tests/testSelectOutput.sh
tests/testAdiabaticIndex
tests/testRiemannExact
tests/testRiemannTRRS
......
......@@ -96,18 +96,21 @@ SWIFT depends on a number of third party libraries that should be available
before you can build it.
- HDF5: a HDF5 library (v. 1.8.x or higher) is required to read and
write particle data. One of the commands "h5cc" or "h5pcc"
should be available. If "h5pcc" is located them a parallel
HDF5 built for the version of MPI located should be
provided. If the command is not available then it can be
located using the "--with-hfd5" configure option. The value
should be the full path to the "h5cc" or "h5pcc" commands.
- MPI: to run on more than one node an MPI library that fully
supports MPI_THREAD_MULTIPLE. Before running configure the
"mpirun" command should be available in the shell. If your
- HDF5:
A HDF5 library (v. 1.8.x or higher) is required to read and
write particle data. One of the commands "h5cc" or "h5pcc"
should be available. If "h5pcc" is located then a parallel
HDF5 built for the version of MPI located should be
provided. If the command is not available then it can be
located using the "--with-hdf5" configure option. The value
should be the full path to the "h5cc" or "h5pcc" commands.
SWIFT makes effective use of parallel HDF5 when running on more than
one node, so this option is highly recommended.
- MPI:
To run on more than one node an MPI library that fully
supports MPI_THREAD_MULTIPLE is required. Before running configure
the "mpirun" command should be available in the shell. If your
command isn't called "mpirun" then define the "MPIRUN"
environment variable, either in the shell or when running
configure.
......@@ -116,57 +119,69 @@ before you can build it.
much like the CC one. Use this when your MPI compiler has a
none-standard name.
- GSL: To use cosmological time integration, a version of the GSL
must be available.
- GSL:
To use cosmological time integration, a version of the GSL
must be available.
- libtool: The build system relies on libtool as well as the other autotools.
- FFTW 3.x:
To run with periodic gravity forces, a build of the FFTW 3
library must be available. Note that SWIFT does not make use
of the parallel capability of FFTW. Calculations are done by
single MPI nodes independently.
Optional Dependencies
=====================
- libtool:
The build system relies on libtool as well as the other autotools.
- METIS: a build of the METIS library can be optionally used to
optimize the load between MPI nodes (requires an MPI
library). This should be found in the standard installation
directories, or pointed at using the "--with-metis"
configuration option. In this case the top-level
installation directory of the METIS build should be
given. Note to use METIS you should at least supply
"--with-metis".
Optional Dependencies
=====================
- libNUMA: a build of the NUMA library can be used to pin the threads
to the physical core of the machine SWIFT is running
on. This is not always necessary as the OS scheduler may
do a good job at distributing the threads among the
different cores on each computing node.
- METIS:
a build of the METIS library can be optionally used to
optimize the load between MPI nodes (requires an MPI
library). This should be found in the standard installation
directories, or pointed at using the "--with-metis"
configuration option. In this case the top-level installation
directory of the METIS build should be given. Note to use
METIS you should supply at least "--with-metis".
- TCMalloc: a build of the TCMalloc library (part of gperftools) can
be used to obtain faster allocations than the standard C
malloc function part of glibc. The option "-with-tcmalloc"
should be passed to the configuration script to use it.
- libNUMA:
a build of the NUMA library can be used to pin the threads to
the physical core of the machine SWIFT is running on. This is
not always necessary as the OS scheduler may do a good job at
distributing the threads among the different cores on each
computing node.
- tcmalloc / jemalloc / TBBmalloc:
a build of the tcmalloc library (part of gperftools), jemalloc
or TBBmalloc can be used be used to obtain faster and more
scalable allocations than the standard C malloc function part
of glibc. Using one of these is highly recommended on systems
with many cores per node. One of the options
"--with-tcmalloc", "--with-jemalloc" or "--with-tbbmalloc"
should be passed to the configuration script to use it.
- gperftools: a build of gperftools can be used to obtain good
profiling of the code. The option "-with-profiler"
needs to be passed to the configuration script to use
it.
- gperftools:
a build of gperftools can be used to obtain good profiling of
the code. The option "--with-profiler" needs to be passed to
the configuration script to use it.
- DOXYGEN:
the doxygen library is required to create the SWIFT API
documentation.
- DOXYGEN: the doxygen library is required to create the SWIFT API
documentation.
- python:
Examples and solution script use python and rely on the numpy
library version 1.8.2 or higher.
- python: Examples and solution script use python and rely on the
numpy library version 1.8.2 or higher.
SWIFT Coding style
==================
The SWIFT source code is using a variation of the 'Google' style. The
script 'format.sh' in the root directory applies the clang-format-3.8
tool with our style choices to all the SWIFT C source file. Please
apply the formatting script to the files before submitting a merge
request.
The SWIFT source code uses a variation of 'Google' style. The script
'format.sh' in the root directory applies the clang-format-3.8 tool with our
style choices to all the SWIFT C source file. Please apply the formatting
script to the files before submitting a merge request.
......@@ -19,9 +19,6 @@
AC_INIT([SWIFT],[0.7.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim])
swift_config_flags="$*"
# Need to define this, instead of using fifth argument of AC_INIT, until 2.64.
AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages])
AC_COPYRIGHT
AC_CONFIG_SRCDIR([src/space.c])
AC_CONFIG_AUX_DIR([.])
......@@ -628,15 +625,51 @@ 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=PATH],
[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],
[AS_HELP_STRING([--with-tcmalloc],
[AS_HELP_STRING([--with-tcmalloc=PATH],
[use tcmalloc library or specify the directory with lib @<:@yes/no@:>@]
)],
[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,10 +693,17 @@ if test "x$with_tcmalloc" != "xno"; then
if test "$have_tcmalloc" = "yes"; then
TCMALLOC_LIBS="$tclibs"
# These are recommended for GCC.
if test "$ax_cv_c_compiler_vendor" = "gnu"; then
CFLAGS="$CFLAGS -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
fi
AC_DEFINE([HAVE_TCMALLOC],1,[The tcmalloc library appears to be present.])
have_special_allocator="tcmalloc"
# 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
TCMALLOC_LIBS=""
fi
......@@ -671,44 +711,19 @@ 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],
[AS_HELP_STRING([--with-jemalloc],
[AS_HELP_STRING([--with-jemalloc=PATH],
[use jemalloc library or specify the directory with lib @<:@yes/no@:>@]
)],
[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"
......@@ -720,6 +735,18 @@ if test "x$with_jemalloc" != "xno"; then
if test "$have_jemalloc" = "yes"; then
JEMALLOC_LIBS="$jelibs"
AC_DEFINE([HAVE_JEMALLOC],1,[The jemalloc library appears to be present.])
have_special_allocator="jemalloc"
# 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"
;;
esac
else
JEMALLOC_LIBS=""
fi
......@@ -727,11 +754,49 @@ 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=PATH],
[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"
AC_DEFINE([HAVE_TBBMALLOC],1,[The TBBmalloc library appears to be present.])
have_special_allocator="TBBmalloc"
# 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
if test "$with_hdf5" != "yes"; then
......@@ -753,7 +818,8 @@ if test "$with_hdf5" = "yes"; then
if test "$enable_parallel_hdf5" = "yes"; then
AC_MSG_CHECKING([for HDF5 parallel support])
# Check if the library is capable, the header should define H5_HAVE_PARALLEL.
# Check if the library is capable, the header should define H5_HAVE_PARALLEL.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "hdf5.h"
......@@ -814,6 +880,27 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM(
[AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])],[rtc_ok=no])
AC_MSG_RESULT($rtc_ok)
# Special timers for the ARM v7 and ARM v8 platforms (taken from FFTW-3 to match their cycle.h)
AC_ARG_ENABLE(armv8-pmccntr-el0, [AC_HELP_STRING([--enable-armv8-pmccntr-el0],[enable the cycle counter on ARMv8 via the PMCCNTR_EL0 register])], have_armv8pmccntrel0=$enableval)
if test "$have_armv8pmccntrel0"x = "yes"x; then
AC_DEFINE(HAVE_ARMV8_PMCCNTR_EL0,1,[Define if you have enabled the PMCCNTR_EL0 cycle counter on ARMv8])
fi
AC_ARG_ENABLE(armv8-cntvct-el0, [AC_HELP_STRING([--enable-armv8-cntvct-el0],[enable the cycle counter on ARMv8 via the CNTVCT_EL0 register])], have_armv8cntvctel0=$enableval)
if test "$have_armv8cntvctel0"x = "yes"x; then
AC_DEFINE(HAVE_ARMV8_CNTVCT_EL0,1,[Define if you have enabled the CNTVCT_EL0 cycle counter on ARMv8])
fi
AC_ARG_ENABLE(armv7a-cntvct, [AC_HELP_STRING([--enable-armv7a-cntvct],[enable the cycle counter on Armv7a via the CNTVCT register])], have_armv7acntvct=$enableval)
if test "$have_armv7acntvct"x = "yes"x; then
AC_DEFINE(HAVE_ARMV7A_CNTVCT,1,[Define if you have enabled the CNTVCT cycle counter on ARMv7a])
fi
AC_ARG_ENABLE(armv7a-pmccntr, [AC_HELP_STRING([--enable-armv7a-pmccntr],[enable the cycle counter on Armv7a via the PMCCNTR register])], have_armv7apmccntr=$enableval)
if test "$have_armv7apmccntr"x = "yes"x; then
AC_DEFINE(HAVE_ARMV7A_PMCCNTR,1,[Define if you have enabled the PMCCNTR cycle counter on ARMv7a])
fi
# Add warning flags by default, if these can be used. Option =error adds
# -Werror to GCC, clang and Intel. Note do this last as compiler tests may
# become errors, if that's an issue don't use CFLAGS for these, use an AC_SUBST().
......@@ -848,6 +935,11 @@ if test "$enable_warn" != "no"; then
;;
esac
fi
# We want strict-prototypes, but this must still work even if warnings
# are an error.
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],[CFLAGS="$CFLAGS -Wstrict-prototypes"],
[CFLAGS="$CFLAGS"],[$CFLAGS],[AC_LANG_SOURCE([int main(void){return 0;}])])
fi
# Various package configuration options.
......@@ -1204,6 +1296,7 @@ AC_CONFIG_FILES([tests/testPeriodicBC.sh], [chmod +x tests/testPeriodicBC.sh])
AC_CONFIG_FILES([tests/testPeriodicBCPerturbed.sh], [chmod +x tests/testPeriodicBCPerturbed.sh])
AC_CONFIG_FILES([tests/testInteractions.sh], [chmod +x tests/testInteractions.sh])
AC_CONFIG_FILES([tests/testParser.sh], [chmod +x tests/testParser.sh])
AC_CONFIG_FILES([tests/testSelectOutput.sh], [chmod +x tests/testSelectOutput.sh])
# Save the compilation options
AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to configure])
......@@ -1211,6 +1304,11 @@ AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to
# Make sure the latest git revision string gets included
touch src/version.c
# Need to define this, instead of using fifth argument of AC_INIT, until
# 2.64. Defer until now as this redefines PACKAGE_URL, which can emit a
# compilation error when testing with -Werror.
AC_DEFINE([PACKAGE_URL],["www.swiftsim.com"], [Package web pages])
# Generate output.
AC_OUTPUT
......@@ -1220,22 +1318,21 @@ AC_MSG_RESULT([
$PACKAGE_NAME v.$PACKAGE_VERSION
Compiler : $CC
- vendor : $ax_cv_c_compiler_vendor
- version : $ax_cv_c_compiler_version
- flags : $CFLAGS
MPI enabled : $enable_mpi
HDF5 enabled : $with_hdf5
- parallel : $have_parallel_hdf5
Metis enabled : $have_metis
FFTW3 enabled : $have_fftw
GSL enabled : $have_gsl
libNUMA enabled : $have_numa
GRACKLE enabled : $have_grackle
Using tcmalloc : $have_tcmalloc
Using jemalloc : $have_jemalloc
CPU profiler : $have_profiler
Pthread barriers : $have_pthread_barrier
Compiler : $CC
- vendor : $ax_cv_c_compiler_vendor
- version : $ax_cv_c_compiler_version
- flags : $CFLAGS
MPI enabled : $enable_mpi
HDF5 enabled : $with_hdf5
- parallel : $have_parallel_hdf5
Metis enabled : $have_metis
FFTW3 enabled : $have_fftw
GSL enabled : $have_gsl
libNUMA enabled : $have_numa
GRACKLE enabled : $have_grackle
Special allocators : $have_special_allocator
CPU profiler : $have_profiler
Pthread barriers : $have_pthread_barrier
Hydro scheme : $with_hydro
Dimensionality : $with_dimension
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment