Page 1 of 1

Increase efficiency of multiple CosmoMC action=4 runs

Posted: August 10 2019
by chien lin
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

Re: Increase efficiency of multiple CosmoMC action=4 runs

Posted: August 30 2019
by Luke Hart
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

Re: Increase efficiency of multiple CosmoMC action=4 runs

Posted: September 08 2019
by chien lin
Hello Luke!

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

Thank you very much!!
Chien