CosmoMC: Problem with adding new parameters

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Henry Lin
Posts: 7
Joined: March 06 2012
Affiliation: Caddo Magnet High School

CosmoMC: Problem with adding new parameters

Post by Henry Lin » May 01 2012

Hi all,

I've recently modified the (updated 2012) PPF module so that it uses an alternate dark energy equation of state parameterization. When I run CAMB by itself, it gives good results.

I then followed the steps on http://cosmocoffee.info/viewtopic.php?p=4698 to add the new parameters to CosmoMC. Unfortunately, I get the following when running CosmoMC:

Code: Select all

 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  6 parameters ( 0 fast)
 starting Monte-Carlo
 Initialising BBN Helium data...
 bad xa input in splint
I've inserted a print command which shows that at the time of the error, the parameters have the correctly loaded values. I can run the standard version of CosmoMC just find.

Thanks for your time!

Sheng Li
Posts: 57
Joined: May 26 2009
Affiliation: University of Sussex
Contact:

Re: CosmoMC: Problem with adding new parameters

Post by Sheng Li » May 04 2012

Henry Lin wrote:Hi all,

I've recently modified the (updated 2012) PPF module so that it uses an alternate dark energy equation of state parameterization. When I run CAMB by itself, it gives good results.

I then followed the steps on http://cosmocoffee.info/viewtopic.php?p=4698 to add the new parameters to CosmoMC. Unfortunately, I get the following when running CosmoMC:

Code: Select all

 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  6 parameters ( 0 fast)
 starting Monte-Carlo
 Initialising BBN Helium data...
 bad xa input in splint
I've inserted a print command which shows that at the time of the error, the parameters have the correctly loaded values. I can run the standard version of CosmoMC just find.

Thanks for your time!
Just One cue:
Reverse xa (virtual argument) in its according file, then reverse to actual argument insteadof xa;

No detail outputs, no further help.

If you switched on "debug" while doing compilation, you must see many outputs, which you would better to paste here, so that you or others can help you better and further.

If you dont know how to switch on debug, you can insert the following line after f90 compilation option in your Makefile under the folder "source".

-O0 -g debug -all

Change your default optimization to -O0 (no optim.. then accelerate compiling process).

So, return here with output msgs after doing that.
Good luck.

Henry Lin
Posts: 7
Joined: March 06 2012
Affiliation: Caddo Magnet High School

Re: CosmoMC: Problem with adding new parameters

Post by Henry Lin » May 12 2012

Thanks so much for your reply! I've changed the makefile to

Code: Select all

FFLAGS = -O0 -g -debug
Incidentally, I'm running cosmobox with ifort.

I get the following messages:

Code: Select all

-I/home/ubuntu/workspace/likelihood -c cmbtypes.f90
cmbtypes.f90(26): warning #5117: Bad # preprocessor line
#ifdef DR71RG
-^
cmbtypes.f90(33): warning #5117: Bad # preprocessor line
#else
-^
cmbtypes.f90(39): warning #5117: Bad # preprocessor line
#endif
-^
cmbtypes.f90(34): error #6418: This name has already been assigned a data type.   [NUM_MATTER_POWER]
  integer, parameter :: num_matter_power = 74 !number of points computed in matter power spectrum
------------------------^
cmbtypes.f90(35): error #6418: This name has already been assigned a data type.   [MATTER_POWER_MINKH]
  real, parameter    :: matter_power_minkh =  0.999e-4  !1e-4 !minimum value of k/h to store
------------------------^
cmbtypes.f90(36): error #6418: This name has already been assigned a data type.   [MATTER_POWER_DLNKH]
  real, parameter    :: matter_power_dlnkh = 0.143911568     !log spacing in k/h
------------------------^
cmbtypes.f90(37): error #6418: This name has already been assigned a data type.   [MATTER_POWER_MAXZ]
  real, parameter    :: matter_power_maxz = 0.    !6.0
------------------------^
cmbtypes.f90(38): error #6418: This name has already been assigned a data type.   [MATTER_POWER_LNZSTEPS]
  integer, parameter :: matter_power_lnzsteps = 1 !20
------------------------^
compilation aborted for cmbtypes.f90 (code 1)
make: *** [cmbtypes.o] Error 1
Thanks for your time!

Sheng Li
Posts: 57
Joined: May 26 2009
Affiliation: University of Sussex
Contact:

CosmoMC: Problem with adding new parameters

Post by Sheng Li » May 16 2012

Let me simply reply under your latest post.

I don't understand why those lines
#ifdef DR71RG
....
#end if
would not be recognised in cosmoBox.

But if you really want to use DR71RG, which is explained in README in CosmoMC page. then check how to configure it.

For the following lines, which indicated you did not define matter_power or such stuffs. so you should look for all the places where they might be used. Or you can define them in you module or somewhere (basically, in each subroutine in which those variables are used).

Or, another possibility is you did not configure well WMAP 7-year data, where most key variables are defined. Then camb and mcmc explorer can find them without question.
However, if those variables are NEW, as you proposed in you post, then you will have to define them as i said above.

btw: debug option should be fully as (the following is enough to get most debug info)
-O0 -g debug -check all

(sorry for missing '-check all' in my last post.)

Henry Lin
Posts: 7
Joined: March 06 2012
Affiliation: Caddo Magnet High School

CosmoMC: Problem with adding new parameters

Post by Henry Lin » May 20 2012

Thank you so much for your help!

I was able to resolve this problem by simply adding -fpp. Now my only problem is once i run cosmomc I get

Code: Select all

 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  6 parameters ( 0 fast)

forrtl: severe (408): fort: (2): Subscript #1 of the array PMAT has value 14 which is greater than the upper bound of 13

Image              PC        Routine            Line        Source             
cosmomc            08AF6BB9  Unknown               Unknown  Unknown
cosmomc            08AF5935  Unknown               Unknown  Unknown
cosmomc            08AAA961  Unknown               Unknown  Unknown
cosmomc            08A654E6  Unknown               Unknown  Unknown
cosmomc            08A657F4  Unknown               Unknown  Unknown
cosmomc            08077CB3  Unknown               Unknown  Unknown
cosmomc            080E91CF  Unknown               Unknown  Unknown
cosmomc            081078F8  Unknown               Unknown  Unknown
cosmomc            08054124  Unknown               Unknown  Unknown
libc.so.6          00129113  Unknown               Unknown  Unknown

Sheng Li
Posts: 57
Joined: May 26 2009
Affiliation: University of Sussex
Contact:

Re: CosmoMC: Problem with adding new parameters

Post by Sheng Li » May 21 2012

Henry Lin wrote:Thank you so much for your help!

I was able to resolve this problem by simply adding -fpp. Now my only problem is once i run cosmomc I get

Code: Select all

 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  6 parameters ( 0 fast)

forrtl: severe (408): fort: (2): Subscript #1 of the array PMAT has value 14 which is greater than the upper bound of 13

Image              PC        Routine            Line        Source             
cosmomc            08AF6BB9  Unknown               Unknown  Unknown
cosmomc            08AF5935  Unknown               Unknown  Unknown
cosmomc            08AAA961  Unknown               Unknown  Unknown
cosmomc            08A654E6  Unknown               Unknown  Unknown
cosmomc            08A657F4  Unknown               Unknown  Unknown
cosmomc            08077CB3  Unknown               Unknown  Unknown
cosmomc            080E91CF  Unknown               Unknown  Unknown
cosmomc            081078F8  Unknown               Unknown  Unknown
cosmomc            08054124  Unknown               Unknown  Unknown
libc.so.6          00129113  Unknown               Unknown  Unknown
Good, since you can get the error msg.

The output error msg indicated that your defined array "PMAT" is out of its allocated bound.

Search your file for of PMAT which is used/called, or defined.

so, then you need to check the size of array PMAT (if this array is actually defined BY YOU OWN SIDE), or what extra components are passed to PMAT.

Henry Lin
Posts: 7
Joined: March 06 2012
Affiliation: Caddo Magnet High School

CosmoMC: Problem with adding new parameters

Post by Henry Lin » May 28 2012

I found PMAT under paramdef.f90. I've bumped up the number of hard parameters in settings and I've changed the proposed covariance matrix (params_CMB.covmat), but I still get

Code: Select all

ubuntu@cosmobox:~/workspace/cosmomc2$ cos
 Random seeds:  5362, 21711 rand_inst:   0
 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  7 parameters ( 0 fast)
forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

 starting Monte-Carlo
 Initialising BBN Helium data...
(alpha, beta) = ( 0.50000,  1.00000)
 bad xa input in splint
(alpha, beta) = ( 0.50000,  1.00000)
ubuntu@cosmobox:~/workspace/cosmomc2$

Sheng Li
Posts: 57
Joined: May 26 2009
Affiliation: University of Sussex
Contact:

Re: CosmoMC: Problem with adding new parameters

Post by Sheng Li » May 28 2012

Henry Lin wrote:I found PMAT under paramdef.f90. I've bumped up the number of hard parameters in settings and I've changed the proposed covariance matrix (params_CMB.covmat), but I still get

Code: Select all

ubuntu@cosmobox:~/workspace/cosmomc2$ cos
 Random seeds:  5362, 21711 rand_inst:   0
 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  7 parameters ( 0 fast)
forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

forrtl: warning (402): fort: (1): In call to I/O Read routine, an array temporary was created for argument #1

 starting Monte-Carlo
 Initialising BBN Helium data...
(alpha, beta) = ( 0.50000,  1.00000)
 bad xa input in splint
(alpha, beta) = ( 0.50000,  1.00000)
ubuntu@cosmobox:~/workspace/cosmomc2$

Good, I think you are close to clean all issues.
*This msg suggests that your codes encounter just an I/O error.

Just check one subroutine which is called before proceeding to start Monte-Carlo.
To do that, you should locate this *array (which may or may not created by you)* between "Varying 7 parameters" and "starting Monte Carlo".

grep the above two key words, then I think you can find some I/O procedures in which the error occurred.

Besides, if you can run your *cos* after Monte Carlo, I think there is possibly no technical errors before getting your expected outputs. If you could not get that, you will have to debug and refine your codes in some physical principles.

Good luck.

Sheng Li
Posts: 57
Joined: May 26 2009
Affiliation: University of Sussex
Contact:

CosmoMC: Problem with adding new parameters

Post by Sheng Li » May 28 2012

by the way, to do that:

Code: Select all

grep -in "varying\|parameters" *90
then

Code: Select all

grep -in 'starting Monte-Carlo' *90
then you will find one or two subroutines to look into.

Henry Lin
Posts: 7
Joined: March 06 2012
Affiliation: Caddo Magnet High School

CosmoMC: Problem with adding new parameters

Post by Henry Lin » June 09 2012

Hi Sheng,
Many thanks again for all of your time. I've used grep to find that the warnings are associated w/ the loading covariance matrix. This is in fact not a problem that needs to be addressed; the standard version of CosmoMC also produces these warnings under debug mode, but it can run with no issues. I've reinstalled everything and I think the issue is with the new version of the PPF module. http://cosmocoffee.info/viewtopic.php?t=1849. Any thoughts?

Sheng Li
Posts: 57
Joined: May 26 2009
Affiliation: University of Sussex
Contact:

Re: CosmoMC: Problem with adding new parameters

Post by Sheng Li » June 09 2012

Henry Lin wrote:Hi Sheng,
Many thanks again for all of your time. I've used grep to find that the warnings are associated w/ the loading covariance matrix. This is in fact not a problem that needs to be addressed; the standard version of CosmoMC also produces these warnings under debug mode, but it can run with no issues. I've reinstalled everything and I think the issue is with the new version of the PPF module. http://cosmocoffee.info/viewtopic.php?t=1849. Any thoughts?
Hi,
I think this is not the case I can do. I could not say anything if I did not explore PPF module.
It seemed that the author of PPF said she would update this module. So I think you can either ask her help or probably just wait until the PPF updated.

Alternatively, you may find the functional modules elsewhere which can support your modules.

Dario Scovacricchi
Posts: 1
Joined: July 18 2012
Affiliation: University of Trieste

CosmoMC: Problem with adding new parameters

Post by Dario Scovacricchi » July 18 2012

Hi,
I have exactly the same problem with ppf module.
When I run it, I obtain: bad xa input in splint
Do you solve the problem? Can you help me?

Hamzeh Alavi
Posts: 6
Joined: October 27 2011
Affiliation: KIT

Re: CosmoMC: Problem with adding new parameters

Post by Hamzeh Alavi » November 19 2012

Henry Lin wrote:Hi all,

I've recently modified the (updated 2012) PPF module so that it uses an alternate dark energy equation of state parameterization. When I run CAMB by itself, it gives good results.

I then followed the steps on http://cosmocoffee.info/viewtopic.php?p=4698 to add the new parameters to CosmoMC. Unfortunately, I get the following when running CosmoMC:

Code: Select all

 Computing tensors: F
 Doing CMB lensing: T
 lmax           = 2100
 Number of C_ls =    4
 Varying  6 parameters ( 0 fast)
 starting Monte-Carlo
 Initialising BBN Helium data...
 bad xa input in splint
I've inserted a print command which shows that at the time of the error, the parameters have the correctly loaded values. I can run the standard version of CosmoMC just find.

Thanks for your time!
I have the same problem, I followed the suggestions above, but the problem still exists. Could you solve it?

Vanessa Smer
Posts: 13
Joined: July 25 2013
Affiliation: ROE at University of Edinburgh

CosmoMC: Problem with adding new parameters

Post by Vanessa Smer » May 19 2014

Hi, I had the same issue:

"bad xa input in splint"

while running PPF mode.

I solved it by adding

w = Ini_Read_Double('w')
wa = Ini_Read_Double('wa')
Whatevs = Ini_Read_Double('Whatevs')

where Whatevs is any other parameter you want to add. You have to do this for any new parameter, but somehow I forgot to add those for PPF. Now the "bad xa" error dissapeared and its running smoothly. Hope it helps!

Vanessa Smer
Posts: 13
Joined: July 25 2013
Affiliation: ROE at University of Edinburgh

CosmoMC: Problem with adding new parameters

Post by Vanessa Smer » May 21 2014

Apologies for my message from yesterday, I got confused in one of the runs and was actually running another modification instead of ppf when I thought I had dealt with it.

Coming back to the PPF problem, while running with the option where you need to modify the equation of state in the function w_de(a) in equations_ppf.f90, this one seems to run fine with cosmomc, I am using April 2014 version. However, while trying to use the tabulated case, it gives the error that some of you describe "bad xa input splint ".

This error comes from the subroutine cubicsplint included in equations_ppf.f90. While trying to run the tabulated version in cosmomc, I added:

write((*,*) 'h, xa(khi), xa(klo)', h, xa(khi), xa(klo)

in cubicsplint, where the variables written are those involved with the crashing of the program. This in order to see if I seeing their values could help to understand what is going on.

Then, before cosmomc stops running it gives me that all these values are zero. That is, it seems like it's not even reading the file with the tabulated data.

Doing some tracing back, the clue seems to be in the function grho_de(a) in equations_ppf.f90. This function works for both cases, in the following way:

For the NOT tabulated case:

if(.not. use_tabulated_w) then
grho_de=grhov*a**(1._dl-3.*w_lam-3.*wa_ppf)*exp(-3.*wa_ppf*(1._dl-a))


For the tabulated case:

else
if(a.eq.0.d0)then
grho_de=0.d0 !assume rho_de*a^4-->0, when a-->0, OK if w_de always <0.
else
al=dlog(a)
if(al.lt.ade(1))then
fint=rde(1)*(a/amin)**(1.-3.*w_de(amin)) !if a<amin, assume here w=w_de(amin)
else !if amin is small enough, this extrapolation will be unnecessary.
call cubicsplint(ade,rde,ddrde,nde,al,fint)
endif
grho_de=grhov*fint
endif
endif


As you can see for the tabulated case it is calling cubicsplint, but cubicsplint is only required for the tabulated case, the not tabulated only needs to know the values w0, wa to do the calculation and that's why that case presents no trouble.

Also, the subroutine DarkEnergy_ReadParams(Ini) which reads the tabulated file is nowhere to be called inside equations_ppf.f90, however, it is called in inidriver.F90. Perhaps that's why in CAMB both versions run well but in CosmoMC only the non tabulated does?

I have been trying to do something similar to the quint module case, where the subroutine init_background is used to call the subroutine Quint_init_background and initialize quintessence, to be more specific, what I have tried to do is to add:

use IniFile
Type(TIniFile) :: Ini

call DarkEnergy_ReadParams(Ini)

to init_background in equations_ppf.f90. But it seems like that is not allowed, I get segmentation errors. I have tried to do the same directly into the function grho_de, in order for it to be read straightaway after compilation, but to no avail.

Any ideas would be appreciated,

Post Reply