build_config.fpp Source File


Contents

Source Code


Source Code

!> Compile-time parameters describing the built configuration
module build_config
  implicit none

#ifdef MPI
  logical, parameter :: gs2_has_mpi = .true.
#else
  logical, parameter :: gs2_has_mpi = .false.
#endif

#ifdef MPI3
  logical, parameter :: gs2_has_mpi3 = .true.
#else
  logical, parameter :: gs2_has_mpi3 = .false.
#endif

#ifdef OPENMP
  logical, parameter :: gs2_has_openmp = .true.
#else
  logical, parameter :: gs2_has_openmp = .false.
#endif

#ifdef FFT
  logical, parameter :: gs2_has_fft = .true.
#else
  logical, parameter :: gs2_has_fft = .false.
#endif

#ifdef NEW_DIAG
  logical, parameter :: gs2_has_new_diag = .true.
#else
  logical, parameter :: gs2_has_new_diag = .false.
#endif

#ifdef GENQUAD
  logical, parameter :: gs2_has_genquad = .true.
#else
  logical, parameter :: gs2_has_genquad = .false.
#endif

#ifdef NETCDF
  logical, parameter :: gs2_has_netcdf = .true.
#else
  logical, parameter :: gs2_has_netcdf = .false.
#endif

#ifdef NETCDF_PARALLEL
  logical, parameter :: gs2_has_netcdf_parallel = .true.
#else
  logical, parameter :: gs2_has_netcdf_parallel = .false.
#endif

#ifdef LAPACK
  logical, parameter :: gs2_has_lapack = .true.
#else
  logical, parameter :: gs2_has_lapack = .false.
#endif

#ifdef WITH_EIG
  logical, parameter :: gs2_has_with_eig = .true.
#ifdef FIELDS_EIG
  logical, parameter :: gs2_has_fields_eig = .true.
#else
  logical, parameter :: gs2_has_fields_eig = .false.
#endif
#else
  logical, parameter :: gs2_has_with_eig = .false.
  logical, parameter :: gs2_has_fields_eig = .false.
#endif

#ifdef SINGLE_PRECISION
  logical, parameter :: gs2_is_single_precision = .true.
#else
  logical, parameter :: gs2_is_single_precision = .false.
#endif

#ifdef QUAD
  logical, parameter :: gs2_has_quad = .true.
#else
  logical, parameter :: gs2_has_quad = .false.
#endif

  character(len=*), parameter :: gs2_build_tag = GS2_BUILD_TAG
  character(len=*), parameter :: gs2_gk_system = GK_SYSTEM
  integer, parameter :: max_build_config_len = 30000

contains

  function formatted_build_config() result(output)
    use, intrinsic :: iso_fortran_env, only: compiler_version, compiler_options
    character(len=:), allocatable :: output
    character(len=*), parameter :: nl = new_line('a')
    allocate(character(len=max_build_config_len)::output)

    write(output, '(a, a)') "Built with ", compiler_version()
    write(output, '(a, a)') trim(output) // nl // "Build flags: ", compiler_options()
    write(output, '(a)') trim(output) // nl // nl // "Current build configuration: "
    write(output, '(a, a)') trim(output) // nl // "GS2_GK_SYSTEM: ", gs2_gk_system
    write(output, '(a, a)') trim(output) // nl // "GS2_BUILD_TAG: ", gs2_build_tag
    write(output, '(a, l1)') trim(output) // nl // "MPI: ", gs2_has_mpi
    write(output, '(a, l1)') trim(output) // nl // "MPI3: ", gs2_has_mpi3
    write(output, '(a, l1)') trim(output) // nl // "OPENMP: ", gs2_has_openmp
    write(output, '(a, l1)') trim(output) // nl // "FFTW: ", gs2_has_fft
    write(output, '(a, l1)') trim(output) // nl // "New diagnostics: ", gs2_has_new_diag
    write(output, '(a, l1)') trim(output) // nl // "GENQUAD: ", gs2_has_genquad
    write(output, '(a, l1)') trim(output) // nl // "NetCDF: ", gs2_has_netcdf
    write(output, '(a, l1)') trim(output) // nl // "NetCDF Parallel: ", gs2_has_netcdf_parallel
    write(output, '(a, l1)') trim(output) // nl // "LAPACK: ", gs2_has_lapack
    write(output, '(a, l1)') trim(output) // nl // "Eigensolver: ", gs2_has_with_eig
    write(output, '(a, l1)') trim(output) // nl // "Field eigensolver: ", gs2_has_fields_eig
    write(output, '(a, l1)') trim(output) // nl // "Single precision: ", gs2_is_single_precision
    write(output, '(a, l1)') trim(output) // nl // "Quad precision: ", gs2_has_quad

    output = trim(output)
  end function formatted_build_config

end module build_config