joezuntz / cosmosis

Other
22 stars 18 forks source link

C++ modules cause Cosmosis to complain about .ini parameters not being used #81

Closed annis closed 1 year ago

annis commented 1 year ago

When we compile a C++ module into Cosmosis, at run time it presents warnings of "Parameter '' in the [] section never used!". The C++ modules clearly do use the parameters, as they run correctly. See cut and paste of stream below.

This would merely be annoying, but it interacts poorly with a separate Cosmosis bug with C++, where when a parameter is in fact not found an opaque and not useful message is sent. One has to grovel to understand which parameter was not being read. A C++ debugger is invaluable, which gives the scale of the issue.

One thing at a time- this issue is about the warnings that Cosmosis generates in error.

======= nid008549:y3_buzzard % srun -n 1 cosmosis --mpi buzzard.ini DEBUG:root:CosmoSIS verbosity set to 40 Found 10 samples and 101 bins in redshift in file cluster_power_nz.txt Calculating Limber: Kernel 1 = ('N', 'sample'), Kernel 2 = ('N', 'sample'), P_3D = MatterPower3D --> Output: galaxy_cl Will project these spectra into 2D:

**** WARNING: Parameter 'do_cartesian_product_of_bins' in the [numberCounts] section never used!

**** WARNING: Parameter 'eps_abs' in the [numberCounts] section never used!

**** WARNING: Parameter 'eps_rel' in the [numberCounts] section never used!

**** WARNING: Parameter 'lnm_high' in the [numberCounts] section never used!

**** WARNING: Parameter 'lnm_low' in the [numberCounts] section never used!

**** WARNING: Parameter 'lo_high' in the [numberCounts] section never used!

**** WARNING: Parameter 'lo_low' in the [numberCounts] section never used! etc....

joezuntz commented 1 year ago

Hi Jim.

This doesn't happen in general C++ modules - demo5, for example, uses the JLA likelihood which is in C++ and doesn't yield these warnings. If I add an unused parameter to the section then it does warn correctly.:

# no warnings:
cosmosis demos/demo5.ini -p runtime.sampler=test

# prints **** WARNING: Parameter 'unused' in the [jla] section never used!
cosmosis demos/demo5.ini -p runtime.sampler=test jla.unused=1

so it must be something more specific to either your module or triggered by some other condition. Is the module you're using something I can access to have a closer look?

Cheers, Joe

joezuntz commented 1 year ago

This has been modified in v3, so hopefully whatever issue this was is fixed.