Skip to content

Commit

Permalink
Merge branch 'master' into xcor_cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
vitenti committed Apr 3, 2024
2 parents 17a7238 + c1238b7 commit 09672b4
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1
- name: Configure NumCosmo
run: |
meson setup build -Dbuildtype=release -Dnumcosmo_py=true --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
meson setup build -Dbuildtype=release -Dnumcosmo_py=true -Dmpi=disabled --prefix=/usr || (cat build/meson-logs/meson-log.txt && exit 1)
- name: Building NumCosmo
run: |
meson compile -C build
Expand Down
47 changes: 30 additions & 17 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -360,26 +360,39 @@ flint_req = '>= 3.0'
#######################################################################################
message('Checking for MPI')

mpi_c_dep = dependency(
'mpi',
language: 'c',
required: false,
)
if get_option('mpi').auto() or get_option('mpi').enabled()

mpi_fortran_dep = dependency(
'mpi',
language: 'fortran',
required: false,
)
mpi_c_dep = dependency(
'mpi',
language: 'c',
required: false,
)

# MPICH is not found by the mpi dependency, so we need to check for it manually
if not mpi_c_dep.found()
mpi_c_dep = dependency('mpich', required: false)
endif
mpi_fortran_dep = dependency(
'mpi',
language: 'fortran',
required: false,
)

# MPICH is not found by the mpi dependency, so we need to check for it manually
if not mpi_fortran_dep.found()
mpi_fortran_dep = dependency('mpichf90', required: false)
# MPICH is not found by the mpi dependency, so we need to check for it manually
if (not mpi_c_dep.found())
mpi_c_dep = dependency('mpich', required: false)
endif

# MPICH is not found by the mpi dependency, so we need to check for it manually
if (not mpi_fortran_dep.found())
mpi_fortran_dep = dependency('mpichf90', required: false)
endif

if get_option('mpi').enabled() and not mpi_c_dep.found()
error(
'''MPI support requested but not found. Both attempts to locate MPI dependency, \
using Meson's generic finder and MPICH specifically, failed.''',
)
endif
else
mpi_c_dep = not_found
mpi_fortran_dep = not_found
endif

if mpi_c_dep.found()
Expand Down
7 changes: 7 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,10 @@ option(
value: false,
description: 'Enable MPI debug messages',
)

option(
'mpi',
type: 'feature',
value: 'auto',
description: 'Enable MPI support',
)
8 changes: 7 additions & 1 deletion numcosmo/build_cfg.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@
*
* This section shows the macros controling which prerequisite/option was
* used when compiling NumCosmo.
*
*
*/

@have_nlopt_support@
@have_mpi_support@

#ifdef NUMCOSMO_GIR_SCAN
#define NUMCOSMO_HAVE_INLINE
#define NCM_INLINE
#else /* NUMCOSMO_GIR_SCAN */
@have_inline_support@
@have_inline_macro@
#endif /* NUMCOSMO_GIR_SCAN */

#define NUMCOSMO_MAJOR_VERSION @NUMCOSMO_MAJOR_VERSION@
#define NUMCOSMO_MINOR_VERSION @NUMCOSMO_MINOR_VERSION@
#define NUMCOSMO_MICRO_VERSION @NUMCOSMO_MICRO_VERSION@
#define NUMCOSMO_VERSION "@NUMCOSMO_VERSION@"

#endif /* _NCM_BUILD_CFG_H_ */

18 changes: 8 additions & 10 deletions numcosmo_py/app/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def create_cosmo_for_cmb(massive_nu: bool = False) -> Nc.HICosmo:
cosmo = Nc.HICosmoDEXcdm()

cosmo.params_set_default_ftype()
cosmo.omega_x2omega_k()
cosmo.cmb_params()
cosmo.param_set_by_name("H0", 70.0)
cosmo.param_set_by_name("Omegab", 0.05)
cosmo.param_set_by_name("Omegac", 0.25)
cosmo.param_set_by_name("omegab", 0.022)
cosmo.param_set_by_name("omegac", 0.12)

if massive_nu:
cosmo.orig_param_set(Nc.HICosmoDESParams.ENNU, 2.0328)
Expand All @@ -60,7 +60,7 @@ def create_cosmo_for_cmb(massive_nu: bool = False) -> Nc.HICosmo:
cosmo.set_property("H0_fit", True)
cosmo.set_property("Omegac_fit", True)
cosmo.set_property("Omegab_fit", True)
cosmo.set_property("w_fit", True)
cosmo.set_property("w_fit", False)
cosmo.param_set_by_name("Omegak", 0.00)
cosmo.set_property("Omegax_fit", False)

Expand Down Expand Up @@ -202,9 +202,8 @@ def generate_planck18_ttteee() -> tuple[Ncm.ObjDictStr, Ncm.ObjArray]:
EXP_PARAMETERS: dict[str, dict[str, float]] = {
Planck18Types.TT: {
"NcHICosmo:H0": 66.86,
"NcHICosmo:Omegac": 0.12068 / 0.6686**2,
"NcHICosmo:Omegab": 0.022126 / 0.6686**2,
"NcHICosmo:w": -1.0,
"NcHICosmo:omegac": 0.12068,
"NcHICosmo:omegab": 0.022126,
"NcHIPrim:ln10e10ASA": 3.0413,
"NcHIPrim:n_SA": 0.9635,
"NcHIReion:z_re": 7.54,
Expand All @@ -226,9 +225,8 @@ def generate_planck18_ttteee() -> tuple[Ncm.ObjDictStr, Ncm.ObjArray]:
},
Planck18Types.TTTEEE: {
"NcHICosmo:H0": 67.32,
"NcHICosmo:Omegac": 0.12010 / 0.6732**2,
"NcHICosmo:Omegab": 0.022377 / 0.6732**2,
"NcHICosmo:w": -1.0,
"NcHICosmo:omegac": 0.12010,
"NcHICosmo:omegab": 0.022377,
"NcHIPrim:ln10e10ASA": 3.0447,
"NcHIPrim:n_SA": 0.96589,
"NcHIReion:z_re": 7.68,
Expand Down

0 comments on commit 09672b4

Please sign in to comment.