brinckmann / montepython_public

Public repository for the Monte Python Code
MIT License
93 stars 77 forks source link

Segfaults #277

Closed gmfricke closed 1 year ago

gmfricke commented 2 years ago

Hello,

I am providing support to one of our users at the UNM Center for Advanced Research Computing. The user is running montepython but is seeing segfaults in about 25% of his runs. The code is compiled with intel 20.04.

In other tickets where segfaults are mentioned the cause seems to be CLASS or MultiNest. Can you provide any suggestions on the versions of these packages that are known to work with monte_python?

Please let me know if I can provide any information that you would find helpful.

All the best,

Matthew

brinckmann commented 2 years ago

Hi Matthew,

Except for some minor/rare version mismatches CLASS and MontePython versions are always compatible as they are designed to work together. In general, you can safely use the latest MontePython versions with any version of CLASS from the last few years, with the exception that this line in the input .param files may have to be changed as the path changed: CLASS v3.0 and up data.cosmo_arguments['sBBN file'] = data.path['cosmo']+'/external/bbn/sBBN.dat' CLASS v2.10 and earlier data.cosmo_arguments['sBBN file'] = data.path['cosmo']+'/bbn/sBBN.dat'

Since you mention MultiNest, which explores the entirety of the parameter space indicates in the input .param file, you may be exceeding the range of some parameters where CLASS is valid, which might return a seg fault. We provide an example .param file suitable for MultiNest input/example_ns.param which you can try to use to debug. The difference is that in the following lines the numbers provided on the 2nd and 3rd entry in the lists, which are the limits within which those parameters are explored and the range of values here are allowed by CLASS. This shouldn't be a problem for Metropolis-Hastings, which is the default MCMC sampler, unless non-standard parameters are introduced.

data.parameters['omega_b']  = [2.249,  1.8, 3, 0.016, 0.01,'cosmo']
data.parameters['omega_cdm']    = [0.1120, 0.1,   0.2, 0.0016,1,   'cosmo']
data.parameters['n_s']          = [0.963,  0.9,1.1, 0.004, 1,   'cosmo']
data.parameters['A_s']          = [2.42,   1.8,3, 0.038, 1e-9,'cosmo']
data.parameters['h']            = [0.703,  0.6,0.8, 0.0065,1,   'cosmo']
data.parameters['tau_reio']     = [0.085,  0.004,0.12, 0.0044,1,   'cosmo']

Another trick is sampling tau_reio sometimes provide seg faults (although 25% is a lot), and switching to sampling z_reio with boundaries 4 and 12.

Let me know if the problem persists. In that case it would be helpful to include the contents of the .param file being used and whether any changes were made to CLASS.

Best, Thejs

gmfricke commented 2 years ago

@brinckmann thank you so much for your reply. I will pass this on to the user on our end. All the best,

Matthew