| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(rdm_spawn_t), | intent(out) | :: | spawn | |||
| integer, | intent(in) | :: | nrows | |||
| integer, | intent(in) | :: | sign_length | |||
| integer, | intent(in) | :: | max_nelements_send | |||
| integer, | intent(in) | :: | nhashes |
subroutine init_rdm_spawn_t(spawn, nrows, sign_length, max_nelements_send, nhashes) ! Initialise an rdm_spawn_t object. ! Out: spawn - rdm_spawn_t object to be initialised. ! In: nrows - the number of rows in the RDM. ! In: sign_length - the number of signs which can be stored for each element. ! In: max_nelements_send - the length of the spawn%rdm_send%elements array. ! In: nhashes - the number of unique hashes for indexing spawn%rdm_send%hash_table. type(rdm_spawn_t), intent(out) :: spawn integer, intent(in) :: nrows, sign_length, nhashes integer, intent(in) :: max_nelements_send integer :: iproc, ierr real(dp) :: slots_per_proc spawn%nrows = nrows call init_rdm_list_t(spawn%rdm_send, sign_length, max_nelements_send, nhashes) allocate(spawn%free_slots(0:nProcessors - 1), stat=ierr) ! init_free_slots has one extra element compared to free_slots. This ! is set equal to the total number of elements + 1, which allows us to ! avoid an extra if-statement for an edge case in add_to_rdm_spawn_t. allocate(spawn%init_free_slots(0:nProcessors), stat=ierr) ! Equally divide RDM rows across all processors. slots_per_proc = real(max_nelements_send, dp) / real(nProcessors, dp) do iproc = 0, nProcessors - 1 spawn%init_free_slots(iproc) = nint(slots_per_proc * iproc) + 1 end do ! For edge cases - see comment above. spawn%init_free_slots(nProcessors) = max_nelements_send + 1 ! Set the free slots array to its initial value. spawn%free_slots = spawn%init_free_slots(0:nProcessors - 1) end subroutine init_rdm_spawn_t