Ejemplo n.º 1
0
def _have_fortran_compiler():
    from numpy.distutils.fcompiler import available_fcompilers_for_platform, \
                                            new_fcompiler, \
                                            DistutilsModuleError, \
                                            CompilerNotFound
    from numpy.distutils import customized_fcompiler

    log.info('---------Detecting FORTRAN compilers-------')
    try:
        c = customized_fcompiler()
        v = c.get_version()
        return True
    except (DistutilsModuleError, CompilerNotFound, AttributeError) as e:
        return False
Ejemplo n.º 2
0
    def get_flags(self):
        return [
            "/nologo",
            "/MD",
            "/WX",
            "/iface=(cref,nomixed_str_len_arg)",
            "/names:lowercase",
            "/assume:underscore",
        ]

    def get_flags_opt(self):
        return [
            "/Ox", "/fast", "/optimize:5", "/unroll:0", "/math_library:fast"
        ]

    def get_flags_arch(self):
        return ["/threads"]

    def get_flags_debug(self):
        return ["/debug"]


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="compaq").get_version())
Ejemplo n.º 3
0
                break
        return opt

    def get_flags_arch_f77(self):
        r = None
        if cpu.is_r10000():
            r = 10000
        elif cpu.is_r12000():
            r = 12000
        elif cpu.is_r8000():
            r = 8000
        elif cpu.is_r5000():
            r = 5000
        elif cpu.is_r4000():
            r = 4000
        if r is not None:
            return ["r%s" % (r)]
        return []

    def get_flags_arch_f90(self):
        r = self.get_flags_arch_f77()
        if r:
            r[0] = "-" + r[0]
        return r


if __name__ == "__main__":
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="mips").get_version())
Ejemplo n.º 4
0
class PathScaleFCompiler(FCompiler):

    compiler_type = 'pathf95'
    description = 'PathScale Fortran Compiler'
    version_pattern = r'PathScale\(TM\) Compiler Suite: Version (?P<version>[\d.]+)'

    executables = {
        'version_cmd': ["pathf95", "-version"],
        'compiler_f77': ["pathf95", "-fixedform"],
        'compiler_fix': ["pathf95", "-fixedform"],
        'compiler_f90': ["pathf95"],
        'linker_so': ["pathf95", "-shared"],
        'archiver': ["ar", "-cr"],
        'ranlib': ["ranlib"]
    }
    pic_flags = ['-fPIC']
    module_dir_switch = '-module '  # Don't remove ending space!
    module_include_switch = '-I'

    def get_flags_opt(self):
        return ['-O3']
    def get_flags_debug(self):
        return ['-g']

if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='pathf95').get_version())
Ejemplo n.º 5
0
    possible_executables = ['efl']  # XXX this is a wild guess
    ar_exe = IntelVisualFCompiler.ar_exe

    executables = {
        'version_cmd': None,
        'compiler_f77': [None, "-FI", "-w90", "-w95"],
        'compiler_fix': [None, "-FI", "-4L72", "-w"],
        'compiler_f90': [None],
        'linker_so': ['<F90>', "-shared"],
        'archiver': [ar_exe, "/verbose", "/OUT:"],
        'ranlib': None
    }


class IntelEM64VisualFCompiler(IntelVisualFCompiler):
    compiler_type = 'intelvem'
    description = 'Intel Visual Fortran Compiler for 64-bit apps'

    version_match = simple_version_match(start=r'Intel\(R\).*?64,')

    def get_flags_arch(self):
        return ['/QaxSSE3']


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='intel').get_version())
Ejemplo n.º 6
0
        def get_flags_opt(self):
            return ['-O3']

        def get_flags_arch(self):
            return []

        def runtime_library_dir_option(self, dir):
            raise NotImplementedError

else:
    from numpy.distutils.fcompiler import CompilerNotFound

    # No point in supporting on older Pythons because not ABI compatible
    class PGroupFlangCompiler(FCompiler):
        compiler_type = 'flang'
        description = 'Portland Group Fortran LLVM Compiler'

        def get_version(self):
            raise CompilerNotFound('Flang unsupported on Python < 3.5')


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    if 'flang' in sys.argv:
        print(customized_fcompiler(compiler='flang').get_version())
    else:
        print(customized_fcompiler(compiler='pg').get_version())
Ejemplo n.º 7
0
            if self.get_version() > "4.6":
                opt.extend(["-YDEALLOC=ALL"])
        return opt

    def get_flags_fix(self):
        opt = FCompiler.get_flags_fix(self)
        opt.extend([
            "-YCFRL=1",
            "-YCOM_NAMES=LCS",
            "-YCOM_PFX",
            "-YEXT_PFX",
            "-YCOM_SFX=_",
            "-YEXT_SFX=_",
            "-YEXT_NAMES=LCS",
        ])
        opt.extend(["-f", "fixed"])
        return opt

    def get_flags_opt(self):
        opt = ["-O"]
        return opt


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="absoft").get_version())
Ejemplo n.º 8
0
    description = 'NAG Fortran Compiler'

    executables = {
        'version_cmd': ["nagfor", "-V"],
        'compiler_f77': ["nagfor", "-fixed"],
        'compiler_fix': ["nagfor", "-fixed"],
        'compiler_f90': ["nagfor"],
        'linker_so': ["nagfor"],
        'archiver': ["ar", "-cr"],
        'ranlib': ["ranlib"]
    }

    def get_flags_debug(self):
        version = self.get_version()
        if version and version > '6.1':
            return [
                '-g', '-u', '-nan', '-C=all', '-thread_safe', '-kind=unique',
                '-Warn=allocation', '-Warn=subnormal'
            ]
        else:
            return ['-g', '-nan', '-C=all', '-u', '-thread_safe']


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    compiler = customized_fcompiler(compiler='nagfor')
    print(compiler.get_version())
    print(compiler.get_flags_debug())
Ejemplo n.º 9
0
    module_dir_switch = None  # XXX: fix me
    module_include_switch = None  # XXX: fix me
    pic_flags = ["+Z"]

    def get_flags(self):
        return self.pic_flags + ["+ppu", "+DD64"]

    def get_flags_opt(self):
        return ["-O3"]

    def get_libraries(self):
        return ["m"]

    def get_library_dirs(self):
        opt = ["/usr/lib/hpux64"]
        return opt

    def get_version(self, force=0, ok_status=[256, 0, 1]):
        # XXX status==256 may indicate 'unrecognized option' or
        #     'no input file'. So, version_cmd needs more work.
        return FCompiler.get_version(self, force, ok_status)


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(10)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="hpux").get_version())
Ejemplo n.º 10
0
    description = "PathScale Fortran Compiler"
    version_pattern = r"PathScale\(TM\) Compiler Suite: Version (?P<version>[\d.]+)"

    executables = {
        "version_cmd": ["pathf95", "-version"],
        "compiler_f77": ["pathf95", "-fixedform"],
        "compiler_fix": ["pathf95", "-fixedform"],
        "compiler_f90": ["pathf95"],
        "linker_so": ["pathf95", "-shared"],
        "archiver": ["ar", "-cr"],
        "ranlib": ["ranlib"],
    }
    pic_flags = ["-fPIC"]
    module_dir_switch = "-module "  # Don't remove ending space!
    module_include_switch = "-I"

    def get_flags_opt(self):
        return ["-O3"]

    def get_flags_debug(self):
        return ["-g"]


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="pathf95").get_version())
Ejemplo n.º 11
0
        'version_cmd': ["<F77>", "--version"],
        'compiler_f77': ["frt", "-Fixed"],
        'compiler_fix': ["frt", "-Fixed"],
        'compiler_f90': ["frt"],
        'linker_so': ["frt", "-shared"],
        'archiver': ["ar", "-cr"],
        'ranlib': ["ranlib"]
    }
    pic_flags = ['-KPIC']
    module_dir_switch = '-M'
    module_include_switch = '-I'

    def get_flags_opt(self):
        return ['-O3']

    def get_flags_debug(self):
        return ['-g']

    def runtime_library_dir_option(self, dir):
        return f'-Wl,-rpath={dir}'

    def get_libraries(self):
        return ['fj90f', 'fj90i', 'fjsrcinfo']


if __name__ == '__main__':
    from distutils import log
    from numpy.distutils import customized_fcompiler
    log.set_verbosity(2)
    print(customized_fcompiler('fujitsu').get_version())
Ejemplo n.º 12
0
    ar_exe = IntelVisualFCompiler.ar_exe

    executables = {
        "version_cmd": None,
        "compiler_f77": [None, "-FI", "-w90", "-w95"],
        "compiler_fix": [None, "-FI", "-4L72", "-w"],
        "compiler_f90": [None],
        "linker_so": ["<F90>", "-shared"],
        "archiver": [ar_exe, "/verbose", "/OUT:"],
        "ranlib": None,
    }


class IntelEM64VisualFCompiler(IntelVisualFCompiler):
    compiler_type = "intelvem"
    description = "Intel Visual Fortran Compiler for 64-bit apps"

    version_match = simple_version_match(start=r"Intel\(R\).*?64,")

    def get_flags_arch(self):
        return [""]


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="intel").get_version())
Ejemplo n.º 13
0
    }
    module_dir_switch = None  # XXX Fix me
    module_include_switch = None  # XXX Fix me

    def find_executables(self):
        pass

    def get_version_cmd(self):
        f90 = self.compiler_f90[0]
        d, b = os.path.split(f90)
        vf90 = os.path.join(d, "v" + b)
        return vf90

    def get_flags_arch(self):
        vast_version = self.get_version()
        gnu = GnuFCompiler()
        gnu.customize(None)
        self.version = gnu.get_version()
        opt = GnuFCompiler.get_flags_arch(self)
        self.version = vast_version
        return opt


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="vast").get_version())
Ejemplo n.º 14
0
from numpy.distutils import customized_fcompiler

compilers = ["NoneFCompiler"]


class NoneFCompiler(FCompiler):

    compiler_type = "none"
    description = "Fake Fortran compiler"

    executables = {
        "compiler_f77": None,
        "compiler_f90": None,
        "compiler_fix": None,
        "linker_so": None,
        "linker_exe": None,
        "archiver": None,
        "ranlib": None,
        "version_cmd": None,
    }

    def find_executables(self):
        pass


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    print(customized_fcompiler(compiler="none").get_version())
Ejemplo n.º 15
0
    def get_flags_arch(self):
        opt = []
        for a in '19 20 21 22_4k 22_5k 24 25 26 27 28 30 32_5k 32_10k'.split():
            if getattr(cpu, 'is_IP%s' % a)():
                opt.append('-TARG:platform=IP%s' % a)
                break
        return opt

    def get_flags_arch_f77(self):
        r = None
        if cpu.is_r10000(): r = 10000
        elif cpu.is_r12000(): r = 12000
        elif cpu.is_r8000(): r = 8000
        elif cpu.is_r5000(): r = 5000
        elif cpu.is_r4000(): r = 4000
        if r is not None:
            return ['r%s' % (r)]
        return []

    def get_flags_arch_f90(self):
        r = self.get_flags_arch_f77()
        if r:
            r[0] = '-' + r[0]
        return r


if __name__ == '__main__':
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='mips').get_version())
Ejemplo n.º 16
0
        'ranlib': ["ranlib"]
    }

    module_dir_switch = None  #XXX Fix me
    module_include_switch = None  #XXX Fix me

    def get_flags_opt(self):
        return ['-O']

    def get_flags_debug(self):
        return ['-g', '--chk', '--chkglobal']

    def get_library_dirs(self):
        opt = []
        d = os.environ.get('LAHEY')
        if d:
            opt.append(os.path.join(d, 'lib'))
        return opt

    def get_libraries(self):
        opt = []
        opt.extend(['fj9f6', 'fj9i6', 'fj9ipp', 'fj9e6'])
        return opt


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='lahey').get_version())
Ejemplo n.º 17
0
        "compiler_f77": ["frt", "-Fixed"],
        "compiler_fix": ["frt", "-Fixed"],
        "compiler_f90": ["frt"],
        "linker_so": ["frt", "-shared"],
        "archiver": ["ar", "-cr"],
        "ranlib": ["ranlib"],
    }
    pic_flags = ["-KPIC"]
    module_dir_switch = "-M"
    module_include_switch = "-I"

    def get_flags_opt(self):
        return ["-O3"]

    def get_flags_debug(self):
        return ["-g"]

    def runtime_library_dir_option(self, dir):
        return f"-Wl,-rpath={dir}"

    def get_libraries(self):
        return ["fj90f", "fj90i", "fjsrcinfo"]


if __name__ == "__main__":
    from distutils import log
    from numpy.distutils import customized_fcompiler

    log.set_verbosity(2)
    print(customized_fcompiler("fujitsu").get_version())
Ejemplo n.º 18
0
    module_dir_switch = None  # XXX: fix me
    module_include_switch = None  # XXX: fix me
    pic_flags = ['+Z']

    def get_flags(self):
        return self.pic_flags + ['+ppu', '+DD64']

    def get_flags_opt(self):
        return ['-O3']

    def get_libraries(self):
        return ['m']

    def get_library_dirs(self):
        opt = ['/usr/lib/hpux64']
        return opt

    def get_version(self, force=0, ok_status=[256, 0, 1]):
        # XXX status==256 may indicate 'unrecognized option' or
        #     'no input file'. So, version_cmd needs more work.
        return FCompiler.get_version(self, force, ok_status)


if __name__ == '__main__':
    from distutils import log

    log.set_verbosity(10)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler='hpux').get_version())
Ejemplo n.º 19
0
        "archiver": ["ar", "-cr"],
        "ranlib": ["ranlib"],
    }

    def get_flags_debug(self):
        version = self.get_version()
        if version and version > "6.1":
            return [
                "-g",
                "-u",
                "-nan",
                "-C=all",
                "-thread_safe",
                "-kind=unique",
                "-Warn=allocation",
                "-Warn=subnormal",
            ]
        else:
            return ["-g", "-nan", "-C=all", "-u", "-thread_safe"]


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    compiler = customized_fcompiler(compiler="nagfor")
    print(compiler.get_version())
    print(compiler.get_flags_debug())
Ejemplo n.º 20
0
    executables = {
        "version_cmd": ["<F90>", "--version"],
        "compiler_f77": ["g95", "-ffixed-form"],
        "compiler_fix": ["g95", "-ffixed-form"],
        "compiler_f90": ["g95"],
        "linker_so": ["<F90>", "-shared"],
        "archiver": ["ar", "-cr"],
        "ranlib": ["ranlib"],
    }
    pic_flags = ["-fpic"]
    module_dir_switch = "-fmod="
    module_include_switch = "-I"

    def get_flags(self):
        return ["-fno-second-underscore"]

    def get_flags_opt(self):
        return ["-O"]

    def get_flags_debug(self):
        return ["-g"]


if __name__ == "__main__":
    from distutils import log
    from numpy.distutils import customized_fcompiler

    log.set_verbosity(2)
    print(customized_fcompiler("g95").get_version())
Ejemplo n.º 21
0
        'archiver': ["ar", "-cr"],
        'ranlib': ["ranlib"]
    }
    module_dir_switch = None  #XXX Fix me
    module_include_switch = None  #XXX Fix me

    def find_executables(self):
        pass

    def get_version_cmd(self):
        f90 = self.compiler_f90[0]
        d, b = os.path.split(f90)
        vf90 = os.path.join(d, 'v' + b)
        return vf90

    def get_flags_arch(self):
        vast_version = self.get_version()
        gnu = GnuFCompiler()
        gnu.customize(None)
        self.version = gnu.get_version()
        opt = GnuFCompiler.get_flags_arch(self)
        self.version = vast_version
        return opt


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='vast').get_version())
Ejemplo n.º 22
0
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils import customized_fcompiler

compilers = ['NoneFCompiler']


class NoneFCompiler(FCompiler):

    compiler_type = 'none'
    description = 'Fake Fortran compiler'

    executables = {
        'compiler_f77': None,
        'compiler_f90': None,
        'compiler_fix': None,
        'linker_so': None,
        'linker_exe': None,
        'archiver': None,
        'ranlib': None,
        'version_cmd': None,
    }

    def find_executables(self):
        pass


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    print(customized_fcompiler(compiler='none').get_version())
Ejemplo n.º 23
0
    module_dir_switch = None  # XXX Fix me
    module_include_switch = None  # XXX Fix me

    def get_flags_opt(self):
        return ["-O"]

    def get_flags_debug(self):
        return ["-g", "--chk", "--chkglobal"]

    def get_library_dirs(self):
        opt = []
        d = os.environ.get("LAHEY")
        if d:
            opt.append(os.path.join(d, "lib"))
        return opt

    def get_libraries(self):
        opt = []
        opt.extend(["fj9f6", "fj9i6", "fj9ipp", "fj9e6"])
        return opt


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    print(customized_fcompiler(compiler="lahey").get_version())
Ejemplo n.º 24
0
Archivo: ibm.py Proyecto: Horta/numpy
        else:
            opt.append('-bshared')
        version = self.get_version(ok_status=[0, 40])
        if version is not None:
            if sys.platform.startswith('aix'):
                xlf_cfg = '/etc/xlf.cfg'
            else:
                xlf_cfg = '/etc/opt/ibmcmp/xlf/%s/xlf.cfg' % version
            fo, new_cfg = make_temp_file(suffix='_xlf.cfg')
            log.info('Creating '+new_cfg)
            fi = open(xlf_cfg, 'r')
            crt1_match = re.compile(r'\s*crt\s*[=]\s*(?P<path>.*)/crt1.o').match
            for line in fi:
                m = crt1_match(line)
                if m:
                    fo.write('crt = %s/bundle1.o\n' % (m.group('path')))
                else:
                    fo.write(line)
            fi.close()
            fo.close()
            opt.append('-F'+new_cfg)
        return opt

    def get_flags_opt(self):
        return ['-O3']

if __name__ == '__main__':
    from numpy.distutils import customized_fcompiler
    log.set_verbosity(2)
    print(customized_fcompiler(compiler='ibm').get_version())
Ejemplo n.º 25
0
    def get_flags(self):
        return []

    def get_flags_free(self):
        return []

    def get_flags_debug(self):
        return ["-g"]

    def get_flags_opt(self):
        return ["-O3"]

    def get_flags_arch(self):
        return []

    def runtime_library_dir_option(self, dir):
        raise NotImplementedError


if __name__ == "__main__":
    from distutils import log

    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler

    if "flang" in sys.argv:
        print(customized_fcompiler(compiler="flang").get_version())
    else:
        print(customized_fcompiler(compiler="pg").get_version())
Ejemplo n.º 26
0
                    # Though -N15 is undocumented, it works with
                    # Absoft 8.0 on Linux
                    opt.append('-N15')
        return opt

    def get_flags_f90(self):
        opt = FCompiler.get_flags_f90(self)
        opt.extend(["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX",
                    "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"])
        if self.get_version():
            if self.get_version()>'4.6':
                opt.extend(["-YDEALLOC=ALL"])
        return opt

    def get_flags_fix(self):
        opt = FCompiler.get_flags_fix(self)
        opt.extend(["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX",
                    "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"])
        opt.extend(["-f", "fixed"])
        return opt

    def get_flags_opt(self):
        opt = ['-O']
        return opt

if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='absoft').get_version())
Ejemplo n.º 27
0
    """Return true if the architecture supports the -arch flag"""
    newcmd = cmd[:]
    fid, filename = tempfile.mkstemp(suffix=".f")
    os.close(fid)
    try:
        d = os.path.dirname(filename)
        output = os.path.splitext(filename)[0] + ".o"
        try:
            newcmd.extend(["-arch", arch, "-c", filename])
            p = Popen(newcmd, stderr=STDOUT, stdout=PIPE, cwd=d)
            p.communicate()
            return p.returncode == 0
        finally:
            if os.path.exists(output):
                os.remove(output)
    finally:
        os.remove(filename)
    return False


if __name__ == '__main__':
    from distutils import log
    from numpy.distutils import customized_fcompiler
    log.set_verbosity(2)

    print(customized_fcompiler('gnu').get_version())
    try:
        print(customized_fcompiler('g95').get_version())
    except Exception:
        print(get_exception())
Ejemplo n.º 28
0
        'compiler_fix': [fc_exe, "/fixed"],
        'compiler_f90': [fc_exe],
        'linker_so': ['<F90>'],
        'archiver': [ar_exe, "/OUT:"],
        'ranlib': None
    }

    def get_flags(self):
        return [
            '/nologo', '/MD', '/WX', '/iface=(cref,nomixed_str_len_arg)',
            '/names:lowercase', '/assume:underscore'
        ]

    def get_flags_opt(self):
        return [
            '/Ox', '/fast', '/optimize:5', '/unroll:0', '/math_library:fast'
        ]

    def get_flags_arch(self):
        return ['/threads']

    def get_flags_debug(self):
        return ['/debug']


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='compaq').get_version())
Ejemplo n.º 29
0
Archivo: pg.py Proyecto: Horta/numpy
        def get_flags_opt(self):
            return ['-O3']

        def get_flags_arch(self):
            return []

        def runtime_library_dir_option(self, dir):
            raise NotImplementedError

else:
    from numpy.distutils.fcompiler import CompilerNotFound

    # No point in supporting on older Pythons because not ABI compatible
    class PGroupFlangCompiler(FCompiler):
        compiler_type = 'flang'
        description = 'Portland Group Fortran LLVM Compiler'

        def get_version(self):
            raise CompilerNotFound('Flang unsupported on Python < 3.5')


if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    if 'flang' in sys.argv:
        print(customized_fcompiler(compiler='flang').get_version())
    else:
        print(customized_fcompiler(compiler='pg').get_version())
Ejemplo n.º 30
0
    """Return true if the architecture supports the -arch flag"""
    newcmd = cmd[:]
    fid, filename = tempfile.mkstemp(suffix=".f")
    os.close(fid)
    try:
        d = os.path.dirname(filename)
        output = os.path.splitext(filename)[0] + ".o"
        try:
            newcmd.extend(["-arch", arch, "-c", filename])
            p = Popen(newcmd, stderr=STDOUT, stdout=PIPE, cwd=d)
            p.communicate()
            return p.returncode == 0
        finally:
            if os.path.exists(output):
                os.remove(output)
    finally:
        os.remove(filename)
    return False


if __name__ == '__main__':
    from distutils import log
    from numpy.distutils import customized_fcompiler
    log.set_verbosity(2)

    print(customized_fcompiler('gnu').get_version())
    try:
        print(customized_fcompiler('g95').get_version())
    except Exception as e:
        print(e)
Ejemplo n.º 31
0
                    # Though -N15 is undocumented, it works with
                    # Absoft 8.0 on Linux
                    opt.append('-N15')
        return opt

    def get_flags_f90(self):
        opt = FCompiler.get_flags_f90(self)
        opt.extend(["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX",
                    "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"])
        if self.get_version():
            if self.get_version()>'4.6':
                opt.extend(["-YDEALLOC=ALL"])
        return opt

    def get_flags_fix(self):
        opt = FCompiler.get_flags_fix(self)
        opt.extend(["-YCFRL=1", "-YCOM_NAMES=LCS", "-YCOM_PFX", "-YEXT_PFX",
                    "-YCOM_SFX=_", "-YEXT_SFX=_", "-YEXT_NAMES=LCS"])
        opt.extend(["-f", "fixed"])
        return opt

    def get_flags_opt(self):
        opt = ['-O']
        return opt

if __name__ == '__main__':
    from distutils import log
    log.set_verbosity(2)
    from numpy.distutils import customized_fcompiler
    print(customized_fcompiler(compiler='absoft').get_version())