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

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

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

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&#58;
GenericLikelihoodFunction = LogZero
stop 'GenericLikelihoodFunction&#58; need to write this function!'
! test 2D gaussian
real &#58;&#58; sigma1=1, sigma2=2
GenericLikelihoodFunction = &#40;&#40;Params%P&#40;1&#41;/sigma1&#41;**2+&#40;Params%P&#40;2&#41;/sigma2&#41;**2&#41;/2
write&#40;*,*&#41; "P&#40;1&#41;=", Params%P&#40;1&#41;,", P&#40;2&#41;=",Params%P&#40;2&#41;,", chi2/2=",GenericLikelihoodFunction

In setting.f90, I change the variables as following.

Code: Select all

  integer, parameter &#58;&#58; num_hard =2
integer, parameter &#58;&#58; num_initpower = 0
integer, parameter &#58;&#58; num_norm = 0
logical, parameter &#58;&#58; 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&#58;           1
Random seeds&#58;  3299, 11038 rand_inst&#58;   1
Computing tensors&#58; F
Doing CMB lensing&#58; F
lmax           = 2100
Number of C_ls =    3
Varying  2 parameters &#40; 0 fast&#41;
starting Monte-Carlo
P&#40;1&#41;=  -1.017417     , P&#40;2&#41;=   1.627655     , chi2/2=  0.8487263
P&#40;1&#41;=  -4.047430     , P&#40;2&#41;=  0.9254450     , chi2/2=   8.297900
P&#40;1&#41;=  0.8030607     , P&#40;2&#41;=   2.856761     , chi2/2=   1.342589
P&#40;1&#41;=  -3.785574     , P&#40;2&#41;=   5.727679     , chi2/2=   11.26608
P&#40;1&#41;=  0.1393982     , P&#40;2&#41;= -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: 1595
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

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

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

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!