CosmoMC (version June 2008): freeze after starting Monte-Carlo

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Albert Chuang
Posts: 4
Joined: March 09 2005

CosmoMC (version June 2008): freeze after starting Monte-Car

Post by Albert Chuang » September 15 2009

Hi,
I’m trying to use cosmomc as a MCMC generic sampler. I've followed the suggestion in the post http://cosmocoffee.info/viewtopic.php?t=1399 and everything seems fine until starting Monte-Carlo. It seems to freeze after few steps after “starting Monte-Carlo”. Below are the codes I modified and the results I got. To simplify the problem, here I only show the result with using one processor to run the MPI code.

In calclike.f90, I am testing a simple 2D Gaussian with mean (0,0) and standard deviation (1,2). The values will be showed on the stdout when the function is called.

Code: Select all

I remove: 
    GenericLikelihoodFunction = LogZero 
    stop 'GenericLikelihoodFunction: need to write this function!'
I add:
! test 2D gaussian
    real :: sigma1=1, sigma2=2
    GenericLikelihoodFunction = ((Params%P(1)/sigma1)**2+(Params%P(2)/sigma2)**2)/2
    write(*,*) "P(1)=", Params%P(1),", P(2)=",Params%P(2),", chi2/2=",GenericLikelihoodFunction
In setting.f90, I change the variables as following.

Code: Select all

  integer, parameter :: num_hard =2 
  integer, parameter :: num_initpower = 0
  integer, parameter :: num_norm = 0
  logical, parameter :: generic_mcmc= .true.
In param_generic.ini, I add the parameters to param13 otherwise it will stop with a message: “key not found: param8”. (There are only param1 to param7 in the original param_generic.ini file).

Code: Select all

#parameter start center, min, max, start width, propose width
#e.g. for 2D Gaussian
param1 = 0 -20 20 1 1
param2 = 0 -20 20 1 1
param3 = 0 0 0 0 0
param4 = 0 0 0 0 0
param5 = 0 0 0 0 0
param6 = 0 0 0 0 0
param7 = 0 0 0 0 0
param8 = 0 0 0 0 0
param9 = 0 0 0 0 0
param10 = 0 0 0 0 0
param11 = 0 0 0 0 0
param12 = 0 0 0 0 0
param13 = 0 0 0 0 0
The result from stdout:

Code: Select all

Number of MPI processes:           1
 Random seeds:  3299, 11038 rand_inst:   1
 Computing tensors: F
 Doing CMB lensing: F
 lmax           = 2100
 Number of C_ls =    3
 Varying  2 parameters ( 0 fast)
 starting Monte-Carlo
 P(1)=  -1.017417     , P(2)=   1.627655     , chi2/2=  0.8487263
 P(1)=  -4.047430     , P(2)=  0.9254450     , chi2/2=   8.297900
 P(1)=  0.8030607     , P(2)=   2.856761     , chi2/2=   1.342589
 P(1)=  -3.785574     , P(2)=   5.727679     , chi2/2=   11.26608
 P(1)=  0.1393982     , P(2)= -0.5411084     , chi2/2=  4.6315715E-02
Then, it seems to be blocked until time out. (I set the time limit to be 30 mins.) I have no idea how to fix this problem. Any suggestion would be appreciated. Thanks in advance.

Albert

Antony Lewis
Posts: 1943
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: CosmoMC (version June 2008): freeze after starting Monte

Post by Antony Lewis » September 15 2009

It shouldn't be trying to read param8 if you only have 2 parameters. Did you change to using the Makefile_nowmap make file and re-make the code OK? (e.g. make clean then make in the source directory)

I think MPI on one processor should work, but for testing may be better to turn MPI off.

Albert Chuang
Posts: 4
Joined: March 09 2005

CosmoMC (version June 2008): freeze after starting Monte-Car

Post by Albert Chuang » September 16 2009

Yes! That's the reason. I did not use "make clean" before re-make. Now it runs good without MPI (compiling with ifort without -DMPI). Although there is a problem when I try to use MPI, it is totally different issue and I'm still working on it. Anyway, many thanks!

Post Reply