Loading...
Searching...
No Matches
Compiler

Definition

Retrieves compiler information at run time as the compiler's name and version, as well as compilation options. It uses the intrinsic functions compiler_options and compiler_version from the module iso_fortran_env.

Features

  • Automatic detection of compiler name, vendor and version at runtime
  • Detection of compilation options and debug/release profile
  • Support for a wide range of Fortran compilers (gfortran, ifort/ifx, nvfortran, nagfor, flang, etc.)
  • Compile-time fallback detection using preprocessor macros
  • Consistent output formatting for benchmark reports

Examples

program test_compiler_info
use benchmark_steps_compiler
use benchmark_workflow
type(workflow) :: w
call w%add(compiler())
call w%run()
end program
Provides base class for storing compiler information.
Definition Compiler.f90:124

Another example showing direct usage:

use benchmark_steps_compiler
type(compiler) :: ci
character(:), allocatable :: opts
ci = build_compilerinfo(compiler_gcc, compiler_version())
opts = compiler_options()
print *, 'Compiler:', trim(ci%name), trim(ci%version)
print *, 'Options:', opts
type(compiler) function build_compilerinfo(id, string)
Constructs a compiler type from compiler id and version stringRemarks.
Definition Compiler.f90:366

Data Types

interface  compiler
 Provides base class for storing compiler information. More...

Enumerations

enum  
 Enum defining supported Fortran compilers. More...

Methods

◆ build_compilerinfo()

type(compiler) function build_compilerinfo ( integer, intent(in) id,
character(*), intent(in) string )
private

Constructs a compiler type from compiler id and version stringRemarks.

Definition at line 365 of file Compiler.f90.

◆ compiler_is_debug()

logical function compiler_is_debug ( integer, intent(in) compiler,
character(*), intent(in) options )
private

Determines if the current compilation is in debug modeRemarks.

Definition at line 328 of file Compiler.f90.

◆ compiler_new()

type(workflow) function compiler_new
private

Creates and returns a workflow step that prints compiler informationRemarks.

Definition at line 146 of file Compiler.f90.

◆ get_compiler_at_compiletime()

integer function get_compiler_at_compiletime ( integer, intent(in) os)
private

Returns compiler identity based on compile-time preprocessor macrosRemarks.

Definition at line 283 of file Compiler.f90.

◆ get_compilerinfo()

subroutine get_compilerinfo ( integer, intent(in), optional os)
private

Detects current compiler and prints name, vendor, version, options and profileRemarks.

Definition at line 166 of file Compiler.f90.

◆ step_run()

subroutine step_run ( class(workflow), intent(inout) step)
private

Runs the compiler information step and outputs formatted dataRemarks.

Definition at line 156 of file Compiler.f90.