Fortran 2003 added intrinsic modules: modules the compiler provides, used like any other with use. use, intrinsic :: iso_c_binding names one of them explicitly, and
use, non_intrinsic :: name asks for the user’s module of the same name. The standard defines five.
ISO_FORTRAN_ENV
| Name | What it is | Since |
|---|---|---|
input_unit, output_unit, error_unit | unit numbers of the standard input, output and error | F2003 |
iostat_end, iostat_eor | the iostat= values for end of file and end of record | F2003 |
iostat_inquire_internal_unit | the iostat= value for inquire of an internal unit | F2008 |
numeric_storage_size, character_storage_size, file_storage_size | sizes in bits of a numeric storage unit, a character and a file storage unit | F2003 |
int8, int16, int32, int64 | kind values of integers of that many bits | F2008 |
real32, real64, real128 | kind values of reals of that many bits | F2008 |
integer_kinds, real_kinds, logical_kinds, character_kinds | arrays of all the kinds a compiler supports | F2008 |
compiler_version(), compiler_options() | functions that return text describing the compiler | F2008 |
atomic_int_kind, atomic_logical_kind | kinds for atomic variables | F2008 |
lock_type, event_type, team_type | derived types for locks, events and teams | F2008, F2018 |
stat_failed_image, stat_locked, stat_locked_other_image, stat_stopped_image, stat_unlocked, stat_unlocked_failed_image | values of stat= in parallel statements | F2008, F2018 |
initial_team, current_team, parent_team | team selectors for team_number, get_team and so on | F2018 |
use iso_fortran_env, only: int32, int64, real64, output_unit, error_unit, iostat_end
integer(int64) :: big
real(real64) :: x
write (error_unit, '(a)') 'warning'
print *, compiler_version()
The viewer colours the kind names (int32, real64, …) as types and the unit and status constants as literals.
ISO_C_BINDING
| Group | Names |
|---|---|
| integer kinds | c_int, c_short, c_long, c_long_long, c_signed_char, c_size_t, c_int8_t, c_int16_t, c_int32_t, c_int64_t, c_int_least8_t … c_int_least64_t, c_int_fast8_t … c_int_fast64_t, c_intmax_t, c_intptr_t, c_ptrdiff_t (F2018) |
| real and complex kinds | c_float, c_double, c_long_double, c_float128, c_float_complex, c_double_complex, c_long_double_complex, c_float128_complex |
| logical and character kinds | c_bool, c_char |
| pointer types | c_ptr, c_funptr (derived types) |
| constants | c_null_ptr, c_null_funptr, c_null_char, c_alert, c_backspace, c_carriage_return, c_form_feed, c_horizontal_tab, c_vertical_tab, c_new_line |
| procedures | c_associated, c_f_pointer, c_f_procpointer, c_funloc, c_loc, c_sizeof (Fortran 2008) |
The Fortran 2018 revision adds ISO_Fortran_binding.h, a C header (not a Fortran module) for C code that receives assumed-shape or assumed-rank Fortran arguments (CFI_cdesc_t).
IEEE_ARITHMETIC, IEEE_EXCEPTIONS and IEEE_FEATURES
Three modules, from Fortran 2003, give access to IEEE floating-point arithmetic. A compiler supports as much of them as its hardware does, and ieee_support_* functions ask.
| Module | Contents |
|---|---|
ieee_features | the feature names a use may ask for: ieee_datatype, ieee_denormal, ieee_divide, ieee_halting, ieee_inexact_flag, ieee_inf, ieee_invalid_flag, ieee_nan, ieee_rounding, ieee_sqrt, ieee_underflow_flag |
ieee_exceptions | types ieee_flag_type, ieee_status_type; flags ieee_overflow, ieee_divide_by_zero, ieee_invalid, ieee_underflow, ieee_inexact, and the arrays ieee_usual, ieee_all;
procedures ieee_get_flag, ieee_set_flag, ieee_get_halting_mode, ieee_set_halting_mode, ieee_get_status, ieee_set_status, ieee_support_flag, ieee_support_halting |
ieee_arithmetic | types ieee_class_type, ieee_round_type; classes ieee_signaling_nan, ieee_quiet_nan, ieee_negative_inf, ieee_negative_normal, ieee_negative_denormal, ieee_negative_zero, ieee_positive_zero, ieee_positive_denormal, ieee_positive_normal, ieee_positive_inf, ieee_other_value;
rounding modes ieee_nearest, ieee_to_zero, ieee_up, ieee_down, ieee_other; procedures ieee_class, ieee_copy_sign, ieee_get_rounding_mode, ieee_set_rounding_mode, ieee_is_finite, ieee_is_nan, ieee_is_negative, ieee_is_normal, ieee_logb, ieee_next_after, ieee_rem, ieee_rint, ieee_scalb, ieee_selected_real_kind, ieee_unordered, ieee_value, the
ieee_support_… inquiry functions and, from Fortran 2018, ieee_fma, ieee_int, ieee_real, the ieee_quiet_… and ieee_signaling_… comparisons and ieee_min_num, ieee_max_num, ieee_min_num_mag, ieee_max_num_mag, ieee_get_modes, ieee_set_modes |
use, intrinsic :: ieee_arithmetic
real :: x
x = ieee_value(x, ieee_quiet_nan)
if (ieee_is_nan(x)) print *, 'not a number'
call ieee_set_rounding_mode(ieee_down)
The viewer colours every name that starts with ieee_: a name ending in _type as a type, a name followed by ( as a function and any other as a literal. The module names themselves stay plain.
Vendor modules
| Module | Provided by | Holds |
|---|---|---|
omp_lib, omp_lib_kinds | OpenMP compilers | runtime routines omp_get_thread_num, omp_get_num_threads, omp_set_num_threads, omp_get_wtime, the lock routines and kinds such as omp_lock_kind (also available as a file omp_lib.h) |
openacc | OpenACC compilers | runtime routines acc_get_num_devices, acc_set_device_num, acc_malloc and so on |
cudafor | NVIDIA nvfortran | CUDA Fortran runtime: cudaMalloc, cudaMemcpy, dim3, threadidx and the other built-in variables |
mpi, mpi_f08 | MPI libraries | MPI constants, types and routines: mpi_init, mpi_comm_world and the rest |
ifport, ifcore | Intel Fortran | portability routines for POSIX, time and system calls |
The viewer colours calls to omp_… and acc_… routines as functions, and the OpenMP lock kinds as types.