Memory handling

Dynamic allocation / deallocation

Quick access

Routines:

f_malloc(), f_malloc0(), f_malloc0_buf(), f_malloc0_ptr(), f_malloc0_str(), f_malloc0_str_ptr(), f_malloc_buf(), f_malloc_ptr(), f_malloc_str(), f_malloc_str_ptr(), f_map_ptr(), operator(.plus.)(), operator(.to.)(), remap_bounds_i2()

Needed modules

  • f_precisions: Defines the portable Futile kind policy, undefined sentinels, precision conversion helpers, and low-level address inquiry helpers. Host codes should use these names instead of compiler-specific kind

  • dictionaries (f_err_throw(), f_err_raise(), dictionary): High-level dictionary API used throughout Futile and BigDFT. A dictionary is a pointer-based tree that can represent scalars, ordered mappings, and lists. It maps directly to YAML data and is manipulated with constructors

  • yaml_strings (f_strcpy(), operator(+)())

Subroutines and functions

interface  module_f_malloc/operator(.to.)()
interface  module_f_malloc/operator(.plus.)()
interface  module_f_malloc/f_map_ptr()
Called from:

f_map_ptr_addr_d0(), f_map_ptr_addr_l0(), f_map_ptr_addr_i0(), f_map_ptr_addr_li0()

interface  module_f_malloc/f_malloc()
interface  module_f_malloc/f_malloc0()
interface  module_f_malloc/f_malloc_ptr()
interface  module_f_malloc/f_malloc0_ptr()
interface  module_f_malloc/f_malloc_str()
interface  module_f_malloc/f_malloc0_str()
interface  module_f_malloc/f_malloc_str_ptr()
interface  module_f_malloc/f_malloc0_str_ptr()
subroutine  module_f_malloc/remap_bounds_i2(lb, lu, heap, ptr)
Parameters:
  • lb (2) [integer, in,required]

  • lu (2) [integer, in,required]

  • heap (1 - lb(1) + lu(1,1 - lb(2) + lu(2) [integer, in,target]

  • ptr (,) [integer, out,pointer]

function  module_f_malloc/f_malloc([sizes, id, routine_id, lbounds, ubounds, profile, info, src, src_ptr])
Options:
  • sizes (*) [integer, in,]

  • id [character(len=*), in,]

  • routine_id [character(len=*), in,]

  • lbounds (*) [integer, in,]

  • ubounds (*) [integer, in,]

  • profile [logical, in,]

  • info [character(len=*), in,]

  • src (*) [integer, in,]

  • src_ptr (*) [integer, in,pointer]

Return:

m [malloc_information_all]

function  module_f_malloc/f_malloc0([sizes, id, routine_id, lbounds, ubounds, profile, info])
Options:
  • sizes (*) [integer, in,]

  • id [character(len=*), in,]

  • routine_id [character(len=*), in,]

  • lbounds (*) [integer, in,]

  • ubounds (*) [integer, in,]

  • profile [logical, in,]

  • info [character(len=*), in,]

Return:

m [malloc_information_all]

function  module_f_malloc/f_malloc_ptr([sizes, id, routine_id, lbounds, ubounds, profile, info, src, src_ptr])
Options:
  • sizes (*) [integer, in,]

  • id [character(len=*), in,]

  • routine_id [character(len=*), in,]

  • lbounds (*) [integer, in,]

  • ubounds (*) [integer, in,]

  • profile [logical, in,]

  • info [character(len=*), in,]

  • src (*) [integer, in,]

  • src_ptr (*) [integer, in,pointer]

Return:

m [malloc_information_ptr]

function  module_f_malloc/f_malloc0_ptr([sizes, id, routine_id, lbounds, ubounds, profile, info])
Options:
  • sizes (*) [integer, in,]

  • id [character(len=*), in,]

  • routine_id [character(len=*), in,]

  • lbounds (*) [integer, in,]

  • ubounds (*) [integer, in,]

  • profile [logical, in,]

  • info [character(len=*), in,]

Return:

m [malloc_information_ptr]

function  module_f_malloc/f_malloc_buf([sizes, id, routine_id, profile, info, src])
Options:
  • sizes [integer, in,]

  • id [character(len=*), in,]

  • routine_id [character(len=*), in,]

  • profile [logical, in,]

  • info [character(len=*), in,]

  • src (*) [integer, in,]

Return:

m [malloc_information_buf]

function  module_f_malloc/f_malloc0_buf([sizes, id, routine_id, profile, info])
Options:
  • sizes [integer, in,]

  • id [character(len=*), in,]

  • routine_id [character(len=*), in,]

  • profile [logical, in,]

  • info [character(len=*), in,]

Return:

m [malloc_information_buf]

Quick access

Variables:

operator(.plus.), operator(.to.)

Routines:

dynamic_memory_errors(), f_free(), f_free_ptr(), f_free_str(), f_malloc_dump_status(), f_malloc_finalize(), f_malloc_initialize(), f_malloc_set_status(), f_maxdiff(), f_memcpy(), f_purge_database(), f_release_routine(), f_routine(), f_subptr(), f_subptr2(), f_update_database(), free_validate(), malloc_validate(), update_allocation_database()

Needed modules

  • memory_profiling

  • dictionaries (max_field_length => info_length()): High-level dictionary API used throughout Futile and BigDFT. A dictionary is a pointer-based tree that can represent scalars, ordered mappings, and lists. It maps directly to YAML data and is manipulated with constructors

  • yaml_strings

  • module_f_malloc

  • f_precisions: Defines the portable Futile kind policy, undefined sentinels, precision conversion helpers, and low-level address inquiry helpers. Host codes should use these names instead of compiler-specific kind

  • yaml_parse_base (yaml_load())

  • yaml_output (yaml_map())

  • f_utils (f_time(), f_zero(), f_sizeof(), f_get_option(), f_size())

  • iso_c_binding

  • smpi_shared

  • f_environment

Variables

  • dynamic_memory_base/operator (.plus.) [public]
  • dynamic_memory_base/operator (.to.) [public]

Subroutines and functions

interface  dynamic_memory_base/assignment(=)(array, m)
Parameters:
  • array (*) [character(len=m%len), inout,pointer]

  • m [malloc_information_str_ptr, in]

interface  dynamic_memory_base/f_free(array[, cptr])
Parameters:

array (various shapes) [integer, inout,allocatable]

Options:

cptr [logical, in,]

interface  dynamic_memory_base/f_free_str(length, array[, cptr])
Parameters:
  • length [integer, in] :: < need to specify length for the declaration below (sometimes fortran runtime error)

  • array (various shapes) [character(len=length), inout,allocatable]

Options:

cptr [logical, in,]

Called from:

yaml_parse_from_file()

interface  dynamic_memory_base/f_free_ptr(array[, cptr])
Parameters:

array (various shapes) [double_complex, inout,pointer]

Options:

cptr [logical, in,]

interface  dynamic_memory_base/f_memcpy(dest, src)
Parameters:
  • dest (various shapes) [integer, character, complex, inout] :: <destination buffer

  • src (various shapes) [character, integer, complex, in] :: <source buffer

interface  dynamic_memory_base/f_maxdiff(a, b[, n])
Parameters:
  • a (various shapes) [character, in]

  • b (*) [integer, in]

Options:

n [integer, in,]

interface  dynamic_memory_base/f_subptr()
interface  dynamic_memory_base/f_subptr2()
interface  dynamic_memory_base/malloc_validate()
interface  dynamic_memory_base/update_allocation_database(address, size_bn, kind, m)
Parameters:
  • address [integer, in]

  • size_bn [integer, in]

  • kind [integer, in]

  • m [malloc_information_all, in]

subroutine  dynamic_memory_base/update_allocation_database(address, size_bn, kind, m)
Parameters:
  • address [integer, in]

  • size_bn [integer, in]

  • kind [integer, in]

  • m [malloc_information_all, in]

Call to:

f_update_database()

function  dynamic_memory_base/free_validate(ierror)
Parameters:

ierror [integer, in]

Return:

ok [logical]

Call to:

f_timer_resume(), f_err_throw()

subroutine  dynamic_memory_base/f_routine([id, profile])
Options:
  • id [character(len=*), in,] :: < name of the subprogram

  • profile [logical, in,] :: < ???

Use :

yaml_output (yaml_map(), yaml_flush_document(), yaml_mapping_open()), yaml_strings (yaml_time_toa())

Called from:

f_malloc_initialize(), input_file_complete(), input_file_minimal()

Call to:

f_err_throw(), f_time(), f_timer_interrupt(), prepend(), f_zero(), yaml_mapping_open(), yaml_map(), yaml_time_toa(), yaml_flush_document(), f_timer_resume()

subroutine  dynamic_memory_base/f_release_routine([performance_info])
Options:

performance_info [f_perf, in,]

Use :

f_perfs, yaml_output (yaml_dict_dump(), yaml_map(), yaml_flush_document(), yaml_mapping_close(), yaml_comment()), f_utils (f_rewind()), yaml_strings (yaml_time_toa())

Called from:

f_malloc_finalize(), input_file_complete(), input_file_minimal()

Call to:

f_err_throw(), f_timer_interrupt(), prepend(), yaml_map(), yaml_time_toa(), yaml_comment(), yaml_mapping_close(), yaml_flush_document(), f_timer_resume(), dict_key(), has_key(), yaml_dict_dump(), f_rewind(), dump_status_line()

subroutine  dynamic_memory_base/f_update_database(size_bn, kind, rank_bn, address, id, routine, info)
Parameters:
  • size_bn [integer, in]

  • kind [integer, in]

  • rank_bn [integer, in]

  • address [integer, in]

  • id [character(len=*), in]

  • routine [character(len=*), in]

  • info [character(len=*), in]

Use :

metadata_interfaces (long_toa()), yaml_output (yaml_flush_document()), dictionaries

Called from:

update_allocation_database()

Call to:

dict_init(), set(), long_toa(), memstate_update(), dump_status_line(), yaml_flush_document()

subroutine  dynamic_memory_base/f_purge_database(size_bn, kind[, address, id, routine, info])
Parameters:
  • size_bn [integer, in]

  • kind [integer, in]

Options:
  • address [integer, in,]

  • id [character(len=*), in,]

  • routine [character(len=*), in,]

  • info [dictionary, pointer]

Use :

metadata_interfaces (long_toa()), yaml_output (yaml_flush_document()), yaml_strings (f_strcpy())

Call to:

find_key(), long_toa(), f_err_throw(), yaml_load(), dict_copy(), dict_len(), dict_free(), dict_remove(), f_strcpy(), memstate_update(), dump_status_line(), yaml_flush_document()

subroutine  dynamic_memory_base/dynamic_memory_errors()
Use :

dictionaries (f_err_define())

Called from:

initialize_flib_errors()

Call to:

f_err_define()

subroutine  dynamic_memory_base/f_malloc_initialize()
Use :

f_environment

Called from:

f_lib_initialize()

Call to:

f_err_raise(), memstate_init(), set(), yaml_date_and_time_toa(), f_routine(), f_set_memory_limit()

subroutine  dynamic_memory_base/f_malloc_set_status([output_level, logfile_name, iproc])
Options:
  • output_level [integer, in,] :: < Level of output for memocc

  • logfile_name [character(len=*), in,] :: < Name of the logfile

  • iproc [integer, in,] :: < Process Id (used to dump, by default 0)

Use :

yaml_output, f_utils, yaml_strings

Call to:

f_err_raise(), f_err_throw(), yaml_close_stream(), f_file_unit(), f_close(), f_get_free_unit(), yaml_set_stream(), yaml_comment(), yaml_sequence_open(), f_strcpy(), set()

subroutine  dynamic_memory_base/f_malloc_finalize([dump, process_id])
Options:
  • dump [logical, in,] :: < Dump always information,

  • process_id [integer, out,] :: < retrieve the process_id

Use :

yaml_output, f_utils

Called from:

f_lib_finalize(), f_lib_finalize_noreport()

Call to:

f_err_raise(), prepend(), dict_size(), yaml_warning(), yaml_map(), yaml_mapping_open(), yaml_mapping_close(), f_release_routine(), dict_free(), memstate_report(), yaml_sequence_close(), yaml_close_stream(), f_delete_file(), memstate_init()

subroutine  dynamic_memory_base/f_malloc_dump_status([filename, dict_summary])
Options:
  • filename [character(len=*), in,] :: < file to which the memory should be dumped

  • dict_summary [dictionary, inout,pointer]

Use :

yaml_output

Call to:

f_err_raise(), dict_init(), dict_size(), set(), dict_free(), yaml_get_default_stream(), yaml_set_stream(), yaml_newline(), yaml_warning(), f_dump_all_errors(), yaml_map(), yaml_mapping_open(), yaml_mapping_close(), yaml_close_stream()

subroutine  dynamic_memory_base/f_free_str_ptr(length, array[, cptr])
Parameters:
  • length [integer, in]

  • array (*) [character(len=length), inout,pointer]

Options:

cptr [logical, in,]

Use :

metadata_interfaces (getc1ptr => metadata_address())

Memory initialisers

Quick access

Types:

f_dump_buffer, f_none_object, f_progress_bar

Variables:

f_zero

Routines:

assignment(=)(), f_assert(), f_close(), f_delete_file(), f_diff(), f_file_exists(), f_file_unit(), f_get_free_unit(), f_get_option(), f_getpid(), f_humantime(), f_increment(), f_mkdir(), f_move_file(), f_none(), f_open_file(), f_pause(), f_progress_bar_new(), f_rewind(), f_savetxt(), f_size(), f_sizeof(), f_system(), f_time(), f_tty(), f_utils_errors(), f_utils_recl(), update_progress_bar()

Needed modules

Types

  • type  f_utils/f_dump_buffer
    Type fields:
    • % buf (*) [character(len=1), pointer]

    • % ipos [integer]

  • type  f_utils/f_none_object
    Type fields:
    • % none [character(len=len(null))]

  • type  f_utils/f_progress_bar
    Type fields:
    • % message [character(len=90)] :: < Message of the progress bar to be updated

    • % ncall [integer] :: < number of times the progress bar is called

    • % nstep [integer] :: < number of steps for the progress

    • % t0 [integer] :: < creation time of the progress bar

Variables

  • f_utils/f_zero [public]

Subroutines and functions

interface  f_utils/f_diff()
interface  f_utils/f_sizeof()
interface  f_utils/f_size()
interface  f_utils/f_increment()
interface  f_utils/f_humantime(ns[, short_bn])
Parameters:

ns [real, in] :: <nanoseconds

Options:

short_bn [logical, in,]

interface  f_utils/f_assert(condition, id[, err_id, err_name])
Parameters:
  • condition [logical, in]

  • id [character(len=*), in]

Options:
  • err_id [integer, in,]

  • err_name [character(len=*), in,]

interface  f_utils/f_savetxt()
interface  f_utils/f_get_option()
interface  f_utils/assignment(=)()
subroutine  f_utils/f_utils_errors()
Called from:

initialize_flib_errors()

Call to:

f_err_define()

function  f_utils/f_none()
Return:

f_none [f_none_object]

function  f_utils/f_time()
Return:

f_time [integer]

Called from:

f_routine(), f_progress_bar_new(), update_progress_bar(), f_clock(), f_timing_reset(), f_timing_checkpoint(), f_timing_stop(), f_timing(), f_profile()

subroutine  f_utils/f_assert(condition, id[, err_id, err_name])
Parameters:
  • condition [logical, in]

  • id [character(len=*), in]

Options:
  • err_id [integer, in,]

  • err_name [character(len=*), in,]

Use :

module_f_malloc (f_malloc_routine_name()), yaml_strings, dictionaries

Call to:

f_err_throw()

function  f_utils/f_progress_bar_new([nstep])
Options:

nstep [integer, in,]

Return:

bar [f_progress_bar]

Call to:

f_time(), f_zero()

subroutine  f_utils/update_progress_bar(bar, istep)
Parameters:
Use :

yaml_strings

Called from:

dump_progress_bar()

Call to:

f_strcpy(), f_zero(), f_time(), f_humantime(), yaml_time_toa()

function  f_utils/f_humantime(ns[, short_bn])
Parameters:

ns [real, in] :: <nanoseconds

Options:

short_bn [logical, in,]

Return:

time [character(len=95)]

Use :

yaml_strings

Called from:

update_progress_bar(), f_profile(), f_lib_finalize()

Call to:

f_strcpy()

function  f_utils/f_tty(unit)
Parameters:

unit [integer, in]

Return:

f_tty [logical]

Called from:

dump_progress_bar()

subroutine  f_utils/f_pause(sec)
Parameters:

sec [integer, in] :: < seconds to be waited

subroutine  f_utils/f_utils_recl(unt, recl_max, recl)
Parameters:
  • unt [integer, in] :: < unit to be checked for record length

  • recl_max [integer, in] :: < maximum value for record length

  • recl [integer, out]

Called from:

yaml_set_stream()

subroutine  f_utils/f_file_exists(file, exists)
Parameters:
  • file [character(len=*), in]

  • exists [logical, out]

Called from:

f_file_unit(), f_delete_file(), get_proc_status_dict(), yaml_parse_from_file()

Call to:

f_err_throw()

subroutine  f_utils/f_close(unit)
Parameters:

unit [integer, in]

Called from:

f_malloc_set_status(), f_delete_file(), yaml_cite()

Call to:

f_err_throw()

subroutine  f_utils/f_file_unit(file, unit)
Parameters:
  • file [character(len=*), in]

  • unit [integer, out]

Called from:

f_malloc_set_status(), f_delete_file(), f_open_file()

Call to:

f_file_exists(), f_err_throw()

function  f_utils/f_get_free_unit([unit])
Options:

unit [integer, in,]

Return:

unt2 [integer]

Called from:

f_malloc_set_status(), f_iostream_from_file(), f_open_file(), yaml_set_stream()

Call to:

f_err_throw()

subroutine  f_utils/f_mkdir(dir, path)
Parameters:
  • dir [character(len=*), in] :: < Directory to be created

  • path [character(len=*), out] :: < Path of the created directory (trailing slash added)

Use :

f_precisions (f_integer())

Call to:

f_zero(), f_err_throw()

subroutine  f_utils/f_delete_file(file)
Parameters:

file [character(len=*), in]

Called from:

f_malloc_finalize()

Call to:

f_file_exists(), f_file_unit(), f_close(), f_err_throw()

subroutine  f_utils/f_move_file(src, dest)
Parameters:
  • src [character(len=*), in]

  • dest [character(len=*), in]

Call to:

f_err_throw()

function  f_utils/f_getpid()
Return:

f_getpid [integer]

Called from:

get_proc_status_dict()

subroutine  f_utils/f_system(command)
Parameters:

command [character(len=*), in]

Call to:

f_err_throw()

subroutine  f_utils/f_rewind(unit)
Parameters:

unit [integer, in]

Called from:

f_release_routine()

Call to:

f_err_throw()

subroutine  f_utils/f_open_file(unit, file[, status, position, action, binary])
Parameters:
  • unit [integer, inout]

  • file [character(len=*), in]

Options:
  • status [character(len=*), in,]

  • position [character(len=*), in,]

  • action [character(len=*), in,]

  • binary [logical, in,]

Use :

yaml_strings (f_strcpy())

Called from:

yaml_set_stream(), yaml_cite()

Call to:

f_file_unit(), f_get_free_unit(), f_strcpy(), f_err_throw()