fab.tools.compiler_wrapper#
This file contains the base class for any compiler-wrapper, including the derived classes for mpif90, mpicc, and CrayFtnWrapper and CrayCcWrapper.
Classes
|
A decorator-based compiler wrapper. |
|
Class for the Cray C compiler wrapper. |
|
Class for the Cray Fortran compiler wrapper. |
|
Class for a simple wrapper for using a compiler driver (like mpicc) It will be using the name "mpicc-COMPILER_NAME" and calls mpicc. |
|
Class for a simple wrapper for using a compiler driver (like mpif90) It will be using the name "mpif90-COMPILER_NAME" and calls mpif90. |
- class fab.tools.compiler_wrapper.CompilerWrapper(name, exec_name, compiler, mpi=False)#
A decorator-based compiler wrapper. It basically uses a different executable name when compiling, but otherwise behaves like the wrapped compiler. An example of a compiler wrapper is mpif90 (which can internally call e.g. gfortran, icc, …)
- Parameters:
- property has_syntax_only: bool#
- Returns:
whether this compiler supports a syntax-only feature.
- Raises:
RuntimeError – if this function is called for a non-Fortran wrapped compiler.
- get_flags(profile=None)#
- set_module_output_path(path)#
Sets the output path for modules.
- Params path:
the path to the output directory.
- Raises:
RuntimeError – if this function is called for a non-Fortran wrapped compiler.
- get_all_commandline_options(config, input_file, output_file, add_flags=None, syntax_only=False)#
This function returns all command line options for a compiler wrapper. The syntax_only flag is only accepted, if the wrapped compiler is a Fortran compiler. Otherwise, an exception will be raised.
- Parameters:
input_file (
Path
) – the name of the input file.output_file (
Path
) – the name of the output file.config (
BuildConfig
) – The BuildConfig, from which compiler profile and OpenMP status are taken.add_flags (
Optional
[List
[str
]]) – additional flags for the compiler. (default:None
)syntax_only (
Optional
[bool
]) – if set, the compiler will only do a syntax check (default:False
)
- Return type:
- Returns:
command line flags for compiler wrapper.
- Raises:
RuntimeError – if syntax_only is requested for a non-Fortran compiler.
- compile_file(input_file, output_file, config, add_flags=None, syntax_only=None)#
Compiles a file using the wrapper compiler.
- Parameters:
input_file (
Path
) – the name of the input file.output_file (
Path
) – the name of the output file.config (
BuildConfig
) – The BuildConfig, from which compiler profile and OpenMP status are taken.add_flags (
Optional
[List
[str
]]) – additional flags for the compiler. (default:None
)syntax_only (
Optional
[bool
]) – if set, the compiler will only do a syntax check (default:None
)
- class fab.tools.compiler_wrapper.Mpif90(compiler)#
Class for a simple wrapper for using a compiler driver (like mpif90) It will be using the name “mpif90-COMPILER_NAME” and calls mpif90. All flags from the original compiler will be used when using the wrapper as compiler.
- Parameters:
compiler (
Compiler
) – the compiler that the mpif90 wrapper will use.
- class fab.tools.compiler_wrapper.Mpicc(compiler)#
Class for a simple wrapper for using a compiler driver (like mpicc) It will be using the name “mpicc-COMPILER_NAME” and calls mpicc. All flags from the original compiler will be used when using the wrapper as compiler.
- Parameters:
compiler (
Compiler
) – the compiler that the mpicc wrapper will use.