MONC
Data Types | Functions/Subroutines | Variables
allreduction_inter_io_mod Module Reference

All reduction, which does a reduce and then broadcasts the data to all IO servers. More...

Data Types

type  allreduce_type
 

Functions/Subroutines

subroutine, public init_allreduction_inter_io (io_configuration)
 Initialises the all reduction inter IO functionality. More...
 
subroutine, public finalise_allreduction_inter_io (io_configuration)
 Finalises the all reduction inter IO functionality. More...
 
logical function, public check_allreduction_inter_io_for_completion (io_configuration)
 Determines whether this all reduction inter IO functionality has completed or not. More...
 
subroutine, public perform_inter_io_allreduction (io_configuration, field_values, field_size, field_name, reduction_op, root, timestep, completion_procedure)
 Performs the all reduction inter IO reduction. More...
 
subroutine internal_reduction_completion_procedure (io_configuration, values, field_name, timestep)
 Internal completion, called after the reduce has completed (on root) and calls out to broadcast. More...
 
subroutine add_allreduce_information_if_needed (field_name, timestep, root, completion_procedure)
 Adds an all reduce information to the status if it does not exist. More...
 
type(allreduce_type) function, pointer find_allreduce_information (field_name, timestep, dolock)
 Finds an all reduce status information based on the field name and timestep, or returns null if none is found. More...
 
subroutine remove_allreduce_information (field_name, timestep, dolock)
 Removes an all reduce status information based on the field name and timestep. More...
 

Variables

logical, volatile initialised =.false.
 
integer, volatile allreduce_rwlock
 
type(hashmap_type), volatile allreduce_types
 

Detailed Description

All reduction, which does a reduce and then broadcasts the data to all IO servers.

Function/Subroutine Documentation

◆ add_allreduce_information_if_needed()

subroutine allreduction_inter_io_mod::add_allreduce_information_if_needed ( character(len=*), intent(in)  field_name,
integer, intent(in)  timestep,
integer, intent(in)  root,
procedure(handle_completion completion_procedure 
)
private

Adds an all reduce information to the status if it does not exist.

Parameters
field_nameThe corresponding field name
timestepThe corresponding timestep
rootThe root process
completion_procedureProcedure to call on communication completion

Definition at line 124 of file allreduction-inter-io.F90.

125  character(len=*), intent(in) :: field_name
126  integer, intent(in) :: timestep, root
127  procedure(handle_completion) :: completion_procedure
128 
129  type(allreduce_type), pointer :: allreduce_information
130  class(*), pointer :: generic
131 
132  allreduce_information=>find_allreduce_information(field_name, timestep, .true.)
133  if (.not. associated(allreduce_information)) then
134  call check_thread_status(forthread_rwlock_wrlock(allreduce_rwlock))
135  allreduce_information=>find_allreduce_information(field_name, timestep, .false.)
136  if (.not. associated(allreduce_information)) then
137  allocate(allreduce_information)
138  allreduce_information%completion_procedure=>completion_procedure
139  allreduce_information%root=root
140  generic=>allreduce_information
141  call c_put_generic(allreduce_types, trim(field_name)//"#"//conv_to_string(timestep), generic, .true.)
142  end if
143  call check_thread_status(forthread_rwlock_unlock(allreduce_rwlock))
144  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_allreduction_inter_io_for_completion()

logical function, public allreduction_inter_io_mod::check_allreduction_inter_io_for_completion ( type(io_configuration_type), intent(inout)  io_configuration)

Determines whether this all reduction inter IO functionality has completed or not.

Parameters
io_configurationThe IO server configuration
Returns
Whether the inter IO communication has completed or not

Definition at line 63 of file allreduction-inter-io.F90.

64  type(io_configuration_type), intent(inout) :: io_configuration
65 
66  call check_thread_status(forthread_rwlock_rdlock(allreduce_rwlock))
67  check_allreduction_inter_io_for_completion=c_is_empty(allreduce_types)
68  call check_thread_status(forthread_rwlock_unlock(allreduce_rwlock))
Here is the call graph for this function:

◆ finalise_allreduction_inter_io()

subroutine, public allreduction_inter_io_mod::finalise_allreduction_inter_io ( type(io_configuration_type), intent(inout)  io_configuration)

Finalises the all reduction inter IO functionality.

Parameters
io_configurationThe IO server configuration

Definition at line 49 of file allreduction-inter-io.F90.

50  type(io_configuration_type), intent(inout) :: io_configuration
51 
52  if (initialised) then
53  initialised=.false.
54  call check_thread_status(forthread_rwlock_destroy(allreduce_rwlock))
55  end if
56  call finalise_reduction_inter_io(io_configuration)
57  call finalise_broadcast_inter_io()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_allreduce_information()

type(allreduce_type) function, pointer allreduction_inter_io_mod::find_allreduce_information ( character(len=*), intent(in)  field_name,
integer, intent(in)  timestep,
logical, intent(in)  dolock 
)
private

Finds an all reduce status information based on the field name and timestep, or returns null if none is found.

Parameters
field_nameThe corresponding field name
timestepThe corresponding timestep
dolockWhether to issue a read lock or not
Returns
The corresponding all reduce status or null if none is found

Definition at line 152 of file allreduction-inter-io.F90.

153  character(len=*), intent(in) :: field_name
154  integer, intent(in) :: timestep
155  logical, intent(in) :: dolock
156  type(allreduce_type), pointer :: find_allreduce_information
157 
158  class(*), pointer :: generic
159 
160  if (dolock) call check_thread_status(forthread_rwlock_rdlock(allreduce_rwlock))
161  generic=>c_get_generic(allreduce_types, trim(field_name)//"#"//conv_to_string(timestep))
162  if (dolock) call check_thread_status(forthread_rwlock_unlock(allreduce_rwlock))
163 
164  if (associated(generic)) then
165  select type(generic)
166  type is (allreduce_type)
167  find_allreduce_information=>generic
168  end select
169  else
170  find_allreduce_information=>null()
171  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_allreduction_inter_io()

subroutine, public allreduction_inter_io_mod::init_allreduction_inter_io ( type(io_configuration_type), intent(inout)  io_configuration)

Initialises the all reduction inter IO functionality.

Parameters
io_configurationThe IO server configuration

Definition at line 36 of file allreduction-inter-io.F90.

37  type(io_configuration_type), intent(inout) :: io_configuration
38 
39  if (.not. initialised) then
40  initialised=.true.
41  call check_thread_status(forthread_rwlock_init(allreduce_rwlock, -1))
42  end if
43  call init_reduction_inter_io(io_configuration)
44  call init_broadcast_inter_io(io_configuration)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ internal_reduction_completion_procedure()

subroutine allreduction_inter_io_mod::internal_reduction_completion_procedure ( type(io_configuration_type), intent(inout)  io_configuration,
real(default_precision), dimension(:)  values,
character(len=*)  field_name,
integer  timestep 
)
private

Internal completion, called after the reduce has completed (on root) and calls out to broadcast.

Parameters
io_configurationConfiguration of the IO server
valuesArray of values resulting from the communication
field_nameCorresponding field name
timestepCorresponding timestep

Definition at line 105 of file allreduction-inter-io.F90.

106  type(io_configuration_type), intent(inout) :: io_configuration
107  real(DEFAULT_PRECISION), dimension(:) :: values
108  character(len=*) :: field_name
109  integer :: timestep
110 
111  type(allreduce_type), pointer :: allreduce_information
112 
113  allreduce_information=>find_allreduce_information(field_name, timestep, .true.)
114  call perform_inter_io_broadcast(io_configuration, values, size(values), field_name, &
115  allreduce_information%root, timestep, allreduce_information%completion_procedure)
116  call remove_allreduce_information(field_name, timestep, .true.)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ perform_inter_io_allreduction()

subroutine, public allreduction_inter_io_mod::perform_inter_io_allreduction ( type(io_configuration_type), intent(inout)  io_configuration,
real(kind=double_precision), dimension(:)  field_values,
integer, intent(in)  field_size,
character(len=*), intent(in)  field_name,
integer, intent(in)  reduction_op,
integer, intent(in)  root,
integer, intent(in)  timestep,
procedure(handle_completion completion_procedure 
)

Performs the all reduction inter IO reduction.

Parameters
io_configurationConfiguration of the IO server
field_valuesThe values to communicate
field_sizeNumber of elements to communicate
reduction_field_nameField name that the reduction will be performed over
reduction_opThe reduction operator to use
rootThe root IO server process
timestepThe timestep this is issued at
completion_procedureCallback completion procedure

Definition at line 80 of file allreduction-inter-io.F90.

82  type(io_configuration_type), intent(inout) :: io_configuration
83  real(kind=double_precision), dimension(:) :: field_values
84  integer, intent(in) :: field_size, reduction_op, root, timestep
85  character(len=*), intent(in) :: field_name
86  procedure(handle_completion) :: completion_procedure
87 
88  if (io_configuration%my_io_rank .eq. root) then
89  call add_allreduce_information_if_needed(field_name, timestep, root, completion_procedure)
90  end if
91  call perform_inter_io_reduction(io_configuration, field_values, field_size, field_name, reduction_op, &
92  root, timestep, internal_reduction_completion_procedure)
93  if (io_configuration%my_io_rank .ne. root) then
94  ! None root processes issue a broadcast
95  call perform_inter_io_broadcast(io_configuration, field_values, size(field_values), field_name, root, &
96  timestep, completion_procedure)
97  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_allreduce_information()

subroutine allreduction_inter_io_mod::remove_allreduce_information ( character(len=*), intent(in)  field_name,
integer, intent(in)  timestep,
logical, intent(in)  dolock 
)
private

Removes an all reduce status information based on the field name and timestep.

Parameters
field_nameThe corresponding field name
timestepThe corresponding timestep
dolockWhether to issue a write lock or not

Definition at line 178 of file allreduction-inter-io.F90.

179  character(len=*), intent(in) :: field_name
180  integer, intent(in) :: timestep
181  logical, intent(in) :: dolock
182 
183  if (dolock) call check_thread_status(forthread_rwlock_wrlock(allreduce_rwlock))
184  call c_remove(allreduce_types, trim(field_name)//"#"//conv_to_string(timestep))
185  if (dolock) call check_thread_status(forthread_rwlock_unlock(allreduce_rwlock))
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ allreduce_rwlock

integer, volatile allreduction_inter_io_mod::allreduce_rwlock
private

Definition at line 27 of file allreduction-inter-io.F90.

27  integer, volatile :: allreduce_rwlock

◆ allreduce_types

type(hashmap_type), volatile allreduction_inter_io_mod::allreduce_types
private

Definition at line 28 of file allreduction-inter-io.F90.

28  type(hashmap_type), volatile :: allreduce_types

◆ initialised

logical, volatile allreduction_inter_io_mod::initialised =.false.
private

Definition at line 25 of file allreduction-inter-io.F90.

25  logical, volatile :: initialised=.false.