diff --git a/configure.ac b/configure.ac index ee6649a7ade89ea09ec29f678c3a94071dc3d3d2..9181685653d800af584456df03bfdf0880b734e4 100644 --- a/configure.ac +++ b/configure.ac @@ -693,6 +693,42 @@ AC_SUBST([GSL_LIBS]) AC_SUBST([GSL_INCS]) AM_CONDITIONAL([HAVEGSL],[test -n "$GSL_LIBS"]) +# Check for GMP. We test for this in the standard directories by default, +# and only disable if using --with-gmp=no or --without-gmp. When a value +# is given GMP must be found. +have_gmp="no" +AC_ARG_WITH([gmp], + [AS_HELP_STRING([--with-gmp=PATH], + [root directory where GMP is installed @<:@yes/no@:>@] + )], + [with_gmp="$withval"], + [with_gmp="test"] +) +if test "x$with_gmp" != "xno"; then + if test "x$with_gmp" != "xyes" -a "x$with_gmp" != "xtest" -a "x$with_gmp" != "x"; then + GMP_LIBS="-L$with_gmp/lib -lgsl -lgslcblas" + else + GMP_LIBS="-lgmp" + fi + # GMP is not specified, so just check if we have it. + if test "x$with_gmp" = "xtest"; then + AC_CHECK_LIB([gmp],[__gmpz_inits],[have_gmp="yes"],[have_gmp="no"],$GMP_LIBS) + if test "x$have_gmp" != "xno"; then + AC_DEFINE([HAVE_LIBGMP],1,[The GMP library appears to be present.]) + fi + else + AC_CHECK_LIB([gmp],[__gmpz_inits], + AC_DEFINE([HAVE_LIBGMP],1,[The GMP library appears to be present.]), + AC_MSG_ERROR(something is wrong with the GMP library!), $GMP_LIBS) + have_gmp="yes" + fi + if test "$have_gmp" = "no"; then + GMP_LIBS="" + fi +fi +AC_SUBST([GMP_LIBS]) +AM_CONDITIONAL([HAVEGMP],[test -n "$GMP_LIBS"]) + # Check for pthreads. AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $LIBS"], @@ -2456,6 +2492,7 @@ AC_MSG_RESULT([ METIS/ParMETIS : $have_metis / $have_parmetis FFTW3 enabled : $have_fftw GSL enabled : $have_gsl + GMP enabled : $have_gmp libNUMA enabled : $have_numa GRACKLE enabled : $have_grackle Special allocators : $have_special_allocator diff --git a/examples/Makefile.am b/examples/Makefile.am index 64735be2e177d2839c69d718303edb8192b3e72f..e21f702b202bc2d424617580eec32087fa9139ed 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -27,7 +27,7 @@ AM_LDFLAGS = $(HDF5_LDFLAGS) # Extra libraries. EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(PROFILER_LIBS) \ $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) \ - $(VELOCIRAPTOR_LIBS) $(GSL_LIBS) + $(VELOCIRAPTOR_LIBS) $(GSL_LIBS) $(GMP_LIBS) # MPI libraries. MPI_LIBS = $(PARMETIS_LIBS) $(METIS_LIBS) $(MPI_THREAD_LIBS) diff --git a/src/Makefile.am b/src/Makefile.am index ad1a3b8c331730442f59bae1f4b53c9649fc84a7..8d02acf0df18c684a1abce191e91fcd94cdf91ef 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -25,7 +25,7 @@ AM_LDFLAGS = $(HDF5_LDFLAGS) $(FFTW_LIBS) GIT_CMD = @GIT_CMD@ # Additional dependencies for shared libraries. -EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS) +EXTRA_LIBS = $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS) $(GMP_LIBS) # MPI libraries. MPI_LIBS = $(PARMETIS_LIBS) $(METIS_LIBS) $(MPI_THREAD_LIBS) diff --git a/src/cell_drift.c b/src/cell_drift.c index 291316b17b67364942ee0c67a9c1f6b0558d43ba..008516fdb61275cb854341251cf7baf5cce41b48 100644 --- a/src/cell_drift.c +++ b/src/cell_drift.c @@ -36,6 +36,10 @@ #include "star_formation.h" #include "tracers.h" +#ifdef SHADOWFAX_SPH +#include "shadowfax/cell_shadowfax.h" +#endif + /** * @brief Recursively drifts the #part in a cell hierarchy. * @@ -236,6 +240,10 @@ void cell_drift_part(struct cell *c, const struct engine *e, int force) { } } +#ifdef SHADOWFAX_SPH + cell_malloc_delaunay_tesselation(c, &e->s->hs); +#endif + /* Now, get the maximal particle motion from its square */ dx_max = sqrtf(dx2_max); dx_max_sort = sqrtf(dx2_max_sort); diff --git a/src/cell_hydro.h b/src/cell_hydro.h index 19928930d95673d3dc86c3d46436229579a768f3..566e231cb2e17f74477c2af8c4de05af15e0bd6f 100644 --- a/src/cell_hydro.h +++ b/src/cell_hydro.h @@ -43,7 +43,7 @@ struct cell_hydro { /*! Pointer to the #xpart data. */ struct xpart *xparts; - + #ifdef SHADOWFAX_SPH /*! Delaunay tessellation. */ struct delaunay deltess; diff --git a/src/shadowfax/cell_shadowfax.h b/src/shadowfax/cell_shadowfax.h index 387225ca02abbc2a1361f2ff5c6e9785638841fd..88a55d3cf45d9a525da813a7297fd6961575d56f 100644 --- a/src/shadowfax/cell_shadowfax.h +++ b/src/shadowfax/cell_shadowfax.h @@ -4,10 +4,10 @@ #include "cell.h" #include "delaunay.h" -__attribute__((always_inline)) INLINE static void cell_malloc_delaunay_tesselation( - struct cell *c, const struct hydro_space *hs) { - - delaunay_init(&c->hydro.deltess, hs, 100, 100); +__attribute__((always_inline)) INLINE static void +cell_malloc_delaunay_tesselation(struct cell *c, const struct hydro_space *hs) { + + delaunay_init(&c->hydro.deltess, hs, 100, 100); } #endif /* SWIFT_CELL_SHADOWFAX_H */ diff --git a/src/shadowfax/delaunay.h b/src/shadowfax/delaunay.h index 9e15c3bbc448497f6139d82fda0d528360a662af..b9b5ab841f0530415b1a670548d778bec28f5d2d 100644 --- a/src/shadowfax/delaunay.h +++ b/src/shadowfax/delaunay.h @@ -28,15 +28,15 @@ #ifndef SWIFT_DELAUNAY_H #define SWIFT_DELAUNAY_H +#include "geometry.h" +#include "hydro_space.h" +#include "triangle.h" + #include <float.h> #include <math.h> #include <stdio.h> #include <stdlib.h> -#include "geometry.h" -#include "hydro_space.h" -#include "triangle.h" - /*! @brief Activate extensive log output. */ /*#define DELAUNAY_LOG_OUTPUT*/ /*! @brief Activate runtime assertions. */ diff --git a/src/shadowfax/voronoi.h b/src/shadowfax/voronoi.h index 4e11aca56372b3b9f2386c5c4c7637fc755624e3..ef8f0fecbb2f5dc743165ba95b08807dc02d4d74 100644 --- a/src/shadowfax/voronoi.h +++ b/src/shadowfax/voronoi.h @@ -28,10 +28,10 @@ #ifndef SWIFT_VORONOI_H #define SWIFT_VORONOI_H -#include <string.h> - #include "voronoi.h" +#include <string.h> + /** * @brief Voronoi grid. *