Esempio n. 1
0
def check_f2py_compiler():
    from numpy.distutils.fcompiler import get_default_fcompiler, CompilerNotFound
    from numpy.distutils.fcompiler import CompilerNotFound
    f2py_compiler = get_default_fcompiler()

    if f2py_compiler == None:
        raise CompilerNotFound(
            'You don\'t have a Fortran compiler installed. Please install one and try again'
        )
        sys.exit()

    if 'gnu' not in f2py_compiler:
        print(
            ' GNU compiler not installed. Checking f2py compiler - this is UNTESTED'
        )
        print(
            ' Speculatively setting flags - if compile fails, or OpenMP doesn\'t work install gfortran and retry'
        )

    if 'gnu' in f2py_compiler:
        print('Found gnu compiler. Setting OpenMP flag to \'-fopenmp\'')
        compile_args = ['-fopenmp', '-lgomp', '-O3']
        link_args = ['-lgomp']
    elif f2py_compiler == 'intel':
        print('Found intel compiler. Setting OpenMP flag to \'-openmp\'')
        compile_args = ['-qopenmp', '-O3']
        link_args = []
    elif f2py_compiler == 'intelem':
        print('Found intel compiler. Setting OpenMP flag to \'-openmp\'')
        compile_args = ['-qopenmp', '-O3']
        link_args = []
    elif 'pg' in f2py_comopiler:
        print('Found portland compiler. Setting OpenMP flag to \'-mp\'')
        compile_args = ['-mp', '-O3']
        link_args = []
    elif 'nag' in f2py_compiler:
        print('Found NAG compiler. Setting OpenMP flag to \'-openmp\'')
        compile_args = ['-openmp', '-O3']
        link_args = []
    else:
        print(
            'Not sure what compiler f2py uses. Speculatively setting OpenMP flag to \'-openmp\''
        )
        compile_args = ['-openmp', '-O3']
        link_args = []

    args = {'link_args': link_args, 'compile_args': compile_args}

    return args
Esempio n. 2
0
 def get_version(self):
     raise CompilerNotFound('Flang unsupported on Python < 3.5')