Merge mumps into trunk
parent
c3d57d91db
commit
d096f682dd
@ -1,6 +1,6 @@
|
||||
sherman3.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
|
||||
fidapm07.mtx ! This matrix (and others) from: http://math.nist.gov/MatrixMarket/ or
|
||||
NONE ! rhs | http://www.cise.ufl.edu/research/sparse/matrices/index.html
|
||||
MM ! File format: MM (Matrix Market) HB (Harwell-Boeing).
|
||||
1 ! Preconditioner choice
|
||||
01000 ! ITMAX
|
||||
0100 ! ITMAX
|
||||
1.d-5 ! EPS
|
||||
|
@ -1,3 +1,3 @@
|
||||
40 ! IDIM; domain size is idim**3
|
||||
0100 ! ITMAX
|
||||
15 ! IDIM; domain size is idim**3
|
||||
10 ! ITMAX
|
||||
1.d-6 ! EPS
|
||||
|
@ -1,4 +1,4 @@
|
||||
1 ! Preconditioner choice
|
||||
40 ! IDIM; domain size is idim**3
|
||||
0100 ! ITMAX
|
||||
2 ! Preconditioner choice
|
||||
10 ! IDIM; domain size is idim**3
|
||||
500 ! ITMAX
|
||||
1.d-6 ! EPS
|
||||
|
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
#PBS -l nodes=1:ppn=4,walltime=10:00:00
|
||||
#PBS -A ambra
|
||||
#PBS -o pbs2.output
|
||||
#PBS -e pbs2.error
|
||||
cd $PBS_O_WORKDIR
|
||||
mpirun -np 4 ./mld_dexample_ml<ml.inp
|
||||
|
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
#PBS -l nodes=1:ppn=4,walltime=0:40:00
|
||||
#PBS -A ambra
|
||||
#PBS -o pbs.output
|
||||
#PBS -e pbs.error
|
||||
cd $PBS_O_WORKDIR
|
||||
mpirun -np 4 ./mld_dexample_1lev<1lev.inp
|
||||
|
||||
|
@ -0,0 +1,147 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 c_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_c_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
complex(psb_spk_),intent(inout) :: x(:)
|
||||
complex(psb_spk_),intent(inout) :: y(:)
|
||||
complex(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: n_row, n_col, nglob
|
||||
complex(psb_spk_), allocatable :: ww(:)
|
||||
complex(psb_spk_), allocatable, target :: gx(:)
|
||||
integer(psb_ipk_) :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='c_mumps_solver_apply'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
info = psb_success_
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
nglob = desc_data%get_global_rows()
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww = work(1:n_col)
|
||||
else
|
||||
allocate(ww(n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/n_col,0,0,0,0/),&
|
||||
& a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
allocate(gx(nglob),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/nglob,0,0,0,0/),&
|
||||
& a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_gather(gx, x, desc_data, info, root=0)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
sv%id%icntl(9) = 1
|
||||
case('T')
|
||||
sv%id%icntl(9) = 2
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Invalid TRANS in subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
sv%id%rhs => gx
|
||||
sv%id%nrhs = 1
|
||||
sv%id%icntl(1)=-1
|
||||
sv%id%icntl(2)=-1
|
||||
sv%id%icntl(3)=-1
|
||||
sv%id%icntl(4)=-1
|
||||
sv%id%job = 3
|
||||
call cmumps(sv%id)
|
||||
call psb_scatter(gx, ww, desc_data, info, root=0)
|
||||
|
||||
if (info == psb_success_) then
|
||||
call psb_geaxpby(alpha,ww,beta,y,desc_data,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (nglob > size(work)) then
|
||||
deallocate(ww)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine c_mumps_solver_apply
|
||||
|
@ -0,0 +1,84 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 c_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_c_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_c_vect_type),intent(inout) :: x
|
||||
type(psb_c_vect_type),intent(inout) :: y
|
||||
complex(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_mumps_solver_apply_vect'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
call x%v%sync()
|
||||
call y%v%sync()
|
||||
call sv%apply(alpha,x%v%v,beta,y%v%v,desc_data,trans,work,info)
|
||||
call y%v%set_host()
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
|
||||
end subroutine c_mumps_solver_apply_vect
|
||||
|
@ -0,0 +1,189 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 c_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use mpi
|
||||
use mld_c_mumps_solver
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type) :: c
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_cspmat_type), intent(in), target, optional :: b
|
||||
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
type(psb_cspmat_type) :: atmp
|
||||
type(psb_c_coo_sparse_mat), target :: acoo
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nglob, nglobrec, nzt, npr, npc
|
||||
integer(psb_ipk_) :: ifrst, ibcheck
|
||||
integer(psb_ipk_) :: ictxt, ictxt1, icomm, np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='c_mumps_solver_bld', ch_err
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
info=psb_success_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ictxt = desc_a%get_context()
|
||||
if (sv%ipar(1) < 0 ) then
|
||||
call psb_info(ictxt, me, np)
|
||||
call psb_init(ictxt1,np=1,basectxt=ictxt,ids=(/me/))
|
||||
call psb_get_mpicomm(ictxt1, icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt1,mpi_comm_world
|
||||
call psb_info(ictxt1, me, np)
|
||||
npr = np
|
||||
else
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt,mpi_comm_world
|
||||
call psb_info(ictxt, me, np)
|
||||
npr = np
|
||||
end if
|
||||
npc = 1
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
! if (allocated(sv%id)) then
|
||||
! call sv%free(info)
|
||||
|
||||
! deallocate(sv%id)
|
||||
! end if
|
||||
if(.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_cmumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (psb_toupper(upd) == 'F') then
|
||||
|
||||
sv%id%comm = icomm
|
||||
sv%id%job = -1
|
||||
sv%id%par=1
|
||||
call cmumps(sv%id)
|
||||
!WARNING: CALLING cMUMPS WITH JOB=-1 DESTROY THE SETTING OF DEFAULT:TO FIX
|
||||
sv%id%icntl(3)=sv%ipar(2)
|
||||
nglob = desc_a%get_global_rows()
|
||||
if (sv%ipar(1) < 0) then
|
||||
nglobrec=desc_a%get_local_rows()
|
||||
call a%csclip(c,info,jmax=a%get_nrows())
|
||||
call c%cp_to(acoo)
|
||||
nglob = c%get_nrows()
|
||||
if (nglobrec /= nglob) then
|
||||
write(*,*)'WARNING: MUMPS solver does not allow overlap in AS yet. A zero-overlap is used instead'
|
||||
end if
|
||||
else
|
||||
call a%cp_to(acoo)
|
||||
end if
|
||||
nztota = acoo%get_nzeros()
|
||||
|
||||
! switch to global numbering
|
||||
if (sv%ipar(1) >= 0 ) then
|
||||
call psb_loc_to_glob(acoo%ja(1:nztota), desc_a, info, iact='I')
|
||||
call psb_loc_to_glob(acoo%ia(1:nztota), desc_a, info, iact='I')
|
||||
end if
|
||||
sv%id%irn_loc=> acoo%ia
|
||||
sv%id%jcn_loc=> acoo%ja
|
||||
sv%id%a_loc=> acoo%val
|
||||
sv%id%icntl(18)=3
|
||||
if(acoo%is_upper() .or. acoo%is_lower()) then
|
||||
sv%id%sym = 2
|
||||
else
|
||||
sv%id%sym = 0
|
||||
end if
|
||||
sv%id%n = nglob
|
||||
! there should be a better way for this
|
||||
sv%id%nz_loc = acoo%get_nzeros()
|
||||
sv%id%nz = acoo%get_nzeros()
|
||||
sv%id%job = 4
|
||||
call psb_barrier(ictxt)
|
||||
write(*,*)'calling mumps N,nz,nz_loc',sv%id%n,sv%id%nz,sv%id%nz_loc
|
||||
call cmumps(sv%id)
|
||||
call psb_barrier(ictxt)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='mld_cmumps_fact '
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
nullify(sv%id%irn)
|
||||
nullify(sv%id%jcn)
|
||||
nullify(sv%id%a)
|
||||
|
||||
call acoo%free()
|
||||
sv%built=.true.
|
||||
else
|
||||
! ?
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine c_mumps_solver_bld
|
||||
|
@ -0,0 +1,148 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 d_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_d_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
real(psb_dpk_),intent(inout) :: y(:)
|
||||
real(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: n_row, n_col, nglob
|
||||
real(psb_dpk_), allocatable :: ww(:)
|
||||
real(psb_dpk_), allocatable, target :: gx(:)
|
||||
integer(psb_ipk_) :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_mumps_solver_apply'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
nglob = desc_data%get_global_rows()
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww = work(1:n_col)
|
||||
else
|
||||
allocate(ww(n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/n_col,0,0,0,0/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
allocate(gx(nglob),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/nglob,0,0,0,0/),&
|
||||
& a_err='real(psb_dpk_)')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_gather(gx, x, desc_data, info, root=0)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
sv%id%icntl(9) = 1
|
||||
case('T')
|
||||
sv%id%icntl(9) = 2
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Invalid TRANS in subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
sv%id%rhs => gx
|
||||
sv%id%nrhs = 1
|
||||
sv%id%icntl(1)=-1
|
||||
sv%id%icntl(2)=-1
|
||||
sv%id%icntl(3)=-1
|
||||
sv%id%icntl(4)=-1
|
||||
sv%id%job = 3
|
||||
call dmumps(sv%id)
|
||||
call psb_scatter(gx, ww, desc_data, info, root=0)
|
||||
|
||||
if (info == psb_success_) then
|
||||
call psb_geaxpby(alpha,ww,beta,y,desc_data,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (nglob > size(work)) then
|
||||
deallocate(ww)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine d_mumps_solver_apply
|
||||
|
@ -0,0 +1,83 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 d_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_d_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_d_vect_type),intent(inout) :: x
|
||||
type(psb_d_vect_type),intent(inout) :: y
|
||||
real(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_mumps_solver_apply_vect'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
call x%v%sync()
|
||||
call y%v%sync()
|
||||
call sv%apply(alpha,x%v%v,beta,y%v%v,desc_data,trans,work,info)
|
||||
call y%v%set_host()
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine d_mumps_solver_apply_vect
|
||||
|
@ -0,0 +1,191 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 d_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use mpi
|
||||
use mld_d_mumps_solver
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type) :: c
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), target, optional :: b
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_d_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
type(psb_dspmat_type) :: atmp
|
||||
type(psb_d_coo_sparse_mat), target :: acoo
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nglob, nglobrec, nzt, npr, npc
|
||||
integer(psb_ipk_) :: ifrst, ibcheck
|
||||
integer(psb_ipk_) :: ictxt, ictxt1, icomm, np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='d_mumps_solver_bld', ch_err
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
info=psb_success_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ictxt = desc_a%get_context()
|
||||
if (sv%ipar(1) < 0 ) then
|
||||
call psb_info(ictxt, me, np)
|
||||
call psb_init(ictxt1,np=1,basectxt=ictxt,ids=(/me/))
|
||||
call psb_get_mpicomm(ictxt1, icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt1,mpi_comm_world
|
||||
call psb_info(ictxt1, me, np)
|
||||
npr = np
|
||||
else
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt,mpi_comm_world
|
||||
call psb_info(ictxt, me, np)
|
||||
npr = np
|
||||
end if
|
||||
npc = 1
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
! if (allocated(sv%id)) then
|
||||
! call sv%free(info)
|
||||
|
||||
! deallocate(sv%id)
|
||||
! end if
|
||||
if(.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_dmumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (psb_toupper(upd) == 'F') then
|
||||
|
||||
sv%id%comm = icomm
|
||||
sv%id%job = -1
|
||||
sv%id%par=1
|
||||
call dmumps(sv%id)
|
||||
!WARNING: CALLING dMUMPS WITH JOB=-1 DESTROY THE SETTING OF DEFAULT:TO FIX
|
||||
sv%id%icntl(3)=sv%ipar(2)
|
||||
nglob = desc_a%get_global_rows()
|
||||
if (sv%ipar(1) < 0) then
|
||||
nglobrec=desc_a%get_local_rows()
|
||||
call a%csclip(c,info,jmax=a%get_nrows())
|
||||
call c%mv_to(acoo)
|
||||
nglob = c%get_nrows()
|
||||
if (nglobrec /= nglob) then
|
||||
write(*,*)'WARNING: MUMPS solver does not allow overlap in AS yet. A zero-overlap is used instead'
|
||||
end if
|
||||
else
|
||||
call a%cp_to(acoo)
|
||||
end if
|
||||
nztota = acoo%get_nzeros()
|
||||
|
||||
! switch to global numbering
|
||||
if (sv%ipar(1) >= 0 ) then
|
||||
call psb_loc_to_glob(acoo%ja(1:nztota), desc_a, info, iact='I')
|
||||
call psb_loc_to_glob(acoo%ia(1:nztota), desc_a, info, iact='I')
|
||||
end if
|
||||
|
||||
sv%id%irn_loc=> acoo%ia
|
||||
sv%id%jcn_loc=> acoo%ja
|
||||
sv%id%a_loc=> acoo%val
|
||||
sv%id%icntl(18)=3
|
||||
if(acoo%is_upper() .or. acoo%is_lower()) then
|
||||
sv%id%sym = 2
|
||||
else
|
||||
sv%id%sym = 0
|
||||
end if
|
||||
sv%id%n = nglob
|
||||
! there should be a better way for this
|
||||
sv%id%nz_loc = acoo%get_nzeros()
|
||||
sv%id%nz = acoo%get_nzeros()
|
||||
sv%id%job = 4
|
||||
call psb_barrier(ictxt)
|
||||
write(*,*)'calling mumps N,nz,nz_loc',sv%id%n,sv%id%nz,sv%id%nz_loc
|
||||
call dmumps(sv%id)
|
||||
call psb_barrier(ictxt)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='mld_dmumps_fact '
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
nullify(sv%id%irn)
|
||||
nullify(sv%id%jcn)
|
||||
nullify(sv%id%a)
|
||||
|
||||
call acoo%free()
|
||||
sv%built=.true.
|
||||
else
|
||||
! ?
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine d_mumps_solver_bld
|
||||
|
@ -0,0 +1,148 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 s_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_s_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
real(psb_spk_),intent(inout) :: y(:)
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: n_row, n_col, nglob
|
||||
real(psb_spk_), allocatable :: ww(:)
|
||||
real(psb_spk_), allocatable, target :: gx(:)
|
||||
integer :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='s_mumps_solver_apply'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
nglob = desc_data%get_global_rows()
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww = work(1:n_col)
|
||||
else
|
||||
allocate(ww(n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/n_col,0,0,0,0/),&
|
||||
& a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
allocate(gx(nglob),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/nglob,0,0,0,0/),&
|
||||
& a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_gather(gx, x, desc_data, info, root=0)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
sv%id%icntl(9) = 1
|
||||
case('T')
|
||||
sv%id%icntl(9) = 2
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Invalid TRANS in subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
sv%id%rhs => gx
|
||||
sv%id%nrhs = 1
|
||||
sv%id%icntl(1)=-1
|
||||
sv%id%icntl(2)=-1
|
||||
sv%id%icntl(3)=-1
|
||||
sv%id%icntl(4)=-1
|
||||
sv%id%job = 3
|
||||
call smumps(sv%id)
|
||||
call psb_scatter(gx, ww, desc_data, info, root=0)
|
||||
|
||||
if (info == psb_success_) then
|
||||
call psb_geaxpby(alpha,ww,beta,y,desc_data,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (nglob > size(work)) then
|
||||
deallocate(ww)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine s_mumps_solver_apply
|
||||
|
@ -0,0 +1,82 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 s_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_s_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_s_vect_type),intent(inout) :: x
|
||||
type(psb_s_vect_type),intent(inout) :: y
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: err_act
|
||||
character(len=20) :: name='s_mumps_solver_apply_vect'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
call x%v%sync()
|
||||
call y%v%sync()
|
||||
call sv%apply(alpha,x%v%v,beta,y%v%v,desc_data,trans,work,info)
|
||||
call y%v%set_host()
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine s_mumps_solver_apply_vect
|
||||
|
@ -0,0 +1,190 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 s_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use mpi
|
||||
use mld_s_mumps_solver
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type) :: c
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer, intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), target, optional :: b
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
type(psb_sspmat_type) :: atmp
|
||||
type(psb_s_coo_sparse_mat), target :: acoo
|
||||
integer :: n_row,n_col, nrow_a, nztota, nglob, nglobrec, nzt, npr, npc
|
||||
integer :: ifrst, ibcheck
|
||||
integer :: ictxt, ictxt1, icomm, np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='s_mumps_solver_bld', ch_err
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
info=psb_success_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ictxt = desc_a%get_context()
|
||||
if (sv%ipar(1) < 0 ) then
|
||||
call psb_info(ictxt, me, np)
|
||||
call psb_init(ictxt1,np=1,basectxt=ictxt,ids=(/me/))
|
||||
call psb_get_mpicomm(ictxt1, icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt1,mpi_comm_world
|
||||
call psb_info(ictxt1, me, np)
|
||||
npr = np
|
||||
else
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt,mpi_comm_world
|
||||
call psb_info(ictxt, me, np)
|
||||
npr = np
|
||||
end if
|
||||
npc = 1
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
! if (allocated(sv%id)) then
|
||||
! call sv%free(info)
|
||||
|
||||
! deallocate(sv%id)
|
||||
! end if
|
||||
if(.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_mumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (psb_toupper(upd) == 'F') then
|
||||
|
||||
sv%id%comm = icomm
|
||||
sv%id%job = -1
|
||||
sv%id%par=1
|
||||
call smumps(sv%id)
|
||||
!WARNING: CALLING mumps WITH JOB=-1 DESTROY THE SETTING OF DEFAULT:TO FIX
|
||||
sv%id%icntl(3)=sv%ipar(2)
|
||||
nglob = desc_a%get_global_rows()
|
||||
if (sv%ipar(1) < 0) then
|
||||
nglobrec=desc_a%get_local_rows()
|
||||
call a%csclip(c,info,jmax=a%get_nrows())
|
||||
call c%cp_to(acoo)
|
||||
nglob = c%get_nrows()
|
||||
if (nglobrec /= nglob) then
|
||||
write(*,*)'WARNING: MUMPS solver does not allow overlap in AS yet. A zero-overlap is used instead'
|
||||
end if
|
||||
else
|
||||
call a%cp_to(acoo)
|
||||
end if
|
||||
nztota = acoo%get_nzeros()
|
||||
|
||||
! switch to global numbering
|
||||
if (sv%ipar(1) >= 0 ) then
|
||||
call psb_loc_to_glob(acoo%ja(1:nztota), desc_a, info, iact='I')
|
||||
call psb_loc_to_glob(acoo%ia(1:nztota), desc_a, info, iact='I')
|
||||
end if
|
||||
sv%id%irn_loc=> acoo%ia
|
||||
sv%id%jcn_loc=> acoo%ja
|
||||
sv%id%a_loc=> acoo%val
|
||||
sv%id%icntl(18)=3
|
||||
if(acoo%is_upper() .or. acoo%is_lower()) then
|
||||
sv%id%sym = 2
|
||||
else
|
||||
sv%id%sym = 0
|
||||
end if
|
||||
sv%id%n = nglob
|
||||
! there should be a better way for this
|
||||
sv%id%nz_loc = acoo%get_nzeros()
|
||||
sv%id%nz = acoo%get_nzeros()
|
||||
sv%id%job = 4
|
||||
call psb_barrier(ictxt)
|
||||
write(*,*)'calling mumps N,nz,nz_loc',sv%id%n,sv%id%nz,sv%id%nz_loc
|
||||
call smumps(sv%id)
|
||||
call psb_barrier(ictxt)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='mld_mumps_fact '
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
nullify(sv%id%irn)
|
||||
nullify(sv%id%jcn)
|
||||
nullify(sv%id%a)
|
||||
|
||||
call acoo%free()
|
||||
sv%built=.true.
|
||||
else
|
||||
! ?
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine s_mumps_solver_bld
|
||||
|
@ -0,0 +1,149 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 z_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_z_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
complex(psb_dpk_),intent(inout) :: y(:)
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: n_row, n_col, nglob
|
||||
complex(psb_dpk_), allocatable :: ww(:)
|
||||
complex(psb_dpk_), allocatable, target :: gx(:)
|
||||
integer(psb_ipk_) :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='z_mumps_solver_apply'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
trans_ = psb_toupper(trans)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
case('T')
|
||||
case default
|
||||
call psb_errpush(psb_err_iarg_invalid_i_,name)
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
nglob = desc_data%get_global_rows()
|
||||
n_row = desc_data%get_local_rows()
|
||||
n_col = desc_data%get_local_cols()
|
||||
|
||||
if (n_col <= size(work)) then
|
||||
ww = work(1:n_col)
|
||||
else
|
||||
allocate(ww(n_col),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/n_col,0,0,0,0/),&
|
||||
& a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
allocate(gx(nglob),stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_request_
|
||||
call psb_errpush(info,name,i_err=(/nglob,0,0,0,0/),&
|
||||
& a_err='complex(psb_spk_)')
|
||||
goto 9999
|
||||
end if
|
||||
call psb_gather(gx, x, desc_data, info, root=0)
|
||||
select case(trans_)
|
||||
case('N')
|
||||
sv%id%icntl(9) = 1
|
||||
case('T')
|
||||
sv%id%icntl(9) = 2
|
||||
case default
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Invalid TRANS in subsolve')
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
sv%id%rhs => gx
|
||||
sv%id%nrhs = 1
|
||||
sv%id%icntl(1)=-1
|
||||
sv%id%icntl(2)=-1
|
||||
sv%id%icntl(3)=-1
|
||||
sv%id%icntl(4)=-1
|
||||
sv%id%job = 3
|
||||
call zmumps(sv%id)
|
||||
call psb_scatter(gx, ww, desc_data, info, root=0)
|
||||
|
||||
if (info == psb_success_) then
|
||||
call psb_geaxpby(alpha,ww,beta,y,desc_data,info)
|
||||
end if
|
||||
|
||||
if (info /= psb_success_) then
|
||||
call psb_errpush(psb_err_internal_error_,&
|
||||
& name,a_err='Error in subsolve')
|
||||
goto 9999
|
||||
endif
|
||||
|
||||
if (nglob > size(work)) then
|
||||
deallocate(ww)
|
||||
endif
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
|
||||
end subroutine z_mumps_solver_apply
|
||||
|
@ -0,0 +1,83 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 z_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
use psb_base_mod
|
||||
use mld_z_mumps_solver
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_z_vect_type),intent(inout) :: x
|
||||
type(psb_z_vect_type),intent(inout) :: y
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_apply_vect'
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
info = psb_success_
|
||||
|
||||
call x%v%sync()
|
||||
call y%v%sync()
|
||||
call sv%apply(alpha,x%v%v,beta,y%v%v,desc_data,trans,work,info)
|
||||
call y%v%set_host()
|
||||
if (info /= 0) goto 9999
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine z_mumps_solver_apply_vect
|
||||
|
@ -0,0 +1,190 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 z_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use psb_base_mod
|
||||
use mpi
|
||||
use mld_z_mumps_solver
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type) :: c
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), target, optional :: b
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
! Local variables
|
||||
type(psb_zspmat_type) :: atmp
|
||||
type(psb_z_coo_sparse_mat), target :: acoo
|
||||
integer(psb_ipk_) :: n_row,n_col, nrow_a, nztota, nglob, nglobrec, nzt, npr, npc
|
||||
integer(psb_ipk_) :: ifrst, ibcheck
|
||||
integer(psb_ipk_) :: ictxt, ictxt1, icomm, np, me, i, err_act, debug_unit, debug_level
|
||||
character(len=20) :: name='z_mumps_solver_bld', ch_err
|
||||
|
||||
#if defined(HAVE_MUMPS_)
|
||||
|
||||
info=psb_success_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
debug_unit = psb_get_debug_unit()
|
||||
debug_level = psb_get_debug_level()
|
||||
ictxt = desc_a%get_context()
|
||||
if (sv%ipar(1) < 0 ) then
|
||||
call psb_info(ictxt, me, np)
|
||||
call psb_init(ictxt1,np=1,basectxt=ictxt,ids=(/me/))
|
||||
call psb_get_mpicomm(ictxt1, icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt1,mpi_comm_world
|
||||
call psb_info(ictxt1, me, np)
|
||||
npr = np
|
||||
else
|
||||
call psb_get_mpicomm(ictxt,icomm)
|
||||
write(*,*)'mumps_bld: +++++>',icomm,ictxt,mpi_comm_world
|
||||
call psb_info(ictxt, me, np)
|
||||
npr = np
|
||||
end if
|
||||
npc = 1
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' start'
|
||||
! if (allocated(sv%id)) then
|
||||
! call sv%free(info)
|
||||
|
||||
! deallocate(sv%id)
|
||||
! end if
|
||||
if(.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_zmumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
if (psb_toupper(upd) == 'F') then
|
||||
|
||||
sv%id%comm = icomm
|
||||
sv%id%job = -1
|
||||
sv%id%par=1
|
||||
call zmumps(sv%id)
|
||||
!WARNING: CALLING zMUMPS WITH JOB=-1 DESTROY THE SETTING OF DEFAULT:TO FIX
|
||||
sv%id%icntl(3)=sv%ipar(2)
|
||||
nglob = desc_a%get_global_rows()
|
||||
if (sv%ipar(1) < 0) then
|
||||
nglobrec=desc_a%get_local_rows()
|
||||
call a%csclip(c,info,jmax=a%get_nrows())
|
||||
call c%cp_to(acoo)
|
||||
nglob = c%get_nrows()
|
||||
if (nglobrec /= nglob) then
|
||||
write(*,*)'WARNING: MUMPS solver does not allow overlap in AS yet. A zero-overlap is used instead'
|
||||
end if
|
||||
else
|
||||
call a%cp_to(acoo)
|
||||
end if
|
||||
nztota = acoo%get_nzeros()
|
||||
|
||||
! switch to global numbering
|
||||
if (sv%ipar(1) >= 0 ) then
|
||||
call psb_loc_to_glob(acoo%ja(1:nztota), desc_a, info, iact='I')
|
||||
call psb_loc_to_glob(acoo%ia(1:nztota), desc_a, info, iact='I')
|
||||
end if
|
||||
sv%id%irn_loc=> acoo%ia
|
||||
sv%id%jcn_loc=> acoo%ja
|
||||
sv%id%a_loc=> acoo%val
|
||||
sv%id%icntl(18)=3
|
||||
if(acoo%is_upper() .or. acoo%is_lower()) then
|
||||
sv%id%sym = 2
|
||||
else
|
||||
sv%id%sym = 0
|
||||
end if
|
||||
sv%id%n = nglob
|
||||
! there should be a better way for this
|
||||
sv%id%nz_loc = acoo%get_nzeros()
|
||||
sv%id%nz = acoo%get_nzeros()
|
||||
sv%id%job = 4
|
||||
call psb_barrier(ictxt)
|
||||
write(*,*)'calling mumps N,nz,nz_loc',sv%id%n,sv%id%nz,sv%id%nz_loc
|
||||
call zmumps(sv%id)
|
||||
call psb_barrier(ictxt)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_from_subroutine_
|
||||
ch_err='mld_zmumps_fact '
|
||||
call psb_errpush(info,name,a_err=ch_err)
|
||||
goto 9999
|
||||
end if
|
||||
nullify(sv%id%irn)
|
||||
nullify(sv%id%jcn)
|
||||
nullify(sv%id%a)
|
||||
|
||||
call acoo%free()
|
||||
sv%built=.true.
|
||||
else
|
||||
! ?
|
||||
info=psb_err_internal_error_
|
||||
call psb_errpush(info,name)
|
||||
goto 9999
|
||||
|
||||
end if
|
||||
|
||||
if (debug_level >= psb_debug_outer_) &
|
||||
& write(debug_unit,*) me,' ',trim(name),' end'
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
#else
|
||||
write(psb_err_unit,*) "MUMPS Not Configured, fix make.inc and recompile "
|
||||
#endif
|
||||
end subroutine z_mumps_solver_bld
|
||||
|
@ -0,0 +1,477 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 mld_c_mumps_solver
|
||||
#if defined(HAVE_MUMPS_)
|
||||
use cmumps_struc_def
|
||||
#endif
|
||||
use mld_c_base_solver_mod
|
||||
|
||||
#if defined(LONG_INTEGERS)
|
||||
|
||||
type, extends(mld_c_base_solver_type) :: mld_c_mumps_solver_type
|
||||
|
||||
end type mld_c_mumps_solver_type
|
||||
#else
|
||||
type, extends(mld_c_base_solver_type) :: mld_c_mumps_solver_type
|
||||
#if defined(HAVE_MUMPS_)
|
||||
type(cmumps_struc), allocatable :: id
|
||||
#else
|
||||
integer, allocatable :: id
|
||||
#endif
|
||||
integer(psb_ipk_),dimension(2) :: ipar
|
||||
logical :: built=.false.
|
||||
contains
|
||||
procedure, pass(sv) :: build => c_mumps_solver_bld
|
||||
procedure, pass(sv) :: apply_a => c_mumps_solver_apply
|
||||
procedure, pass(sv) :: apply_v => c_mumps_solver_apply_vect
|
||||
procedure, pass(sv) :: free => c_mumps_solver_free
|
||||
procedure, pass(sv) :: descr => c_mumps_solver_descr
|
||||
procedure, pass(sv) :: sizeof => c_mumps_solver_sizeof
|
||||
procedure, pass(sv) :: seti => c_mumps_solver_seti
|
||||
procedure, pass(sv) :: setr => c_mumps_solver_setr
|
||||
procedure, pass(sv) :: cseti =>c_mumps_solver_cseti
|
||||
procedure, pass(sv) :: csetr => c_mumps_solver_csetr
|
||||
procedure, pass(sv) :: default => c_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
|
||||
final :: c_mumps_solver_finalize
|
||||
#endif
|
||||
end type mld_c_mumps_solver_type
|
||||
|
||||
|
||||
private :: c_mumps_solver_bld, c_mumps_solver_apply, &
|
||||
& c_mumps_solver_free, c_mumps_solver_descr, &
|
||||
& c_mumps_solver_sizeof, c_mumps_solver_apply_vect,&
|
||||
& c_mumps_solver_seti, c_mumps_solver_setr, &
|
||||
& c_mumps_solver_cseti, c_mumps_solver_csetri, &
|
||||
& c_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
private :: c_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
interface
|
||||
subroutine c_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_c_mumps_solver_type, psb_c_vect_type, psb_dpk_, psb_spk_, &
|
||||
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_c_vect_type),intent(inout) :: x
|
||||
type(psb_c_vect_type),intent(inout) :: y
|
||||
complex(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_mumps_solver_apply_vect'
|
||||
end subroutine c_mumps_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine c_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_c_mumps_solver_type, psb_c_vect_type, psb_dpk_, psb_spk_, &
|
||||
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
complex(psb_spk_),intent(inout) :: x(:)
|
||||
complex(psb_spk_),intent(inout) :: y(:)
|
||||
complex(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: n_row, n_col, nglob
|
||||
complex(psb_spk_), pointer :: ww(:)
|
||||
complex(psb_spk_), allocatable, target :: gx(:)
|
||||
integer(psb_ipk_) :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='c_mumps_solver_apply'
|
||||
end subroutine c_mumps_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine c_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use mpi
|
||||
import :: psb_desc_type, mld_c_mumps_solver_type, psb_c_vect_type, psb_spk_, &
|
||||
& psb_cspmat_type, psb_c_base_sparse_mat, psb_c_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_cspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_cspmat_type), intent(in), target, optional :: b
|
||||
class(psb_c_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_c_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine c_mumps_solver_bld
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine c_mumps_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
Integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='c_mumps_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
#if defined(HAVE_MUMPS_)
|
||||
if (allocated(sv%id)) then
|
||||
if (sv%built) then
|
||||
sv%id%job = -2
|
||||
call cmumps(sv%id)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) goto 9999
|
||||
end if
|
||||
deallocate(sv%id)
|
||||
sv%built=.false.
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
#endif
|
||||
end subroutine c_mumps_solver_free
|
||||
|
||||
#if defined(HAVE_FINAL)
|
||||
subroutine c_mumps_solver_finalize(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
integer :: info
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='c_mumps_solver_finalize'
|
||||
|
||||
call sv%free(info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine c_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
subroutine c_mumps_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='mld_z_mumps_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' MUMPS Solver. '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine c_mumps_solver_descr
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!$ WARNING: OTHERS PARAMETERS OF MUMPS COULD BE ADDED. FOR THIS, ADD AN !!$
|
||||
!!$ INTEGER IN MLD_BASE_PREC_TYPE.F90 AND MODIFY SUBROUTINE SET !!$
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
subroutine c_mumps_solver_seti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
select case(what)
|
||||
case(mld_as_sequential_)
|
||||
sv%ipar(1)=val
|
||||
case(mld_mumps_print_err_)
|
||||
sv%ipar(2)=val
|
||||
!case(mld_print_stat_)
|
||||
! sv%id%icntl(2)=val
|
||||
! sv%ipar(2)=val
|
||||
!case(mld_print_glob_)
|
||||
! sv%id%icntl(3)=val
|
||||
! sv%ipar(3)=val
|
||||
case default
|
||||
call sv%mld_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine c_mumps_solver_seti
|
||||
|
||||
|
||||
subroutine c_mumps_solver_setr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_setr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case default
|
||||
call sv%mld_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine c_mumps_solver_setr
|
||||
|
||||
subroutine c_mumps_solver_cseti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='c_mumps_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SET_AS_SEQUENTIAL')
|
||||
iwhat=mld_as_sequential_
|
||||
case('SET_MUMPS_PRINT_ERR')
|
||||
iwhat=mld_mumps_print_err_
|
||||
case default
|
||||
iwhat=-1
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_c_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine c_mumps_solver_cseti
|
||||
|
||||
subroutine c_mumps_solver_csetr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='z_mumps_solver_csetr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case default
|
||||
call sv%mld_c_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_c_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine c_mumps_solver_csetr
|
||||
|
||||
!!NOTE: BY DEFAULT BLR is activated with a dropping parameter to 1d-4 !!
|
||||
subroutine c_mumps_solver_default(sv)
|
||||
|
||||
Implicit none
|
||||
|
||||
!Argument
|
||||
class(mld_c_mumps_solver_type),intent(inout) :: sv
|
||||
integer(psb_ipk_) :: info
|
||||
integer(psb_ipk_) :: err_act,ictx,icomm
|
||||
character(len=20) :: name='c_mumps_default'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_cmumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
sv%built=.false.
|
||||
end if
|
||||
|
||||
!INSTANCIATION OF sv%id needed to set parmater but mpi communicator needed
|
||||
! sv%id%job = -1
|
||||
! sv%id%par=1
|
||||
! call dmumps(sv%id)
|
||||
sv%ipar(1)=2
|
||||
!sv%ipar(10)=6
|
||||
!sv%ipar(11)=0
|
||||
!sv%ipar(12)=6
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine c_mumps_solver_default
|
||||
|
||||
function c_mumps_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(mld_c_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_long_int_k_) :: val
|
||||
integer :: i
|
||||
#if defined(HAVE_MUMPS_)
|
||||
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
|
||||
#else
|
||||
val = 0
|
||||
#endif
|
||||
! val = 2*psb_sizeof_int + psb_sizeof_dp
|
||||
! val = val + sv%symbsize
|
||||
! val = val + sv%numsize
|
||||
return
|
||||
end function c_mumps_solver_sizeof
|
||||
#endif
|
||||
end module mld_c_mumps_solver
|
||||
|
@ -0,0 +1,477 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 mld_d_mumps_solver
|
||||
#if defined(HAVE_MUMPS_)
|
||||
use dmumps_struc_def
|
||||
#endif
|
||||
use mld_d_base_solver_mod
|
||||
|
||||
#if defined(LONG_INTEGERS)
|
||||
|
||||
type, extends(mld_d_base_solver_type) :: mld_d_mumps_solver_type
|
||||
|
||||
end type mld_d_mumps_solver_type
|
||||
#else
|
||||
type, extends(mld_d_base_solver_type) :: mld_d_mumps_solver_type
|
||||
#if defined(HAVE_MUMPS_)
|
||||
type(dmumps_struc), allocatable :: id
|
||||
#else
|
||||
integer, allocatable :: id
|
||||
#endif
|
||||
integer(psb_ipk_),dimension(2) :: ipar
|
||||
logical :: built=.false.
|
||||
contains
|
||||
procedure, pass(sv) :: build => d_mumps_solver_bld
|
||||
procedure, pass(sv) :: apply_a => d_mumps_solver_apply
|
||||
procedure, pass(sv) :: apply_v => d_mumps_solver_apply_vect
|
||||
procedure, pass(sv) :: free => d_mumps_solver_free
|
||||
procedure, pass(sv) :: descr => d_mumps_solver_descr
|
||||
procedure, pass(sv) :: sizeof => d_mumps_solver_sizeof
|
||||
procedure, pass(sv) :: seti => d_mumps_solver_seti
|
||||
procedure, pass(sv) :: setr => d_mumps_solver_setr
|
||||
procedure, pass(sv) :: cseti =>d_mumps_solver_cseti
|
||||
procedure, pass(sv) :: csetr => d_mumps_solver_csetr
|
||||
procedure, pass(sv) :: default => d_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
|
||||
final :: d_mumps_solver_finalize
|
||||
#endif
|
||||
end type mld_d_mumps_solver_type
|
||||
|
||||
|
||||
private :: d_mumps_solver_bld, d_mumps_solver_apply, &
|
||||
& d_mumps_solver_free, d_mumps_solver_descr, &
|
||||
& d_mumps_solver_sizeof, d_mumps_solver_apply_vect,&
|
||||
& d_mumps_solver_seti, d_mumps_solver_setr, &
|
||||
& d_mumps_solver_cseti, d_mumps_solver_csetri, &
|
||||
& d_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
private :: d_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
interface
|
||||
subroutine d_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_d_mumps_solver_type, psb_d_vect_type, psb_dpk_, psb_spk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_d_vect_type),intent(inout) :: x
|
||||
type(psb_d_vect_type),intent(inout) :: y
|
||||
real(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_mumps_solver_apply_vect'
|
||||
end subroutine d_mumps_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine d_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_d_mumps_solver_type, psb_d_vect_type, psb_dpk_, psb_spk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
real(psb_dpk_),intent(inout) :: x(:)
|
||||
real(psb_dpk_),intent(inout) :: y(:)
|
||||
real(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: n_row, n_col, nglob
|
||||
real(psb_dpk_), pointer :: ww(:)
|
||||
real(psb_dpk_), allocatable, target :: gx(:)
|
||||
integer(psb_ipk_) :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='d_mumps_solver_apply'
|
||||
end subroutine d_mumps_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine d_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use mpi
|
||||
import :: psb_desc_type, mld_d_mumps_solver_type, psb_d_vect_type, psb_spk_, &
|
||||
& psb_dspmat_type, psb_d_base_sparse_mat, psb_d_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_dspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_dspmat_type), intent(in), target, optional :: b
|
||||
class(psb_d_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_d_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine d_mumps_solver_bld
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine d_mumps_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
Integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='d_mumps_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
#if defined(HAVE_MUMPS_)
|
||||
if (allocated(sv%id)) then
|
||||
if (sv%built) then
|
||||
sv%id%job = -2
|
||||
call dmumps(sv%id)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) goto 9999
|
||||
end if
|
||||
deallocate(sv%id)
|
||||
sv%built=.false.
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
#endif
|
||||
end subroutine d_mumps_solver_free
|
||||
|
||||
#if defined(HAVE_FINAL)
|
||||
subroutine d_mumps_solver_finalize(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
integer :: info
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='d_mumps_solver_finalize'
|
||||
|
||||
call sv%free(info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine d_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
subroutine d_mumps_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='mld_z_mumps_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' MUMPS Solver. '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine d_mumps_solver_descr
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!$ WARNING: OTHERS PARAMETERS OF MUMPS COULD BE ADDED. FOR THIS, ADD AN !!$
|
||||
!!$ INTEGER IN MLD_BASE_PREC_TYPE.F90 AND MODIFY SUBROUTINE SET !!$
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
subroutine d_mumps_solver_seti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
select case(what)
|
||||
case(mld_as_sequential_)
|
||||
sv%ipar(1)=val
|
||||
case(mld_mumps_print_err_)
|
||||
sv%ipar(2)=val
|
||||
!case(mld_print_stat_)
|
||||
! sv%id%icntl(2)=val
|
||||
! sv%ipar(2)=val
|
||||
!case(mld_print_glob_)
|
||||
! sv%id%icntl(3)=val
|
||||
! sv%ipar(3)=val
|
||||
case default
|
||||
call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine d_mumps_solver_seti
|
||||
|
||||
|
||||
subroutine d_mumps_solver_setr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_setr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case default
|
||||
call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine d_mumps_solver_setr
|
||||
|
||||
subroutine d_mumps_solver_cseti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='d_mumps_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SET_AS_SEQUENTIAL')
|
||||
iwhat=mld_as_sequential_
|
||||
case('SET_MUMPS_PRINT_ERR')
|
||||
iwhat=mld_mumps_print_err_
|
||||
case default
|
||||
iwhat=-1
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine d_mumps_solver_cseti
|
||||
|
||||
subroutine d_mumps_solver_csetr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='z_mumps_solver_csetr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case default
|
||||
call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_d_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine d_mumps_solver_csetr
|
||||
|
||||
!!NOTE: BY DEFAULT BLR is activated with a dropping parameter to 1d-4 !!
|
||||
subroutine d_mumps_solver_default(sv)
|
||||
|
||||
Implicit none
|
||||
|
||||
!Argument
|
||||
class(mld_d_mumps_solver_type),intent(inout) :: sv
|
||||
integer(psb_ipk_) :: info
|
||||
integer(psb_ipk_) :: err_act,ictx,icomm
|
||||
character(len=20) :: name='d_mumps_default'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_dmumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
sv%built=.false.
|
||||
end if
|
||||
|
||||
!INSTANCIATION OF sv%id needed to set parmater but mpi communicator needed
|
||||
! sv%id%job = -1
|
||||
! sv%id%par=1
|
||||
! call dmumps(sv%id)
|
||||
sv%ipar(1)=2
|
||||
!sv%ipar(10)=6
|
||||
!sv%ipar(11)=0
|
||||
!sv%ipar(12)=6
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine d_mumps_solver_default
|
||||
|
||||
function d_mumps_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(mld_d_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_long_int_k_) :: val
|
||||
integer :: i
|
||||
#if defined(HAVE_MUMPS_)
|
||||
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
|
||||
#else
|
||||
val = 0
|
||||
#endif
|
||||
! val = 2*psb_sizeof_int + psb_sizeof_dp
|
||||
! val = val + sv%symbsize
|
||||
! val = val + sv%numsize
|
||||
return
|
||||
end function d_mumps_solver_sizeof
|
||||
#endif
|
||||
end module mld_d_mumps_solver
|
||||
|
@ -0,0 +1,477 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 mld_s_mumps_solver
|
||||
#if defined(HAVE_MUMPS_)
|
||||
use smumps_struc_def
|
||||
#endif
|
||||
use mld_s_base_solver_mod
|
||||
|
||||
#if defined(LONG_INTEGERS)
|
||||
|
||||
type, extends(mld_s_base_solver_type) :: mld_s_mumps_solver_type
|
||||
|
||||
end type mld_s_mumps_solver_type
|
||||
#else
|
||||
type, extends(mld_s_base_solver_type) :: mld_s_mumps_solver_type
|
||||
#if defined(HAVE_MUMPS_)
|
||||
type(smumps_struc), allocatable :: id
|
||||
#else
|
||||
integer, allocatable :: id
|
||||
#endif
|
||||
integer(psb_ipk_),dimension(2) :: ipar
|
||||
logical :: built=.false.
|
||||
contains
|
||||
procedure, pass(sv) :: build => s_mumps_solver_bld
|
||||
procedure, pass(sv) :: apply_a => s_mumps_solver_apply
|
||||
procedure, pass(sv) :: apply_v => s_mumps_solver_apply_vect
|
||||
procedure, pass(sv) :: free => s_mumps_solver_free
|
||||
procedure, pass(sv) :: descr => s_mumps_solver_descr
|
||||
procedure, pass(sv) :: sizeof => s_mumps_solver_sizeof
|
||||
procedure, pass(sv) :: seti => s_mumps_solver_seti
|
||||
procedure, pass(sv) :: setr => s_mumps_solver_setr
|
||||
procedure, pass(sv) :: cseti => s_mumps_solver_cseti
|
||||
procedure, pass(sv) :: csetr => s_mumps_solver_csetr
|
||||
procedure, pass(sv) :: default => s_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
|
||||
final :: s_mumps_solver_finalize
|
||||
#endif
|
||||
end type mld_s_mumps_solver_type
|
||||
|
||||
|
||||
private :: s_mumps_solver_bld, s_mumps_solver_apply, &
|
||||
& s_mumps_solver_free, s_mumps_solver_descr, &
|
||||
& s_mumps_solver_sizeof, s_mumps_solver_apply_vect,&
|
||||
& s_mumps_solver_seti, s_mumps_solver_setr, &
|
||||
& s_mumps_solver_cseti, s_mumps_solver_csetri, &
|
||||
& s_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
private :: s_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
interface
|
||||
subroutine s_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_s_mumps_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_s_vect_type),intent(inout) :: x
|
||||
type(psb_s_vect_type),intent(inout) :: y
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: err_act
|
||||
character(len=20) :: name='s_mumps_solver_apply_vect'
|
||||
end subroutine s_mumps_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine s_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_s_mumps_solver_type, psb_s_vect_type, psb_spk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
real(psb_spk_),intent(inout) :: x(:)
|
||||
real(psb_spk_),intent(inout) :: y(:)
|
||||
real(psb_spk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
real(psb_spk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer :: n_row, n_col, nglob
|
||||
real(psb_spk_), pointer :: ww(:)
|
||||
real(psb_spk_), allocatable, target :: gx(:)
|
||||
integer :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='s_mumps_solver_apply'
|
||||
end subroutine s_mumps_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine s_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use mpi
|
||||
import :: psb_desc_type, mld_s_mumps_solver_type, psb_s_vect_type, psb_spk_, psb_dpk_, &
|
||||
& psb_sspmat_type, psb_s_base_sparse_mat, psb_s_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_sspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer, intent(out) :: info
|
||||
type(psb_sspmat_type), intent(in), target, optional :: b
|
||||
class(psb_s_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_s_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine s_mumps_solver_bld
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine s_mumps_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
integer, intent(out) :: info
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='s_mumps_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
#if defined(HAVE_MUMPS_)
|
||||
if (allocated(sv%id)) then
|
||||
if (sv%built) then
|
||||
sv%id%job = -2
|
||||
call smumps(sv%id)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) goto 9999
|
||||
end if
|
||||
deallocate(sv%id)
|
||||
sv%built=.false.
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
#endif
|
||||
end subroutine s_mumps_solver_free
|
||||
|
||||
#if defined(HAVE_FINAL)
|
||||
subroutine s_mumps_solver_finalize(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
integer :: info
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='s_mumps_solver_finalize'
|
||||
|
||||
call sv%free(info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine s_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
subroutine s_mumps_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(in) :: sv
|
||||
integer, intent(out) :: info
|
||||
integer, intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer :: err_act
|
||||
integer :: ictxt, me, np
|
||||
character(len=20), parameter :: name='mld_s_mumps_solver_descr'
|
||||
integer :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' MUMPS Solver. '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine s_mumps_solver_descr
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!$ WARNING: OTHERS PARAMETERS OF MUMPS COULD BE ADDED. FOR THIS, ADD AN !!$
|
||||
!!$ INTEGER IN MLD_BASE_PREC_TYPE.F90 AND MODIFY SUBROUTINE SET !!$
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
subroutine s_mumps_solver_seti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='s_mumps_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
select case(what)
|
||||
case(mld_as_sequential_)
|
||||
sv%ipar(1)=val
|
||||
case(mld_mumps_print_err_)
|
||||
sv%ipar(2)=val
|
||||
!case(mld_print_stat_)
|
||||
! sv%id%icntl(2)=val
|
||||
! sv%ipar(2)=val
|
||||
!case(mld_print_glob_)
|
||||
! sv%id%icntl(3)=val
|
||||
! sv%ipar(3)=val
|
||||
case default
|
||||
call sv%mld_s_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine s_mumps_solver_seti
|
||||
|
||||
|
||||
subroutine s_mumps_solver_setr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='s_mumps_solver_setr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case default
|
||||
call sv%mld_s_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine s_mumps_solver_setr
|
||||
|
||||
subroutine s_mumps_solver_cseti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='s_mumps_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SET_AS_SEQUENTIAL')
|
||||
iwhat=mld_as_sequential_
|
||||
case('SET_MUMPS_PRINT_ERR')
|
||||
iwhat=mld_mumps_print_err_
|
||||
case default
|
||||
iwhat=-1
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_s_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine s_mumps_solver_cseti
|
||||
|
||||
subroutine s_mumps_solver_csetr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_spk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='s_mumps_solver_csetr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case default
|
||||
call sv%mld_s_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_s_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine s_mumps_solver_csetr
|
||||
|
||||
!!NOTE: BY DEFAULT BLR is activated with a dropping parameter to 1d-4 !!
|
||||
subroutine s_mumps_solver_default(sv)
|
||||
|
||||
Implicit none
|
||||
|
||||
!Argument
|
||||
class(mld_s_mumps_solver_type),intent(inout) :: sv
|
||||
integer(psb_ipk_) :: info
|
||||
integer(psb_ipk_) :: err_act,ictx,icomm
|
||||
character(len=20) :: name='s_mumps_default'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_smumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
sv%built=.false.
|
||||
end if
|
||||
|
||||
!INSTANCIATION OF sv%id needed to set parmater but mpi communicator needed
|
||||
! sv%id%job = -1
|
||||
! sv%id%par=1
|
||||
! call dmumps(sv%id)
|
||||
sv%ipar(1)=2
|
||||
!sv%ipar(10)=6
|
||||
!sv%ipar(11)=0
|
||||
!sv%ipar(12)=6
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine s_mumps_solver_default
|
||||
|
||||
function s_mumps_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(mld_s_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_long_int_k_) :: val
|
||||
integer :: i
|
||||
#if defined(HAVE_MUMPS_)
|
||||
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
|
||||
#else
|
||||
val = 0
|
||||
#endif
|
||||
! val = 2*psb_sizeof_int + psb_sizeof_dp
|
||||
! val = val + sv%symbsize
|
||||
! val = val + sv%numsize
|
||||
return
|
||||
end function s_mumps_solver_sizeof
|
||||
#endif
|
||||
end module mld_s_mumps_solver
|
||||
|
@ -0,0 +1,477 @@
|
||||
!!$
|
||||
!!$
|
||||
!!$ MLD2P4 version 2.0
|
||||
!!$ MultiLevel Domain Decomposition Parallel Preconditioners Package
|
||||
!!$ based on PSBLAS (Parallel Sparse BLAS version 3.0)
|
||||
!!$
|
||||
!!$ (C) Copyright 2008,2009,2010,2012,2013
|
||||
!!$
|
||||
!!$ Salvatore Filippone University of Rome Tor Vergata
|
||||
!!$ Alfredo Buttari CNRS-IRIT, Toulouse
|
||||
!!$ Pasqua D'Ambra ICAR-CNR, Naples
|
||||
!!$ Daniela di Serafino Second University of Naples
|
||||
!!$
|
||||
!!$ 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 MLD2P4 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 MLD2P4 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 mld_z_mumps_solver
|
||||
#if defined(HAVE_MUMPS_)
|
||||
use zmumps_struc_def
|
||||
#endif
|
||||
use mld_z_base_solver_mod
|
||||
|
||||
#if defined(LONG_INTEGERS)
|
||||
|
||||
type, extends(mld_z_base_solver_type) :: mld_z_mumps_solver_type
|
||||
|
||||
end type mld_z_mumps_solver_type
|
||||
#else
|
||||
type, extends(mld_z_base_solver_type) :: mld_z_mumps_solver_type
|
||||
#if defined(HAVE_MUMPS_)
|
||||
type(zmumps_struc), allocatable :: id
|
||||
#else
|
||||
integer, allocatable :: id
|
||||
#endif
|
||||
integer(psb_ipk_),dimension(2) :: ipar
|
||||
logical :: built=.false.
|
||||
contains
|
||||
procedure, pass(sv) :: build => z_mumps_solver_bld
|
||||
procedure, pass(sv) :: apply_a => z_mumps_solver_apply
|
||||
procedure, pass(sv) :: apply_v => z_mumps_solver_apply_vect
|
||||
procedure, pass(sv) :: free => z_mumps_solver_free
|
||||
procedure, pass(sv) :: descr => z_mumps_solver_descr
|
||||
procedure, pass(sv) :: sizeof => z_mumps_solver_sizeof
|
||||
procedure, pass(sv) :: seti => z_mumps_solver_seti
|
||||
procedure, pass(sv) :: setr => z_mumps_solver_setr
|
||||
procedure, pass(sv) :: cseti =>z_mumps_solver_cseti
|
||||
procedure, pass(sv) :: csetr => z_mumps_solver_csetr
|
||||
procedure, pass(sv) :: default => z_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
|
||||
final :: z_mumps_solver_finalize
|
||||
#endif
|
||||
end type mld_z_mumps_solver_type
|
||||
|
||||
|
||||
private :: z_mumps_solver_bld, z_mumps_solver_apply, &
|
||||
& z_mumps_solver_free, z_mumps_solver_descr, &
|
||||
& z_mumps_solver_sizeof, z_mumps_solver_apply_vect,&
|
||||
& z_mumps_solver_seti, z_mumps_solver_setr, &
|
||||
& z_mumps_solver_cseti, z_mumps_solver_csetri, &
|
||||
& z_mumps_solver_default
|
||||
#if defined(HAVE_FINAL)
|
||||
private :: z_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
interface
|
||||
subroutine z_mumps_solver_apply_vect(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_z_mumps_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
type(psb_z_vect_type),intent(inout) :: x
|
||||
type(psb_z_vect_type),intent(inout) :: y
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer, intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_apply_vect'
|
||||
end subroutine z_mumps_solver_apply_vect
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine z_mumps_solver_apply(alpha,sv,x,beta,y,desc_data,trans,work,info)
|
||||
import :: psb_desc_type, mld_z_mumps_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type, psb_ipk_
|
||||
implicit none
|
||||
type(psb_desc_type), intent(in) :: desc_data
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
complex(psb_dpk_),intent(inout) :: x(:)
|
||||
complex(psb_dpk_),intent(inout) :: y(:)
|
||||
complex(psb_dpk_),intent(in) :: alpha,beta
|
||||
character(len=1),intent(in) :: trans
|
||||
complex(psb_dpk_),target, intent(inout) :: work(:)
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
|
||||
integer(psb_ipk_) :: n_row, n_col, nglob
|
||||
complex(psb_dpk_), pointer :: ww(:)
|
||||
complex(psb_dpk_), allocatable, target :: gx(:)
|
||||
integer(psb_ipk_) :: ictxt,np,me,i, err_act
|
||||
character :: trans_
|
||||
character(len=20) :: name='z_mumps_solver_apply'
|
||||
end subroutine z_mumps_solver_apply
|
||||
end interface
|
||||
|
||||
interface
|
||||
subroutine z_mumps_solver_bld(a,desc_a,sv,upd,info,b,amold,vmold,imold)
|
||||
|
||||
use mpi
|
||||
import :: psb_desc_type, mld_z_mumps_solver_type, psb_z_vect_type, psb_dpk_, &
|
||||
& psb_zspmat_type, psb_z_base_sparse_mat, psb_z_base_vect_type,&
|
||||
& psb_ipk_, psb_i_base_vect_type
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(psb_zspmat_type), intent(in), target :: a
|
||||
Type(psb_desc_type), Intent(in) :: desc_a
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
character, intent(in) :: upd
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
type(psb_zspmat_type), intent(in), target, optional :: b
|
||||
class(psb_z_base_sparse_mat), intent(in), optional :: amold
|
||||
class(psb_z_base_vect_type), intent(in), optional :: vmold
|
||||
class(psb_i_base_vect_type), intent(in), optional :: imold
|
||||
end subroutine z_mumps_solver_bld
|
||||
end interface
|
||||
|
||||
contains
|
||||
|
||||
subroutine z_mumps_solver_free(sv,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
Integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_free'
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
#if defined(HAVE_MUMPS_)
|
||||
if (allocated(sv%id)) then
|
||||
if (sv%built) then
|
||||
sv%id%job = -2
|
||||
call zmumps(sv%id)
|
||||
info = sv%id%infog(1)
|
||||
if (info /= psb_success_) goto 9999
|
||||
end if
|
||||
deallocate(sv%id)
|
||||
sv%built=.false.
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
#endif
|
||||
end subroutine z_mumps_solver_free
|
||||
|
||||
#if defined(HAVE_FINAL)
|
||||
subroutine z_mumps_solver_finalize(sv)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
type(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
integer :: info
|
||||
Integer :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_finalize'
|
||||
|
||||
call sv%free(info)
|
||||
|
||||
return
|
||||
|
||||
end subroutine z_mumps_solver_finalize
|
||||
#endif
|
||||
|
||||
subroutine z_mumps_solver_descr(sv,info,iout,coarse)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_), intent(in), optional :: iout
|
||||
logical, intent(in), optional :: coarse
|
||||
|
||||
! Local variables
|
||||
integer(psb_ipk_) :: err_act
|
||||
integer(psb_ipk_) :: ictxt, me, np
|
||||
character(len=20), parameter :: name='mld_z_mumps_solver_descr'
|
||||
integer(psb_ipk_) :: iout_
|
||||
|
||||
call psb_erractionsave(err_act)
|
||||
info = psb_success_
|
||||
if (present(iout)) then
|
||||
iout_ = iout
|
||||
else
|
||||
iout_ = 6
|
||||
endif
|
||||
|
||||
write(iout_,*) ' MUMPS Solver. '
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine z_mumps_solver_descr
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!$ WARNING: OTHERS PARAMETERS OF MUMPS COULD BE ADDED. FOR THIS, ADD AN !!$
|
||||
!!$ INTEGER IN MLD_BASE_PREC_TYPE.F90 AND MODIFY SUBROUTINE SET !!$
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
subroutine z_mumps_solver_seti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_seti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
select case(what)
|
||||
case(mld_as_sequential_)
|
||||
sv%ipar(1)=val
|
||||
case(mld_mumps_print_err_)
|
||||
sv%ipar(2)=val
|
||||
!case(mld_print_stat_)
|
||||
! sv%id%icntl(2)=val
|
||||
! sv%ipar(2)=val
|
||||
!case(mld_print_glob_)
|
||||
! sv%id%icntl(3)=val
|
||||
! sv%ipar(3)=val
|
||||
case default
|
||||
call sv%mld_z_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine z_mumps_solver_seti
|
||||
|
||||
|
||||
subroutine z_mumps_solver_setr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
integer(psb_ipk_), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act
|
||||
character(len=20) :: name='z_mumps_solver_setr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(what)
|
||||
case default
|
||||
call sv%mld_z_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine z_mumps_solver_setr
|
||||
|
||||
subroutine z_mumps_solver_cseti(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
integer(psb_ipk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='z_mumps_solver_cseti'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case('SET_AS_SEQUENTIAL')
|
||||
iwhat=mld_as_sequential_
|
||||
case('SET_MUMPS_PRINT_ERR')
|
||||
iwhat=mld_mumps_print_err_
|
||||
case default
|
||||
iwhat=-1
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_z_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine z_mumps_solver_cseti
|
||||
|
||||
subroutine z_mumps_solver_csetr(sv,what,val,info)
|
||||
|
||||
Implicit None
|
||||
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(inout) :: sv
|
||||
character(len=*), intent(in) :: what
|
||||
real(psb_dpk_), intent(in) :: val
|
||||
integer(psb_ipk_), intent(out) :: info
|
||||
integer(psb_ipk_) :: err_act, iwhat
|
||||
character(len=20) :: name='z_mumps_solver_csetr'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
select case(psb_toupper(what))
|
||||
case default
|
||||
call sv%mld_z_base_solver_type%set(what,val,info)
|
||||
end select
|
||||
|
||||
if (iwhat >=0 ) then
|
||||
call sv%set(iwhat,val,info)
|
||||
else
|
||||
call sv%mld_z_base_solver_type%set(what,val,info)
|
||||
end if
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
end subroutine z_mumps_solver_csetr
|
||||
|
||||
!!NOTE: BY DEFAULT BLR is activated with a dropping parameter to 1d-4 !!
|
||||
subroutine z_mumps_solver_default(sv)
|
||||
|
||||
Implicit none
|
||||
|
||||
!Argument
|
||||
class(mld_z_mumps_solver_type),intent(inout) :: sv
|
||||
integer(psb_ipk_) :: info
|
||||
integer(psb_ipk_) :: err_act,ictx,icomm
|
||||
character(len=20) :: name='z_mumps_default'
|
||||
|
||||
info = psb_success_
|
||||
call psb_erractionsave(err_act)
|
||||
|
||||
if (.not.allocated(sv%id)) then
|
||||
allocate(sv%id,stat=info)
|
||||
if (info /= psb_success_) then
|
||||
info=psb_err_alloc_dealloc_
|
||||
call psb_errpush(info,name,a_err='mld_zmumps_default')
|
||||
goto 9999
|
||||
end if
|
||||
sv%built=.false.
|
||||
end if
|
||||
|
||||
!INSTANCIATION OF sv%id needed to set parmater but mpi communicator needed
|
||||
! sv%id%job = -1
|
||||
! sv%id%par=1
|
||||
! call dmumps(sv%id)
|
||||
sv%ipar(1)=2
|
||||
!sv%ipar(10)=6
|
||||
!sv%ipar(11)=0
|
||||
!sv%ipar(12)=6
|
||||
|
||||
|
||||
call psb_erractionrestore(err_act)
|
||||
return
|
||||
|
||||
9999 continue
|
||||
call psb_erractionrestore(err_act)
|
||||
if (err_act == psb_act_abort_) then
|
||||
call psb_error()
|
||||
return
|
||||
end if
|
||||
return
|
||||
|
||||
end subroutine z_mumps_solver_default
|
||||
|
||||
function z_mumps_solver_sizeof(sv) result(val)
|
||||
|
||||
implicit none
|
||||
! Arguments
|
||||
class(mld_z_mumps_solver_type), intent(in) :: sv
|
||||
integer(psb_long_int_k_) :: val
|
||||
integer :: i
|
||||
#if defined(HAVE_MUMPS_)
|
||||
val = (sv%id%INFOG(22)+sv%id%INFOG(32))*1d+6
|
||||
#else
|
||||
val = 0
|
||||
#endif
|
||||
! val = 2*psb_sizeof_int + psb_sizeof_dp
|
||||
! val = val + sv%symbsize
|
||||
! val = val + sv%numsize
|
||||
return
|
||||
end function z_mumps_solver_sizeof
|
||||
#endif
|
||||
end module mld_z_mumps_solver
|
||||
|
@ -1,32 +1,32 @@
|
||||
BICGSTAB ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
|
||||
RGMRES ! Iterative method: BiCGSTAB BiCG CGS RGMRES BiCGSTABL CG
|
||||
CSR ! Storage format CSR COO JAD
|
||||
040 ! IDIM; domain size is idim**3
|
||||
0100 ! IDIM; domain size is idim**3
|
||||
2 ! ISTOPC
|
||||
2000 ! ITMAX
|
||||
1 ! ITRACE
|
||||
0100 ! ITMAX
|
||||
1 ! ITRACE
|
||||
30 ! IRST (restart for RGMRES and BiCGSTABL)
|
||||
1.d-6 ! EPS
|
||||
NL-MUL-RAS-BJAC4-ILU ! Descriptive name for preconditioner (up to 40 chars)
|
||||
ML ! Preconditioner NONE JACOBI BJAC AS ML
|
||||
3L-MUL-RAS-BJAC4-ILU ! Descriptive name for preconditioner (up to 40 chars)
|
||||
ML ! Preconditioner NONE JACOBI BJAC AS ML
|
||||
1 ! Number of overlap layers for AS preconditioner at finest level
|
||||
HALO ! Restriction operator NONE HALO
|
||||
NONE ! Prolongation operator NONE SUM AVG
|
||||
ILU ! Subdomain solver DSCALE ILU MILU ILUT UMF SLU
|
||||
GS ! Subdomain solver DSCALE ILU MILU ILUT UMF SLU
|
||||
1 ! sweeps for GS
|
||||
0 ! Level-set N for ILU(N), and P for ILUT
|
||||
1.d-4 ! Threshold T for ILU(T,P)
|
||||
1 ! Smoother/Jacobi sweeps
|
||||
AS ! Smoother type JACOBI BJAC AS; ignored for non-ML
|
||||
BJAC ! Smoother type JACOBI BJAC AS; ignored for non-ML
|
||||
2 ! Number of levels in a multilevel preconditioner
|
||||
SMOOTHED ! Kind of aggregation: SMOOTHED, NONSMOOTHED, MINENERGY
|
||||
DEC ! Type of aggregation DEC SYMDEC GLB
|
||||
MULT ! Type of multilevel correction: ADD MULT
|
||||
TWOSIDE ! Side of correction PRE POST TWOSIDE (ignored for ADD)
|
||||
DIST ! Coarse level: matrix distribution DIST REPL
|
||||
BJAC ! Coarse level: solver JACOBI BJAC UMF SLU SLUDIST
|
||||
UMF ! Coarse level: subsolver DSCALE ILU UMF SLU SLUDIST
|
||||
0 ! Coarse level: Level-set N for ILU(N)
|
||||
REPL ! Coarse level: matrix distribution DIST REPL
|
||||
BJAC ! Coarse level: solver JACOBI BJAC UMF SLU SLUDIST MUMPS
|
||||
MUMPS ! Coarse level: subsolver DSCALE ILU UMF SLU SLUDIST MUMPS
|
||||
1 ! Coarse level: Level-set N for ILU(N)
|
||||
1.d-4 ! Coarse level: Threshold T for ILU(T,P)
|
||||
4 ! Coarse level: Number of Jacobi sweeps
|
||||
-0.10d0 ! Smoother Aggregation Threshold: >= 0.0 default if <0
|
||||
-200 ! Coarse size limit to determine levels. If <0, then use NL
|
||||
-10 ! Coarse size limit to determine levels. If <0, then use NL
|
||||
|
Loading…
Reference in New Issue