adding a new parameter to CosmoMC

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Levon Pogosian
Posts: 30
Joined: September 25 2004
Affiliation: Simon Fraser University
Contact:

adding a new parameter to CosmoMC

Post by Levon Pogosian » March 16 2023

Hello,

I am having a problem with adding a new parameter to CosmoMC. This parameter, bpmf, appears in recfast.f90. To implement, I followed the instructions and some examples I have of CosmoMC with added parameters. My code compiles cosmomc, but crashes after completing the likelihood checks. Interestingly, when I compile it in the debug mode, cosmomc_debug runs OK, sampling the new parameter along with the others and writing to the chain files.

By putting write(*,*) statements in various parts of the code, I traced the problem to this line in function CAMBdata_DeltaTime in results.f90:

CAMBdata_DeltaTime = Integrate_Romberg(this, dtauda,a1,a2,atol)

I checked that the new parameter, P%bpmf, has a reasonable value by writing it between calling this%CMBToCAMB and this%CurrentState%SetParams, before the crashes.

I should add that his does not appear to be a problem specific to the latest version of CosmoMC. Exactly the same problem happens when I try to add a second parameter to an older version of CosmoMC that already had a new parameter in recfast.

Any clue what could be happening? And what could make cosmomc crush while allowing cosmomc_debug run OK?

Thanks!

Levon

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

Re: adding a new parameter to CosmoMC

Post by Antony Lewis » March 16 2023

Access violation? Not sure. Could be a compiler bug, esp. if some older gfortran version.

Levon Pogosian
Posts: 30
Joined: September 25 2004
Affiliation: Simon Fraser University
Contact:

Re: adding a new parameter to CosmoMC

Post by Levon Pogosian » March 16 2023

Thanks, Antony.

I am using ifort on a cluster. Here is a line showing the compiler options:

mpiifort -fc=ifort -mkl -O3 -no-prec-div -fpp -qopenmp -DMPI -DCLIK -I../camb/fortran/ReleaseMPI -I/project/6005493/levon/cosmos/code/dist_CosmoMC/source/../camb/forutils/ReleaseMPI/ -I/project/6005493/levon/cosmos/code/plc_3.0/plc-3.01/include -module ReleaseMPI -IReleaseMPI/ -c propose.f90 -o ReleaseMPI/propose.o

It says "signal 11" when crashing, which could be memory access indeed.

In comparison, when compiling cosmomc_debug, the options look like this:

mpiifort -fc=ifort -mkl -g -check all -check noarg_temp_created -traceback -fpp -fpe0 -qopenmp -DMPI -DCLIK -I../camb/fortran/DebugMPI -I/project/6005493/levon/cosmos/code/dist_CosmoMC/source/../camb/forutils/DebugMPI/ -I/project/6005493/levon/cosmos/code/plc_3.0/plc-3.01/include -module DebugMPI -IDebugMPI/ -c CalcLike_Cosmology.f90 -o DebugMPI/CalcLike_Cosmology.o

and it doesn't crash.

Post Reply