eggplantbren / DNest4

Diffusive Nested Sampling
MIT License
62 stars 22 forks source link

Segmentation fault when generating particles from prior #16

Open vatsalpanwar opened 8 years ago

vatsalpanwar commented 8 years ago

Hi Brendon, After having successfully built an RJObject model for modelling the radial velocities (using the model from gp_quasiperiodic_branch of eggplantbren/Exoplanet as a template adapted to run with DNest4), I keep getting a segmentation fault error when I execute main.cpp .

[vatsal@radaura MyRJObject]$ ./main
# Loaded 143 data points from file RV.txt.
# Using 1 thread.
# Target compression factor between levels = 2.7182818284590451
# Seeding random number generators. First seed = 1474535773.
# Generating 3 particles from the prior...Segmentation fault (core dumped)
[vatsal@radaura MyRJObject]$ ./main
# Loaded 143 data points from file RV.txt.
# Using 1 thread.
# Target compression factor between levels = 2.7182818284590451
# Seeding random number generators. First seed = 1474535790.
# Generating 3 particles from the prior...Segmentation fault (core dumped)
[vatsal@radaura MyRJObject]$ ./main
# Loaded 143 data points from file RV.txt.
# Using 1 thread.
# Target compression factor between levels = 2.7182818284590451
# Seeding random number generators. First seed = 1474535795.
# Generating 3 particles from the prior...Segmentation fault (core dumped)
[vatsal@radaura MyRJObject]$ 

The problem persists even when I am using the suggested values for the OPTIONS file (as given in Brewer and Mackey 2016). I suspect it might be due to the unusually high value of seed being used for the random number generator. Can you please help me figure out how I might solve this?

Vatsal

eggplantbren commented 8 years ago

Hi Vatsal,

It won't have anything to do with the seed - high numbers work fine. Is your code in a repository somewhere so I can run it myself?

vatsalpanwar commented 8 years ago

Hi Brendon,

Sure, I uploaded the code here : https://github.com/vatsalpanwar/OnlyRV

Vatsal

eggplantbren commented 8 years ago

Ta.

One problem is that the model needs the lookup tables (orbit shapes) to be loaded before it can calculate any likelihoods. See main.cpp in the Exoplanet repo, which contains this line before running the sampler:

Lookup::get_instance().load();

However there is still a segfault after fixing that. Not sure why.

On Thu, Sep 22, 2016 at 9:55 PM, Vatsal Panwar notifications@github.com wrote:

Hi Brendon,

Sure, I uploaded the code here : https://github.com/vatsalpanwar/OnlyRV

Vatsal

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eggplantbren/DNest4/issues/16#issuecomment-248858548, or mute the thread https://github.com/notifications/unsubscribe-auth/ABgVOrTHAmN5kdTUrYz3QLtyaPtlkKQzks5qslCKgaJpZM4KDsbv .

Dr Brendon J. Brewer Department of Statistics, The University of Auckland, New Zealand Ph: +64 27 500 1336 Web: http://www.stat.auckland.ac.nz/~brewer/

vatsalpanwar commented 8 years ago

Thanks for running the code yourself. I made a modification in my repository to the MyModel.cpp (uncommented the part to check if the log likelihood is nan or inf), took the number of particles as 1, and tried to run it again. It still gives me segmentation fault for a few retries even for this case, before starting to run in the latest attempt.

eggplantbren commented 8 years ago

There is something wrong with the orbit files. Try running orbits.py to regenerate them. It now works on my computer.

On Thu, Sep 22, 2016 at 10:54 PM, Vatsal Panwar notifications@github.com wrote:

Thanks for trying to run the code yourself. I made a modification in my repository to the MyModel.cpp (uncommented the part to check if the log likelihood is nan or inf), took the number of particles as 1, and tried to run it again. It still gives me segmentation fault for a few retries even for this case, before starting to run.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eggplantbren/DNest4/issues/16#issuecomment-248869344, or mute the thread https://github.com/notifications/unsubscribe-auth/ABgVOuJnlsnaQ5zDynAKCuCYdwvjDtU0ks5qsl5bgaJpZM4KDsbv .

Dr Brendon J. Brewer Department of Statistics, The University of Auckland, New Zealand Ph: +64 27 500 1336 Web: http://www.stat.auckland.ac.nz/~brewer/

vatsalpanwar commented 8 years ago

It started working for me for one particle. Will regenerate the orbits and run it again once I am done with this run. Thanks!