dgrin1 / axionCAMB

MIT License
19 stars 7 forks source link

Running axionCAMB as a module in CosmoSIS but return a Segmentation fault #9

Open Saber-of-QFT opened 2 years ago

Saber-of-QFT commented 2 years ago

Hello, I met some tricky problem when I try to run axionCAMB as a module in CosmoSIS.

I install axionCAMB and running axionCAMB with "./camb params.ini" successfully. Then I install CosmoSIS using the conda-forge (following https://cosmosis.readthedocs.io/en/latest/intro/installation.html). The installation of CosmoSIS also success and work well with the original version of CAMB. Then I try to add axionCAMB as a modify CAMB module of CosmoSIS.

I notice that axionCAMB is based on CAMB_Nov13. So I download the camb_interface.F90 from https://github.com/philbull/cosmosis-standard-library/tree/master/boltzmann/camb_Nov13. And try to modify it to become an interface of axionCAMB.

Here are the changes that I made

First I change the function camb_shift_parameter(params) result(shift_parameter) part, adding the contribution of axion in it

    function camb_shift_parameter(params) result(shift_parameter)
        type(cambparams) :: params
        real(dl) :: omega_m, ombh2, omdmh2, zstar, shift_parameter
        real(dl), parameter :: c_km_per_s = 299792.458

        omega_m = params%omegac + params%omegab + params%omegan + params%omegaax

                ombh2 = CP%omegab*(CP%h0/100.0d0)**2
                omdmh2 = (CP%omegac+CP%omegan+CP%omegaax)*(CP%h0/100.0d0)**2`

Then I modify the function camb_interface_set_params(block, params, background_only) result(status), adding two axion parameters into

status = status + datablock_get_double(block, cosmo, "omega_ax", params%omegaax)

 status = status + datablock_get_double(block, cosmo, "m_ax", params%ma)

After that, I try to run a pipeline which include the axionCAMB module. Then I got this error:

* Running sampler 1/1: test
****************************
Running consistency ...
Done consistency status = 0
consistency took: 0.033 seconds
Running camb ...
Fatal Python error: Segmentation fault

Current thread 0x00007f0bec1a0740 (most recent call first):
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/runtime/module.py", line 249 in execute
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/runtime/pipeline.py", line 631 in run
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/runtime/pipeline.py", line 1110 in run_parameters
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/runtime/pipeline.py", line 1344 in likelihood
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/samplers/test/test_sampler.py", line 26 in execute
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/main.py", line 87 in sampler_main_loop
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/main.py", line 305 in run_cosmosis
  File "/home/anduril/conda-env/lib/python3.9/site-packages/cosmosis/main.py", line 397 in main
  File "/home/anduril/conda-env/bin/cosmosis", line 4 in <module>
Segmentation fault (core dumped)

I don't know how to solve this problem. Maybe some missing part in the interface file. Can you help me? Thank you very much!

dgrin1 commented 2 years ago

Hello there - @reneehlozek or @keirkwame and Mona Dentler have done this recently, so I'd reach out to them! (They have done recent constraints in cosmosis with axioncamb).

xboluna commented 2 years ago

Hi @Saber-of-QFT -- were you able to figure this out?