PolyChord / PolyChordLite

Public version of PolyChord: See polychord.co.uk for PolyChordPro
https://polychord.io/
Other
83 stars 26 forks source link

`pypolychord` sometimes hangs when generating live points. #88

Open tillahoffmann opened 1 year ago

tillahoffmann commented 1 year ago

pypolychord occasionally hangs when generating live points (see below for an example output). The CPU utilization is zero when the problem occurs which makes it seem like pypolychord "gave up" trying to generate live points.

Edit: this seems to work fine if I package up the code in an ubuntu docker container running either on ARM or AMD64.

What I've tried, observations, and configuration

# Check that at least 10% of prior samples have log_likelihood > logzero and all are finite.
log_likelihoods = []
for _ in range(10_000):
    # Sample from the hypercube.
    x = np.random.uniform(size=model.size)
    # Convert to prior space.
    y = model.sample_params_from_vector(x)
    # Evaluate the log likelihood given the prior sample.
    log_likelihood, _ = model.evaluate_log_likelihood_from_vector(y, data)
    assert np.isfinite(log_likelihood), log_likelihood
    log_likelihoods.append(log_likelihood)

log_likelihoods = np.asarray(log_likelihoods)
assert np.mean(log_likelihoods > settings.logzero) > .1

Example output

PolyChord: Next Generation Nested Sampling
copyright: Will Handley, Mike Hobson & Anthony Lasenby
  version: 1.20.1
  release: 1st June 2021
    email: wh260@mrao.cam.ac.uk

Run Settings
nlive    :    1025
nDims    :      41
nDerived :       0
Doing Clustering
Synchronous parallelisation
Generating equally weighted posteriors
Generating weighted posteriors
Clustering on posteriors

generating live points

  8% |********                                                                                            |
williamjameshandley commented 1 year ago

If the likelihood works on a linux install, then this is likely a mac issue. Have you tried the CMake install system #76?