New I/L/E/M tools (interface & impl).
parent
18fe928a09
commit
335066b305
@ -0,0 +1,119 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
Module psb_c_tools_a_mod
|
||||
use psb_desc_mod, only : psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_
|
||||
|
||||
interface psb_geall
|
||||
subroutine psb_calloc(x, desc_a, info, n, lb)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_spk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
end subroutine psb_calloc
|
||||
subroutine psb_callocv(x, desc_a,info,n)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_spk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
end subroutine psb_callocv
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geasb
|
||||
subroutine psb_casb(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_spk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_casb
|
||||
subroutine psb_casbv(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_spk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_casbv
|
||||
end interface
|
||||
|
||||
interface psb_gefree
|
||||
subroutine psb_cfree(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_spk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_cfree
|
||||
subroutine psb_cfreev(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_spk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_cfreev
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geins
|
||||
subroutine psb_cinsi(m,irw,val, x, desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_spk_),intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_spk_), intent(in) :: val(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_cinsi
|
||||
subroutine psb_cinsvi(m, irw,val, x,desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_spk_),intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_spk_), intent(in) :: val(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_cinsvi
|
||||
end interface
|
||||
|
||||
end module psb_c_tools_a_mod
|
||||
@ -0,0 +1,119 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
Module psb_d_tools_a_mod
|
||||
use psb_desc_mod, only : psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_
|
||||
|
||||
interface psb_geall
|
||||
subroutine psb_dalloc(x, desc_a, info, n, lb)
|
||||
import
|
||||
implicit none
|
||||
real(psb_dpk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
end subroutine psb_dalloc
|
||||
subroutine psb_dallocv(x, desc_a,info,n)
|
||||
import
|
||||
implicit none
|
||||
real(psb_dpk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
end subroutine psb_dallocv
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geasb
|
||||
subroutine psb_dasb(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_dasb
|
||||
subroutine psb_dasbv(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_dasbv
|
||||
end interface
|
||||
|
||||
interface psb_gefree
|
||||
subroutine psb_dfree(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
real(psb_dpk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_dfree
|
||||
subroutine psb_dfreev(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
real(psb_dpk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_dfreev
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geins
|
||||
subroutine psb_dinsi(m,irw,val, x, desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_),intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_dpk_), intent(in) :: val(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_dinsi
|
||||
subroutine psb_dinsvi(m, irw,val, x,desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_dpk_), intent(in) :: val(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_dinsvi
|
||||
end interface
|
||||
|
||||
end module psb_d_tools_a_mod
|
||||
@ -0,0 +1,119 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
Module psb_e_tools_a_mod
|
||||
use psb_desc_mod, only : psb_desc_type, psb_epk_, psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_
|
||||
|
||||
interface psb_geall
|
||||
subroutine psb_ealloc(x, desc_a, info, n, lb)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_epk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
end subroutine psb_ealloc
|
||||
subroutine psb_eallocv(x, desc_a,info,n)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_epk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
end subroutine psb_eallocv
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geasb
|
||||
subroutine psb_easb(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_epk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_easb
|
||||
subroutine psb_easbv(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_epk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_easbv
|
||||
end interface
|
||||
|
||||
interface psb_gefree
|
||||
subroutine psb_efree(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_epk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_efree
|
||||
subroutine psb_efreev(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_epk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_efreev
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geins
|
||||
subroutine psb_einsi(m,irw,val, x, desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_epk_),intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_epk_), intent(in) :: val(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_einsi
|
||||
subroutine psb_einsvi(m, irw,val, x,desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_epk_),intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_epk_), intent(in) :: val(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_einsvi
|
||||
end interface
|
||||
|
||||
end module psb_e_tools_a_mod
|
||||
@ -0,0 +1,119 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
Module psb_m_tools_a_mod
|
||||
use psb_desc_mod, only : psb_desc_type, psb_mpk_, psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_
|
||||
|
||||
interface psb_geall
|
||||
subroutine psb_malloc(x, desc_a, info, n, lb)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_mpk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
end subroutine psb_malloc
|
||||
subroutine psb_mallocv(x, desc_a,info,n)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_mpk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
end subroutine psb_mallocv
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geasb
|
||||
subroutine psb_masb(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_mpk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_masb
|
||||
subroutine psb_masbv(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_mpk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_masbv
|
||||
end interface
|
||||
|
||||
interface psb_gefree
|
||||
subroutine psb_mfree(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_mpk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_mfree
|
||||
subroutine psb_mfreev(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_mpk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_mfreev
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geins
|
||||
subroutine psb_minsi(m,irw,val, x, desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_mpk_),intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_mpk_), intent(in) :: val(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_minsi
|
||||
subroutine psb_minsvi(m, irw,val, x,desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_mpk_),intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_mpk_), intent(in) :: val(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_minsvi
|
||||
end interface
|
||||
|
||||
end module psb_m_tools_a_mod
|
||||
@ -0,0 +1,119 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
Module psb_s_tools_a_mod
|
||||
use psb_desc_mod, only : psb_desc_type, psb_spk_, psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_
|
||||
|
||||
interface psb_geall
|
||||
subroutine psb_salloc(x, desc_a, info, n, lb)
|
||||
import
|
||||
implicit none
|
||||
real(psb_spk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
end subroutine psb_salloc
|
||||
subroutine psb_sallocv(x, desc_a,info,n)
|
||||
import
|
||||
implicit none
|
||||
real(psb_spk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
end subroutine psb_sallocv
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geasb
|
||||
subroutine psb_sasb(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_sasb
|
||||
subroutine psb_sasbv(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_sasbv
|
||||
end interface
|
||||
|
||||
interface psb_gefree
|
||||
subroutine psb_sfree(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
real(psb_spk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_sfree
|
||||
subroutine psb_sfreev(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
real(psb_spk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_sfreev
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geins
|
||||
subroutine psb_sinsi(m,irw,val, x, desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_),intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_spk_), intent(in) :: val(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_sinsi
|
||||
subroutine psb_sinsvi(m, irw,val, x,desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_spk_), intent(in) :: val(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_sinsvi
|
||||
end interface
|
||||
|
||||
end module psb_s_tools_a_mod
|
||||
@ -0,0 +1,119 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
Module psb_z_tools_a_mod
|
||||
use psb_desc_mod, only : psb_desc_type, psb_dpk_, psb_ipk_, psb_lpk_, psb_mpk_, psb_epk_
|
||||
|
||||
interface psb_geall
|
||||
subroutine psb_zalloc(x, desc_a, info, n, lb)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_dpk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
end subroutine psb_zalloc
|
||||
subroutine psb_zallocv(x, desc_a,info,n)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_dpk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
end subroutine psb_zallocv
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geasb
|
||||
subroutine psb_zasb(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_dpk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_zasb
|
||||
subroutine psb_zasbv(x, desc_a, info, scratch)
|
||||
import
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_dpk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
end subroutine psb_zasbv
|
||||
end interface
|
||||
|
||||
interface psb_gefree
|
||||
subroutine psb_zfree(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_dpk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_zfree
|
||||
subroutine psb_zfreev(x, desc_a, info)
|
||||
import
|
||||
implicit none
|
||||
complex(psb_dpk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
end subroutine psb_zfreev
|
||||
end interface
|
||||
|
||||
|
||||
interface psb_geins
|
||||
subroutine psb_zinsi(m,irw,val, x, desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_dpk_),intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_dpk_), intent(in) :: val(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_zinsi
|
||||
subroutine psb_zinsvi(m, irw,val, x,desc_a,info,dupl,local)
|
||||
import
|
||||
implicit none
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_dpk_), intent(in) :: val(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
end subroutine psb_zinsvi
|
||||
end interface
|
||||
|
||||
end module psb_z_tools_a_mod
|
||||
@ -0,0 +1,246 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_callc.f90
|
||||
!
|
||||
! Function: psb_calloc
|
||||
! Allocates dense matrix for PSBLAS routines.
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - Return code
|
||||
! n - optional number of columns.
|
||||
! lb - optional lower bound on column indices
|
||||
subroutine psb_calloc(x, desc_a, info, n, lb)
|
||||
use psb_base_mod, psb_protect_name => psb_calloc
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
complex(psb_spk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,err,nr,i,j,err_act
|
||||
integer(psb_ipk_) :: ictxt,n_
|
||||
integer(psb_ipk_) :: int_err(5),exch(3)
|
||||
character(len=20) :: name
|
||||
|
||||
name='psb_geall'
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
err=0
|
||||
int_err(1)=0
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(n)) then
|
||||
n_ = n
|
||||
else
|
||||
n_ = 1
|
||||
endif
|
||||
!global check on n parameters
|
||||
if (me == psb_root_) then
|
||||
exch(1)=n_
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
else
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
if (exch(1) /= n_) then
|
||||
info=psb_err_parm_differs_among_procs_
|
||||
int_err(1)=1
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,n_,x,info,lb2=lb)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr*n_
|
||||
call psb_errpush(info,name,int_err,a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:,:) = czero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_calloc
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! Function: psb_callocv
|
||||
! Allocates dense matrix for PSBLAS routines
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - return code
|
||||
subroutine psb_callocv(x, desc_a,info,n)
|
||||
use psb_base_mod, psb_protect_name => psb_callocv
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
complex(psb_spk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,nr,i,err_act
|
||||
integer(psb_ipk_) :: ictxt, int_err(5)
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_geall'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! As this is a rank-1 array, optional parameter N is actually ignored.
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr
|
||||
call psb_errpush(info,name,int_err,a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:) = czero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_callocv
|
||||
|
||||
@ -0,0 +1,254 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_casb.f90
|
||||
!
|
||||
! Subroutine: psb_casb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - complex, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
subroutine psb_casb(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_casb
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_spk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: i1sz, i2sz
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_cgeasb_m'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
ictxt = desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': start: ',np,&
|
||||
& desc_a%get_dectype()
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' error '
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! check size
|
||||
ictxt = desc_a%get_context()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
i1sz = size(x,dim=1)
|
||||
i2sz = size(x,dim=2)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': ',i1sz,i2sz,nrow,ncol
|
||||
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,i2sz,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_halo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_casb
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_casb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - complex, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_casbv(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_casbv
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_spk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: int_err(5), i1sz,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
int_err(1) = 0
|
||||
name = 'psb_cgeasb_v'
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol
|
||||
i1sz = size(x)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes ',i1sz,ncol
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='f90_pshalo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_casbv
|
||||
@ -0,0 +1,162 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_cfree.f90
|
||||
!
|
||||
! Subroutine: psb_cfree
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - complex, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_cfree(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_cfree
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
complex(psb_spk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_cfree'
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_cfree
|
||||
|
||||
|
||||
|
||||
! Subroutine: psb_cfreev
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - complex, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_cfreev(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_cfreev
|
||||
implicit none
|
||||
!....parameters...
|
||||
complex(psb_spk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_cfreev'
|
||||
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_cfreev
|
||||
@ -0,0 +1,371 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! Subroutine: psb_cinsvi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:) - complex The source dense submatrix.
|
||||
! x(:) - complex The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_cinsvi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_cinsvi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_spk_), intent(in) :: val(:)
|
||||
complex(psb_spk_),intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np, me, dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_cinsvi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (m == 0) return
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = x(irl(i)) + val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_cinsvi
|
||||
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_cinsi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:,:) - complex The source dense submatrix.
|
||||
! x(:,:) - complex The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_cinsi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_cinsi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_spk_), intent(in) :: val(:,:)
|
||||
complex(psb_spk_),intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,loc_row,j,n,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np,me,dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_cinsi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
if (m == 0) return
|
||||
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
n = min(size(val,2),size(x,2))
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = x(loc_row,j) + val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_cinsi
|
||||
|
||||
@ -0,0 +1,246 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_dallc.f90
|
||||
!
|
||||
! Function: psb_dalloc
|
||||
! Allocates dense matrix for PSBLAS routines.
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - Return code
|
||||
! n - optional number of columns.
|
||||
! lb - optional lower bound on column indices
|
||||
subroutine psb_dalloc(x, desc_a, info, n, lb)
|
||||
use psb_base_mod, psb_protect_name => psb_dalloc
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
real(psb_dpk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,err,nr,i,j,err_act
|
||||
integer(psb_ipk_) :: ictxt,n_
|
||||
integer(psb_ipk_) :: int_err(5),exch(3)
|
||||
character(len=20) :: name
|
||||
|
||||
name='psb_geall'
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
err=0
|
||||
int_err(1)=0
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(n)) then
|
||||
n_ = n
|
||||
else
|
||||
n_ = 1
|
||||
endif
|
||||
!global check on n parameters
|
||||
if (me == psb_root_) then
|
||||
exch(1)=n_
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
else
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
if (exch(1) /= n_) then
|
||||
info=psb_err_parm_differs_among_procs_
|
||||
int_err(1)=1
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,n_,x,info,lb2=lb)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr*n_
|
||||
call psb_errpush(info,name,int_err,a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:,:) = dzero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dalloc
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! Function: psb_dallocv
|
||||
! Allocates dense matrix for PSBLAS routines
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - return code
|
||||
subroutine psb_dallocv(x, desc_a,info,n)
|
||||
use psb_base_mod, psb_protect_name => psb_dallocv
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
real(psb_dpk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,nr,i,err_act
|
||||
integer(psb_ipk_) :: ictxt, int_err(5)
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_geall'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! As this is a rank-1 array, optional parameter N is actually ignored.
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr
|
||||
call psb_errpush(info,name,int_err,a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:) = dzero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dallocv
|
||||
|
||||
@ -0,0 +1,254 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_dasb.f90
|
||||
!
|
||||
! Subroutine: psb_dasb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - real, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
subroutine psb_dasb(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_dasb
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: i1sz, i2sz
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_dgeasb_m'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
ictxt = desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': start: ',np,&
|
||||
& desc_a%get_dectype()
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' error '
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! check size
|
||||
ictxt = desc_a%get_context()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
i1sz = size(x,dim=1)
|
||||
i2sz = size(x,dim=2)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': ',i1sz,i2sz,nrow,ncol
|
||||
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,i2sz,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_halo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dasb
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_dasb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - real, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_dasbv(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_dasbv
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_dpk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: int_err(5), i1sz,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
int_err(1) = 0
|
||||
name = 'psb_dgeasb_v'
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol
|
||||
i1sz = size(x)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes ',i1sz,ncol
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='f90_pshalo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dasbv
|
||||
@ -0,0 +1,162 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_dfree.f90
|
||||
!
|
||||
! Subroutine: psb_dfree
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - real, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_dfree(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_dfree
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
real(psb_dpk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_dfree'
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dfree
|
||||
|
||||
|
||||
|
||||
! Subroutine: psb_dfreev
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - real, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_dfreev(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_dfreev
|
||||
implicit none
|
||||
!....parameters...
|
||||
real(psb_dpk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_dfreev'
|
||||
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dfreev
|
||||
@ -0,0 +1,371 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! Subroutine: psb_dinsvi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:) - real The source dense submatrix.
|
||||
! x(:) - real The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_dinsvi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_dinsvi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_dpk_), intent(in) :: val(:)
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np, me, dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_dinsvi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (m == 0) return
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = x(irl(i)) + val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dinsvi
|
||||
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_dinsi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:,:) - real The source dense submatrix.
|
||||
! x(:,:) - real The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_dinsi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_dinsi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_dpk_), intent(in) :: val(:,:)
|
||||
real(psb_dpk_),intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,loc_row,j,n,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np,me,dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_dinsi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
if (m == 0) return
|
||||
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
n = min(size(val,2),size(x,2))
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = x(loc_row,j) + val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_dinsi
|
||||
|
||||
@ -0,0 +1,246 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_eallc.f90
|
||||
!
|
||||
! Function: psb_ealloc
|
||||
! Allocates dense matrix for PSBLAS routines.
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - Return code
|
||||
! n - optional number of columns.
|
||||
! lb - optional lower bound on column indices
|
||||
subroutine psb_ealloc(x, desc_a, info, n, lb)
|
||||
use psb_base_mod, psb_protect_name => psb_ealloc
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
integer(psb_epk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,err,nr,i,j,err_act
|
||||
integer(psb_ipk_) :: ictxt,n_
|
||||
integer(psb_ipk_) :: int_err(5),exch(3)
|
||||
character(len=20) :: name
|
||||
|
||||
name='psb_geall'
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
err=0
|
||||
int_err(1)=0
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(n)) then
|
||||
n_ = n
|
||||
else
|
||||
n_ = 1
|
||||
endif
|
||||
!global check on n parameters
|
||||
if (me == psb_root_) then
|
||||
exch(1)=n_
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
else
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
if (exch(1) /= n_) then
|
||||
info=psb_err_parm_differs_among_procs_
|
||||
int_err(1)=1
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,n_,x,info,lb2=lb)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr*n_
|
||||
call psb_errpush(info,name,int_err,a_err='integer(psb_epk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:,:) = ezero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_ealloc
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! Function: psb_eallocv
|
||||
! Allocates dense matrix for PSBLAS routines
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - return code
|
||||
subroutine psb_eallocv(x, desc_a,info,n)
|
||||
use psb_base_mod, psb_protect_name => psb_eallocv
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
integer(psb_epk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,nr,i,err_act
|
||||
integer(psb_ipk_) :: ictxt, int_err(5)
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_geall'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! As this is a rank-1 array, optional parameter N is actually ignored.
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr
|
||||
call psb_errpush(info,name,int_err,a_err='integer(psb_epk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:) = ezero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_eallocv
|
||||
|
||||
@ -0,0 +1,254 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_easb.f90
|
||||
!
|
||||
! Subroutine: psb_easb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - integer, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
subroutine psb_easb(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_easb
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_epk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: i1sz, i2sz
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_egeasb_m'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
ictxt = desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': start: ',np,&
|
||||
& desc_a%get_dectype()
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' error '
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! check size
|
||||
ictxt = desc_a%get_context()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
i1sz = size(x,dim=1)
|
||||
i2sz = size(x,dim=2)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': ',i1sz,i2sz,nrow,ncol
|
||||
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,i2sz,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_halo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_easb
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_easb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - integer, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_easbv(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_easbv
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_epk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: int_err(5), i1sz,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
int_err(1) = 0
|
||||
name = 'psb_egeasb_v'
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol
|
||||
i1sz = size(x)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes ',i1sz,ncol
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='f90_pshalo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_easbv
|
||||
@ -0,0 +1,162 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_efree.f90
|
||||
!
|
||||
! Subroutine: psb_efree
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - integer, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_efree(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_efree
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
integer(psb_epk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_efree'
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_efree
|
||||
|
||||
|
||||
|
||||
! Subroutine: psb_efreev
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - integer, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_efreev(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_efreev
|
||||
implicit none
|
||||
!....parameters...
|
||||
integer(psb_epk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_efreev'
|
||||
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_efreev
|
||||
@ -0,0 +1,371 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! Subroutine: psb_einsvi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:) - integer The source dense submatrix.
|
||||
! x(:) - integer The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_einsvi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_einsvi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_epk_), intent(in) :: val(:)
|
||||
integer(psb_epk_),intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np, me, dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_einsvi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (m == 0) return
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = x(irl(i)) + val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_einsvi
|
||||
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_einsi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:,:) - integer The source dense submatrix.
|
||||
! x(:,:) - integer The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_einsi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_einsi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_epk_), intent(in) :: val(:,:)
|
||||
integer(psb_epk_),intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,loc_row,j,n,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np,me,dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_einsi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
if (m == 0) return
|
||||
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
n = min(size(val,2),size(x,2))
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = x(loc_row,j) + val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_einsi
|
||||
|
||||
@ -0,0 +1,246 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_mallc.f90
|
||||
!
|
||||
! Function: psb_malloc
|
||||
! Allocates dense matrix for PSBLAS routines.
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - Return code
|
||||
! n - optional number of columns.
|
||||
! lb - optional lower bound on column indices
|
||||
subroutine psb_malloc(x, desc_a, info, n, lb)
|
||||
use psb_base_mod, psb_protect_name => psb_malloc
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
integer(psb_mpk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,err,nr,i,j,err_act
|
||||
integer(psb_ipk_) :: ictxt,n_
|
||||
integer(psb_ipk_) :: int_err(5),exch(3)
|
||||
character(len=20) :: name
|
||||
|
||||
name='psb_geall'
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
err=0
|
||||
int_err(1)=0
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(n)) then
|
||||
n_ = n
|
||||
else
|
||||
n_ = 1
|
||||
endif
|
||||
!global check on n parameters
|
||||
if (me == psb_root_) then
|
||||
exch(1)=n_
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
else
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
if (exch(1) /= n_) then
|
||||
info=psb_err_parm_differs_among_procs_
|
||||
int_err(1)=1
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,n_,x,info,lb2=lb)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr*n_
|
||||
call psb_errpush(info,name,int_err,a_err='integer(psb_mpk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:,:) = mzero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_malloc
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! Function: psb_mallocv
|
||||
! Allocates dense matrix for PSBLAS routines
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - return code
|
||||
subroutine psb_mallocv(x, desc_a,info,n)
|
||||
use psb_base_mod, psb_protect_name => psb_mallocv
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
integer(psb_mpk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,nr,i,err_act
|
||||
integer(psb_ipk_) :: ictxt, int_err(5)
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_geall'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! As this is a rank-1 array, optional parameter N is actually ignored.
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr
|
||||
call psb_errpush(info,name,int_err,a_err='integer(psb_mpk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:) = mzero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_mallocv
|
||||
|
||||
@ -0,0 +1,254 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_masb.f90
|
||||
!
|
||||
! Subroutine: psb_masb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - integer, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
subroutine psb_masb(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_masb
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_mpk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: i1sz, i2sz
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_mgeasb_m'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
ictxt = desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': start: ',np,&
|
||||
& desc_a%get_dectype()
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' error '
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! check size
|
||||
ictxt = desc_a%get_context()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
i1sz = size(x,dim=1)
|
||||
i2sz = size(x,dim=2)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': ',i1sz,i2sz,nrow,ncol
|
||||
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,i2sz,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_halo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_masb
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_masb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - integer, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_masbv(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_masbv
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_mpk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: int_err(5), i1sz,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
int_err(1) = 0
|
||||
name = 'psb_mgeasb_v'
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol
|
||||
i1sz = size(x)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes ',i1sz,ncol
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='f90_pshalo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_masbv
|
||||
@ -0,0 +1,162 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_mfree.f90
|
||||
!
|
||||
! Subroutine: psb_mfree
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - integer, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_mfree(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_mfree
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
integer(psb_mpk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_mfree'
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_mfree
|
||||
|
||||
|
||||
|
||||
! Subroutine: psb_mfreev
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - integer, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_mfreev(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_mfreev
|
||||
implicit none
|
||||
!....parameters...
|
||||
integer(psb_mpk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_mfreev'
|
||||
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_mfreev
|
||||
@ -0,0 +1,371 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! Subroutine: psb_minsvi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:) - integer The source dense submatrix.
|
||||
! x(:) - integer The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_minsvi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_minsvi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_mpk_), intent(in) :: val(:)
|
||||
integer(psb_mpk_),intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np, me, dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_minsvi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (m == 0) return
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = x(irl(i)) + val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_minsvi
|
||||
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_minsi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:,:) - integer The source dense submatrix.
|
||||
! x(:,:) - integer The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_minsi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_minsi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
integer(psb_mpk_), intent(in) :: val(:,:)
|
||||
integer(psb_mpk_),intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,loc_row,j,n,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np,me,dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_minsi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
if (m == 0) return
|
||||
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
n = min(size(val,2),size(x,2))
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = x(loc_row,j) + val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_minsi
|
||||
|
||||
@ -0,0 +1,246 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_sallc.f90
|
||||
!
|
||||
! Function: psb_salloc
|
||||
! Allocates dense matrix for PSBLAS routines.
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - Return code
|
||||
! n - optional number of columns.
|
||||
! lb - optional lower bound on column indices
|
||||
subroutine psb_salloc(x, desc_a, info, n, lb)
|
||||
use psb_base_mod, psb_protect_name => psb_salloc
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
real(psb_spk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,err,nr,i,j,err_act
|
||||
integer(psb_ipk_) :: ictxt,n_
|
||||
integer(psb_ipk_) :: int_err(5),exch(3)
|
||||
character(len=20) :: name
|
||||
|
||||
name='psb_geall'
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
err=0
|
||||
int_err(1)=0
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(n)) then
|
||||
n_ = n
|
||||
else
|
||||
n_ = 1
|
||||
endif
|
||||
!global check on n parameters
|
||||
if (me == psb_root_) then
|
||||
exch(1)=n_
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
else
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
if (exch(1) /= n_) then
|
||||
info=psb_err_parm_differs_among_procs_
|
||||
int_err(1)=1
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,n_,x,info,lb2=lb)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr*n_
|
||||
call psb_errpush(info,name,int_err,a_err='real(psb_spk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:,:) = szero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_salloc
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! Function: psb_sallocv
|
||||
! Allocates dense matrix for PSBLAS routines
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - return code
|
||||
subroutine psb_sallocv(x, desc_a,info,n)
|
||||
use psb_base_mod, psb_protect_name => psb_sallocv
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
real(psb_spk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,nr,i,err_act
|
||||
integer(psb_ipk_) :: ictxt, int_err(5)
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_geall'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! As this is a rank-1 array, optional parameter N is actually ignored.
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr
|
||||
call psb_errpush(info,name,int_err,a_err='real(psb_spk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:) = szero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sallocv
|
||||
|
||||
@ -0,0 +1,254 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_sasb.f90
|
||||
!
|
||||
! Subroutine: psb_sasb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - real, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
subroutine psb_sasb(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_sasb
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: i1sz, i2sz
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_sgeasb_m'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
ictxt = desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': start: ',np,&
|
||||
& desc_a%get_dectype()
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' error '
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! check size
|
||||
ictxt = desc_a%get_context()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
i1sz = size(x,dim=1)
|
||||
i2sz = size(x,dim=2)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': ',i1sz,i2sz,nrow,ncol
|
||||
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,i2sz,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_halo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sasb
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_sasb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - real, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_sasbv(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_sasbv
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
real(psb_spk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: int_err(5), i1sz,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
int_err(1) = 0
|
||||
name = 'psb_sgeasb_v'
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol
|
||||
i1sz = size(x)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes ',i1sz,ncol
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='f90_pshalo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sasbv
|
||||
@ -0,0 +1,162 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_sfree.f90
|
||||
!
|
||||
! Subroutine: psb_sfree
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - real, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_sfree(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_sfree
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
real(psb_spk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_sfree'
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sfree
|
||||
|
||||
|
||||
|
||||
! Subroutine: psb_sfreev
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - real, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_sfreev(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_sfreev
|
||||
implicit none
|
||||
!....parameters...
|
||||
real(psb_spk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_sfreev'
|
||||
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sfreev
|
||||
@ -0,0 +1,371 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! Subroutine: psb_sinsvi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:) - real The source dense submatrix.
|
||||
! x(:) - real The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_sinsvi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_sinsvi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_spk_), intent(in) :: val(:)
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np, me, dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_sinsvi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (m == 0) return
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = x(irl(i)) + val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sinsvi
|
||||
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_sinsi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:,:) - real The source dense submatrix.
|
||||
! x(:,:) - real The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_sinsi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_sinsi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
real(psb_spk_), intent(in) :: val(:,:)
|
||||
real(psb_spk_),intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,loc_row,j,n,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np,me,dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_sinsi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
if (m == 0) return
|
||||
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
n = min(size(val,2),size(x,2))
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = x(loc_row,j) + val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_sinsi
|
||||
|
||||
@ -0,0 +1,246 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_zallc.f90
|
||||
!
|
||||
! Function: psb_zalloc
|
||||
! Allocates dense matrix for PSBLAS routines.
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - Return code
|
||||
! n - optional number of columns.
|
||||
! lb - optional lower bound on column indices
|
||||
subroutine psb_zalloc(x, desc_a, info, n, lb)
|
||||
use psb_base_mod, psb_protect_name => psb_zalloc
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
complex(psb_dpk_), allocatable, intent(out) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n, lb
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,err,nr,i,j,err_act
|
||||
integer(psb_ipk_) :: ictxt,n_
|
||||
integer(psb_ipk_) :: int_err(5),exch(3)
|
||||
character(len=20) :: name
|
||||
|
||||
name='psb_geall'
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
err=0
|
||||
int_err(1)=0
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(n)) then
|
||||
n_ = n
|
||||
else
|
||||
n_ = 1
|
||||
endif
|
||||
!global check on n parameters
|
||||
if (me == psb_root_) then
|
||||
exch(1)=n_
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
else
|
||||
call psb_bcast(ictxt,exch(1),root=psb_root_)
|
||||
if (exch(1) /= n_) then
|
||||
info=psb_err_parm_differs_among_procs_
|
||||
int_err(1)=1
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,n_,x,info,lb2=lb)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr*n_
|
||||
call psb_errpush(info,name,int_err,a_err='complex(psb_dpk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:,:) = zzero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zalloc
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
!
|
||||
! Function: psb_zallocv
|
||||
! Allocates dense matrix for PSBLAS routines
|
||||
! The descriptor may be in either the build or assembled state.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - the matrix to be allocated.
|
||||
! desc_a - the communication descriptor.
|
||||
! info - return code
|
||||
subroutine psb_zallocv(x, desc_a,info,n)
|
||||
use psb_base_mod, psb_protect_name => psb_zallocv
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
complex(psb_dpk_), allocatable, intent(out) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_),intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: n
|
||||
|
||||
!locals
|
||||
integer(psb_ipk_) :: np,me,nr,i,err_act
|
||||
integer(psb_ipk_) :: ictxt, int_err(5)
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_geall'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check m and n parameters....
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! As this is a rank-1 array, optional parameter N is actually ignored.
|
||||
|
||||
!....allocate x .....
|
||||
if (psb_is_asb_desc(desc_a).or.psb_is_upd_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_cols())
|
||||
else if (psb_is_bld_desc(desc_a)) then
|
||||
nr = max(1,desc_a%get_local_rows())
|
||||
else
|
||||
info = psb_err_internal_error_
|
||||
call psb_errpush(info,name,int_err,a_err='Invalid desc_a')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
call psb_realloc(nr,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
int_err(1)=nr
|
||||
call psb_errpush(info,name,int_err,a_err='complex(psb_dpk_)')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
x(:) = zzero
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zallocv
|
||||
|
||||
@ -0,0 +1,254 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_zasb.f90
|
||||
!
|
||||
! Subroutine: psb_zasb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - complex, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
subroutine psb_zasb(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_zasb
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_dpk_), allocatable, intent(inout) :: x(:,:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: i1sz, i2sz
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name, ch_err
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
name='psb_zgeasb_m'
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
ictxt = desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': start: ',np,&
|
||||
& desc_a%get_dectype()
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' error '
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
! check size
|
||||
ictxt = desc_a%get_context()
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
i1sz = size(x,dim=1)
|
||||
i2sz = size(x,dim=2)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': ',i1sz,i2sz,nrow,ncol
|
||||
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,i2sz,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='psb_halo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zasb
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_zasb
|
||||
! Assembles a dense matrix for PSBLAS routines
|
||||
! Since the allocation may have been called with the desciptor
|
||||
! in the build state we make sure that X has a number of rows
|
||||
! allowing for the halo indices, reallocating if necessary.
|
||||
! We also call the halo routine for good measure.
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - complex, allocatable The matrix to be assembled.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_zasbv(x, desc_a, info, scratch)
|
||||
use psb_base_mod, psb_protect_name => psb_zasbv
|
||||
implicit none
|
||||
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
complex(psb_dpk_), allocatable, intent(inout) :: x(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
logical, intent(in), optional :: scratch
|
||||
|
||||
! local variables
|
||||
integer(psb_ipk_) :: ictxt,np,me
|
||||
integer(psb_ipk_) :: int_err(5), i1sz,nrow,ncol, err_act
|
||||
integer(psb_ipk_) :: debug_level, debug_unit
|
||||
logical :: scratch_
|
||||
character(len=20) :: name,ch_err
|
||||
|
||||
info = psb_success_
|
||||
int_err(1) = 0
|
||||
name = 'psb_zgeasb_v'
|
||||
|
||||
ictxt = desc_a%get_context()
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
scratch_ = .false.
|
||||
if (present(scratch)) scratch_ = scratch
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
else if (.not.psb_is_asb_desc(desc_a)) then
|
||||
info = psb_err_input_matrix_unassembled_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
nrow = desc_a%get_local_rows()
|
||||
ncol = desc_a%get_local_cols()
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol
|
||||
i1sz = size(x)
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': sizes ',i1sz,ncol
|
||||
if (i1sz < ncol) then
|
||||
call psb_realloc(ncol,x,info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
call psb_errpush(info,name,a_err='psb_realloc')
|
||||
goto 9999
|
||||
endif
|
||||
endif
|
||||
|
||||
if (.not.scratch_) then
|
||||
! ..update halo elements..
|
||||
call psb_halo(x,desc_a,info)
|
||||
if(info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='f90_pshalo'
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
if (debug_level >= psb_debug_ext_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),': end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zasbv
|
||||
@ -0,0 +1,162 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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: psb_zfree.f90
|
||||
!
|
||||
! Subroutine: psb_zfree
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:,:) - complex, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_zfree(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_zfree
|
||||
implicit none
|
||||
|
||||
!....parameters...
|
||||
complex(psb_dpk_),allocatable, intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_zfree'
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
! ....verify blacs grid correctness..
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zfree
|
||||
|
||||
|
||||
|
||||
! Subroutine: psb_zfreev
|
||||
! frees a dense matrix structure
|
||||
!
|
||||
! Arguments:
|
||||
! x(:) - complex, allocatable The dense matrix to be freed.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. Return code
|
||||
subroutine psb_zfreev(x, desc_a, info)
|
||||
use psb_base_mod, psb_protect_name => psb_zfreev
|
||||
implicit none
|
||||
!....parameters...
|
||||
complex(psb_dpk_),allocatable, intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
!...locals....
|
||||
integer(psb_ipk_) :: ictxt,np,me, err_act
|
||||
character(len=20) :: name
|
||||
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name='psb_zfreev'
|
||||
|
||||
|
||||
if (.not.psb_is_ok_desc(desc_a)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
endif
|
||||
|
||||
if (.not.allocated(x)) then
|
||||
info=psb_err_forgot_spall_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end if
|
||||
|
||||
!deallocate x
|
||||
deallocate(x,stat=info)
|
||||
if (info /= psb_no_err_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zfreev
|
||||
@ -0,0 +1,371 @@
|
||||
!
|
||||
! Parallel Sparse BLAS version 3.5
|
||||
! (C) Copyright 2006-2018
|
||||
! Salvatore Filippone
|
||||
! Alfredo Buttari
|
||||
!
|
||||
! 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.
|
||||
!
|
||||
!
|
||||
! Subroutine: psb_zinsvi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:) - complex The source dense submatrix.
|
||||
! x(:) - complex The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_zinsvi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_zinsvi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_dpk_), intent(in) :: val(:)
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np, me, dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_zinsvi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (m == 0) return
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
if (irl(i) > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
x(irl(i)) = x(irl(i)) + val(i)
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zinsvi
|
||||
|
||||
|
||||
|
||||
|
||||
!!$
|
||||
!!$ Parallel Sparse BLAS version 3.5
|
||||
!!$ (C) Copyright 2006-2018
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari
|
||||
!!$
|
||||
!!$ 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.
|
||||
!!$
|
||||
!!$
|
||||
! Subroutine: psb_zinsi
|
||||
! Insert dense submatrix to dense matrix. Note: the row indices in IRW
|
||||
! are assumed to be in global numbering and are converted on the fly.
|
||||
! Row indices not belonging to the current process are silently discarded.
|
||||
!
|
||||
! Arguments:
|
||||
! m - integer. Number of rows of submatrix belonging to
|
||||
! val to be inserted.
|
||||
! irw(:) - integer Row indices of rows of val (global numbering)
|
||||
! val(:,:) - complex The source dense submatrix.
|
||||
! x(:,:) - complex The destination dense matrix.
|
||||
! desc_a - type(psb_desc_type). The communication descriptor.
|
||||
! info - integer. return code
|
||||
! dupl - integer What to do with duplicates:
|
||||
! psb_dupl_ovwrt_ overwrite
|
||||
! psb_dupl_add_ add
|
||||
subroutine psb_zinsi(m, irw, val, x, desc_a, info, dupl,local)
|
||||
use psb_base_mod, psb_protect_name => psb_zinsi
|
||||
use psi_mod
|
||||
implicit none
|
||||
|
||||
! m rows number of submatrix belonging to val to be inserted
|
||||
|
||||
! ix x global-row corresponding to position at which val submatrix
|
||||
! must be inserted
|
||||
|
||||
!....parameters...
|
||||
integer(psb_ipk_), intent(in) :: m
|
||||
integer(psb_ipk_), intent(in) :: irw(:)
|
||||
complex(psb_dpk_), intent(in) :: val(:,:)
|
||||
complex(psb_dpk_),intent(inout) :: x(:,:)
|
||||
type(psb_desc_type), intent(in) :: desc_a
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), optional, intent(in) :: dupl
|
||||
logical, intent(in), optional :: local
|
||||
|
||||
!locals.....
|
||||
integer(psb_ipk_) :: ictxt,i,loc_row,j,n,&
|
||||
& loc_rows,loc_cols,mglob,err_act, int_err(5)
|
||||
integer(psb_ipk_) :: np,me,dupl_
|
||||
integer(psb_ipk_), allocatable :: irl(:)
|
||||
logical :: local_
|
||||
character(len=20) :: name
|
||||
|
||||
if(psb_get_errstatus() /= 0) return
|
||||
info=psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
name = 'psb_zinsi'
|
||||
|
||||
if (.not.desc_a%is_ok()) then
|
||||
info = psb_err_invalid_cd_state_
|
||||
call psb_errpush(info,name)
|
||||
return
|
||||
end if
|
||||
|
||||
ictxt=desc_a%get_context()
|
||||
|
||||
call psb_info(ictxt, me, np)
|
||||
if (np == -1) then
|
||||
info = psb_err_context_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
!... check parameters....
|
||||
if (m < 0) then
|
||||
info = psb_err_iarg_neg_
|
||||
int_err(1) = 1
|
||||
int_err(2) = m
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
else if (size(x, dim=1) < desc_a%get_local_rows()) then
|
||||
info = 310
|
||||
int_err(1) = 5
|
||||
int_err(2) = 4
|
||||
call psb_errpush(info,name,int_err)
|
||||
goto 9999
|
||||
endif
|
||||
if (m == 0) return
|
||||
|
||||
loc_rows = desc_a%get_local_rows()
|
||||
loc_cols = desc_a%get_local_cols()
|
||||
mglob = desc_a%get_global_rows()
|
||||
|
||||
n = min(size(val,2),size(x,2))
|
||||
|
||||
if (present(dupl)) then
|
||||
dupl_ = dupl
|
||||
else
|
||||
dupl_ = psb_dupl_ovwrt_
|
||||
endif
|
||||
|
||||
allocate(irl(m),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info = psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
endif
|
||||
if (present(local)) then
|
||||
local_ = local
|
||||
else
|
||||
local_ = .false.
|
||||
endif
|
||||
|
||||
if (local_) then
|
||||
irl(1:m) = irw(1:m)
|
||||
else
|
||||
call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.)
|
||||
end if
|
||||
|
||||
select case(dupl_)
|
||||
case(psb_dupl_ovwrt_)
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case(psb_dupl_add_)
|
||||
|
||||
do i = 1, m
|
||||
!loop over all val's rows
|
||||
|
||||
! row actual block row
|
||||
loc_row = irl(i)
|
||||
if (loc_row > 0) then
|
||||
! this row belongs to me
|
||||
! copy i-th row of block val in x
|
||||
do j=1,n
|
||||
x(loc_row,j) = x(loc_row,j) + val(i,j)
|
||||
end do
|
||||
end if
|
||||
enddo
|
||||
|
||||
case default
|
||||
info = 321
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
end select
|
||||
deallocate(irl)
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 call psb_error_handler(ictxt,err_act)
|
||||
|
||||
return
|
||||
|
||||
end subroutine psb_zinsi
|
||||
|
||||
Loading…
Reference in New Issue