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

Merge branch 'os_x_build' into 'master'

OS X-flavoured build fixes

A couple fixes to avoid assuming HAVE_SETAFFINITY, and to stop the linker complaining about duplicate symbols defined in a header.

See merge request !63
parents 9374b461 c4f52b6d
......@@ -260,8 +260,10 @@ fi
AM_CONDITIONAL([HAVEPARALLELHDF5],[test "$have_parallel_hdf5" = "yes"])
# Check for setaffinity.
AC_CHECK_FUNC( pthread_setaffinity_np , AC_DEFINE([HAVE_SETAFFINITY],[true],
AC_CHECK_FUNC(pthread_setaffinity_np, AC_DEFINE([HAVE_SETAFFINITY],[true],
[Defined if pthread_setaffinity_np exists.]) )
AM_CONDITIONAL(HAVESETAFFINITY,
[test "$ac_cv_func_pthread_setaffinity_np" = "yes"])
# Check for timing functions needed by cycle.h.
AC_HEADER_TIME
......
......@@ -36,19 +36,26 @@ if HAVEMPI
bin_PROGRAMS += swift_mpi swift_fixdt_mpi swift_mindt_mpi
endif
# engine_policy_setaffinity is available?
if HAVESETAFFINITY
ENGINE_POLICY_SETAFFINITY=| engine_policy_setaffinity
else
ENGINE_POLICY_SETAFFINITY=
endif
# Sources for swift
swift_SOURCES = main.c
swift_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_multistep | engine_policy_keep | engine_policy_setaffinity"
swift_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_multistep | engine_policy_keep $(ENGINE_POLICY_SETAFFINITY)"
swift_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS)
# Sources for swift_fixdt
swift_fixdt_SOURCES = main.c
swift_fixdt_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_fixdt | engine_policy_keep | engine_policy_setaffinity"
swift_fixdt_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_fixdt | engine_policy_keep $(ENGINE_POLICY_SETAFFINITY)"
swift_fixdt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS)
# Sources for swift_mindt
swift_mindt_SOURCES = main.c
swift_mindt_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_keep | engine_policy_setaffinity"
swift_mindt_CFLAGS = $(MYFLAGS) $(AM_CFLAGS) -DENGINE_POLICY="engine_policy_keep $(ENGINE_POLICY_SETAFFINITY)"
swift_mindt_LDADD = ../src/.libs/libswiftsim.a $(HDF5_LDFLAGS) $(HDF5_LIBS)
# Sources for swift_mpi
......
......@@ -2130,11 +2130,11 @@ void engine_split(struct engine *e, int *grid) {
void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
int nr_queues, int nr_nodes, int nodeID, int policy) {
int k;
int i, k;
float dt_min = dt;
#if defined(HAVE_SETAFFINITY)
int nr_cores = sysconf(_SC_NPROCESSORS_ONLN);
int i, j, cpuid[nr_cores];
int j, cpuid[nr_cores];
cpu_set_t cpuset;
if (policy & engine_policy_cputight) {
for (k = 0; k < nr_cores; k++) cpuid[k] = k;
......
......@@ -54,6 +54,9 @@
#define cell_getid(cdim, i, j, k) \
((int)(k) + (cdim)[2] * ((int)(j) + (cdim)[1] * (int)(i)))
/* Histograms bins. */
long long int runner_hist_bins[runner_hist_N];
/* The counters. */
int runner_counter[runner_counter_count];
......
......@@ -58,7 +58,7 @@ extern int runner_counter[runner_counter_count];
#define runner_hist_a 1.0
#define runner_hist_b 100.0
#define runner_hist_N 99
long long int runner_hist_bins[runner_hist_N];
extern long long int runner_hist_bins[runner_hist_N];
#define runner_hist_hit(x) \
__sync_add_and_fetch( \
&runner_hist_bins[(int)fmax( \
......
Supports Markdown
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