Intel-Cl tests: increase robustness of Windows Intel compilers detection (#5828)

* intel-cl tests: more rigorous detection of intent to use Intel Windows compilers

* fortran coarray test: make skipping more robust in that underlying MPI stack is .run()

This is useful for any Fortran coarray work, and especially for intel-cl where multiple Intel compiler
versions are often installed, and the wrong underlying MPI library may be dynamically linked,
and so a runtime check is needed to exercise the MPI stack underlying Fortran coarray.
This is done by

fc.run('sync all; end', dependencies: coarray)

* pep8
pull/5756/head
Michael Hirsch, Ph.D 6 years ago committed by Jussi Pakkanen
parent 110b562930
commit e3b21de563
  1. 30
      run_tests.py
  2. 12
      test cases/fortran/13 coarray/meson.build

@ -38,9 +38,7 @@ def guess_backend(backend, msbuild_exe: str):
# Auto-detect backend if unspecified
backend_flags = []
if backend is None:
if (msbuild_exe is not None and
mesonlib.is_windows() and not
(os.environ.get('CC') == 'icl' or os.environ.get('CXX') == 'icl' or os.environ.get('FC') == 'ifort')):
if msbuild_exe is not None and (mesonlib.is_windows() and not _using_intelcl()):
backend = 'vs' # Meson will auto-detect VS version to use
else:
backend = 'ninja'
@ -59,6 +57,32 @@ def guess_backend(backend, msbuild_exe: str):
return (backend, backend_flags)
def _using_intelcl() -> bool:
"""
detect if intending to using Intel-Cl compilers (Intel compilers on Windows)
Sufficient evidence of intent is that user is working in the Intel compiler
shell environment, otherwise this function returns False
"""
if not mesonlib.is_windows():
return False
# handle where user tried to "blank" MKLROOT and left space(s)
if not os.environ.get('MKLROOT', '').strip():
return False
if (os.environ.get('CC') == 'icl' or
os.environ.get('CXX') == 'icl' or
os.environ.get('FC') == 'ifort'):
return True
# Intel-Cl users might not have the CC,CXX,FC envvars set,
# but because they're in Intel shell, the exe's below are on PATH
if shutil.which('icl') or shutil.which('ifort'):
return True
mlog.warning('It appears you might be intending to use Intel compiler on Windows '
'since non-empty environment variable MKLROOT is set to {} '
'However, Meson cannot find the Intel WIndows compiler executables (icl,ifort).'
'Please try using the Intel shell.'.format(os.environ.get('MKLROOT')))
return False
# Fake classes and objects for mocking
class FakeBuild:
def __init__(self, env):

@ -9,10 +9,18 @@ if ['pgi', 'flang'].contains(fcid)
endif
# coarray is required because single-image fallback is an intrinsic feature
coarray = dependency('coarray', required : true)
coarray = dependency('coarray')
# check coarray, because user might not have all the library stack installed correctly
# for example, conflicting library/compiler versions on PATH
# this has to invoke a run of "sync all" to verify the MPI stack is functioning,
# particularly for dynamic linking
coarray_ok = fc.run('sync all; end', dependencies: coarray, name: 'Coarray link & run').returncode() == 0
if not coarray_ok
error('MESON_SKIP_TEST: The coarray stack (including MPI) did not link correctly so that a simple test could run.')
endif
exe = executable('hello', 'main.f90',
dependencies : coarray)
test('Coarray hello world', exe)

Loading…
Cancel
Save