You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
psblas3/base/internals/psi_desc_index.F90

342 lines
12 KiB
Fortran

!!$
!!$ Parallel Sparse BLAS version 2.2
!!$ (C) Copyright 2006/2007/2008
!!$ Salvatore Filippone University of Rome Tor Vergata
!!$ Alfredo Buttari University of Rome Tor Vergata
!!$
!!$ Redistribution and use in source and binary forms, with or without
!!$ modification, are permitted provided that the following conditions
!!$ are met:
!!$ 1. Redistributions of source code must retain the above copyright
!!$ notice, this list of conditions and the following disclaimer.
!!$ 2. Redistributions in binary form must reproduce the above copyright
!!$ notice, this list of conditions, and the following disclaimer in the
!!$ documentation and/or other materials provided with the distribution.
!!$ 3. The name of the PSBLAS group or the names of its contributors may
!!$ not be used to endorse or promote products derived from this
!!$ software without specific written permission.
!!$
!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS
!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
!!$ POSSIBILITY OF SUCH DAMAGE.
!!$
!!$
!
!
! File: psi_desc_index.f90
!
! Subroutine: psi_desc_index
! Converts a list of data exchanges from build format to assembled format.
! See below for a description of the formats.
!
! Arguments:
! desc_a - type(psb_desc_type) The descriptor; in this context only the index
! mapping parts are used.
! index_in(:) - integer The index list, build format
! index_out(:) - integer, allocatable The index list, assembled format
! glob_idx - logical Whether the input indices are in local or global
! numbering; the global numbering is used when
! converting the overlap exchange lists.
! nxch - integer The number of data exchanges on the calling process
! nsnd - integer Total send buffer size on the calling process
! nrcv - integer Total receive buffer size on the calling process
!
! The format of the index lists. Copied from base/modules/psb_desc_type
!
! 7. The data exchange is based on lists of local indices to be exchanged; all the
! lists have the same format, as follows:
! the list is composed of variable dimension blocks, one for each process to
! communicate with; each block contains indices of local elements to be
! exchanged. We do choose the order of communications: do not change
! the sequence of blocks unless you know what you're doing, or you'll
! risk a deadlock. NOTE: This is the format when the state is PSB_ASB_.
! See below for BLD. The end-of-list is marked with a -1.
!
! notation stored in explanation
! --------------- --------------------------- -----------------------------------
! process_id index_v(p+proc_id_) identifier of process with which
! data is exchanged.
! n_elements_recv index_v(p+n_elem_recv_) number of elements to receive.
! elements_recv index_v(p+elem_recv_+i) indexes of local elements to
! receive. these are stored in the
! array from location p+elem_recv_ to
! location p+elem_recv_+
! index_v(p+n_elem_recv_)-1.
! n_elements_send index_v(p+n_elem_send_) number of elements to send.
! elements_send index_v(p+elem_send_+i) indexes of local elements to
! send. these are stored in the
! array from location p+elem_send_ to
! location p+elem_send_+
! index_v(p+n_elem_send_)-1.
!
! This organization is valid for both halo and overlap indices; overlap entries
! need to be updated to ensure that a variable at a given global index
! (assigned to multiple processes) has the same value. The way to resolve the
! issue is to exchange the data and then sum (or average) the values. See
! psb_ovrl subroutine.
!
! 8. When the descriptor is in the BLD state the INDEX vectors contains only
! the indices to be received, organized as a sequence
! of entries of the form (proc,N,(lx1,lx2,...,lxn)) with owning process,
! number of indices (most often N=1), list of local indices.
! This is because we only know the list of halo indices to be received
! as we go about building the sparse matrix pattern, and we want the build
! phase to be loosely synchronized. Thus we record the indices we have to ask
! for, and at the time we call PSB_CDASB we match all the requests to figure
! out who should be sending what to whom.
! However this implies that we know who owns the indices; if we are in the
! LARGE case (as described above) this is actually only true for the OVERLAP list
! that is filled in at CDALL time, and not for the HALO; thus the HALO list
! is rebuilt during the CDASB process (in the psi_ldsc_pre_halo subroutine).
!
!
subroutine psi_desc_index(desc,index_in,dep_list,&
& length_dl,nsnd,nrcv,desc_index,isglob_in,info)
use psb_descriptor_type
20 years ago
use psb_realloc_mod
use psb_error_mod
use psb_const_mod
#ifdef MPI_MOD
use mpi
#endif
use psb_penv_mod
use psi_mod, psb_protect_name => psi_desc_index
20 years ago
implicit none
#ifdef MPI_H
include 'mpif.h'
#endif
20 years ago
! ...array parameters.....
type(psb_desc_type) :: desc
integer :: index_in(:),dep_list(:)
integer,allocatable :: desc_index(:)
integer :: length_dl,nsnd,nrcv,info
20 years ago
logical :: isglob_in
! ....local scalars...
integer :: j,me,np,i,proc
! ...parameters...
integer :: ictxt
integer, parameter :: no_comm=-1
! ...local arrays..
integer,allocatable :: brvindx(:),rvsz(:),&
& bsdindx(:),sdsz(:), sndbuf(:), rcvbuf(:)
20 years ago
integer :: ihinsz,ntot,k,err_act,nidx,&
& idxr, idxs, iszs, iszr, nesd, nerv, icomm
20 years ago
logical,parameter :: usempi=.true.
integer :: debug_level, debug_unit
character(len=20) :: name
20 years ago
info = psb_success_
20 years ago
name='psi_desc_index'
call psb_erractionsave(err_act)
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
20 years ago
ictxt = psb_cd_get_context(desc)
icomm = psb_cd_get_mpic(desc)
call psb_info(ictxt,me,np)
20 years ago
if (np == -1) then
psblas3: base/comm/psb_cgather.f90 base/comm/psb_chalo.f90 base/comm/psb_covrl.f90 base/comm/psb_cscatter.F90 base/comm/psb_dgather.f90 base/comm/psb_dhalo.f90 base/comm/psb_dovrl.f90 base/comm/psb_dscatter.F90 base/comm/psb_igather.f90 base/comm/psb_ihalo.f90 base/comm/psb_iovrl.f90 base/comm/psb_iscatter.F90 base/comm/psb_sgather.f90 base/comm/psb_shalo.f90 base/comm/psb_sovrl.f90 base/comm/psb_sscatter.F90 base/comm/psb_zgather.f90 base/comm/psb_zhalo.f90 base/comm/psb_zovrl.f90 base/comm/psb_zscatter.F90 base/internals/psi_bld_g2lmap.f90 base/internals/psi_bld_tmphalo.f90 base/internals/psi_bld_tmpovrl.f90 base/internals/psi_compute_size.f90 base/internals/psi_crea_index.f90 base/internals/psi_cswapdata.F90 base/internals/psi_cswaptran.F90 base/internals/psi_desc_index.F90 base/internals/psi_dswapdata.F90 base/internals/psi_dswaptran.F90 base/internals/psi_fnd_owner.F90 base/internals/psi_iswapdata.F90 base/internals/psi_iswaptran.F90 base/internals/psi_ldsc_pre_halo.f90 base/internals/psi_sswapdata.F90 base/internals/psi_sswaptran.F90 base/internals/psi_zswapdata.F90 base/internals/psi_zswaptran.F90 base/modules/psb_const_mod.F90 base/modules/psb_desc_type.f90 base/modules/psb_error_mod.F90 base/psblas/psb_camax.f90 base/psblas/psb_casum.f90 base/psblas/psb_caxpby.f90 base/psblas/psb_cdot.f90 base/psblas/psb_cnrm2.f90 base/psblas/psb_cnrmi.f90 base/psblas/psb_cspmm.f90 base/psblas/psb_cspsm.f90 base/psblas/psb_damax.f90 base/psblas/psb_dasum.f90 base/psblas/psb_daxpby.f90 base/psblas/psb_ddot.f90 base/psblas/psb_dnrm2.f90 base/psblas/psb_dnrmi.f90 base/psblas/psb_dspmm.f90 base/psblas/psb_dspsm.f90 base/psblas/psb_samax.f90 base/psblas/psb_sasum.f90 base/psblas/psb_saxpby.f90 base/psblas/psb_sdot.f90 base/psblas/psb_snrm2.f90 base/psblas/psb_snrmi.f90 base/psblas/psb_sspmm.f90 base/psblas/psb_sspsm.f90 base/psblas/psb_sxdot.f90 base/psblas/psb_zamax.f90 base/psblas/psb_zasum.f90 base/psblas/psb_zaxpby.f90 base/psblas/psb_zdot.f90 base/psblas/psb_znrm2.f90 base/psblas/psb_znrmi.f90 base/psblas/psb_zspmm.f90 base/psblas/psb_zspsm.f90 base/serial/psi_impl.f90 base/tools/psb_callc.f90 base/tools/psb_casb.f90 base/tools/psb_cdcpy.f90 base/tools/psb_cdren.f90 base/tools/psb_cfree.f90 base/tools/psb_cins.f90 base/tools/psb_cspalloc.f90 base/tools/psb_cspasb.f90 base/tools/psb_dallc.f90 base/tools/psb_dasb.f90 base/tools/psb_dfree.f90 base/tools/psb_dins.f90 base/tools/psb_dspalloc.f90 base/tools/psb_dspasb.f90 base/tools/psb_ialloc.f90 base/tools/psb_iasb.f90 base/tools/psb_icdasb.F90 base/tools/psb_ifree.f90 base/tools/psb_iins.f90 base/tools/psb_sallc.f90 base/tools/psb_sasb.f90 base/tools/psb_sfree.f90 base/tools/psb_sins.f90 base/tools/psb_sspalloc.f90 base/tools/psb_sspasb.f90 base/tools/psb_zallc.f90 base/tools/psb_zasb.f90 base/tools/psb_zfree.f90 base/tools/psb_zins.f90 base/tools/psb_zspalloc.f90 base/tools/psb_zspasb.f90 test/serial/Makefile test/serial/d_coo_matgen.f03 Fix blacs_error into context_error
15 years ago
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
20 years ago
endif
if (debug_level >= psb_debug_inner_) then
write(debug_unit,*) me,' ',trim(name),': start'
call psb_barrier(ictxt)
20 years ago
endif
!
! first, find out the sizes to be exchanged.
! note: things marked here as sndbuf/rcvbuf (for mpi) corresponds to things
! to be received/sent (in the final psblas descriptor).
! be careful of the inversion
!
20 years ago
allocate(sdsz(np),rvsz(np),bsdindx(np),brvindx(np),stat=info)
if(info /= psb_success_) then
info=psb_err_alloc_dealloc_
call psb_errpush(info,name)
goto 9999
20 years ago
end if
sdsz(:) = 0
rvsz(:) = 0
bsdindx(:) = 0
brvindx(:) = 0
i = 1
do
if (index_in(i) == -1) exit
proc = index_in(i)
i = i + 1
nerv = index_in(i)
sdsz(proc+1) = sdsz(proc+1) + nerv
i = i + nerv + 1
20 years ago
end do
ihinsz=i
call mpi_alltoall(sdsz,1,mpi_integer,rvsz,1,mpi_integer,icomm,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='mpi_alltoall')
goto 9999
20 years ago
end if
i = 1
idxs = 0
idxr = 0
do i=1, length_dl
proc = dep_list(i)
bsdindx(proc+1) = idxs
idxs = idxs + sdsz(proc+1)
brvindx(proc+1) = idxr
idxr = idxr + rvsz(proc+1)
20 years ago
end do
iszs = sum(sdsz)
iszr = sum(rvsz)
nsnd = iszr
nrcv = iszs
20 years ago
if ((iszs /= idxs).or.(iszr /= idxr)) then
psblas3: base/comm/psb_dhalo.f90 base/comm/psb_dspgather.F90 base/comm/psb_shalo.f90 base/internals/psi_bld_g2lmap.f90 base/internals/psi_bld_tmphalo.f90 base/internals/psi_cswapdata.F90 base/internals/psi_cswaptran.F90 base/internals/psi_desc_index.F90 base/internals/psi_dl_check.f90 base/internals/psi_dswapdata.F90 base/internals/psi_dswaptran.F90 base/internals/psi_extrct_dl.F90 base/internals/psi_fnd_owner.F90 base/internals/psi_iswapdata.F90 base/internals/psi_iswaptran.F90 base/internals/psi_sswapdata.F90 base/internals/psi_sswaptran.F90 base/internals/psi_zswapdata.F90 base/internals/psi_zswaptran.F90 base/internals/srtlist.f base/modules/psb_base_mat_mod.f03 base/modules/psb_c_tools_mod.f90 base/modules/psb_const_mod.F90 base/modules/psb_d_tools_mod.f90 base/modules/psb_desc_type.f90 base/modules/psb_error_impl.F90 base/modules/psb_error_mod.F90 base/modules/psb_gps_mod.f90 base/modules/psb_hash_mod.f90 base/modules/psb_realloc_mod.F90 base/modules/psb_s_tools_mod.f90 base/modules/psb_z_tools_mod.f90 base/modules/psi_comm_buffers_mod.F90 base/modules/psi_p2p_mod.F90 base/modules/psi_penv_mod.F90 base/psblas/psb_sxdot.f90 base/serial/aux/dasrx.f90 base/serial/aux/dmsr.f90 base/serial/aux/dmsrx.f90 base/serial/aux/zamsr.f90 base/serial/f03/psb_c_coo_impl.f03 base/serial/f03/psb_c_mat_impl.f03 base/serial/f03/psb_d_coo_impl.f03 base/serial/f03/psb_d_mat_impl.f03 base/serial/f03/psb_s_coo_impl.f03 base/serial/f03/psb_s_mat_impl.f03 base/serial/f03/psb_z_coo_impl.f03 base/serial/f03/psb_z_mat_impl.f03 base/serial/f77/smmp.f base/serial/psb_cnumbmm.f90 base/serial/psb_crwextd.f90 base/serial/psb_csymbmm.f90 base/serial/psb_dnumbmm.f90 base/serial/psb_drwextd.f90 base/serial/psb_dsymbmm.f90 base/serial/psb_snumbmm.f90 base/serial/psb_sort_impl.f90 base/serial/psb_srwextd.f90 base/serial/psb_ssymbmm.f90 base/serial/psb_znumbmm.f90 base/serial/psb_zrwextd.f90 base/serial/psb_zsymbmm.f90 base/serial/psi_impl.f90 base/tools/psb_ccdbldext.F90 base/tools/psb_cd_inloc.f90 base/tools/psb_cd_set_bld.f90 base/tools/psb_cdins.f90 base/tools/psb_cspins.f90 base/tools/psb_dcdbldext.F90 base/tools/psb_dspins.f90 base/tools/psb_glob_to_loc.f90 base/tools/psb_linmap.f90 base/tools/psb_loc_to_glob.f90 base/tools/psb_map.f90 base/tools/psb_scdbldext.F90 base/tools/psb_sspins.f90 base/tools/psb_zcdbldext.F90 base/tools/psb_zspins.f90 config/pac.m4 configure.ac configure krylov/psb_base_inner_krylov_mod.f90 krylov/psb_ckrylov.f90 krylov/psb_dkrylov.f90 krylov/psb_skrylov.f90 krylov/psb_zkrylov.f90 prec/psb_c_bjacprec.f03 prec/psb_cilu_fct.f90 prec/psb_cprecinit.f90 prec/psb_d_bjacprec.f03 prec/psb_dilu_fct.f90 prec/psb_dprecinit.f90 prec/psb_prec_const_mod.f03 prec/psb_s_bjacprec.f03 prec/psb_silu_fct.f90 prec/psb_sprecinit.f90 prec/psb_z_bjacprec.f03 prec/psb_zilu_fct.f90 prec/psb_zprecinit.f90 test/fileread/cf_sample.f90 test/fileread/df_sample.f90 test/fileread/getp.f90 test/fileread/sf_sample.f90 test/fileread/zf_sample.f90 test/pargen/ppde.f90 test/pargen/spde.f90 test/serial/d_coo_matgen.f03 test/serial/d_matgen.f03 test/torture/psbtf.f90 util/psb_hbio_impl.f90 util/psb_mat_dist_impl.f90 util/psb_metispart_mod.F90 util/psb_mmio_impl.f90 I/O changes with ISO_FORTRAN_ENV psb_XXX_unit & friends.
15 years ago
write(psb_err_unit,*) me, trim(name),': Warning: strange results?', &
& iszs,idxs,iszr,idxr
20 years ago
end if
if (debug_level >= psb_debug_inner_) then
write(debug_unit,*) me,' ',trim(name),': computed sizes ',iszr,iszs
call psb_barrier(ictxt)
20 years ago
endif
ntot = (3*(count((sdsz>0).or.(rvsz>0)))+ iszs + iszr) + 1
if (ntot > psb_size(desc_index)) then
call psb_realloc(ntot,desc_index,info)
20 years ago
endif
!!$ call psb_ensure_size(ntot,desc_index,info)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_realloc')
goto 9999
20 years ago
end if
if (debug_level >= psb_debug_inner_) then
write(debug_unit,*) me,' ',trim(name),': computed allocated workspace ',iszr,iszs
call psb_barrier(ictxt)
20 years ago
endif
allocate(sndbuf(iszs),rcvbuf(iszr),stat=info)
if(info /= psb_success_) then
info=psb_err_alloc_dealloc_
call psb_errpush(info,name)
goto 9999
20 years ago
end if
!
! Second build the lists of requests
!
20 years ago
i = 1
do
if (i > ihinsz) then
psblas3: base/comm/psb_dhalo.f90 base/comm/psb_dspgather.F90 base/comm/psb_shalo.f90 base/internals/psi_bld_g2lmap.f90 base/internals/psi_bld_tmphalo.f90 base/internals/psi_cswapdata.F90 base/internals/psi_cswaptran.F90 base/internals/psi_desc_index.F90 base/internals/psi_dl_check.f90 base/internals/psi_dswapdata.F90 base/internals/psi_dswaptran.F90 base/internals/psi_extrct_dl.F90 base/internals/psi_fnd_owner.F90 base/internals/psi_iswapdata.F90 base/internals/psi_iswaptran.F90 base/internals/psi_sswapdata.F90 base/internals/psi_sswaptran.F90 base/internals/psi_zswapdata.F90 base/internals/psi_zswaptran.F90 base/internals/srtlist.f base/modules/psb_base_mat_mod.f03 base/modules/psb_c_tools_mod.f90 base/modules/psb_const_mod.F90 base/modules/psb_d_tools_mod.f90 base/modules/psb_desc_type.f90 base/modules/psb_error_impl.F90 base/modules/psb_error_mod.F90 base/modules/psb_gps_mod.f90 base/modules/psb_hash_mod.f90 base/modules/psb_realloc_mod.F90 base/modules/psb_s_tools_mod.f90 base/modules/psb_z_tools_mod.f90 base/modules/psi_comm_buffers_mod.F90 base/modules/psi_p2p_mod.F90 base/modules/psi_penv_mod.F90 base/psblas/psb_sxdot.f90 base/serial/aux/dasrx.f90 base/serial/aux/dmsr.f90 base/serial/aux/dmsrx.f90 base/serial/aux/zamsr.f90 base/serial/f03/psb_c_coo_impl.f03 base/serial/f03/psb_c_mat_impl.f03 base/serial/f03/psb_d_coo_impl.f03 base/serial/f03/psb_d_mat_impl.f03 base/serial/f03/psb_s_coo_impl.f03 base/serial/f03/psb_s_mat_impl.f03 base/serial/f03/psb_z_coo_impl.f03 base/serial/f03/psb_z_mat_impl.f03 base/serial/f77/smmp.f base/serial/psb_cnumbmm.f90 base/serial/psb_crwextd.f90 base/serial/psb_csymbmm.f90 base/serial/psb_dnumbmm.f90 base/serial/psb_drwextd.f90 base/serial/psb_dsymbmm.f90 base/serial/psb_snumbmm.f90 base/serial/psb_sort_impl.f90 base/serial/psb_srwextd.f90 base/serial/psb_ssymbmm.f90 base/serial/psb_znumbmm.f90 base/serial/psb_zrwextd.f90 base/serial/psb_zsymbmm.f90 base/serial/psi_impl.f90 base/tools/psb_ccdbldext.F90 base/tools/psb_cd_inloc.f90 base/tools/psb_cd_set_bld.f90 base/tools/psb_cdins.f90 base/tools/psb_cspins.f90 base/tools/psb_dcdbldext.F90 base/tools/psb_dspins.f90 base/tools/psb_glob_to_loc.f90 base/tools/psb_linmap.f90 base/tools/psb_loc_to_glob.f90 base/tools/psb_map.f90 base/tools/psb_scdbldext.F90 base/tools/psb_sspins.f90 base/tools/psb_zcdbldext.F90 base/tools/psb_zspins.f90 config/pac.m4 configure.ac configure krylov/psb_base_inner_krylov_mod.f90 krylov/psb_ckrylov.f90 krylov/psb_dkrylov.f90 krylov/psb_skrylov.f90 krylov/psb_zkrylov.f90 prec/psb_c_bjacprec.f03 prec/psb_cilu_fct.f90 prec/psb_cprecinit.f90 prec/psb_d_bjacprec.f03 prec/psb_dilu_fct.f90 prec/psb_dprecinit.f90 prec/psb_prec_const_mod.f03 prec/psb_s_bjacprec.f03 prec/psb_silu_fct.f90 prec/psb_sprecinit.f90 prec/psb_z_bjacprec.f03 prec/psb_zilu_fct.f90 prec/psb_zprecinit.f90 test/fileread/cf_sample.f90 test/fileread/df_sample.f90 test/fileread/getp.f90 test/fileread/sf_sample.f90 test/fileread/zf_sample.f90 test/pargen/ppde.f90 test/pargen/spde.f90 test/serial/d_coo_matgen.f03 test/serial/d_matgen.f03 test/torture/psbtf.f90 util/psb_hbio_impl.f90 util/psb_mat_dist_impl.f90 util/psb_metispart_mod.F90 util/psb_mmio_impl.f90 I/O changes with ISO_FORTRAN_ENV psb_XXX_unit & friends.
15 years ago
!!$ write(psb_err_unit,*) me,' did not find index_in end??? ',i,ihinsz
exit
end if
if (index_in(i) == -1) exit
proc = index_in(i)
i = i + 1
nerv = index_in(i)
!
! note that here bsdinx is zero-based, hence the following loop
!
if (isglob_in) then
do j=1, nerv
sndbuf(bsdindx(proc+1)+j) = (index_in(i+j))
end do
else
call psb_map_l2g(index_in(i+1:i+nerv),&
& sndbuf(bsdindx(proc+1)+1:bsdindx(proc+1)+nerv),&
& desc%idxmap,info)
if (info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='psb_map_l2g')
goto 9999
end if
endif
bsdindx(proc+1) = bsdindx(proc+1) + nerv
i = i + nerv + 1
20 years ago
end do
if (debug_level >= psb_debug_inner_) then
write(debug_unit,*) me,' ',trim(name),': prepared send buffer '
call psb_barrier(ictxt)
20 years ago
endif
!
! now have to regenerate bsdindx
!
20 years ago
idxs = 0
idxr = 0
do i=1, length_dl
proc = dep_list(i)
bsdindx(proc+1) = idxs
idxs = idxs + sdsz(proc+1)
brvindx(proc+1) = idxr
idxr = idxr + rvsz(proc+1)
20 years ago
end do
call mpi_alltoallv(sndbuf,sdsz,bsdindx,mpi_integer,&
& rcvbuf,rvsz,brvindx,mpi_integer,icomm,info)
if(info /= psb_success_) then
call psb_errpush(psb_err_from_subroutine_,name,a_err='mpi_alltoallv')
goto 9999
20 years ago
end if
!
! at this point we can finally build the output desc_index. beware
! of snd/rcv inversion.
!
20 years ago
i = 1
do k = 1, length_dl
proc = dep_list(k)
desc_index(i) = proc
i = i + 1
nerv = sdsz(proc+1)
desc_index(i) = nerv
call psi_idx_cnv(nerv,sndbuf(bsdindx(proc+1)+1:bsdindx(proc+1)+nerv),&
& desc_index(i+1:i+nerv),desc,info)
i = i + nerv + 1
nesd = rvsz(proc+1)
desc_index(i) = nesd
call psi_idx_cnv(nesd,rcvbuf(brvindx(proc+1)+1:brvindx(proc+1)+nesd),&
& desc_index(i+1:i+nesd),desc,info)
i = i + nesd + 1
20 years ago
end do
desc_index(i) = - 1
deallocate(sdsz,rvsz,bsdindx,brvindx,sndbuf,rcvbuf,stat=info)
if (info /= psb_success_) then
info=psb_err_alloc_dealloc_
call psb_errpush(info,name)
goto 9999
20 years ago
end if
if (debug_level >= psb_debug_inner_) then
write(debug_unit,*) me,' ',trim(name),': done'
call psb_barrier(ictxt)
20 years ago
endif
call psb_erractionrestore(err_act)
return
9999 continue
call psb_erractionrestore(err_act)
if (err_act == psb_act_abort_) then
call psb_error(ictxt)
return
20 years ago
end if
return
end subroutine psi_desc_index