15 USE grid_api,
ONLY: grid_basis_set_type,&
23 #include "./base/base_uses.f90"
29 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'task_list_types'
32 INTEGER :: destination = 0
34 INTEGER :: dist_type = 0
36 INTEGER :: subpatch_pattern = 0
37 INTEGER :: grid_level = 0
45 INTEGER :: pair_index = 0
47 REAL(KIND=
dp),
DIMENSION(3) :: rab = 0.0_dp
48 REAL(KIND=
dp) :: radius = 0.0_dp
56 END TYPE atom_pair_type
59 TYPE(task_type),
DIMENSION(:),
POINTER :: tasks => null()
61 INTEGER,
DIMENSION(:, :),
POINTER :: taskstart => null(), taskstop => null()
62 INTEGER,
DIMENSION(:),
POINTER :: npairs => null()
64 TYPE(atom_pair_type),
DIMENSION(:),
POINTER :: atom_pair_send => null()
65 INTEGER,
DIMENSION(:),
POINTER :: pair_offsets_send => null()
66 INTEGER,
DIMENSION(:),
POINTER :: rank_offsets_send => null()
67 INTEGER,
DIMENSION(:),
POINTER :: rank_sizes_send => null()
68 INTEGER :: buffer_size_send = 0
70 TYPE(atom_pair_type),
DIMENSION(:),
POINTER :: atom_pair_recv => null()
71 INTEGER,
DIMENSION(:),
POINTER :: pair_offsets_recv => null()
72 INTEGER,
DIMENSION(:),
POINTER :: rank_offsets_recv => null()
73 INTEGER,
DIMENSION(:),
POINTER :: rank_sizes_recv => null()
74 INTEGER :: buffer_size_recv = 0
76 TYPE(grid_basis_set_type),
DIMENSION(:),
POINTER :: grid_basis_sets => null()
77 TYPE(grid_task_list_type) :: grid_task_list = grid_task_list_type()
78 TYPE(offload_buffer_type) :: pab_buffer = offload_buffer_type()
79 TYPE(offload_buffer_type) :: hab_buffer = offload_buffer_type()
80 END TYPE task_list_type
84 PUBLIC :: task_type, atom_pair_type, task_list_type
97 TYPE(task_list_type),
POINTER :: task_list
101 NULLIFY (task_list%tasks)
102 NULLIFY (task_list%atom_pair_send)
103 NULLIFY (task_list%atom_pair_recv)
104 NULLIFY (task_list%taskstart)
105 NULLIFY (task_list%taskstop)
106 NULLIFY (task_list%npairs)
117 TYPE(task_type),
DIMENSION(:),
INTENT(inout), &
119 INTEGER,
INTENT(in) :: new_size
121 TYPE(task_type),
DIMENSION(:),
POINTER :: old_tasks
123 IF (.NOT.
ASSOCIATED(tasks))
THEN
124 ALLOCATE (tasks(new_size))
128 IF (new_size <=
SIZE(tasks))
RETURN
133 ALLOCATE (tasks(new_size))
134 tasks(1:
SIZE(old_tasks)) = old_tasks(:)
135 DEALLOCATE (old_tasks)
145 TYPE(task_list_type),
POINTER :: task_list
149 IF (
ASSOCIATED(task_list%tasks))
THEN
150 DEALLOCATE (task_list%tasks)
152 IF (
ASSOCIATED(task_list%taskstart))
THEN
153 DEALLOCATE (task_list%taskstart)
155 IF (
ASSOCIATED(task_list%taskstop))
THEN
156 DEALLOCATE (task_list%taskstop)
158 IF (
ASSOCIATED(task_list%npairs))
THEN
159 DEALLOCATE (task_list%npairs)
162 IF (
ASSOCIATED(task_list%atom_pair_send))
THEN
163 DEALLOCATE (task_list%atom_pair_send)
165 IF (
ASSOCIATED(task_list%pair_offsets_send))
THEN
166 DEALLOCATE (task_list%pair_offsets_send)
168 IF (
ASSOCIATED(task_list%rank_offsets_send))
THEN
169 DEALLOCATE (task_list%rank_offsets_send)
171 IF (
ASSOCIATED(task_list%rank_sizes_send))
THEN
172 DEALLOCATE (task_list%rank_sizes_send)
175 IF (
ASSOCIATED(task_list%atom_pair_recv))
THEN
176 DEALLOCATE (task_list%atom_pair_recv)
178 IF (
ASSOCIATED(task_list%pair_offsets_recv))
THEN
179 DEALLOCATE (task_list%pair_offsets_recv)
181 IF (
ASSOCIATED(task_list%rank_offsets_recv))
THEN
182 DEALLOCATE (task_list%rank_offsets_recv)
184 IF (
ASSOCIATED(task_list%rank_sizes_recv))
THEN
185 DEALLOCATE (task_list%rank_sizes_recv)
190 IF (
ASSOCIATED(task_list%grid_basis_sets))
THEN
191 DO i = 1,
SIZE(task_list%grid_basis_sets)
194 DEALLOCATE (task_list%grid_basis_sets)
197 DEALLOCATE (task_list)
207 TYPE(task_type),
INTENT(IN) :: task
208 INTEGER(KIND=int_8), &
209 DIMENSION(task_size_in_int8),
INTENT(OUT) :: serialized_task
211 serialized_task(1) = task%destination
212 serialized_task(2) = task%source
213 serialized_task(3) = task%dist_type
214 serialized_task(4) = task%cost
215 serialized_task(5) = task%subpatch_pattern
217 serialized_task(6) = task%grid_level
218 serialized_task(7) = task%image
219 serialized_task(8) = task%iatom
220 serialized_task(9) = task%jatom
221 serialized_task(10) = task%iset
222 serialized_task(11) = task%jset
223 serialized_task(12) = task%ipgf
224 serialized_task(13) = task%jpgf
226 serialized_task(14) = transfer(task%rab(1), mold=1_int_8)
227 serialized_task(15) = transfer(task%rab(2), mold=1_int_8)
228 serialized_task(16) = transfer(task%rab(3), mold=1_int_8)
229 serialized_task(17) = transfer(task%radius, mold=1_int_8)
239 TYPE(task_type),
INTENT(OUT) :: task
240 INTEGER(KIND=int_8), &
241 DIMENSION(task_size_in_int8),
INTENT(IN) :: serialized_task
243 task%destination = int(serialized_task(1))
244 task%source = int(serialized_task(2))
245 task%dist_type = int(serialized_task(3))
246 task%cost = int(serialized_task(4))
247 task%subpatch_pattern = int(serialized_task(5))
249 task%grid_level = int(serialized_task(6))
250 task%image = int(serialized_task(7))
251 task%iatom = int(serialized_task(8))
252 task%jatom = int(serialized_task(9))
253 task%iset = int(serialized_task(10))
254 task%jset = int(serialized_task(11))
255 task%ipgf = int(serialized_task(12))
256 task%jpgf = int(serialized_task(13))
258 task%rab(1) = transfer(serialized_task(14), mold=1.0_dp)
259 task%rab(2) = transfer(serialized_task(15), mold=1.0_dp)
260 task%rab(3) = transfer(serialized_task(16), mold=1.0_dp)
261 task%radius = transfer(serialized_task(17), mold=1.0_dp)
void grid_free_basis_set(grid_basis_set *basis_set)
Deallocates given basis set.
Fortran API for the grid package, which is written in C.
subroutine, public grid_free_task_list(task_list)
Deallocates given task list, basis_sets have to be freed separately.
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
Fortran API for the offload package, which is written in C.
subroutine, public offload_free_buffer(buffer)
Deallocates given buffer.
subroutine, public serialize_task(task, serialized_task)
Serialize a task into an integer array. Used for MPI communication.
subroutine, public deserialize_task(task, serialized_task)
De-serialize a task from an integer array. Used for MPI communication.
subroutine, public deallocate_task_list(task_list)
deallocates the components and the object itself
subroutine, public reallocate_tasks(tasks, new_size)
Grow an array of tasks while preserving the existing entries.
subroutine, public allocate_task_list(task_list)
allocates and initialised the components of the task_list_type
integer, parameter, public task_size_in_int8