60 integer,
allocatable :: peaks(:), children_peaks(:), aux(:), &
61 & roots(:), child(:), tnch(:)
62 integer :: root, maxch, nroots, nleaves, i, nl, leaf, f, c
63 integer :: nch, nnodes, node, peak
70 do node = 1, adata%nnodes
71 if(adata%parent(node) .eq. 0)
then 75 nch = adata%childptr(node+1)-adata%childptr(node)
76 if(nch .gt. maxch) maxch = nch
77 if(nch .eq. 0 ) nleaves = nleaves+1
96 maxch = max(maxch, nroots)
101 nnodes = adata%nnodes
106 main:
do leaf=1, adata%nnodes
108 nch = adata%childptr(leaf+1)-adata%childptr(leaf)
114 if(nnodes .eq. 0)
exit main
117 if(peaks(node) .ne. 0)
exit 122 if(adata%childptr(node) .ne. adata%childptr(node+1))
then 123 do i = adata%childptr(node), adata%childptr(node+1)-1
125 children_peaks(nch) = peaks(adata%child(i))
128 call qrm_mergesort(nch, children_peaks(1:nch), aux(0:nch+1), order=-1)
130 call qrm_mergeswap(nch, aux(0:nch+1), children_peaks(1:nch), &
131 & adata%child(adata%childptr(node):adata%childptr(node+1)-1))
134 peak = max(peak, i-1+children_peaks(i))
138 peaks(node) = max(peak,nch+1)
141 f = adata%parent(node)
143 peaks(f) = peaks(f)+1
144 if(peaks(f) .eq. 0)
then 162 children_peaks(i) = peaks(roots(i))
165 call qrm_mergesort(nroots, children_peaks(1:nroots), aux(0:nroots+1), order=-1)
166 call qrm_mergeswap(nroots, aux(0:nroots+1), children_peaks(1:nroots), &
173 call move_alloc(peaks, child)
181 do node=1, adata%nnodes
182 do i=adata%childptr(node), adata%childptr(node+1)-1
184 if(adata%small(c) .eq. 0) tnch(node) = tnch(node)+1
189 roots_loop:
do root=1, nroots
194 if(tnch(node) .eq. 0)
then 196 adata%leaves(nleaves) = node
199 nch=adata%childptr(node+1) - adata%childptr(node)
201 if(child(node) .ge. nch)
exit 202 child(node) = child(node)+1
203 c = adata%child(adata%childptr(node)+child(node)-1)
204 if(adata%small(c) .ne. 1)
then 210 node = adata%parent(node)
211 if (node .eq. 0) cycle roots_loop
217 adata%nleaves = nleaves
Generic interface for the qrm_adealloc_i, qrm_adealloc_2i, qrm_adealloc_s, qrm_adealloc_2s, qrm_adealloc_3s, qrm_adealloc_d, qrm_adealloc_2d, qrm_adealloc_3d, qrm_adealloc_c, qrm_adealloc_2c, qrm_adealloc_3c, qrm_adealloc_z, qrm_adealloc_2z, qrm_adealloc_3z, routines.
This module contains routines for sorting.
This module contains the definition of the analysis data type.
The main data type for the analysis phase.
Generic interface for the qrm_aalloc_i, qrm_aalloc_2i, qrm_aalloc_s, qrm_aalloc_2s, qrm_aalloc_3s, qrm_aalloc_d, qrm_aalloc_2d, qrm_aalloc_3d, qrm_aalloc_c, qrm_aalloc_2c, qrm_aalloc_3c, qrm_aalloc_z, qrm_aalloc_2z, qrm_aalloc_3z, routines.
subroutine qrm_reorder_tree(adata)
This subroutine reorders the assembly tree in order to reduce the tasks search space.
This module implements the memory handling routines. Pretty mucch allocations and deallocations...