Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve mkl and mpi4py search #827

Merged
merged 2 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions SU2_PY/pySU2/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@ swig = find_program('swig')

# add mpi4py include
if mpi_dep[0].found() and mpi_dep[1].found()
if get_option('python_path') != ''
python_dir = get_option('python_path')
else
python_dir = run_command(python, '-c', 'from distutils.sysconfig import get_python_lib; print(get_python_lib())').stdout().strip()
message ('Looking for mpi4py in ' + python_dir)
endif
mpi4py_include = python_dir + '/mpi4py/include'
mpi4py_include = run_command(python, '-c', 'import mpi4py; print(mpi4py.get_include())').stdout().strip()
assert(not mpi4py_include.contains('Traceback'), 'python does not have mpi4py module')
message('Using mpi4py from ' + mpi4py_include)
else
mpi4py_include = ''
mpi4py_include = ''
endif

swig_gen = generator(
Expand All @@ -23,7 +19,7 @@ swig_gen = generator(
)

wrapper_deps = [
dependency('python3'),
dependency('python3'),
]

if get_option('enable-normal')
Expand Down
76 changes: 44 additions & 32 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
project('SU2', 'c', 'cpp',
version: '6.2.0',
project('SU2', 'c', 'cpp',
version: '6.2.0',
license: 'LGPL2',
default_options: ['buildtype=release',
'warning_level=0',
default_options: ['buildtype=release',
'warning_level=0',
'cpp_std=c++11'])


Expand Down Expand Up @@ -34,7 +34,7 @@ if get_option('custom-mpi')
mpi = true
# Otherwise they are automatically determined
else
mpi_dep = [dependency('mpi', language:'c', required : get_option('with-mpi')),
mpi_dep = [dependency('mpi', language:'c', required : get_option('with-mpi')),
dependency('mpi', language:'cpp', required : get_option('with-mpi'))]
if mpi_dep[0].found() or mpi_dep[1].found()
mpi = true
Expand Down Expand Up @@ -62,24 +62,24 @@ endif
# check if MPI dependencies are found and add them
if mpi

# add MPI dependency
# add MPI dependency
su2_deps += mpi_dep
su2_cpp_args += '-DHAVE_MPI'

# compile metis
subdir('externals/metis')

# add metis dependency
su2_deps += metis_dep
su2_cpp_args += '-DHAVE_METIS'
su2_cpp_args += '-DHAVE_METIS'

# compile parmetis
subdir('externals/parmetis')

# add parmetis dependency
su2_deps += parmetis_dep
su2_cpp_args += '-DHAVE_PARMETIS'
su2_cpp_args += '-DHAVE_PARMETIS'

# add medi dependency
if get_option('enable-autodiff') or get_option('enable-directdiff')
codi_dep += declare_dependency(include_directories: ['externals/medi/include', 'externals/medi/src'])
Expand All @@ -99,22 +99,34 @@ if get_option('enable-pastix')

su2_cpp_args += '-DHAVE_PASTIX'

pastix_root = get_option('pastix_root')+'/install'
scotch_root = get_option('scotch_root')+'/lib'
pastix_dep = declare_dependency(include_directories: pastix_root,
link_args: [ '-L../'+pastix_root, '-L../'+scotch_root,
'-lpastix', '-lscotch', '-lptscotch', '-lptscotcherr',
'-lm', '-lrt', '-lpthread'])
pastix_dep = dependency('pastix', required: false)

if not pastix_dep.found()
pastix_root = get_option('pastix_root')+'/install'
scotch_root = get_option('scotch_root')+'/lib'
pastix_dep = declare_dependency(include_directories: pastix_root,
link_args: [ '-L../'+pastix_root, '-L../'+scotch_root,
'-lpastix', '-lscotch', '-lptscotch', '-lptscotcherr',
'-lm', '-lrt', '-lpthread'])
endif
su2_deps += pastix_dep
endif

# blas-type dependencies
if get_option('enable-mkl')

su2_cpp_args += '-DHAVE_MKL'
mkl_root = get_option('mkl_root')
mkl_dep = declare_dependency(include_directories: mkl_root+'/include', compile_args: '-m64',
link_args: ['-L'+mkl_root+'/lib/intel64','-lmkl_intel_lp64','-lmkl_sequential','-lmkl_core','-lpthread','-lm','-ldl'])

# the following mkl name matches the linked libs in manual dependency
# see https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-and-pkg-config-tool
# should probably switch to iomp if Intel OpenMP is used
mkl_dep = dependency('mkl-static-lp64-seq', required: false)

if not mkl_dep.found()
mkl_root = get_option('mkl_root')
mkl_dep = declare_dependency(include_directories: mkl_root+'/include', compile_args: '-m64',
link_args: ['-L'+mkl_root+'/lib/intel64','-lmkl_intel_lp64','-lmkl_sequential','-lmkl_core','-lpthread','-lm','-ldl'])
endif
su2_deps += mkl_dep

elif get_option('enable-openblas')
Expand Down Expand Up @@ -148,13 +160,13 @@ if get_option('enable-pywrapper')
endif

message('''-------------------------------------------------------------------------
| ___ _ _ ___ |
| / __| | | |_ ) Release 6.2.0 'Falcon' |
| \__ \ |_| |/ / |
| |___/\___//___| Configuration Summary |
| |
-------------------------------------------------------------------------
| ___ _ _ ___ |
| / __| | | |_ ) Release 6.2.0 'Falcon' |
| \__ \ |_| |/ / |
| |___/\___//___| Configuration Summary |
| |
-------------------------------------------------------------------------
Option Value
---------------------
TecIO: @2@
Expand All @@ -170,14 +182,14 @@ message('''---------------------------------------------------------------------
and update your $PATH (and $PYTHONPATH if applicable) with $SU2_RUN
Based on the input to this configuration, add these lines to your .bashrc file:
export SU2_RUN=@0@
export SU2_HOME=@1@
export PATH=$PATH:$SU2_RUN
export PYTHONPATH=$PYTHONPATH:$SU2_RUN
Use './ninja -C @10@ install' to compile and install SU2
'''.format(get_option('prefix')+'/bin', meson.source_root(), get_option('enable-tecio'), get_option('enable-cgns'),
'''.format(get_option('prefix')+'/bin', meson.source_root(), get_option('enable-tecio'), get_option('enable-cgns'),
get_option('enable-autodiff'), get_option('enable-directdiff'), get_option('enable-pywrapper'), get_option('enable-mkl'),
get_option('enable-openblas'), get_option('enable-pastix'), meson.build_root().split('/')[-1]))