Commit 5cc4d4bf authored by James Willis's avatar James Willis
Browse files

Enclose velociraptor calls in macros and created a configuration option that...

Enclose velociraptor calls in macros and created a configuration option that turns velociraptor on via --enable-velociraptor.
parent 21dc19cd
......@@ -993,6 +993,18 @@ if test "$enable_debug_interactions" != "no"; then
fi
fi
# Check if VELOCIraptor is enabled.
AC_ARG_ENABLE([velociraptor],
[AS_HELP_STRING([--enable-velociraptor],
[Activate structure finding with VELOCIraptor.]
)],
[enable_velociraptor="$enableval"],
[enable_velociraptor="no"]
)
if test "$enable_velociraptor" != "no"; then
AC_DEFINE([WITH_VELOCIRAPTOR],1,[Enable VELOCIRaptor])
fi
# SPH Kernel function
AC_ARG_WITH([kernel],
[AS_HELP_STRING([--with-kernel=<kernel>],
......@@ -1344,6 +1356,7 @@ AC_MSG_RESULT([
Special allocators : $have_special_allocator
CPU profiler : $have_profiler
Pthread barriers : $have_pthread_barrier
VELOCIraptor : $enable_velociraptor
Hydro scheme : $with_hydro
Dimensionality : $with_dimension
......
......@@ -1125,11 +1125,13 @@ int main(int argc, char *argv[]) {
engine_print_stats(&e);
engine_dump_snapshot(&e);
#ifdef WITH_VELOCIRAPTOR
/* Call VELOCIraptor at the end of the run to find groups. */
if (e.policy & engine_policy_structure_finding) {
velociraptor_init(&e);
velociraptor_invoke(&e);
}
#endif
#ifdef WITH_MPI
if ((res = MPI_Finalize()) != MPI_SUCCESS)
......
......@@ -43,6 +43,8 @@
*
*/
void velociraptor_init(struct engine *e) {
#ifdef WITH_VELOCIRAPTOR
struct space *s = e->s;
struct cosmoinfo cosmo_info;
struct unitinfo unit_info;
......@@ -146,6 +148,9 @@ void velociraptor_init(struct engine *e) {
/* Initialise VELOCIraptor. */
if(!InitVelociraptor(configfilename, outputFileName, cosmo_info, unit_info, sim_info)) error("Exiting. VELOCIraptor initialisation failed.");
#else
error("SWIFT not configure to run with VELOCIraptor.");
#endif /* WITH_VELOCIRAPTOR */
}
......@@ -157,6 +162,7 @@ void velociraptor_init(struct engine *e) {
*/
void velociraptor_invoke(struct engine *e) {
#ifdef WITH_VELOCIRAPTOR
struct space *s = e->s;
struct gpart *gparts = s->gparts;
struct part *parts = s->parts;
......@@ -242,7 +248,7 @@ void velociraptor_invoke(struct engine *e) {
/* Call VELOCIraptor. */
if(!InvokeVelociraptor(nr_gparts, nr_hydro_parts, swift_parts, cell_node_ids, outputFileName)) error("Exiting. Call to VELOCIraptor failed on rank: %d.", e->nodeID);
/* Reset the pthread affinity mask after VELOCIraptor returns. */
pthread_setaffinity_np(thread, sizeof(cpu_set_t), engine_entry_affinity());
......@@ -252,4 +258,7 @@ void velociraptor_invoke(struct engine *e) {
message("VELOCIraptor took %.3f %s on rank %d.",
clocks_from_ticks(getticks() - tic), clocks_getunit(), engine_rank);
#else
error("SWIFT not configure to run with VELOCIraptor.");
#endif /* WITH_VELOCIRAPTOR */
}
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