Skip to content

Commit

Permalink
[Meson] Update the detection of HWLOC
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Jan 26, 2024
1 parent 4dbd344 commit 31d1534
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
3 changes: 3 additions & 0 deletions README.meson
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Currently supported options with their default value:
* `-Dlibspmf=spmf`: SPMF library against which to link;
* `-Dlibpastix=pastix`: PASTIX library against which to link;
* `-Dlibampl=ampl`: AMPL library against which to link;
* `-Dlibhwloc=hwloc`: HWLOC library against which to link;
* `-Dlibblas_path=[]`: additional directories to search for the BLAS library;
* `-Dliblapack_path=[]`: additional directories to search for the LAPACK library;
* `-Dlibmetis_path=[]`: additional directories to search for the METIS library;
Expand All @@ -46,6 +47,8 @@ Currently supported options with their default value:
* `-Dlibpastix_path=[]`: additional directories to search for the PASTIX library;
* `-Dlibmumps_path=[]`: additional directories to search for the MUMPS libraries;
* `-Dlibampl_path=[]`: additional directories to search for the AMPL library library;
* `-Dlibhwloc_path=[]`: Additional directory to search for the HWLOC library;
* `-Dlibhwloc_include=[]`: Additional directories to search for the HWLOC header files;
* `-Dlibhsl_modules[]`: additional directories to search for the HSL modules;
* `-Dlibmetis_version=5`: version of the METIS library;
* `-Dgalahad_int64=false`: compile GALAHAD with 64-bit integer.
Expand Down
13 changes: 8 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ libpastix_name = get_option('libpastix')
libampl_name = get_option('libampl')
libcutest_single_name = get_option('libcutest_single')
libcutest_double_name = get_option('libcutest_double')
libhwloc_name = get_option('libhwloc')

libmumps_path = get_option('libmumps_path')
libblas_path = get_option('libblas_path')
Expand All @@ -106,9 +107,11 @@ libpastix_path = get_option('libpastix_path')
libampl_path = get_option('libampl_path')
libcutest_single_path = get_option('libcutest_single_path')
libcutest_double_path = get_option('libcutest_double_path')
libhwloc_path = get_option('libhwloc_path')

libmetis_version = get_option('libmetis_version')

libhwloc_include = get_option('libhwloc_include')
libcutest_single_modules = get_option('libcutest_single_modules')
libcutest_double_modules = get_option('libcutest_double_modules')
libhsl_modules = get_option('libhsl_modules')
Expand All @@ -127,7 +130,9 @@ libpastix = fc.find_library(libpastix_name, dirs : libpastix_path, required : fa
libsmumps = fc.find_library('smumps', dirs : libmumps_path, required : false)
libdmumps = fc.find_library('dmumps', dirs : libmumps_path, required : false)
libampl = fc.find_library(libampl_name, dirs : libampl_path, required : false)
libhwloc = fc.find_library(libhwloc_name, dirs : libhwloc_path, required : false)
lm = cc.find_library('m', required : false)
libmpi = dependency('mpi', language : 'fortran', required : false)

# OpenMP
if fc.get_id() == 'nvidia_hpc'
Expand Down Expand Up @@ -156,9 +161,6 @@ elif cxx.get_id() == 'intel-cl' or cxx.get_id() == 'intel-llvm-cl'
add_global_arguments('/Qopenmp', language : 'cpp')
endif

libmpi = dependency('mpi', language : 'fortran', required : false)
libhwloc = dependency('hwloc', required : false)

libgalahad_single_deps = [libsmumps, libcutest_single]
libgalahad_double_deps = [libdmumps, libcutest_double]
libgalahad_deps = [libblas, liblapack, libmetis, libhsl,
Expand Down Expand Up @@ -211,7 +213,7 @@ galahad_python_tests = []
# Folders that contain headers and Fortran modules
libgalahad_include = [include_directories('include'),
include_directories('src/dum/include'),
include_directories('src/ampl')] + libhsl_modules
include_directories('src/ampl')] + libhsl_modules + libhwloc_include

libgalahad_single_include = libgalahad_include + libcutest_single_modules
libgalahad_double_include = libgalahad_include + libcutest_double_modules
Expand All @@ -223,7 +225,8 @@ else
endif

# HWLOC
if libhwloc.found()
has_hwloch = cc.has_header('hwloc.h', include_directories : libhwloc_include)
if libhwloc.found() and has_hwloch
add_global_arguments('-DSPRAL_HAVE_HWLOC', language : 'cpp')
else
add_global_arguments('-DSPRAL_NO_HWLOC', language : 'cpp')
Expand Down
15 changes: 15 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ option('libampl',
value : 'ampl',
description : 'AMPL library against which to link')

option('libhwloc',
type : 'string',
value : 'hwloc',
description : 'HWLOC library against which to link')

option('libblas_path',
type : 'array',
value : [],
Expand Down Expand Up @@ -153,6 +158,16 @@ option('libampl_path',
value : [],
description : 'Additional directories to search for the AMPL library library')

option('libhwloc_path',
type : 'array',
value : [],
description : 'Additional directory to search for the HWLOC library')

option('libhwloc_include',
type : 'array',
value : [],
description : 'Additional directories to search for the HWLOC header files')

option('libhsl_modules',
type : 'array',
value : [],
Expand Down

0 comments on commit 31d1534

Please sign in to comment.