Commit 2cd5cb5e authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge branch 'configure_options_in_code' into 'master'

Added the configuration command line and CFLAGS/CXXFLAGS to the snapshots and greeting message.

Does what it says on the tin. Just wanted to run it pass you in case you have a better way of doing this. 

Thanks ! Branch can be removed.

See merge request !285
parents 3aac6968 a0e45903
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Init the project. # Init the project.
AC_INIT([SWIFT],[0.4.0]) AC_INIT([SWIFT],[0.4.0],[https://gitlab.cosma.dur.ac.uk/swift/swiftsim],,[www.swiftsim.com])
swift_config_flags="$*"
AC_COPYRIGHT
AC_CONFIG_SRCDIR([src/space.c]) AC_CONFIG_SRCDIR([src/space.c])
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
...@@ -182,6 +184,18 @@ if test "$enable_task_debugging" = "yes"; then ...@@ -182,6 +184,18 @@ if test "$enable_task_debugging" = "yes"; then
AC_DEFINE([SWIFT_DEBUG_TASKS],1,[Enable task debugging]) AC_DEFINE([SWIFT_DEBUG_TASKS],1,[Enable task debugging])
fi fi
# Check if expensive debugging is on.
AC_ARG_ENABLE([debugging-checks],
[AS_HELP_STRING([--enable-debugging-checks],
[Activate expensive consistency checks @<:@yes/no@:>@]
)],
[enable_debugging_checks="$enableval"],
[enable_debugging_checks="no"]
)
if test "$enable_debugging_checks" = "yes"; then
AC_DEFINE([SWIFT_DEBUG_CHECKS],1,[Enable expensive debugging])
fi
# Define HAVE_POSIX_MEMALIGN if it works. # Define HAVE_POSIX_MEMALIGN if it works.
AX_FUNC_POSIX_MEMALIGN AX_FUNC_POSIX_MEMALIGN
...@@ -513,6 +527,222 @@ if test "$enable_warn" != "no"; then ...@@ -513,6 +527,222 @@ if test "$enable_warn" != "no"; then
fi fi
fi fi
# Various package configuration options.
# Hydro scheme.
AC_ARG_WITH([hydro],
[AS_HELP_STRING([--with-hydro=<scheme>],
[Hydro dynamics to use @<:@gadget2, minimal, hopkins, default, gizmo default: gadget2@:>@]
)],
[with_hydro="$withval"],
[with_hydro="gadget2"]
)
case "$with_hydro" in
gadget2)
AC_DEFINE([GADGET2_SPH], [1], [Gadget-2 SPH])
;;
minimal)
AC_DEFINE([MINIMAL_SPH], [1], [Minimal SPH])
;;
hopkins)
AC_DEFINE([HOPKINS_PE_SPH], [1], [Pressure-Entropy SPH])
;;
default)
AC_DEFINE([DEFAULT_SPH], [1], [Default SPH])
;;
gizmo)
AC_DEFINE([GIZMO_SPH], [1], [GIZMO SPH])
;;
*)
AC_MSG_ERROR([Unknown hydrodynamics scheme: $with_hydro])
;;
esac
# SPH Kernel function
AC_ARG_WITH([kernel],
[AS_HELP_STRING([--with-kernel=<kernel>],
[Kernel function to use @<:@cubic-spline, quartic-spline, quintic-spline, wendland-C2, wendland-C4, wendland-C6 default: cubic-spline@:>@]
)],
[with_kernel="$withval"],
[with_kernel="cubic-spline"]
)
case "$with_kernel" in
cubic-spline)
AC_DEFINE([CUBIC_SPLINE_KERNEL], [1], [Cubic spline kernel])
;;
quartic-spline)
AC_DEFINE([QUARTIC_SPLINE_KERNEL], [1], [Quartic spline kernel])
;;
quintic-spline)
AC_DEFINE([QUINTIC_SPLINE_KERNEL], [1], [Quintic spline kernel])
;;
wendland-C2)
AC_DEFINE([WENDLAND_C2_KERNEL], [1], [Wendland-C2 kernel])
;;
wendland-C4)
AC_DEFINE([WENDLAND_C4_KERNEL], [1], [Wendland-C4 kernel])
;;
wendland-C6)
AC_DEFINE([WENDLAND_C6_KERNEL], [1], [Wendland-C6 kernel])
;;
*)
AC_MSG_ERROR([Unknown kernel function: $with_kernel])
;;
esac
# Dimensionality of the hydro scheme.
AC_ARG_WITH([hydro-dimension],
[AS_HELP_STRING([--with-hydro-dimension=<dim>],
[dimensionality of problem @<:@3/2/1 default: 3@:>@]
)],
[with_dimension="$withval"],
[with_dimension="3"]
)
case "$with_dimension" in
1)
AC_DEFINE([HYDRO_DIMENSION_1D], [1], [1D analysis])
;;
2)
AC_DEFINE([HYDRO_DIMENSION_2D], [2], [2D analysis])
;;
3)
AC_DEFINE([HYDRO_DIMENSION_3D], [3], [3D analysis])
;;
*)
AC_MSG_ERROR([Dimensionality must be 1, 2 or 3])
;;
esac
# Equation of state
AC_ARG_WITH([equation-of-state],
[AS_HELP_STRING([--with-equation-of-state=<EoS>],
[equation of state @<:@ideal-gas, isothermal-gas default: ideal-gas@:>@]
)],
[with_eos="$withval"],
[with_eos="ideal-gas"]
)
case "$with_eos" in
ideal-gas)
AC_DEFINE([EOS_IDEAL_GAS], [1], [Ideal gas equation of state])
;;
isothermal-gas)
AC_DEFINE([EOS_ISOTHERMAL_GAS], [1], [Isothermal gas equation of state])
;;
*)
AC_MSG_ERROR([Unknown equation of state: $with_eos])
;;
esac
# Adiabatic index
AC_ARG_WITH([adiabatic-index],
[AS_HELP_STRING([--with-adiabatic-index=<gamma>],
[adiabatic index @<:@5/3, 7/5, 4/3, 2 default: 5/3@:>@]
)],
[with_gamma="$withval"],
[with_gamma="5/3"]
)
case "$with_gamma" in
5/3)
AC_DEFINE([HYDRO_GAMMA_5_3], [5./3.], [Adiabatic index is 5/3])
;;
7/5)
AC_DEFINE([HYDRO_GAMMA_7_5], [7./5.], [Adiabatic index is 7/5])
;;
4/3)
AC_DEFINE([HYDRO_GAMMA_4_3], [4./3.], [Adiabatic index is 4/3])
;;
2)
AC_DEFINE([HYDRO_GAMMA_2_1], [2.], [Adiabatic index is 2])
;;
*)
AC_MSG_ERROR([Unknown adiabatic index: $with_gamma])
;;
esac
# Riemann solver
AC_ARG_WITH([riemann-solver],
[AS_HELP_STRING([--with-riemann-solver=<solver>],
[riemann solver (gizmo-sph only) @<:@none, exact, trrs, hllc, default: none@:>@]
)],
[with_riemann="$withval"],
[with_riemann="none"]
)
case "$with_riemann" in
none)
AC_DEFINE([RIEMANN_SOLVER_NONE], [1], [No Riemann solver])
;;
exact)
AC_DEFINE([RIEMANN_SOLVER_EXACT], [1], [Exact Riemann solver])
;;
trrs)
AC_DEFINE([RIEMANN_SOLVER_TRRS], [1], [Two Rarefaction Riemann Solver])
;;
hllc)
AC_DEFINE([RIEMANN_SOLVER_HLLC], [1], [Harten-Lax-van Leer-Contact Riemann solver])
;;
*)
AC_MSG_ERROR([Unknown Riemann solver: $with_riemann])
;;
esac
# Cooling function
AC_ARG_WITH([cooling],
[AS_HELP_STRING([--with-cooling=<function>],
[cooling function @<:@none, const-du, const-lambda, grackle default: none@:>@]
)],
[with_cooling="$withval"],
[with_cooling="none"]
)
case "$with_cooling" in
none)
AC_DEFINE([COOLING_NONE], [1], [No cooling function])
;;
const-du)
AC_DEFINE([COOLING_CONST_DU], [1], [Const du/dt cooling function])
;;
const-lambda)
AC_DEFINE([COOLING_CONST_LAMBDA], [1], [Const Lambda cooling function])
;;
grackle)
AC_DEFINE([COOLING_GRACKLE], [1], [Cooling via the grackle library])
;;
*)
AC_MSG_ERROR([Unknown cooling function: $with_cooling])
;;
esac
# External potential
AC_ARG_WITH([ext-potential],
[AS_HELP_STRING([--with-ext-potential=<pot>],
[external potential @<:@none, point-mass, isothermal, softened-isothermal, disc-patch default: none@:>@]
)],
[with_potential="$withval"],
[with_potential="none"]
)
case "$with_potential" in
none)
AC_DEFINE([EXTERNAL_POTENTIAL_NONE], [1], [No external potential])
;;
point-mass)
AC_DEFINE([EXTERNAL_POTENTIAL_POINTMASS], [1], [Point-mass external potential])
;;
isothermal)
AC_DEFINE([EXTERNAL_POTENTIAL_ISOTHERMAL], [1], [Isothermal external potential])
;;
softened-isothermal)
AC_DEFINE([EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL], [1], [Softened isothermal external potential])
;;
disc-patch)
AC_DEFINE([EXTERNAL_POTENTIAL_DISC_PATCH], [1], [Disc-patch external potential])
;;
*)
AC_MSG_ERROR([Unknown external potential: $with_potential])
;;
esac
# Check for git, needed for revision stamps. # Check for git, needed for revision stamps.
AC_PATH_PROG([GIT_CMD], [git]) AC_PATH_PROG([GIT_CMD], [git])
AC_SUBST([GIT_CMD]) AC_SUBST([GIT_CMD])
...@@ -531,6 +761,9 @@ AC_CONFIG_FILES([tests/test27cellsPerturbed.sh], [chmod +x tests/test27cellsPert ...@@ -531,6 +761,9 @@ AC_CONFIG_FILES([tests/test27cellsPerturbed.sh], [chmod +x tests/test27cellsPert
AC_CONFIG_FILES([tests/test125cells.sh], [chmod +x tests/test125cells.sh]) AC_CONFIG_FILES([tests/test125cells.sh], [chmod +x tests/test125cells.sh])
AC_CONFIG_FILES([tests/testParser.sh], [chmod +x tests/testParser.sh]) AC_CONFIG_FILES([tests/testParser.sh], [chmod +x tests/testParser.sh])
# Save the compilation options
AC_DEFINE_UNQUOTED([SWIFT_CONFIG_FLAGS],["$swift_config_flags"],[Flags passed to configure])
# Report general configuration. # Report general configuration.
AC_MSG_RESULT([ AC_MSG_RESULT([
Compiler : $CC Compiler : $CC
...@@ -545,7 +778,17 @@ AC_MSG_RESULT([ ...@@ -545,7 +778,17 @@ AC_MSG_RESULT([
libNUMA enabled : $have_numa libNUMA enabled : $have_numa
Using tcmalloc : $have_tcmalloc Using tcmalloc : $have_tcmalloc
CPU profiler : $have_profiler CPU profiler : $have_profiler
Task debugging : $enable_task_debugging
Hydro scheme : $with_hydro
Dimensionality : $with_dimension
Kernel function : $with_kernel
Equation of state : $with_eos
Adiabatic index : $with_gamma
Riemann solver : $with_riemann
Cooling function : $with_cooling
External potential : $with_potential
Task debugging : $enable_task_debugging
Debugging checks : $enable_debugging_checks
]) ])
# Generate output. # Generate output.
......
...@@ -108,12 +108,14 @@ version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_ ...@@ -108,12 +108,14 @@ version_string.h: version_string.h.in $(AM_SOURCES) $(include_HEADERS) $(noinst_
GIT_BRANCH=`$(GIT_CMD) branch | sed -n 's/^\* \(.*\)/\1/p'`; \ GIT_BRANCH=`$(GIT_CMD) branch | sed -n 's/^\* \(.*\)/\1/p'`; \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \ sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,$${GIT_REVISION}," \ -e "s,@GIT_REVISION\@,$${GIT_REVISION}," \
-e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" $< > version_string.h; \ -e "s|@GIT_BRANCH\@|$${GIT_BRANCH}|" \
-e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \
else \ else \
if test ! -f version_string.h; then \ if test ! -f version_string.h; then \
sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \ sed -e "s,@PACKAGE_VERSION\@,$(PACKAGE_VERSION)," \
-e "s,@GIT_REVISION\@,unknown," \ -e "s,@GIT_REVISION\@,unknown," \
-e "s,@GIT_BRANCH\@,unknown," $< > version_string.h; \ -e "s,@GIT_BRANCH\@,unknown," \
-e "s|@SWIFT_CFLAGS\@|$(CFLAGS)|" $< > version_string.h; \
fi; \ fi; \
fi fi
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
/* Local includes. */ /* Local includes. */
#include "cell.h" #include "cell.h"
#include "const.h"
#include "engine.h" #include "engine.h"
#include "part.h" #include "part.h"
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <math.h> #include <math.h>
/* Local headers. */ /* Local headers. */
#include "const.h"
#include "debug.h" #include "debug.h"
#include "error.h" #include "error.h"
#include "inline.h" #include "inline.h"
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "common_io.h" #include "common_io.h"
/* Local includes. */ /* Local includes. */
#include "const.h"
#include "error.h" #include "error.h"
#include "hydro.h" #include "hydro.h"
#include "kernel_hydro.h" #include "kernel_hydro.h"
...@@ -374,6 +373,8 @@ void writeCodeDescription(hid_t h_file) { ...@@ -374,6 +373,8 @@ void writeCodeDescription(hid_t h_file) {
writeAttribute_s(h_grpcode, "Compiler Version", compiler_version()); writeAttribute_s(h_grpcode, "Compiler Version", compiler_version());
writeAttribute_s(h_grpcode, "Git Branch", git_branch()); writeAttribute_s(h_grpcode, "Git Branch", git_branch());
writeAttribute_s(h_grpcode, "Git Revision", git_revision()); writeAttribute_s(h_grpcode, "Git Revision", git_revision());
writeAttribute_s(h_grpcode, "Configuration options", configuration_options());
writeAttribute_s(h_grpcode, "CFLAGS", compilation_cflags());
writeAttribute_s(h_grpcode, "HDF5 library version", hdf5_version()); writeAttribute_s(h_grpcode, "HDF5 library version", hdf5_version());
#ifdef HAVE_FFTW #ifdef HAVE_FFTW
writeAttribute_s(h_grpcode, "FFTW library version", fftw3_version()); writeAttribute_s(h_grpcode, "FFTW library version", fftw3_version());
......
...@@ -39,40 +39,11 @@ ...@@ -39,40 +39,11 @@
/* Thermal energy per unit mass used as a constant for the isothermal EoS */ /* Thermal energy per unit mass used as a constant for the isothermal EoS */
#define const_isothermal_internal_energy 20.2615290634f #define const_isothermal_internal_energy 20.2615290634f
/* Dimensionality of the problem */ /* Self gravity stuff. */
#define HYDRO_DIMENSION_3D #define const_gravity_multipole_order 1
//#define HYDRO_DIMENSION_2D #define const_gravity_a_smooth 1.25f
//#define HYDRO_DIMENSION_1D #define const_gravity_r_cut 4.5f
#define const_gravity_eta 0.025f
/* Hydrodynamical adiabatic index. */
#define HYDRO_GAMMA_5_3
//#define HYDRO_GAMMA_7_5
//#define HYDRO_GAMMA_4_3
//#define HYDRO_GAMMA_2_1
/* Equation of state choice */
#define EOS_IDEAL_GAS
//#define EOS_ISOTHERMAL_GAS
/* Kernel function to use */
#define CUBIC_SPLINE_KERNEL
//#define QUARTIC_SPLINE_KERNEL
//#define QUINTIC_SPLINE_KERNEL
//#define WENDLAND_C2_KERNEL
//#define WENDLAND_C4_KERNEL
//#define WENDLAND_C6_KERNEL
/* SPH variant to use */
//#define MINIMAL_SPH
#define GADGET2_SPH
//#define HOPKINS_PE_SPH
//#define DEFAULT_SPH
//#define GIZMO_SPH
/* Riemann solver to use (GIZMO_SPH only) */
#define RIEMANN_SOLVER_EXACT
//#define RIEMANN_SOLVER_TRRS
//#define RIEMANN_SOLVER_HLLC
/* Type of gradients to use (GIZMO_SPH only) */ /* Type of gradients to use (GIZMO_SPH only) */
/* If no option is chosen, no gradients are used (first order scheme) */ /* If no option is chosen, no gradients are used (first order scheme) */
...@@ -84,30 +55,8 @@ ...@@ -84,30 +55,8 @@
#define SLOPE_LIMITER_PER_FACE #define SLOPE_LIMITER_PER_FACE
#define SLOPE_LIMITER_CELL_WIDE #define SLOPE_LIMITER_CELL_WIDE
/* Self gravity stuff. */
#define const_gravity_multipole_order 1
#define const_gravity_a_smooth 1.25f
#define const_gravity_r_cut 4.5f
#define const_gravity_eta 0.025f
/* External gravity properties */
#define EXTERNAL_POTENTIAL_NONE
//#define EXTERNAL_POTENTIAL_POINTMASS
//#define EXTERNAL_POTENTIAL_ISOTHERMALPOTENTIAL
//#define EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL_POTENTIAL
//#define EXTERNAL_POTENTIAL_DISC_PATCH
/* Source terms */ /* Source terms */
#define SOURCETERMS_NONE #define SOURCETERMS_NONE
//#define SOURCETERMS_SN_FEEDBACK //#define SOURCETERMS_SN_FEEDBACK
/* Cooling properties */
#define COOLING_NONE
//#define COOLING_CONST_DU
//#define COOLING_CONST_LAMBDA
//#define COOLING_GRACKLE
/* Are we debugging ? */
//#define SWIFT_DEBUG_CHECKS
#endif /* SWIFT_CONST_H */ #endif /* SWIFT_CONST_H */
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
/* Local headers. */
#include "const.h"
/* Import the right cooling definition */ /* Import the right cooling definition */
#if defined(COOLING_NONE) #if defined(COOLING_NONE)
#include "./cooling/none/cooling.h" #include "./cooling/none/cooling.h"
......
...@@ -27,9 +27,6 @@ ...@@ -27,9 +27,6 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
/* Local headers. */
#include "const.h"
/* Import the right cooling definition */ /* Import the right cooling definition */
#if defined(COOLING_NONE) #if defined(COOLING_NONE)
#include "./cooling/none/cooling_struct.h" #include "./cooling/none/cooling_struct.h"
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
/* Local includes. */ /* Local includes. */
#include "cell.h" #include "cell.h"
#include "const.h"
#include "engine.h" #include "engine.h"
#include "hydro.h" #include "hydro.h"
#include "inline.h" #include "inline.h"
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "../config.h" #include "../config.h"
/* Local headers. */ /* Local headers. */
#include "const.h"
#include "inline.h" #include "inline.h"
#include "vector.h" #include "vector.h"
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
/* Local headers. */ /* Local headers. */
#include "adiabatic_index.h" #include "adiabatic_index.h"
#include "const.h"
#include "debug.h" #include "debug.h"
#include "inline.h" #include "inline.h"
......
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
#ifndef SWIFT_GRAVITY_H #ifndef SWIFT_GRAVITY_H
#define SWIFT_GRAVITY_H #define SWIFT_GRAVITY_H
#include "./const.h" /* Config parameters. */
#include "../config.h"
/* So far only one model here */ /* So far only one model here */
/* Straight-forward import */ /* Straight-forward import */
......
...@@ -19,11 +19,12 @@ ...@@ -19,11 +19,12 @@
#ifndef SWIFT_HYDRO_H #ifndef SWIFT_HYDRO_H
#define SWIFT_HYDRO_H #define SWIFT_HYDRO_H
/* Includes. */ /* Config parameters. */
#include "const.h" #include "../config.h"
/* Local headers. */
#include "hydro_properties.h" #include "hydro_properties.h"
#include "kernel_hydro.h" #include "kernel_hydro.h"
#include "part.h"
/* Import the right functions */ /* Import the right functions */
#if defined(MINIMAL_SPH) #if defined(MINIMAL_SPH)
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <math.h> #include <math.h>
/* Local headers. */ /* Local headers. */
#include "const.h"
#include "dimension.h" #include "dimension.h"
#include "error.h" #include "error.h"
#include "inline.h" #include "inline.h"
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
/* Local headers. */ /* Local headers. */
#include "align.h" #include "align.h"
#include "const.h"
/* Some constants. */ /* Some constants. */
#define part_align 128 #define part_align 128
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#endif #endif
/* Local headers. */ /* Local headers. */
#include "const.h"
#include "debug.h" #include "debug.h"
#include "error.h" #include "error.h"
#include "partition.h" #include "partition.h"
......
...@@ -27,17 +27,14 @@ ...@@ -27,17 +27,14 @@
/* Config parameters. */ /* Config parameters. */
#include "../config.h" #include "../config.h"
/* Local includes. */
#include "const.h"
/* Import the right external potential definition */ /* Import the right external potential definition */
#if defined(EXTERNAL_POTENTIAL_NONE) #if defined(EXTERNAL_POTENTIAL_NONE)
#include "./potential/none/potential.h" #include "./potential/none/potential.h"
#elif defined(EXTERNAL_POTENTIAL_POINTMASS) #elif defined(EXTERNAL_POTENTIAL_POINTMASS)
#include "./potential/point_mass/potential.h" #include "./potential/point_mass/potential.h"
#elif defined(EXTERNAL_POTENTIAL_ISOTHERMALPOTENTIAL) #elif defined(EXTERNAL_POTENTIAL_ISOTHERMAL)
#include "./potential/isothermal/potential.h" #include "./potential/isothermal/potential.h"
#elif defined(EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL_POTENTIAL) #elif defined(EXTERNAL_POTENTIAL_SOFTENED_ISOTHERMAL)
#include "./potential/softened_isothermal/potential.h" #include "./potential/softened_isothermal/potential.h"
#elif defined(EXTERNAL_POTENTIAL_DISC_PATCH) #elif defined(EXTERNAL_POTENTIAL_DISC_PATCH)
#include "./potential/disc_patch/potential.h" #include "./potential/disc_patch/potential.h"
......
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@