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
```

Code: Select all

```
integer, parameter :: num_hard =2
integer, parameter :: num_initpower = 0
integer, parameter :: num_norm = 0
logical, parameter :: generic_mcmc= .true.
```

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
```

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
```

Albert