Commit b48cf575 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

Merge remote-tracking branch 'origin' into tasks_cleanup

Conflicts:
	src/engine.c
	src/scheduler.c
	src/space.c
	src/task.c
parents 98f8fde9 35b13d49
......@@ -88,6 +88,9 @@ 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.
The MPI compiler can be controlled using the MPICC variable, much like
the CC one. Use this when your MPI compiler has a none-standard name.
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
......
......@@ -11,7 +11,10 @@
See INSTALL.swift for install instructions.
Usage: swift [OPTION] PARAMFILE
Usage: swift [OPTION]... PARAMFILE
swift_mpi [OPTION]... PARAMFILE
swift_fixdt [OPTION]... PARAMFILE
swift_fixdt_mpi [OPTION]... PARAMFILE
Valid options are:
-a Pin runners using processor affinity
......
# This file is part of SWIFT.
# Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk),
# Matthieu Schaller (matthieu.schaller@durham.ac.uk).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
doxyfile.stamp:
if HAVE_DOXYGEN
......
......@@ -37,10 +37,8 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length.
max_smoothing_length: 0.705 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
max_volume_change: 2. # Maximal allowed change of volume over one time-step
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -32,10 +32,8 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length.
max_smoothing_length: 10. # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
max_volume_change: 2. # Maximal allowed change of volume over one time-step
# Parameters related to the initial conditions
InitialConditions:
......
# This file is part of SWIFT.
# Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk),
# Matthieu Schaller (matthieu.schaller@durham.ac.uk).
......
......@@ -32,10 +32,8 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length.
max_smoothing_length: 1. # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
max_volume_change: 2. # Maximal allowed change of volume over one time-step
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -32,10 +32,8 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length.
max_smoothing_length: 0.01 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
max_volume_change: 2. # Maximal allowed change of volume over one time-step
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -32,10 +32,8 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length.
max_smoothing_length: 0.1 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
max_volume_change: 2. # Maximal allowed change of volume over one time-step
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -50,7 +50,11 @@
*/
void print_help_message() {
printf("\nUsage: swift [OPTION] PARAMFILE\n\n");
printf("\nUsage: swift [OPTION]... PARAMFILE\n");
printf(" swift_mpi [OPTION]... PARAMFILE\n");
printf(" swift_fixdt [OPTION]... PARAMFILE\n");
printf(" swift_fixdt_mpi [OPTION]... PARAMFILE\n\n");
printf("Valid options are:\n");
printf(" %2s %8s %s\n", "-a", "", "Pin runners using processor affinity");
printf(" %2s %8s %s\n", "-c", "", "Run with cosmological time integration");
......@@ -89,7 +93,6 @@ void print_help_message() {
* @brief Main routine that loads a few particles and generates some output.
*
*/
int main(int argc, char *argv[]) {
struct clocks_time tic, toc;
......@@ -478,10 +481,8 @@ int main(int argc, char *argv[]) {
if (j % 100 == 2) e.forcerepart = reparttype;
#endif
/* Reset timers */
timers_reset(timers_mask_all);
#ifdef COUNTER
for (k = 0; k < runner_counter_count; k++) runner_counter[k] = 0;
#endif
/* Take a step. */
engine_step(&e);
......
......@@ -39,10 +39,10 @@ Statistics:
SPH:
resolution_eta: 1.2348 # Target smoothing length in units of the mean inter-particle separation (1.2348 == 48Ngbs with the cubic spline kernel).
delta_neighbours: 0.1 # The tolerance for the targetted number of neighbours.
max_ghost_iterations: 30 # Maximal number of iterations allowed to converge towards the smoothing length.
max_ghost_iterations: 30 # (Optional) Maximal number of iterations allowed to converge towards the smoothing length.
max_smoothing_length: 0.1 # Maximal smoothing length allowed (in internal units).
CFL_condition: 0.1 # Courant-Friedrich-Levy condition for time integration.
max_volume_change: 2. # Maximal allowed change of kernel volume over one time-step
max_volume_change: 2. # (Optional) Maximal allowed change of kernel volume over one time-step
# Parameters related to the initial conditions
InitialConditions:
......
......@@ -55,8 +55,8 @@ PLOT_PARAMS = {"axes.labelsize": 10,
pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES = ["none", "sort", "self", "pair", "sub", "init", "ghost", "drift",
"kick", "kick_fixdt", "send", "recv", "grav_pp", "grav_mm",
TASKTYPES = ["none", "sort", "self", "pair", "sub_self", "sub_pair", "init", "ghost",
"drift", "kick", "kick_fixdt", "send", "recv", "grav_pp", "grav_mm",
"grav_up", "grav_down", "grav_external", "part_sort", "gpart_sort",
"split_cell", "rewait", "count"]
......@@ -64,7 +64,8 @@ TASKCOLOURS = {"none": "black",
"sort": "lightblue",
"self": "greenyellow",
"pair": "navy",
"sub": "hotpink",
"sub_self": "greenyellow",
"sub_pair": "navy",
"init": "indigo",
"ghost": "cyan",
"drift": "maroon",
......
......@@ -61,8 +61,8 @@ PLOT_PARAMS = {"axes.labelsize": 10,
pl.rcParams.update(PLOT_PARAMS)
# Tasks and subtypes. Indexed as in tasks.h.
TASKTYPES = ["none", "sort", "self", "pair", "sub", "init", "ghost", "drift",
"kick", "kick_fixdt", "send", "recv", "grav_pp", "grav_mm",
TASKTYPES = ["none", "sort", "self", "pair", "sub_self", "sub_pair", "init", "ghost",
"drift", "kick", "kick_fixdt", "send", "recv", "grav_pp", "grav_mm",
"grav_up", "grav_down", "grav_external", "part_sort", "gpart_sort",
"split_cell", "rewait", "count"]
......@@ -70,7 +70,8 @@ TASKCOLOURS = {"none": "black",
"sort": "lightblue",
"self": "greenyellow",
"pair": "navy",
"sub": "hotpink",
"sub_self": "greenyellow",
"sub_pair": "navy",
"init": "indigo",
"ghost": "cyan",
"drift": "maroon",
......
# This file is part of SWIFT.
# Copyright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk),
# Matthieu Schaller (matthieu.schaller@durham.ac.uk).
......@@ -17,10 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Add the debug flag to the whole thing
AM_CFLAGS = -DTIMER -DCOUNTER $(HDF5_CPPFLAGS)
AM_CFLAGS = -DTIMER $(HDF5_CPPFLAGS)
# Assign a "safe" version number
AM_LDFLAGS = $(LAPACK_LIBS) $(BLAS_LIBS) $(HDF5_LDFLAGS) -version-info 0:0:0 # -fsanitize=address
AM_LDFLAGS = $(HDF5_LDFLAGS) -version-info 0:0:0
# The git command, if available.
GIT_CMD = @GIT_CMD@
......@@ -71,6 +70,7 @@ libswiftsim_la_SOURCES = $(AM_SOURCES)
# Sources and flags for MPI library
libswiftsim_mpi_la_SOURCES = $(AM_SOURCES)
libswiftsim_mpi_la_CFLAGS = $(AM_CFLAGS) -DWITH_MPI $(METIS_INCS)
libswiftsim_mpi_la_LDFLAGS = $(AM_LDFLAGS) -DWITH_MPI $(METIS_LIBS)
libswiftsim_mpi_la_SHORTNAME = mpi
......
......@@ -19,6 +19,8 @@
#ifndef SWIFT_APPROX_MATH_H
#define SWIFT_APPROX_MATH_H
#include "inline.h"
/**
* @brief Approximate version of expf(x) using a 4th order Taylor expansion
*
......
......@@ -269,7 +269,7 @@ int cell_locktree(struct cell *c) {
/* Undo the holds up to finger. */
for (struct cell *finger2 = c->parent; finger2 != finger;
finger2 = finger2->parent)
__sync_fetch_and_sub(&finger2->hold, 1);
atomic_dec(&finger2->hold);
/* Unlock this cell. */
if (lock_unlock(&c->lock) != 0) error("Failed to unlock cell.");
......@@ -309,7 +309,7 @@ int cell_glocktree(struct cell *c) {
if (lock_trylock(&finger->glock) != 0) break;
/* Increment the hold. */
__sync_fetch_and_add(&finger->ghold, 1);
atomic_inc(&finger->ghold);
/* Unlock the cell. */
if (lock_unlock(&finger->glock) != 0) error("Failed to unlock cell.");
......@@ -327,7 +327,7 @@ int cell_glocktree(struct cell *c) {
/* Undo the holds up to finger. */
for (struct cell *finger2 = c->parent; finger2 != finger;
finger2 = finger2->parent)
__sync_fetch_and_sub(&finger2->ghold, 1);
atomic_dec(&finger2->ghold);
/* Unlock this cell. */
if (lock_unlock(&c->glock) != 0) error("Failed to unlock cell.");
......@@ -353,7 +353,7 @@ void cell_unlocktree(struct cell *c) {
/* Climb up the tree and unhold the parents. */
for (struct cell *finger = c->parent; finger != NULL; finger = finger->parent)
__sync_fetch_and_sub(&finger->hold, 1);
atomic_dec(&finger->hold);
TIMER_TOC(timer_locktree);
}
......@@ -367,7 +367,7 @@ void cell_gunlocktree(struct cell *c) {
/* Climb up the tree and unhold the parents. */
for (struct cell *finger = c->parent; finger != NULL; finger = finger->parent)
__sync_fetch_and_sub(&finger->ghold, 1);
atomic_dec(&finger->ghold);
TIMER_TOC(timer_locktree);
}
......@@ -406,12 +406,14 @@ void cell_split(struct cell *c) {
xparts[j] = xtemp;
}
}
/* for ( k = 0 ; k <= j ; k++ )
if ( parts[k].x[0] > pivot[0] )
error( "cell_split: sorting failed." );
for ( k = i ; k < count ; k++ )
if ( parts[k].x[0] < pivot[0] )
error( "cell_split: sorting failed." ); */
#ifdef SWIFT_DEBUG_CHECKS
for (int k = 0; k <= j; k++)
if (parts[k].x[0] > pivot[0]) error("cell_split: sorting failed.");
for (int k = i; k < count; k++)
if (parts[k].x[0] < pivot[0]) error("cell_split: sorting failed.");
#endif
left[1] = i;
right[1] = count - 1;
left[0] = 0;
......@@ -433,14 +435,17 @@ void cell_split(struct cell *c) {
xparts[j] = xtemp;
}
}
/* for ( int kk = left[k] ; kk <= j ; kk++ )
if ( parts[kk].x[1] > pivot[1] ) {
message( "ival=[%i,%i], i=%i, j=%i." , left[k] , right[k] , i , j );
error( "sorting failed (left)." );
}
for ( int kk = i ; kk <= right[k] ; kk++ )
if ( parts[kk].x[1] < pivot[1] )
error( "sorting failed (right)." ); */
#ifdef SWIFT_DEBUG_CHECKS
for (int kk = left[k]; kk <= j; kk++)
if (parts[kk].x[1] > pivot[1]) {
message("ival=[%i,%i], i=%i, j=%i.", left[k], right[k], i, j);
error("sorting failed (left).");
}
for (int kk = i; kk <= right[k]; kk++)
if (parts[kk].x[1] < pivot[1]) error("sorting failed (right).");
#endif
left[2 * k + 1] = i;
right[2 * k + 1] = right[k];
left[2 * k] = left[k];
......@@ -463,16 +468,20 @@ void cell_split(struct cell *c) {
xparts[j] = xtemp;
}
}
/* for ( int kk = left[k] ; kk <= j ; kk++ )
if ( parts[kk].x[2] > pivot[2] ) {
message( "ival=[%i,%i], i=%i, j=%i." , left[k] , right[k] , i , j );
error( "sorting failed (left)." );
}
for ( int kk = i ; kk <= right[k] ; kk++ )
if ( parts[kk].x[2] < pivot[2] ) {
message( "ival=[%i,%i], i=%i, j=%i." , left[k] , right[k] , i , j );
error( "sorting failed (right)." );
} */
#ifdef SWIFT_DEBUG_CHECKS
for (int kk = left[k]; kk <= j; kk++)
if (parts[kk].x[2] > pivot[2]) {
message("ival=[%i,%i], i=%i, j=%i.", left[k], right[k], i, j);
error("sorting failed (left).");
}
for (int kk = i; kk <= right[k]; kk++)
if (parts[kk].x[2] < pivot[2]) {
message("ival=[%i,%i], i=%i, j=%i.", left[k], right[k], i, j);
error("sorting failed (right).");
}
#endif
left[2 * k + 1] = i;
right[2 * k + 1] = right[k];
left[2 * k] = left[k];
......@@ -490,32 +499,34 @@ void cell_split(struct cell *c) {
for (int k = 0; k < count; k++)
if (parts[k].gpart != NULL) parts[k].gpart->part = &parts[k];
#ifdef SWIFT_DEBUG_CHECKS
/* Verify that _all_ the parts have been assigned to a cell. */
/* for ( k = 1 ; k < 8 ; k++ )
if ( &c->progeny[k-1]->parts[ c->progeny[k-1]->count ] !=
c->progeny[k]->parts )
error( "Particle sorting failed (internal consistency)." );
if ( c->progeny[0]->parts != c->parts )
error( "Particle sorting failed (left edge)." );
if ( &c->progeny[7]->parts[ c->progeny[7]->count ] != &c->parts[ count ] )
error( "Particle sorting failed (right edge)." ); */
for (int k = 1; k < 8; k++)
if (&c->progeny[k - 1]->parts[c->progeny[k - 1]->count] !=
c->progeny[k]->parts)
error("Particle sorting failed (internal consistency).");
if (c->progeny[0]->parts != c->parts)
error("Particle sorting failed (left edge).");
if (&c->progeny[7]->parts[c->progeny[7]->count] != &c->parts[count])
error("Particle sorting failed (right edge).");
/* Verify a few sub-cells. */
/* for (int k = 0 ; k < c->progeny[0]->count ; k++ )
if ( c->progeny[0]->parts[k].x[0] > pivot[0] ||
c->progeny[0]->parts[k].x[1] > pivot[1] ||
c->progeny[0]->parts[k].x[2] > pivot[2] )
error( "Sorting failed (progeny=0)." );
for (int k = 0 ; k < c->progeny[1]->count ; k++ )
if ( c->progeny[1]->parts[k].x[0] > pivot[0] ||
c->progeny[1]->parts[k].x[1] > pivot[1] ||
c->progeny[1]->parts[k].x[2] <= pivot[2] )
error( "Sorting failed (progeny=1)." );
for (int k = 0 ; k < c->progeny[2]->count ; k++ )
if ( c->progeny[2]->parts[k].x[0] > pivot[0] ||
c->progeny[2]->parts[k].x[1] <= pivot[1] ||
c->progeny[2]->parts[k].x[2] > pivot[2] )
error( "Sorting failed (progeny=2)." ); */
for (int k = 0; k < c->progeny[0]->count; k++)
if (c->progeny[0]->parts[k].x[0] > pivot[0] ||
c->progeny[0]->parts[k].x[1] > pivot[1] ||
c->progeny[0]->parts[k].x[2] > pivot[2])
error("Sorting failed (progeny=0).");
for (int k = 0; k < c->progeny[1]->count; k++)
if (c->progeny[1]->parts[k].x[0] > pivot[0] ||
c->progeny[1]->parts[k].x[1] > pivot[1] ||
c->progeny[1]->parts[k].x[2] <= pivot[2])
error("Sorting failed (progeny=1).");
for (int k = 0; k < c->progeny[2]->count; k++)
if (c->progeny[2]->parts[k].x[0] > pivot[0] ||
c->progeny[2]->parts[k].x[1] <= pivot[1] ||
c->progeny[2]->parts[k].x[2] > pivot[2])
error("Sorting failed (progeny=2).");
#endif
/* Now do the same song and dance for the gparts. */
......
......@@ -27,8 +27,9 @@
#include "lock.h"
#include "multipole.h"
#include "part.h"
#include "task.h"
/* Forward declaration of space, needed for cell_unpack. */
/* Avoid cyclic inclusions */
struct space;
/* Max tag size set to 2^29 to take into account some MPI implementations
......
......@@ -43,6 +43,8 @@
#include "const.h"
#include "error.h"
#include "kernel_hydro.h"
#include "part.h"
#include "units.h"
#include "version.h"
const char* particle_type_names[NUM_PARTICLE_TYPES] = {
......
......@@ -23,13 +23,11 @@
/* Config parameters. */
#include "../config.h"
/* Includes. */
#include "kernel_hydro.h"
#if defined(HAVE_HDF5)
#include "part.h"
#include "units.h"
#if defined(HAVE_HDF5)
/**
* @brief The different types of data used in the GADGET IC files.
*
......@@ -107,6 +105,6 @@ void writeXMFline(FILE* xmfFile, char* fileName, char* partTypeGroupName,
void writeCodeDescription(hid_t h_file);
void writeUnitSystem(hid_t h_file, struct UnitSystem* us);
#endif
#endif /* defined HDF5 */
#endif /* SWIFT_COMMON_IO_H */
......@@ -60,4 +60,7 @@
/* Gravity properties */
#define EXTERNAL_POTENTIAL_POINTMASS
/* Are we debugging ? */
//#define SWIFT_DEBUG_CHECKS
#endif /* SWIFT_CONST_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment