Skip to content

Commit

Permalink
Fixed instrospection error for gobject-instrospection >= 1.80. (#149)
Browse files Browse the repository at this point in the history
* Fixed instrospection error for gobject-instrospection >= 1.80.
* Trying to fix bug in mpi run in MacOS by using brew's openmpi.
* Adding support to control mpi use in meson.
* Disabling mpi in macos brew build (bug in the MPI lib).
  • Loading branch information
vitenti committed Apr 3, 2024
1 parent 6cc7788 commit c1238b7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 19 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_ */

0 comments on commit c1238b7

Please sign in to comment.