PolyChord / PolyChordLite

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

`make_resume_file()` incompatible with MPI #101

Closed AdamOrmondroyd closed 8 months ago

AdamOrmondroyd commented 12 months ago

pypolychord/polychord.py::make_resume_file() does not work with more than one MPI process.

It looks like the send and receive buffers were mixed up, though I admit I have absolutely no idea why recvbuf.dtype was set to int.

I have visually checked that the live points written to the resume file by make_resume_file() are the same numbers as the provided PolyChordSettings.cube_samples.

(I should probably have suspected something would go wrong after not personally pushing my changes in #92 very hard, and here we are)

williamjameshandley commented 12 months ago

Good spot! How easy is it to write a test for this?

AdamOrmondroyd commented 12 months ago

It'll be faster to write than decide whether or not it's easy

AdamOrmondroyd commented 12 months ago

I think this is actually worth some thought.

As things stand, the simplest thing to do would be to create another run_pypolychord.py file which provides some cube samples (not really important what they are).

The natural and easy place for this would be in the Python_Functions folder (which seriously needs tidying up)

However, if we're going to make a test for this, I see no reason why every single other option doesn't also deserve a test. I envisage something like:

@pytest.mark.parameterize("settings", [some, variants, of, settings])
def test_run(settings):
    ...
    output = pypolychord.run_polychord(likelihood, nDims, nDerived, settings, prior, dumper)

However, this would all need to change to plain old kwargs instead of PolyChordSettings if the neglected #90 ever gets merged.

AdamOrmondroyd commented 12 months ago

I've added the optional dependency cube_samples which installs fortranformat which is needed for cube_samples to work properly

AdamOrmondroyd commented 12 months ago

Patch version bump?