Skip to content
Snippets Groups Projects
Commit eb2f9346 authored by Kipp Cannon's avatar Kipp Cannon
Browse files

rate_estimation.c: parallelize posterior sum

- use OpenMP to auto-parallelize.  won't work on systems that don't use GCC
  or clang
parent f4c99c01
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,6 @@ pkgpython_PYTHON = \
pkgpyexec_LTLIBRARIES = _rate_estimation.la
_rate_estimation_la_SOURCES = rate_estimation.c
_rate_estimation_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) -DMODULE_NAME="\"gstlal._rate_estimation\""
_rate_estimation_la_CPPFLAGS = $(AM_CPPFLAGS) $(PYTHON_CPPFLAGS) -DMODULE_NAME="\"gstlal._rate_estimation\"" -fopenmp
_rate_estimation_la_CFLAGS = $(AM_CFLAGS) -DMODULE_NAME="\"gstlal._rate_estimation\""
_rate_estimation_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LDFLAGS) -module -avoid-version
_rate_estimation_la_LDFLAGS = $(AM_LDFLAGS) $(PYTHON_LDFLAGS) -module -avoid-version -fopenmp
......@@ -87,6 +87,7 @@ static double compute_log_posterior(const double *ln_f_over_b, int n, double Rf,
return atof("-inf");
ln_P = 0.;
#pragma omp parallel for reduction(+:ln_P)
for(i = 0; i < n; i++) {
/*
* need to add log(Rf f / (Rb b) + 1) to sum. if Rf f /
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment