base/internals/psi_desc_impl.f90
 base/modules/psb_desc_mod.F90
 base/tools/Makefile
 base/tools/psb_cd_clone.f90
 base/tools/psb_icdasb.F90

Fixed cloning method for descriptors.
psblas-3.2.0
Salvatore Filippone 11 years ago
parent 5a711b642a
commit 009a56e882

@ -83,7 +83,7 @@ subroutine psi_cnv_dsc(halo_in,ovrlap_in,ext_in,cdesc, info, mold)
logical, parameter :: debug=.false. logical, parameter :: debug=.false.
character(len=20) :: name character(len=20) :: name
name='psi_bld_cdesc' name='psi_cnv_desc'
call psb_get_erraction(err_act) call psb_get_erraction(err_act)
debug_level = psb_get_debug_level() debug_level = psb_get_debug_level()
debug_unit = psb_get_debug_unit() debug_unit = psb_get_debug_unit()

@ -267,15 +267,6 @@ module psb_desc_mod
end type psb_desc_type end type psb_desc_type
interface
subroutine psb_cd_clone(desc, desc_out, info)
import psb_desc_type, psb_ipk_
class(psb_desc_type), intent(inout), target :: desc
class(psb_desc_type), intent(inout) :: desc_out
integer(psb_ipk_), intent(out) :: info
end subroutine psb_cd_clone
end interface
interface psb_sizeof interface psb_sizeof
module procedure psb_cd_sizeof module procedure psb_cd_sizeof
@ -875,11 +866,11 @@ contains
! !
! !
! Arguments: ! Arguments:
! desc_in - type(psb_desc_type). The communication descriptor to be ! desc - type(psb_desc_type). The communication descriptor to be
! transferred. ! transferred.
! desc_out - type(psb_desc_type). The output communication descriptor. ! desc_out - type(psb_desc_type). The output communication descriptor.
! info - integer. Return code. ! info - integer. Return code.
subroutine psb_cdtransfer(desc_in, desc_out, info) subroutine psb_cdtransfer(desc, desc_out, info)
use psb_realloc_mod use psb_realloc_mod
use psb_const_mod use psb_const_mod
@ -889,7 +880,7 @@ contains
implicit none implicit none
!....parameters... !....parameters...
type(psb_desc_type), intent(inout) :: desc_in type(psb_desc_type), intent(inout) :: desc
type(psb_desc_type), intent(inout) :: desc_out type(psb_desc_type), intent(inout) :: desc_out
integer(psb_ipk_), intent(out) :: info integer(psb_ipk_), intent(out) :: info
@ -906,38 +897,38 @@ contains
debug_level = psb_get_debug_level() debug_level = psb_get_debug_level()
! !
! Note: this might be called even ! Note: this might be called even
! when desc_in is empty. ! when desc is empty.
! !
if (desc_in%is_valid()) then if (desc%is_valid()) then
ictxt = psb_cd_get_context(desc_in) ictxt = psb_cd_get_context(desc)
call psb_info(ictxt,me,np) call psb_info(ictxt,me,np)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%halo_index , desc_out%halo_index , info) & call psb_move_alloc( desc%halo_index , desc_out%halo_index , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%bnd_elem , desc_out%bnd_elem , info) & call psb_move_alloc( desc%bnd_elem , desc_out%bnd_elem , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%ovrlap_elem , desc_out%ovrlap_elem , info) & call psb_move_alloc( desc%ovrlap_elem , desc_out%ovrlap_elem , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%ovrlap_index, desc_out%ovrlap_index , info) & call psb_move_alloc( desc%ovrlap_index, desc_out%ovrlap_index , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%ovr_mst_idx , desc_out%ovr_mst_idx , info) & call psb_move_alloc( desc%ovr_mst_idx , desc_out%ovr_mst_idx , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%ext_index , desc_out%ext_index , info) & call psb_move_alloc( desc%ext_index , desc_out%ext_index , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%lprm , desc_out%lprm , info) & call psb_move_alloc( desc%lprm , desc_out%lprm , info)
if (info == psb_success_) & if (info == psb_success_) &
& call psb_move_alloc( desc_in%idx_space , desc_out%idx_space , info) & call psb_move_alloc( desc%idx_space , desc_out%idx_space , info)
if (info == psb_success_) & if (info == psb_success_) &
& call move_alloc(desc_in%indxmap, desc_out%indxmap) & call move_alloc(desc%indxmap, desc_out%indxmap)
if (info == psb_success_) & if (info == psb_success_) &
& call desc_in%v_halo_index%clone(desc_out%v_halo_index,info) & call desc%v_halo_index%clone(desc_out%v_halo_index,info)
if (info == psb_success_) & if (info == psb_success_) &
& call desc_in%v_ext_index%clone(desc_out%v_ext_index,info) & call desc%v_ext_index%clone(desc_out%v_ext_index,info)
if (info == psb_success_) & if (info == psb_success_) &
& call desc_in%v_ovrlap_index%clone(desc_out%v_ovrlap_index,info) & call desc%v_ovrlap_index%clone(desc_out%v_ovrlap_index,info)
if (info == psb_success_) & if (info == psb_success_) &
& call desc_in%v_ovr_mst_idx%clone(desc_out%v_ovr_mst_idx,info) & call desc%v_ovr_mst_idx%clone(desc_out%v_ovr_mst_idx,info)
if (info /= psb_success_) then if (info /= psb_success_) then
info = psb_err_from_subroutine_ info = psb_err_from_subroutine_
@ -949,7 +940,7 @@ contains
else else
call desc_out%free(info) call desc_out%free(info)
end if end if
call desc_in%free(info) call desc%free(info)
call psb_erractionrestore(err_act) call psb_erractionrestore(err_act)
return return
@ -965,6 +956,114 @@ contains
return return
end subroutine psb_cdtransfer end subroutine psb_cdtransfer
!
! Subroutine: psb_cd_clone
! Copies data and allocation from in to out.
!
!
! Arguments:
! desc - type(psb_desc_type). The communication descriptor to be
! transferred.
! desc_out - type(psb_desc_type). The output communication descriptor.
! info - integer. Return code.
subroutine psb_cd_clone(desc, desc_out, info)
use psb_error_mod
use psb_penv_mod
use psb_realloc_mod
implicit none
!....parameters...
class(psb_desc_type), intent(inout), target :: desc
class(psb_desc_type), intent(inout) :: desc_out
integer(psb_ipk_), intent(out) :: info
!locals
integer(psb_ipk_) :: np,me,ictxt, err_act
integer(psb_ipk_) :: debug_level, debug_unit
character(len=20) :: name
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
if (psb_get_errstatus() /= 0) return
info = psb_success_
call psb_erractionsave(err_act)
name = 'psb_cdcpy'
if (desc%is_valid()) then
ictxt = desc%get_context()
! check on blacs grid
call psb_info(ictxt, me, np)
if (debug_level >= psb_debug_ext_) &
& write(debug_unit,*) me,' ',trim(name),': Entered'
if (np == -1) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
desc_out%base_desc => desc%base_desc
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%halo_index,desc_out%halo_index,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ext_index,desc_out%ext_index,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ovrlap_index,&
& desc_out%ovrlap_index,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%bnd_elem,desc_out%bnd_elem,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ovrlap_elem,desc_out%ovrlap_elem,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ovr_mst_idx,desc_out%ovr_mst_idx,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%lprm,desc_out%lprm,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%idx_space,desc_out%idx_space,info)
!!$ if ((info == psb_success_).and.(allocated(desc%indxmap))) &
!!$ & call desc%indxmap%clone(desc_out%indxmap,info)
!!$ associate(indxin => desc%indxmap)
!!$ if ((info == psb_success_).and.(allocated(desc%indxmap))) &
!!$ & call indxin%clone(desc_out%indxmap,info)
!!$ end associate
if ((info == psb_success_).and.(allocated(desc%indxmap))) &
& allocate(desc_out%indxmap,source=desc%indxmap,stat=info)
if (info == psb_success_) &
& call desc%v_halo_index%clone(desc_out%v_halo_index,info)
if (info == psb_success_) &
& call desc%v_ext_index%clone(desc_out%v_ext_index,info)
if (info == psb_success_) &
& call desc%v_ovrlap_index%clone(desc_out%v_ovrlap_index,info)
if (info == psb_success_) &
& call desc%v_ovr_mst_idx%clone(desc_out%v_ovr_mst_idx,info)
else
call desc_out%free(info)
end if
if (info /= psb_success_) then
info = psb_err_from_subroutine_
call psb_errpush(info,name)
goto 9999
endif
if (debug_level >= psb_debug_ext_) &
& write(debug_unit,*) me,' ',trim(name),': Done'
call psb_erractionrestore(err_act)
return
9999 continue
call psb_erractionrestore(err_act)
if (err_act == psb_act_ret_) then
return
else
call psb_error(ictxt)
end if
return
end subroutine psb_cd_clone
Subroutine psb_cd_get_recv_idx(tmp,desc,data,info,toglob) Subroutine psb_cd_get_recv_idx(tmp,desc,data,info,toglob)

@ -6,7 +6,7 @@ FOBJS = psb_sallc.o psb_sasb.o \
psb_dfree.o psb_dins.o \ psb_dfree.o psb_dins.o \
psb_cdall.o psb_cdals.o psb_cdalv.o psb_cd_inloc.o psb_cdins.o psb_cdprt.o \ psb_cdall.o psb_cdals.o psb_cdalv.o psb_cd_inloc.o psb_cdins.o psb_cdprt.o \
psb_cdren.o psb_cdrep.o psb_get_overlap.o psb_cd_lstext.o\ psb_cdren.o psb_cdrep.o psb_get_overlap.o psb_cd_lstext.o\
psb_cdcpy.o psb_cd_reinit.o psb_cd_switch_ovl_indxmap.o psb_cd_clone.o\ psb_cdcpy.o psb_cd_reinit.o psb_cd_switch_ovl_indxmap.o \
psb_dspalloc.o psb_dspasb.o \ psb_dspalloc.o psb_dspasb.o \
psb_dspfree.o psb_dspins.o psb_dsprn.o \ psb_dspfree.o psb_dspins.o psb_dsprn.o \
psb_sspalloc.o psb_sspasb.o \ psb_sspalloc.o psb_sspasb.o \

@ -1,90 +0,0 @@
subroutine psb_cd_clone(desc, desc_out, info)
use psb_error_mod
use psb_penv_mod
use psb_realloc_mod
use psb_desc_mod, psb_protect_name => psb_cd_clone
implicit none
!....parameters...
class(psb_desc_type), intent(inout), target :: desc
class(psb_desc_type), intent(inout) :: desc_out
integer(psb_ipk_), intent(out) :: info
!locals
integer(psb_ipk_) :: np,me,ictxt, err_act
integer(psb_ipk_) :: debug_level, debug_unit
character(len=20) :: name
debug_unit = psb_get_debug_unit()
debug_level = psb_get_debug_level()
if (psb_get_errstatus() /= 0) return
info = psb_success_
call psb_erractionsave(err_act)
name = 'psb_cdcpy'
if (desc%is_valid()) then
ictxt = desc%get_context()
! check on blacs grid
call psb_info(ictxt, me, np)
if (debug_level >= psb_debug_ext_) &
& write(debug_unit,*) me,' ',trim(name),': Entered'
if (np == -1) then
info = psb_err_context_error_
call psb_errpush(info,name)
goto 9999
endif
desc_out%base_desc => desc%base_desc
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%halo_index,desc_out%halo_index,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ext_index,desc_out%ext_index,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ovrlap_index,&
& desc_out%ovrlap_index,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%bnd_elem,desc_out%bnd_elem,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ovrlap_elem,desc_out%ovrlap_elem,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%ovr_mst_idx,desc_out%ovr_mst_idx,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%lprm,desc_out%lprm,info)
if (info == psb_success_)&
& call psb_safe_ab_cpy(desc%idx_space,desc_out%idx_space,info)
!!$ if ((info == psb_success_).and.(allocated(desc%indxmap))) &
!!$ & call desc%indxmap%clone(desc_out%indxmap,info)
!!$ associate(indxin => desc%indxmap)
!!$ if ((info == psb_success_).and.(allocated(desc%indxmap))) &
!!$ & call indxin%clone(desc_out%indxmap,info)
!!$ end associate
if ((info == psb_success_).and.(allocated(desc%indxmap))) &
& allocate(desc_out%indxmap,source=desc%indxmap,stat=info)
else
call desc_out%free(info)
end if
if (info /= psb_success_) then
info = psb_err_from_subroutine_
call psb_errpush(info,name)
goto 9999
endif
if (debug_level >= psb_debug_ext_) &
& write(debug_unit,*) me,' ',trim(name),': Done'
call psb_erractionrestore(err_act)
return
9999 continue
call psb_erractionrestore(err_act)
if (err_act == psb_act_ret_) then
return
else
call psb_error(ictxt)
end if
return
end subroutine psb_cd_clone

@ -90,7 +90,7 @@ subroutine psb_icdasb(desc,info,ext_hv,mold)
goto 9999 goto 9999
endif endif
if (.not.psb_is_ok_desc(desc)) then if (.not.desc%is_ok()) then
info = psb_err_spmat_invalid_state_ info = psb_err_spmat_invalid_state_
int_err(1) = dectype int_err(1) = dectype
call psb_errpush(info,name) call psb_errpush(info,name)
@ -161,8 +161,6 @@ subroutine psb_icdasb(desc,info,ext_hv,mold)
goto 9999 goto 9999
endif endif
if (present(mold)) &
& call desc%cnv(mold)
if (debug_level >= psb_debug_ext_) & if (debug_level >= psb_debug_ext_) &
& write(debug_unit,*) me,' ',trim(name),': Done' & write(debug_unit,*) me,' ',trim(name),': Done'

Loading…
Cancel
Save