Increase efficiency of multiple CosmoMC action=4 runs

Use of Healpix, camb, CLASS, cosmomc, compilers, etc.
Post Reply
chien lin
Posts: 6
Joined: July 02 2019
Affiliation: University of Oxford

Increase efficiency of multiple CosmoMC action=4 runs

Post by chien lin » August 10 2019

Hello,

I am trying to work out how \chi^2 varies when Gaussian prior is applied to some parameters (eg ombh2, omch2). I added my new functions in CosmologyParameterizations.f90. To get the data, I have to run multiple times of CosmoMC (action=4). The method I am currently using is simply to write a script that calls CosmoMC multiple times and record the parameter set and the \chi^2. However, this takes a long time to finish as every time CosmoMC is called, the whole program has to re-initialise.

So, I am wondering if there is a way to modify the code so that CosmoMC can retain the initialisation. I want the program to simply change the central value of some parameters, send them to CAMB, and calculate the \chi^2. I think I should modify the driver, but I am not sure where/which subroutines should be in the loop.

Thank you in advance for your help!
Chien Lin

Luke Hart
Posts: 58
Joined: July 13 2015
Affiliation: University of Manchester

Re: Increase efficiency of multiple CosmoMC action=4 runs

Post by Luke Hart » August 30 2019

Hello Chien Lin!

So this is actually a problem I have had to deal with quite recently. There are several options,
  • Write some for loops within the DoTests function that will just resample over new parameters. You can change the values of certain parameters if you use the ParamSet and BaseParameter functions which can target given parameters.
  • Write your own module which effectively does the test sampling for you for a given set of standard CosmoMC samples.[\list]

    I have done the latter for a project I am working on and currently in discussion with Antony about. It currently changes each test run of CosmoMC from a sample/30secs with the likelihood to sample/3secs.

    You should modify the driver, but also GeneralSetup where DoTests is found and also even just writing your own module is a really good exercise. If you are adamant at looking at this on your own, I would take a look at the importance sampling module and start to write your own functions off that (that is what I did), otherwise you can wait for the Git branch that I plan to release for the SelectiveSampling module I'm writing.

    Hope this helps!! If you want more specific help please email [Log in to view email]

    Cheers
    Luke

chien lin
Posts: 6
Joined: July 02 2019
Affiliation: University of Oxford

Re: Increase efficiency of multiple CosmoMC action=4 runs

Post by chien lin » September 08 2019

Hello Luke!

This is very helpful to me, the total runtime drops significantly using the latter method.

Thank you very much!!
Chien

Post Reply