def add_openmp_flags_if_available(extension):
    """
    Add OpenMP compilation flags, if supported (if not a warning will be
    printed to the console and no flags will be added.)

    Returns `True` if the flags were added, `False` otherwise.
    """

    if _ASTROPY_DISABLE_SETUP_WITH_OPENMP_:
        log.info("OpenMP support has been explicitly disabled.")
        return False

    openmp_flags = get_openmp_flags()
    using_openmp = check_openmp_support(openmp_flags=openmp_flags)

    if using_openmp:
        compile_flags = openmp_flags.get('compiler_flags')
        link_flags = openmp_flags.get('linker_flags')
        log.info("Compiling Cython/C/C++ extension with OpenMP support")
        extension.extra_compile_args.extend(compile_flags)
        extension.extra_link_args.extend(link_flags)
    else:
        log.warn("Cannot compile Cython/C/C++ extension with OpenMP, reverting "
                 "to non-parallel code")

    return using_openmp
def add_openmp_flags_if_available ( extension ) : if _ASTROPY_DISABLE_SETUP_WITH_OPENMP_ : log . info ( "OpenMP support has been explicitly disabled." ) return False openmp_flags = get_openmp_flags ( ) using_openmp = check_openmp_support ( openmp_flags = openmp_flags ) if using_openmp : compile_flags = openmp_flags . get ( 'compiler_flags' ) link_flags = openmp_flags . get ( 'linker_flags' ) log . info ( "Compiling Cython/C/C++ extension with OpenMP support" ) extension . extra_compile_args . extend ( compile_flags ) extension . extra_link_args . extend ( link_flags ) else : log . warn ( "Cannot compile Cython/C/C++ extension with OpenMP, reverting " "to non-parallel code" ) return using_openmp
Add OpenMP compilation flags, if supported (if not a warning will be
    printed to the console and no flags will be added.)

    Returns `True` if the flags were added, `False` otherwise.