fujitsu.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """
  2. fujitsu
  3. Supports Fujitsu compiler function.
  4. This compiler is developed by Fujitsu and is used in A64FX on Fugaku.
  5. """
  6. from numpy.distutils.fcompiler import FCompiler
  7. compilers = ['FujitsuFCompiler']
  8. class FujitsuFCompiler(FCompiler):
  9. compiler_type = 'fujitsu'
  10. description = 'Fujitsu Fortran Compiler'
  11. possible_executables = ['frt']
  12. version_pattern = r'frt \(FRT\) (?P<version>[a-z\d.]+)'
  13. # $ frt --version
  14. # frt (FRT) x.x.x yyyymmdd
  15. executables = {
  16. 'version_cmd' : ["<F77>", "--version"],
  17. 'compiler_f77' : ["frt", "-Fixed"],
  18. 'compiler_fix' : ["frt", "-Fixed"],
  19. 'compiler_f90' : ["frt"],
  20. 'linker_so' : ["frt", "-shared"],
  21. 'archiver' : ["ar", "-cr"],
  22. 'ranlib' : ["ranlib"]
  23. }
  24. pic_flags = ['-KPIC']
  25. module_dir_switch = '-M'
  26. module_include_switch = '-I'
  27. def get_flags_opt(self):
  28. return ['-O3']
  29. def get_flags_debug(self):
  30. return ['-g']
  31. def runtime_library_dir_option(self, dir):
  32. return f'-Wl,-rpath={dir}'
  33. def get_libraries(self):
  34. return ['fj90f', 'fj90i', 'fjsrcinfo']
  35. if __name__ == '__main__':
  36. from distutils import log
  37. from numpy.distutils import customized_fcompiler
  38. log.set_verbosity(2)
  39. print(customized_fcompiler('fujitsu').get_version())