From 719d69246e55d48440163ac84d64816ebe2cbd07 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 1 Feb 2007 10:18:00 +0000 Subject: [PATCH] Merged changes for serial version. --- Changelog | 4 + Make.inc.gcc42 | 6 +- Make.inc.gcc42-serialmpi | 92 ++++ Make.inc.ifc9 | 6 +- Make.inc.rs6k | 8 +- Makefile | 4 +- base/comm/psb_iscatter.f90 | 1 - base/internals/Makefile | 4 +- base/internals/psi_extrct_dl.f | 282 ------------ base/internals/psi_extrct_dl.f90 | 276 +++++++++++ base/modules/Makefile | 2 +- base/modules/blacs_env.F90 | 10 +- base/modules/error.f90 | 2 +- base/modules/fakempi.c | 134 ++++++ .../{psb_error_mod.f90 => psb_error_mod.F90} | 24 +- .../{psb_penv_mod.f90 => psb_penv_mod.F90} | 427 +++++++++++++++++- base/psblas/{pdtreecomb.f => pdtreecomb.F} | 5 + base/tools/psb_cd_inloc.f90 | 16 +- base/tools/psb_icdasb.f90 | 3 +- base/tools/psb_zsphalo.f90 | 4 +- baseprec/psb_zbaseprc_aply.f90 | 2 +- test/fileread/runs/dfs.inp | 4 +- 22 files changed, 984 insertions(+), 332 deletions(-) create mode 100644 Make.inc.gcc42-serialmpi delete mode 100644 base/internals/psi_extrct_dl.f create mode 100644 base/internals/psi_extrct_dl.f90 create mode 100644 base/modules/fakempi.c rename base/modules/{psb_error_mod.f90 => psb_error_mod.F90} (98%) rename base/modules/{psb_penv_mod.f90 => psb_penv_mod.F90} (92%) rename base/psblas/{pdtreecomb.f => pdtreecomb.F} (99%) diff --git a/Changelog b/Changelog index 08e950bb..653fc161 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,10 @@ Changelog. A lot less detailed than usual, at least for past history. +2007/02/01: Merged serial version: we provide a minimal fake mpi to + allow compiling and running without mpi and blacs. Only + tested with gnu42 so far. + 2007/01/23: Defined new field ext_index in desc_type, and fixed long standing inconsistency in usage of overlap for AS preconditioners. Modified halo to accept selector for diff --git a/Make.inc.gcc42 b/Make.inc.gcc42 index 87269cd9..b898b9f8 100644 --- a/Make.inc.gcc42 +++ b/Make.inc.gcc42 @@ -1,6 +1,6 @@ .mod=.mod .fh=.fh -.SUFFIXES: .f90 $(.mod) .F90 +.SUFFIXES: .f90 $(.mod) .F90 .F ####################### Section 1 ####################### @@ -78,8 +78,12 @@ $(.mod).o: $(F90) $(F90COPT) $(INCDIRS) -c $< .f90.o: $(F90) $(F90COPT) $(INCDIRS) -c $< +.F.o: + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< .F90.o: $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< +.F90$(.mod): + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< diff --git a/Make.inc.gcc42-serialmpi b/Make.inc.gcc42-serialmpi new file mode 100644 index 00000000..de886f01 --- /dev/null +++ b/Make.inc.gcc42-serialmpi @@ -0,0 +1,92 @@ +.mod=.mod +.fh=.fh +.SUFFIXES: .f90 $(.mod) .F90 .F + + +####################### Section 1 ####################### +# Define your compilers and compiler flags here # +########################################################## +F90=/usr/local/gcc42/bin/gfortran +FC=$(F90) +F77=$(FC) +CC=/usr/local/gcc42/bin/gcc +F90COPT=-O3 -ggdb +FCOPT=-O3 -ggdb +CCOPT=-O3 -ggdb + +####################### Section 2 ####################### +# Define your linker and linker flags here # +########################################################## +F90LINK=$(FC) +FLINK=$(FC) +MPF90=$(FC) +MPF77=$(FC) +MPCC=$(CC) + +####################### Section 3 ####################### +# Specify paths to libraries # +########################################################## +BLAS=-lblas-gcc42 -L$(HOME)/LIB +# No BLACS in serialMPI. But we need the fakempi.o +#BLACS=-lmpiblacs-gcc42 -L$(HOME)/LIB +EXTRA_COBJS=fakempi.o + + +####################### Section 4 ####################### +# Other useful tools&defines # +########################################################## +SLUDIR=/usr/local/SuperLU_3.0 +SLU=-lslu_lx_gcc42 -L$(SLUDIR) +SLUDEF=-DHave_SLU_ -I$(SLUDIR) + +UMFDIR=$(HOME)/LIB/Umfpack_gcc41 +UMF=-lumfpack -lamd -L$(UMFDIR) +UMFDEF=-DHave_UMF_ -I$(UMFDIR) +# +# We are using the public domain tool METIS from U. Minnesota. To get it +# check URL http://www.cs.umn.edu:~karypis +# +METIS_LIB = -L$(HOME)/NUMERICAL/metis-4.0 -lmetis +LDLIBS=$(BLACS) $(SLU) $(UMF) $(BLAS) $(METIS_LIB) + +# Add -DLargeFptr for 64-bit addresses +CDEFINES=-DAdd_ $(SLUDEF) $(UMFDEF) +FDEFINES=-DHAVE_MOVE_ALLOC -DSERIAL_MPI + +AR=ar -cur +RANLIB=ranlib + + + +####################### Section 5 ####################### +# Do not edit this # +########################################################## +LIBDIR=lib +BASELIBNAME=libpsb_base.a +PRECLIBNAME=libpsb_prec.a +METHDLIBNAME=libpsb_krylov.a +UTILLIBNAME=libpsb_util.a + +# Under Linux/gmake there is a rule interpreting .mod as Modula source! +$(.mod).o: + +.f.o: + $(FC) $(FCOPT) $(INCDIRS) -c $< +.c.o: + $(CC) $(CCOPT) $(INCDIRS) $(CDEFINES) -c $< +.f$(.mod): + $(F90) $(FCOPT) $(INCDIRS) -c $< +.f90$(.mod): + $(F90) $(F90COPT) $(INCDIRS) -c $< +.f90.o: + $(F90) $(F90COPT) $(INCDIRS) -c $< +.F.o: + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< +.F90.o: + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< +.F90$(.mod): + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< + + + + diff --git a/Make.inc.ifc9 b/Make.inc.ifc9 index 7f319174..a786eddc 100644 --- a/Make.inc.ifc9 +++ b/Make.inc.ifc9 @@ -1,6 +1,6 @@ .mod=.mod .fh=.fh -.SUFFIXES: .f90 $(.mod) .F90 +.SUFFIXES: .f90 $(.mod) .F90 .F ####################### Section 1 ####################### @@ -80,8 +80,12 @@ $(.mod).o: $(F90) $(F90COPT) $(INCDIRS) -c $< .f90.o: $(F90) $(F90COPT) $(INCDIRS) -c $< +.F.o: + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< .F90.o: $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< +.F90$(.mod): + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< diff --git a/Make.inc.rs6k b/Make.inc.rs6k index b7b8d832..cbd82dad 100644 --- a/Make.inc.rs6k +++ b/Make.inc.rs6k @@ -1,13 +1,13 @@ .mod=.mod .fh=.fh -.SUFFIXES: .f90 $(.mod) .F90 +.SUFFIXES: .f90 $(.mod) .F90 .F ####################### Section 1 ####################### # Define your compilers and compiler flags here # ########################################################## F90=xlf95 -qsuffix=f=f90:cpp=F90 -FC=xlf +FC=xlf -qsuffix=cpp=F F77=$(FC) CC=xlc F90COPT= -O3 @@ -78,8 +78,12 @@ $(.mod).o: $(F90) $(F90COPT) $(INCDIRS) -c $< .f90.o: $(F90) $(F90COPT) $(INCDIRS) -c $< +.F.o: + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< .F90.o: $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< +.F90$(.mod): + $(F90) $(F90COPT) $(INCDIRS) $(FDEFINES) -c $< diff --git a/Makefile b/Makefile index 0e046563..b4f2cafe 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ include Make.inc -#PREC=../mld2p4 -PREC=baseprec +PREC=../mld2p4 +#PREC=baseprec library: ( [ -d lib ] || mkdir lib) diff --git a/base/comm/psb_iscatter.f90 b/base/comm/psb_iscatter.f90 index c06dce65..c17a096a 100644 --- a/base/comm/psb_iscatter.f90 +++ b/base/comm/psb_iscatter.f90 @@ -121,7 +121,6 @@ subroutine psb_iscatterm(globx, locx, desc_a, info, iroot) n = psb_cd_get_global_cols(desc_a) call psb_bcast(ictxt,k,root=iiroot) - ! there should be a global check on k here!!! call psb_chkglobvect(m,n,size(globx),iglobx,jglobx,desc_a,info) diff --git a/base/internals/Makefile b/base/internals/Makefile index b6d1b06b..7dff70db 100644 --- a/base/internals/Makefile +++ b/base/internals/Makefile @@ -11,8 +11,7 @@ COBJS = avltree.o srcht.o MPFOBJS = psi_dswapdata.o psi_dswaptran.o psi_iswapdata.o \ psi_iswaptran.o psi_desc_index.o \ - psi_zswapdata.o psi_zswaptran.o -MPFOBJS2 = psi_extrct_dl.o + psi_zswapdata.o psi_zswaptran.o psi_extrct_dl.o LIBDIR = .. MODDIR = ../modules INCDIRS = -I $(LIBDIR) -I $(MODDIR) -I . @@ -25,7 +24,6 @@ lib: mpfobjs $(FOBJS) $(FOBJS2) $(COBJS) $(MPFOBJS2) mpfobjs: psi_gthsct.o (make $(MPFOBJS) F90="$(MPF90)" FC="$(MPF90)" FCOPT="$(F90COPT)") - (make $(MPFOBJS2) F90="$(MPF77)" FC="$(MPF77)" FCOPT="$(FCOPT)") (make $(FOBJS2) F90="$(MPF77)" FC="$(MPF77)" FCOPT="$(FCOPT)") clean: /bin/rm -f $(MPFOBJS) $(FOBJS) $(COBJS) $(FOBJS2) $(MPFOBJS2) diff --git a/base/internals/psi_extrct_dl.f b/base/internals/psi_extrct_dl.f deleted file mode 100644 index 8a77acfe..00000000 --- a/base/internals/psi_extrct_dl.f +++ /dev/null @@ -1,282 +0,0 @@ -C -C Parallel Sparse BLAS v2.0 -C (C) Copyright 2006 Salvatore Filippone University of Rome Tor Vergata -C Alfredo Buttari University of Rome Tor Vergata -C -C Redistribution and use in source and binary forms, with or without -C modification, are permitted provided that the following conditions -C are met: -C 1. Redistributions of source code must retain the above copyright -C notice, this list of conditions and the following disclaimer. -C 2. Redistributions in binary form must reproduce the above copyright -C notice, this list of conditions, and the following disclaimer in the -C documentation and/or other materials provided with the distribution. -C 3. The name of the PSBLAS group or the names of its contributors may -C not be used to endorse or promote products derived from this -C software without specific written permission. -C -C THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -C ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -C TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -C PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -C BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -C CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -C SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -C INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -C CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -C ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -C POSSIBILITY OF SUCH DAMAGE. -C -C - subroutine psi_extract_dep_list(desc_data, - + desc_str,dep_list, - + length_dl,np,dl_lda,mode,info) - -c internal routine -c ================ -c -c _____called by psi_crea_halo and psi_crea_ovrlap ______ -c -c purpose -c ======= -c process root (pid=0) extracts for each process "k" the ordered list of process -c to which "k" must communicate. this list with its order is extracted from -c desc_str list -c -c -c input -c ======= -c desc_data :integer array -c explanation: -c name explanation -c ------------------ ------------------------------------------------------- -c desc_data array of integer that contains some local and global -c information of matrix. -c -c -c now we explain each of the above vectors. -c -c let a be a generic sparse matrix. we denote with matdata_a the matrix_data -c array for matrix a. -c data stored in matrix_data array are: -c -c notation stored in explanation -c --------------- ---------------------- ------------------------------------- -c dec_type matdata_a[psb_dec_type_] decomposition type -c m matdata_a[m_] total number of equations -c n matdata_a[n_] total number of variables -c n_row matdata_a[psb_n_row_] number of local equations -c n_col matdata_a[psb_n_col_] number of local variables -c psb_ctxt_a matdata_a[ctxt_] the blacs context handle, indicating -c the global context of the operation -c on the matrix. -c the context itself is global. -c desc_str integer array -c explanation: -c let desc_str_p be the array desc_str for local process. -c this is composed of variable dimension blocks for each process to -c communicate to. -c each block contain indexes of local halo elements to exchange with other -c process. -c let p be the pointer to the first element of a block in desc_str_p. -c this block is stored in desc_str_p as : -c -c notation stored in explanation -c --------------- --------------------------- ----------------------------------- -c process_id desc_str_p[p+psb_proc_id_] identifier of process which exchange -c data with. -c n_elements_recv desc_str_p[p+n_elem_recv_] number of elements to receive. -c elements_recv desc_str_p[p+elem_recv_+i] indexes of local elements to -c receive. these are stored in the -c array from location p+elem_recv_ to -c location p+elem_recv_+ -c desc_str_p[p+n_elem_recv_]-1. -c if desc_data(psb_dec_type_) == 0 -c then also will be: -c n_elements_send desc_str_p[p+n_elem_send_] number of elements to send. -c elements_send desc_str_p[p+elem_send_+i] indexes of local elements to -c send. these are stored in the -c array from location p+elem_send_ to -c location p+elem_send_+ -c desc_str_p[p+n_elem_send_]-1. -c list is ended by -1 value -c -c np integer (global input) -c number of grid process. -c -c mode integer (global input) -c if mode =0 then will be inserted also duplicate element in -c a same dependence list -c if mode =1 then not will be inserted duplicate element in -c a same dependence list -c output -c ===== -c only for root (pid=0) process: -c dep_list integer array(dl_lda,0:np) -c dependence list dep_list(*,i) is the list of process identifiers to which process i -c must communicate with. this list with its order is extracted from -c desc_str list. -c length_dl integer array(0:np) -c length_dl(i) is the length of dep_list(*,i) list - use psb_penv_mod - use psb_const_mod - use psb_error_mod - use psb_descriptor_type - implicit none - include 'mpif.h' -c ....scalar parameters... - integer np,dl_lda,mode, info - -c ....array parameters.... - integer desc_str(*),desc_data(*), - + dep_list(dl_lda,0:np),length_dl(0:np) - integer, pointer :: itmp(:) -c .....local arrays.... - integer int_err(5) - double precision real_err(5) - -c .....local scalars... - integer i,nprow,npcol,me,mycol,pointer_dep_list,proc,j,err_act - integer ictxt, err, icomm - logical debug - parameter (debug=.false.) - character name*20 - name='psi_extrct_dl' - - call psb_erractionsave(err_act) - - info = 0 - ictxt = desc_data(psb_ctxt_) - - - call psb_info(ictxt,me,nprow) - do i=0,np - length_dl(i) = 0 - enddo - i=1 - if (debug) write(0,*) 'extract: info ',info, - + desc_data(psb_dec_type_) - pointer_dep_list=1 -c$$$ if (desc_data(psb_dec_type_).eq.psb_desc_bld_) then - if (psb_is_bld_dec(desc_data(psb_dec_type_))) then - do while (desc_str(i).ne.-1) - if (debug) write(0,*) me,' extract: looping ',i, - + desc_str(i),desc_str(i+1),desc_str(i+2) - -c ...with different decomposition type we have different -c structure of indices lists............................ - if ((desc_str(i+1).ne.0).or.(desc_str(i+2).ne.0)) then -c ..if number of element to be exchanged !=0 - proc=desc_str(i) - if ((proc.lt.0).or.(proc.ge.nprow)) then - if (debug) write(0,*) 'extract error ',i,desc_str(i) - info = 9999 - int_err(1) = i - int_err(2) = desc_str(i) - goto 998 - endif -! if((me.eq.1).and.(proc.eq.3))write(0,*)'found 3' - if (mode.eq.1) then -c ...search if already exist proc -c in dep_list(*,me)... - j=1 - do while ((j.lt.pointer_dep_list).and. - + (dep_list(j,me).ne.proc)) - j=j+1 - enddo - - if (j.eq.pointer_dep_list) then -c ...if not found..... - dep_list(pointer_dep_list,me)=proc - pointer_dep_list=pointer_dep_list+1 - endif - else if (mode.eq.0) then - if (pointer_dep_list.gt.dl_lda) then - info = 4000 - goto 998 - endif - dep_list(pointer_dep_list,me)=proc - pointer_dep_list=pointer_dep_list+1 - endif - endif - i=i+desc_str(i+1)+2 - enddo -c$$$ else if (desc_data(psb_dec_type_).eq.psb_desc_upd_) then - else if (psb_is_upd_dec(desc_data(psb_dec_type_))) then - do while (desc_str(i).ne.-1) - if (debug) write(0,*) 'extract: looping ',i,desc_str(i) - -c ...with different decomposition type we have different -c structure of indices lists............................ - if (desc_str(i+1).ne.0) then - - proc=desc_str(i) -c ..if number of element to be exchanged !=0 - - if (mode.eq.1) then -c ...search if already exist proc.... - j=1 - do while ((j.lt.pointer_dep_list).and. - + (dep_list(j,me).ne.proc)) - j=j+1 - enddo - if (j.eq.pointer_dep_list) then -c ...if not found..... - if (pointer_dep_list.gt.dl_lda) then - info = 4000 - goto 998 - endif - dep_list(pointer_dep_list,me)=proc - pointer_dep_list=pointer_dep_list+1 - endif - else if (mode.eq.0) then - if (pointer_dep_list.gt.dl_lda) then - info = 4000 - goto 998 - endif - dep_list(pointer_dep_list,me)=proc - pointer_dep_list=pointer_dep_list+1 - endif - endif - i=i+desc_str(i+1)+2 - enddo - else - write(0,*) 'invalid dec_type',desc_data(psb_dec_type_) - info = 2020 - goto 9999 - endif - - length_dl(me)=pointer_dep_list-1 - -c ... check for errors... - 998 continue - if (debug) write(0,*) 'extract: info ',info - err = info - - if (err.ne.0) goto 9999 - - call psb_sum(ictxt,length_dl(0:np)) - call psb_get_mpicomm(ictxt,icomm ) - allocate(itmp(dl_lda),stat=info) - if (info /= 0) goto 9999 - itmp(1:dl_lda) = dep_list(1:dl_lda,me) - call mpi_allgather(itmp,dl_lda,mpi_integer, - + dep_list,dl_lda,mpi_integer,icomm,info) - deallocate(itmp) - - call psb_erractionrestore(err_act) - return - - - 9999 continue - - call psb_errpush(info,name,i_err=int_err) - call psb_erractionrestore(err_act) - if (err_act.eq.psb_act_ret_) then - return - else - call psb_error() - endif - return - - end diff --git a/base/internals/psi_extrct_dl.f90 b/base/internals/psi_extrct_dl.f90 new file mode 100644 index 00000000..f5fb633a --- /dev/null +++ b/base/internals/psi_extrct_dl.f90 @@ -0,0 +1,276 @@ +!!$ +!!$ Parallel Sparse BLAS v2.0 +!!$ (C) Copyright 2006 Salvatore Filippone University of Rome Tor Vergata +!!$ Alfredo Buttari University of Rome Tor Vergata +!!$ +!!$ Redistribution and use in source and binary forms, with or without +!!$ modification, are permitted provided that the following conditions +!!$ are met: +!!$ 1. Redistributions of source code must retain the above copyright +!!$ notice, this list of conditions and the following disclaimer. +!!$ 2. Redistributions in binary form must reproduce the above copyright +!!$ notice, this list of conditions, and the following disclaimer in the +!!$ documentation and/or other materials provided with the distribution. +!!$ 3. The name of the PSBLAS group or the names of its contributors may +!!$ not be used to endorse or promote products derived from this +!!$ software without specific written permission. +!!$ +!!$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +!!$ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +!!$ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +!!$ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +!!$ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +!!$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +!!$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +!!$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +!!$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +!!$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +!!$ POSSIBILITY OF SUCH DAMAGE. +!!$ +!!$ +subroutine psi_extract_dep_list(desc_data,desc_str,dep_list,& + & length_dl,np,dl_lda,mode,info) + + ! internal routine + ! ================ + ! + ! _____called by psi_crea_halo and psi_crea_ovrlap ______ + ! + ! purpose + ! ======= + ! process root (pid=0) extracts for each process "k" the ordered list of process + ! to which "k" must communicate. this list with its order is extracted from + ! desc_str list + ! + ! + ! input + ! ======= + ! desc_data :integer array + ! explanation: + ! name explanation + ! ------------------ ------------------------------------------------------- + ! desc_data array of integer that contains some local and global + ! information of matrix. + ! + ! + ! now we explain each of the above vectors. + ! + ! let a be a generic sparse matrix. we denote with matdata_a the matrix_data + ! array for matrix a. + ! data stored in matrix_data array are: + ! + ! notation stored in explanation + ! --------------- ---------------------- ------------------------------------- + ! dec_type matdata_a[psb_dec_type_] decomposition type + ! m matdata_a[m_] total number of equations + ! n matdata_a[n_] total number of variables + ! n_row matdata_a[psb_n_row_] number of local equations + ! n_col matdata_a[psb_n_col_] number of local variables + ! psb_ctxt_a matdata_a[ctxt_] the blacs context handle, indicating + ! the global context of the operation + ! on the matrix. + ! the context itself is global. + ! desc_str integer array + ! explanation: + ! let desc_str_p be the array desc_str for local process. + !! this is composed of variable dimension blocks for each process to + ! communicate to. + ! each block contain indexes of local halo elements to exchange with other + ! process. + ! let p be the pointer to the first element of a block in desc_str_p. + ! this block is stored in desc_str_p as : + ! + ! notation stored in explanation + ! --------------- --------------------------- ----------------------------------- + ! process_id desc_str_p[p+psb_proc_id_] identifier of process which exchange + ! data with. + ! n_elements_recv desc_str_p[p+n_elem_recv_] number of elements to receive. + ! elements_recv desc_str_p[p+elem_recv_+i] indexes of local elements to + ! receive. these are stored in the + ! array from location p+elem_recv_ to + ! location p+elem_recv_+ + ! desc_str_p[p+n_elem_recv_]-1. + ! if desc_data(psb_dec_type_) == 0 + ! then also will be: + ! n_elements_send desc_str_p[p+n_elem_send_] number of elements to send. + ! elements_send desc_str_p[p+elem_send_+i] indexes of local elements to + ! send. these are stored in the + ! array from location p+elem_send_ to + ! location p+elem_send_+ + ! desc_str_p[p+n_elem_send_]-1. + ! list is ended by -1 value + ! + ! np integer (global input) + ! number of grid process. + ! + ! mode integer (global input) + ! if mode =0 then will be inserted also duplicate element in + ! a same dependence list + ! if mode =1 then not will be inserted duplicate element in + ! a same dependence list + ! output + ! ===== + ! only for root (pid=0) process: + ! dep_list integer array(dl_lda,0:np) + ! dependence list dep_list(*,i) is the list of process identifiers to which process i + ! must communicate with. this list with its order is extracted from + ! desc_str list. + ! length_dl integer array(0:np) + ! length_dl(i) is the length of dep_list(*,i) list + use mpi + use psb_penv_mod + use psb_const_mod + use psb_error_mod + use psb_descriptor_type + implicit none + ! ....scalar parameters... + integer np,dl_lda,mode, info + + ! ....array parameters.... + integer :: desc_str(*),desc_data(*),dep_list(dl_lda,0:np),length_dl(0:np) + integer, pointer :: itmp(:) + ! .....local arrays.... + integer int_err(5) + double precision real_err(5) + + ! .....local scalars... + integer i,nprow,npcol,me,mycol,pointer_dep_list,proc,j,err_act + integer ictxt, err, icomm + logical, parameter :: debug=.false. + character name*20 + name='psi_extrct_dl' + + call psb_erractionsave(err_act) + + info = 0 + ictxt = desc_data(psb_ctxt_) + + + call psb_info(ictxt,me,nprow) + do i=0,np + length_dl(i) = 0 + enddo + i=1 + if (debug) write(0,*) 'extract: info ',info,desc_data(psb_dec_type_) + pointer_dep_list=1 + if (psb_is_bld_dec(desc_data(psb_dec_type_))) then + do while (desc_str(i) /= -1) + if (debug) write(0,*) me,' extract: looping ',i,& + & desc_str(i),desc_str(i+1),desc_str(i+2) + + ! ...with different decomposition type we have different + ! structure of indices lists............................ + if ((desc_str(i+1) /= 0).or.(desc_str(i+2) /= 0)) then + ! ..if number of element to be exchanged !=0 + proc=desc_str(i) + if ((proc < 0).or.(proc.ge.nprow)) then + if (debug) write(0,*) 'extract error ',i,desc_str(i) + info = 9999 + int_err(1) = i + int_err(2) = desc_str(i) + goto 998 + endif + ! if((me == 1).and.(proc == 3))write(0,*)'found 3' + if (mode == 1) then + ! ...search if already exist proc + ! in dep_list(*,me)... + j=1 + do while ((j < pointer_dep_list).and.& + & (dep_list(j,me) /= proc)) + j=j+1 + enddo + + if (j == pointer_dep_list) then + ! ...if not found..... + dep_list(pointer_dep_list,me)=proc + pointer_dep_list=pointer_dep_list+1 + endif + else if (mode == 0) then + if (pointer_dep_list.gt.dl_lda) then + info = 4000 + goto 998 + endif + dep_list(pointer_dep_list,me)=proc + pointer_dep_list=pointer_dep_list+1 + endif + endif + i=i+desc_str(i+1)+2 + enddo + else if (psb_is_upd_dec(desc_data(psb_dec_type_))) then + do while (desc_str(i) /= -1) + if (debug) write(0,*) 'extract: looping ',i,desc_str(i) + + ! ...with different decomposition type we have different + ! structure of indices lists............................ + if (desc_str(i+1) /= 0) then + + proc=desc_str(i) + ! ..if number of element to be exchanged !=0 + + if (mode == 1) then + ! ...search if already exist proc.... + j=1 + do while ((j < pointer_dep_list).and.& + & (dep_list(j,me) /= proc)) + j=j+1 + enddo + if (j == pointer_dep_list) then + ! ...if not found..... + if (pointer_dep_list.gt.dl_lda) then + info = 4000 + goto 998 + endif + dep_list(pointer_dep_list,me)=proc + pointer_dep_list=pointer_dep_list+1 + endif + else if (mode == 0) then + if (pointer_dep_list.gt.dl_lda) then + info = 4000 + goto 998 + endif + dep_list(pointer_dep_list,me)=proc + pointer_dep_list=pointer_dep_list+1 + endif + endif + i=i+desc_str(i+1)+2 + enddo + else + write(0,*) 'invalid dec_type',desc_data(psb_dec_type_) + info = 2020 + goto 9999 + endif + + length_dl(me)=pointer_dep_list-1 + + ! ... check for errors... +998 continue + if (debug) write(0,*) 'extract: info ',info + err = info + + if (err /= 0) goto 9999 + + call psb_sum(ictxt,length_dl(0:np)) + call psb_get_mpicomm(ictxt,icomm ) + allocate(itmp(dl_lda),stat=info) + if (info /= 0) goto 9999 + itmp(1:dl_lda) = dep_list(1:dl_lda,me) + call mpi_allgather(itmp,dl_lda,mpi_integer,& + & dep_list,dl_lda,mpi_integer,icomm,info) + deallocate(itmp) + + call psb_erractionrestore(err_act) + return + + +9999 continue + + call psb_errpush(info,name,i_err=int_err) + call psb_erractionrestore(err_act) + if (err_act == psb_act_ret_) then + return + else + call psb_error() + endif + return + +end subroutine psi_extract_dep_list diff --git a/base/modules/Makefile b/base/modules/Makefile index fb3135b3..2cbf591c 100644 --- a/base/modules/Makefile +++ b/base/modules/Makefile @@ -12,7 +12,7 @@ MODULES = psb_realloc_mod.o psb_string_mod.o psb_spmat_type.o \ LIBMOD=psb_base_mod$(.mod) MPFOBJS=psb_penv_mod.o -OBJS = error.o psb_base_mod.o +OBJS = error.o psb_base_mod.o $(EXTRA_COBJS) LIBDIR = .. INCDIRS = -I . diff --git a/base/modules/blacs_env.F90 b/base/modules/blacs_env.F90 index 824d50ae..8aae4ad2 100644 --- a/base/modules/blacs_env.F90 +++ b/base/modules/blacs_env.F90 @@ -23,15 +23,23 @@ subroutine psb_restore_coher(ictxt,isvch) end subroutine psb_restore_coher subroutine psb_get_mpicomm(ictxt,comm) integer :: ictxt, comm +#if !defined(SERIAL_MPI) call blacs_get(ictxt,10,comm) +#else + comm = ictxt +#endif end subroutine psb_get_mpicomm subroutine psb_get_rank(rank,ictxt,id) integer :: rank,ictxt, id integer :: blacs_pnum +#if defined(SERIAL_MPI) + rank = 0 +#else rank = blacs_pnum(ictxt,id,0) +#endif end subroutine psb_get_rank -#ifdef ESSL_BLACS +#if defined(ESSL_BLACS) || defined(SERIAL_MPI) ! ! Need these, as they are not in the ESSL implementation ! of the BLACS. diff --git a/base/modules/error.f90 b/base/modules/error.f90 index 70782b36..3dc53fbe 100644 --- a/base/modules/error.f90 +++ b/base/modules/error.f90 @@ -101,7 +101,7 @@ subroutine FCpsb_get_errverbosity(v) integer, intent(out) :: v - call psb_get_errverbosity(v) + v = psb_get_errverbosity() end subroutine FCpsb_get_errverbosity diff --git a/base/modules/fakempi.c b/base/modules/fakempi.c new file mode 100644 index 00000000..c1fba4b0 --- /dev/null +++ b/base/modules/fakempi.c @@ -0,0 +1,134 @@ +#include +#include +#include + +#ifdef Add_ +#define mpi_wtime mpi_wtime_ +#define mpi_send mpi_send_ +#define mpi_irecv mpi_irecv_ +#define mpi_wait mpi_wait_ +#define mpi_alltoall mpi_alltoall_ +#define mpi_alltoallv mpi_alltoallv_ +#define mpi_allgather mpi_allgather_ +#define mpi_allgatherv mpi_allgatherv_ +#endif +#define mpi_integer 1 +#define mpi_double 3 +#define mpi_double_complex 5 + +double mpi_wtime() +{ + struct timeval tt; + struct timezone tz; + double temp; + if (gettimeofday(&tt,&tz) != 0) { + fprintf(stderr,"Fatal error for gettimeofday ??? \n"); + temp=0.0; + } else { + temp = ((double)tt.tv_sec) + ((double)tt.tv_usec)*1.0e-6; + } + return(temp); +} + + +void mpi_wait() +{ + return; +} +void mpi_send() +{ + return; +} +void mpi_irecv() +{ + return; +} + + +void mpi_alltoall(void* sdb, int* sdc, int* sdt, + void* rvb, int* rvc, int* rvt, int* comm, int* ierr) +{ + int i,j,k; + + if (*sdt == mpi_integer) { + memcpy(rvb,sdb, (*sdc)*sizeof(int)); + } + if (*sdt == mpi_double) { + memcpy(rvb,sdb, (*sdc)*sizeof(double)); + } + if (*sdt == mpi_double_complex) { + memcpy(rvb,sdb, (*sdc)*2*sizeof(double)); + } + *ierr = 0; +} + +void mpi_alltoallv(void* sdb, int* sdc, int* sdspl, int* sdt, + void* rvb, int* rvc, int* rdspl, int* rvt, int* comm, int* ierr) +{ + int i,j,k; + + + if (*sdt == mpi_integer) { + memcpy((rvb+rdspl[0]*sizeof(int)), + (sdb+sdspl[0]*sizeof(int)),(*sdc)*sizeof(int)); + } + if (*sdt == mpi_double) { + memcpy((rvb+rdspl[0]*sizeof(double)), + (sdb+sdspl[0]*sizeof(double)),(*sdc)*sizeof(double)); + } + if (*sdt == mpi_double_complex) { + memcpy((rvb+rdspl[0]*2*sizeof(double)), + (sdb+sdspl[0]*2*sizeof(double)),(*sdc)*2*sizeof(double)); + } + *ierr = 0; +} + + +void mpi_allgather(void* sdb, int* sdc, int* sdt, + void* rvb, int* rvc, int* rvt, int* comm, int* ierr) +{ + int i,j,k; + + if (*sdt == mpi_integer) { + memcpy(rvb,sdb, (*sdc)*sizeof(int)); + } + if (*sdt == mpi_double) { + memcpy(rvb,sdb, (*sdc)*sizeof(double)); + } + if (*sdt == mpi_double_complex) { + memcpy(rvb,sdb, (*sdc)*2*sizeof(double)); + } + *ierr = 0; +} + +void mpi_allgatherv(void* sdb, int* sdc, int* sdt, + void* rvb, int* rvc, int* rdspl, + int* rvt, int* comm, int* ierr) +{ + int i,j,k; + + if (*sdt == mpi_integer) { + memcpy(rvb,sdb, (*sdc)*sizeof(int)); + } + if (*sdt == mpi_double) { + memcpy(rvb,sdb, (*sdc)*sizeof(double)); + } + if (*sdt == mpi_double_complex) { + memcpy(rvb,sdb, (*sdc)*2*sizeof(double)); + } + if (*sdt == mpi_integer) { + memcpy((rvb+rdspl[0]*sizeof(int)), + (sdb),(*sdc)*sizeof(int)); + } + if (*sdt == mpi_double) { + memcpy((rvb+rdspl[0]*sizeof(double)), + (sdb),(*sdc)*sizeof(double)); + } + if (*sdt == mpi_double_complex) { + memcpy((rvb+rdspl[0]*2*sizeof(double)), + (sdb),(*sdc)*2*sizeof(double)); + } + + + *ierr = 0; +} diff --git a/base/modules/psb_error_mod.f90 b/base/modules/psb_error_mod.F90 similarity index 98% rename from base/modules/psb_error_mod.f90 rename to base/modules/psb_error_mod.F90 index d893bd5b..376ca201 100644 --- a/base/modules/psb_error_mod.f90 +++ b/base/modules/psb_error_mod.F90 @@ -112,8 +112,10 @@ contains integer :: temp(2) integer, parameter :: ione=1 ! Cannot use psb_amx or otherwise we have a recursion in module usage +#if !defined(SERIAL_MPI) call igamx2d(ictxt, 'A', ' ', ione, ione, err, ione,& &temp ,temp,-ione ,-ione,-ione) +#endif end subroutine psb_errcomm @@ -127,10 +129,11 @@ contains ! returns verbosity of the error message - subroutine psb_get_errverbosity(v) - integer, intent(out) :: v - v=verbosity_level - end subroutine psb_get_errverbosity + function psb_get_errverbosity() + integer :: psb_get_errverbosity + + psb_get_errverbosity=verbosity_level + end function psb_get_errverbosity @@ -203,7 +206,6 @@ contains integer :: nprow, npcol, me, mypcol integer, parameter :: ione=1, izero=0 - call blacs_gridinfo(ictxt, nprow, npcol, me, mypcol) if(error_status.gt.0) then if(verbosity_level.gt.1) then @@ -214,7 +216,11 @@ contains call psb_errmsg(err_c, r_name, i_e_d, a_e_d,me) ! write(0,'(50("="))') end do +#if defined(SERIAL_MPI) + stop +#else call blacs_abort(ictxt,-1) +#endif else call psb_errpop(err_c, r_name, i_e_d, a_e_d) @@ -222,12 +228,20 @@ contains do while (error_stack%n_elems.gt.0) call psb_errpop(err_c, r_name, i_e_d, a_e_d) end do +#if defined(SERIAL_MPI) + stop +#else call blacs_abort(ictxt,-1) +#endif end if end if if(error_status.gt.izero) then +#if defined(SERIAL_MPI) + stop +#else call blacs_abort(ictxt,err_c) +#endif end if diff --git a/base/modules/psb_penv_mod.f90 b/base/modules/psb_penv_mod.F90 similarity index 92% rename from base/modules/psb_penv_mod.f90 rename to base/modules/psb_penv_mod.F90 index b8e57c58..3ad735ee 100644 --- a/base/modules/psb_penv_mod.f90 +++ b/base/modules/psb_penv_mod.F90 @@ -28,6 +28,18 @@ !!$ POSSIBILITY OF SUCH DAMAGE. !!$ !!$ +#if defined(SERIAL_MPI) +! Provide a fake mpi module just to keep the compiler(s) happy. +module mpi + integer, parameter :: mpi_success=0 + integer, parameter :: mpi_request_null=0 + integer, parameter :: mpi_status_size=1 + integer, parameter :: mpi_integer=1, mpi_double_precision=3 + integer, parameter :: mpi_double_complex=5 + real(kind(1.d0)), external :: mpi_wtime +end module mpi +#endif + module psb_penv_mod @@ -107,6 +119,7 @@ module psb_penv_mod & psb_zsums, psb_zsumv, psb_zsumm end interface +#if !defined(SERIAL_MPI) interface gebs2d module procedure igebs2ds, igebs2dv, igebs2dm,& @@ -150,12 +163,13 @@ module psb_penv_mod & dgamn2ds, dgamn2dv, dgamn2dm,& & zgamn2ds, zgamn2dv, zgamn2dm end interface +#endif - -contains - - +#if defined(SERIAL_MPI) + integer, private, save :: nctxt=0 +#endif +contains subroutine psb_init(ictxt,np) use psb_const_mod @@ -165,7 +179,11 @@ contains integer :: np_, npavail, iam, info character(len=20), parameter :: name='psb_init' - +#if defined(SERIAL_MPI) + ictxt = nctxt + nctxt = nctxt + 1 + np_ = 1 +#else call blacs_pinfo(iam, npavail) call blacs_get(izero, izero, ictxt) @@ -176,7 +194,7 @@ contains endif call blacs_gridinit(ictxt, 'R', np_, ione) - +#endif if (present(np)) then if (np_ < np) then info = 2011 @@ -192,7 +210,8 @@ contains logical, intent(in), optional :: close logical :: close_ integer :: nprow, npcol, myprow, mypcol - + +#if !defined(SERIAL_MPI) if (present(close)) then close_ = close else @@ -203,28 +222,34 @@ contains call blacs_gridexit(ictxt) end if if (close_) call blacs_exit(0) +#endif end subroutine psb_exit subroutine psb_barrier(ictxt) integer, intent(in) :: ictxt - + +#if !defined(SERIAL_MPI) call blacs_barrier(ictxt,'All') +#endif end subroutine psb_barrier function psb_wtime() + use mpi real(kind(1.d0)) :: psb_wtime - - real(kind(1.d0)), external :: mpi_wtime - + psb_wtime = mpi_wtime() end function psb_wtime subroutine psb_abort(ictxt) integer, intent(in) :: ictxt +#if defined(SERIAL_MPI) + stop +#else call blacs_abort(ictxt,-1) +#endif end subroutine psb_abort @@ -235,10 +260,15 @@ contains integer, intent(out) :: iam, np integer :: nprow, npcol, myprow, mypcol +#if defined(SERIAL_MPI) + iam = 0 + np = 1 +#else call blacs_gridinfo(ictxt, nprow, npcol, myprow, mypcol) iam = myprow np = nprow +#endif end subroutine psb_info @@ -250,6 +280,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -263,6 +294,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_ibcasts subroutine psb_ibcastv(ictxt,dat,root) @@ -272,6 +304,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -285,6 +318,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_ibcastv subroutine psb_ibcastm(ictxt,dat,root) @@ -294,6 +328,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -307,6 +342,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_ibcastm @@ -317,6 +353,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -330,6 +367,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_dbcasts @@ -340,6 +378,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -353,6 +392,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_dbcastv subroutine psb_dbcastm(ictxt,dat,root) @@ -362,6 +402,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -375,6 +416,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_dbcastm @@ -385,6 +427,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -398,6 +441,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zbcasts subroutine psb_zbcastv(ictxt,dat,root) @@ -407,6 +451,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -420,6 +465,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zbcastv subroutine psb_zbcastm(ictxt,dat,root) @@ -429,6 +475,7 @@ contains integer :: iam, np, root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -442,6 +489,7 @@ contains else call gebr2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zbcastm @@ -453,6 +501,7 @@ contains integer :: iam, np, root_,icomm,length_,info +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -468,6 +517,7 @@ contains call psb_get_mpicomm(ictxt,icomm) call mpi_bcast(dat,length_,MPI_CHARACTER,root_,icomm,info) +#endif end subroutine psb_hbcasts @@ -479,6 +529,7 @@ contains integer :: iam, np, root_,icomm,info +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -488,6 +539,7 @@ contains call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) call mpi_bcast(dat,1,MPI_LOGICAL,root_,icomm,info) +#endif end subroutine psb_lbcasts @@ -502,6 +554,7 @@ contains integer :: iam, np, icomm +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -517,6 +570,7 @@ contains call mpi_reduce(dat,dat_,1,mpi_integer,mpi_max,root_,icomm) dat = dat_ endif +#endif end subroutine psb_imaxs subroutine psb_imaxv(ictxt,dat,root) use mpi @@ -528,6 +582,7 @@ contains integer, allocatable :: dat_(:) integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -548,6 +603,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_max,root_,icomm) end if endif +#endif end subroutine psb_imaxv subroutine psb_imaxm(ictxt,dat,root) use mpi @@ -560,6 +616,7 @@ contains integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -579,6 +636,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_max,root_,icomm) end if endif +#endif end subroutine psb_imaxm subroutine psb_dmaxs(ictxt,dat,root) @@ -591,6 +649,7 @@ contains integer :: iam, np, icomm +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -606,6 +665,7 @@ contains call mpi_reduce(dat,dat_,1,mpi_double_precision,mpi_max,root_,icomm) dat = dat_ endif +#endif end subroutine psb_dmaxs subroutine psb_dmaxv(ictxt,dat,root) use mpi @@ -618,6 +678,7 @@ contains integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -629,7 +690,8 @@ contains if (root_ == -1) then call psb_realloc(size(dat),dat_,info) dat_ = dat - if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm) + if (info ==0) & + & call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm) else if (iam==root_) then call psb_realloc(size(dat),dat_,info) @@ -639,6 +701,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_max,root_,icomm) end if endif +#endif end subroutine psb_dmaxv subroutine psb_dmaxm(ictxt,dat,root) use mpi @@ -650,6 +713,7 @@ contains real(kind(1.d0)), allocatable :: dat_(:,:) integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -662,7 +726,8 @@ contains if (root_ == -1) then call psb_realloc(size(dat,1),size(dat,2),dat_,info) dat_ = dat - if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm) + if (info ==0)& + & call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_max,icomm) else if (iam==root_) then call psb_realloc(size(dat,1),size(dat,2),dat_,info) @@ -672,6 +737,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_max,root_,icomm) end if endif +#endif end subroutine psb_dmaxm @@ -683,6 +749,7 @@ contains integer :: root_, dat_ integer :: iam, np, icomm +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -699,6 +766,7 @@ contains call mpi_reduce(dat,dat_,1,mpi_integer,mpi_min,root_,icomm) dat = dat_ endif +#endif end subroutine psb_imins subroutine psb_iminv(ictxt,dat,root) use mpi @@ -711,6 +779,7 @@ contains integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -730,6 +799,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_min,root_,icomm) end if endif +#endif end subroutine psb_iminv subroutine psb_iminm(ictxt,dat,root) use mpi @@ -742,6 +812,7 @@ contains integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -761,6 +832,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_integer,mpi_min,root_,icomm) end if endif +#endif end subroutine psb_iminm subroutine psb_dmins(ictxt,dat,root) @@ -773,6 +845,7 @@ contains integer :: iam, np, icomm +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -788,6 +861,7 @@ contains call mpi_reduce(dat,dat_,1,mpi_double_precision,mpi_min,root_,icomm) dat = dat_ endif +#endif end subroutine psb_dmins subroutine psb_dminv(ictxt,dat,root) use mpi @@ -800,6 +874,7 @@ contains integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -811,7 +886,8 @@ contains if (root_ == -1) then call psb_realloc(size(dat),dat_,info) dat_ = dat - if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm) + if (info ==0) & + & call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm) else if (iam==root_) then call psb_realloc(size(dat),dat_,info) @@ -821,6 +897,7 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_min,root_,icomm) end if endif +#endif end subroutine psb_dminv subroutine psb_dminm(ictxt,dat,root) use mpi @@ -832,6 +909,7 @@ contains real(kind(1.d0)), allocatable :: dat_(:,:) integer :: iam, np, icomm, info +#if !defined(SERIAL_MPI) call psb_info(ictxt,iam,np) call psb_get_mpicomm(ictxt,icomm) @@ -844,7 +922,8 @@ contains if (root_ == -1) then call psb_realloc(size(dat,1),size(dat,2),dat_,info) dat_ = dat - if (info ==0) call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm) + if (info ==0) & + & call mpi_allreduce(dat_,dat,size(dat),mpi_double_precision,mpi_min,icomm) else if (iam==root_) then call psb_realloc(size(dat,1),size(dat,2),dat_,info) @@ -854,6 +933,8 @@ contains call mpi_reduce(dat,dat_,size(dat),mpi_double_precision,mpi_min,root_,icomm) end if endif +#endif + end subroutine psb_dminm @@ -865,6 +946,11 @@ contains integer :: root_ +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -875,6 +961,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_iamxs subroutine psb_iamxv(ictxt,dat,root,ia) @@ -886,6 +973,12 @@ contains integer :: root_ integer, allocatable :: cia(:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -897,6 +990,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_iamxv subroutine psb_iamxm(ictxt,dat,root,ia) @@ -908,6 +1002,12 @@ contains integer :: root_ integer, allocatable :: cia(:,:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -919,6 +1019,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_iamxm @@ -930,6 +1031,12 @@ contains integer :: root_ + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -940,6 +1047,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_damxs subroutine psb_damxv(ictxt,dat,root,ia) @@ -951,6 +1059,12 @@ contains integer :: root_ integer, allocatable :: cia(:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -962,6 +1076,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_damxv subroutine psb_damxm(ictxt,dat,root,ia) @@ -973,6 +1088,12 @@ contains integer :: root_ integer, allocatable :: cia(:,:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -984,6 +1105,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_damxm @@ -995,6 +1117,12 @@ contains integer :: root_ + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1005,6 +1133,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zamxs subroutine psb_zamxv(ictxt,dat,root,ia) @@ -1016,6 +1145,12 @@ contains integer :: root_ integer, allocatable :: cia(:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1027,6 +1162,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zamxv subroutine psb_zamxm(ictxt,dat,root,ia) @@ -1038,6 +1174,12 @@ contains integer :: root_ integer, allocatable :: cia(:,:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1049,6 +1191,7 @@ contains else call gamx2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zamxm @@ -1061,6 +1204,12 @@ contains integer :: root_ + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1071,6 +1220,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_iamns subroutine psb_iamnv(ictxt,dat,root,ia) @@ -1082,6 +1232,12 @@ contains integer :: root_ integer, allocatable :: cia(:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1093,6 +1249,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_iamnv subroutine psb_iamnm(ictxt,dat,root,ia) @@ -1104,6 +1261,12 @@ contains integer :: root_ integer, allocatable :: cia(:,:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1115,6 +1278,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_iamnm @@ -1126,6 +1290,12 @@ contains integer :: root_ + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1136,6 +1306,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_damns subroutine psb_damnv(ictxt,dat,root,ia) @@ -1147,6 +1318,12 @@ contains integer :: root_ integer, allocatable :: cia(:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1158,6 +1335,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_damnv subroutine psb_damnm(ictxt,dat,root,ia) @@ -1169,6 +1347,12 @@ contains integer :: root_ integer, allocatable :: cia(:,:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1180,6 +1364,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_damnm @@ -1191,6 +1376,12 @@ contains integer :: root_ + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1201,6 +1392,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zamns subroutine psb_zamnv(ictxt,dat,root,ia) @@ -1212,6 +1404,12 @@ contains integer :: root_ integer, allocatable :: cia(:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1223,6 +1421,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zamnv subroutine psb_zamnm(ictxt,dat,root,ia) @@ -1234,6 +1433,12 @@ contains integer :: root_ integer, allocatable :: cia(:,:) + +#if defined(SERIAL_MPI) + if (present(ia)) then + ia = 0 + end if +#else if (present(root)) then root_ = root else @@ -1245,6 +1450,7 @@ contains else call gamn2d(ictxt,'A',dat,rrt=root_) endif +#endif end subroutine psb_zamnm @@ -1256,6 +1462,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1263,6 +1470,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_isums @@ -1273,6 +1481,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1280,6 +1489,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_isumv subroutine psb_isumm(ictxt,dat,root) @@ -1289,6 +1499,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1297,6 +1508,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_isumm @@ -1308,6 +1520,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1315,6 +1528,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_dsums @@ -1325,6 +1539,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1332,6 +1547,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_dsumv @@ -1342,6 +1558,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1350,6 +1567,7 @@ contains call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_dsumm @@ -1360,6 +1578,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1367,6 +1586,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_zsums @@ -1378,6 +1598,7 @@ contains integer :: root_ integer, allocatable :: cia(:) +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1385,6 +1606,7 @@ contains endif call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_zsumv @@ -1395,6 +1617,7 @@ contains integer :: root_ +#if !defined(SERIAL_MPI) if (present(root)) then root_ = root else @@ -1403,11 +1626,13 @@ contains call gsum2d(ictxt,'A',dat,rrt=root_) +#endif end subroutine psb_zsumm subroutine psb_hsnds(ictxt,dat,dst,length) + use psb_error_mod integer, intent(in) :: ictxt character(len=*), intent(in) :: dat integer, intent(in) :: dst @@ -1415,6 +1640,11 @@ contains integer, allocatable :: buffer(:) integer :: length_, i +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else if (present(length)) then length_ = length else @@ -1426,10 +1656,11 @@ contains end do call gesd2d(ictxt,buffer,dst,0) - +#endif end subroutine psb_hsnds subroutine psb_hrcvs(ictxt,dat,src,length) + use psb_error_mod integer, intent(in) :: ictxt character(len=*), intent(out) :: dat integer, intent(in) :: src @@ -1437,6 +1668,12 @@ contains integer, allocatable :: buffer(:) integer :: length_, i +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = '' +#else if (present(length)) then length_ = length else @@ -1448,208 +1685,357 @@ contains do i=1,length_ dat(i:i) = achar(buffer(i)) end do +#endif end subroutine psb_hrcvs subroutine psb_lsnds(ictxt,dat,dst,length) + use psb_error_mod integer, intent(in) :: ictxt logical, intent(in) :: dat integer, intent(in) :: dst integer :: i +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else if (dat) then i = 1 else i = 0 endif call gesd2d(ictxt,i,dst,0) +#endif end subroutine psb_lsnds subroutine psb_lrcvs(ictxt,dat,src,length) + use psb_error_mod integer, intent(in) :: ictxt logical, intent(out) :: dat integer, intent(in) :: src integer :: i +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = .false. +#else call gerv2d(ictxt,i,src,0) dat = (i == 1) +#endif end subroutine psb_lrcvs subroutine psb_isnds(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt integer, intent(in) :: dat integer, intent(in) :: dst - +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_isnds subroutine psb_isndv(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt integer, intent(in) :: dat(:) integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_isndv subroutine psb_isndm(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt integer, intent(in) :: dat(:,:) integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_isndm subroutine psb_dsnds(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt real(kind(1.d0)), intent(in) :: dat integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_dsnds subroutine psb_dsndv(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt real(kind(1.d0)), intent(in) :: dat(:) integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_dsndv subroutine psb_dsndm(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt real(kind(1.d0)), intent(in) :: dat(:,:) integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_dsndm subroutine psb_zsnds(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt complex(kind(1.d0)), intent(in) :: dat integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_zsnds subroutine psb_zsndv(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt complex(kind(1.d0)), intent(in) :: dat(:) integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_zsndv subroutine psb_zsndm(ictxt,dat,dst) + use psb_error_mod integer, intent(in) :: ictxt complex(kind(1.d0)), intent(in) :: dat(:,:) integer, intent(in) :: dst +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >1) then + write(0,*) "Warning: process sending a message in serial mode (to itself)" + endif +#else call gesd2d(ictxt,dat,dst,0) +#endif end subroutine psb_zsndm subroutine psb_ircvs(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt integer, intent(inout) :: dat integer, intent(in) :: src - - +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_ircvs subroutine psb_ircvv(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt integer, intent(inout) :: dat(:) integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_ircvv subroutine psb_ircvm(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt integer, intent(inout) :: dat(:,:) integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else + call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_ircvm subroutine psb_drcvs(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt real(kind(1.d0)), intent(inout) :: dat integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_drcvs subroutine psb_drcvv(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt real(kind(1.d0)), intent(inout) :: dat(:) integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_drcvv subroutine psb_drcvm(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt real(kind(1.d0)), intent(inout) :: dat(:,:) integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_drcvm subroutine psb_zrcvs(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt complex(kind(1.d0)), intent(inout) :: dat integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_zrcvs subroutine psb_zrcvv(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt complex(kind(1.d0)), intent(inout) :: dat(:) integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_zrcvv subroutine psb_zrcvm(ictxt,dat,src) + use psb_error_mod integer, intent(in) :: ictxt complex(kind(1.d0)), intent(inout) :: dat(:,:) integer, intent(in) :: src +#if defined(SERIAL_MPI) + if (psb_get_errverbosity() >0) then + write(0,*) "Warning: process receiving a message in serial mode (to itself)" + endif + dat = 0 +#else call gerv2d(ictxt,dat,src,0) +#endif end subroutine psb_zrcvm @@ -1658,7 +2044,7 @@ contains - +#if !defined(SERIAL_MPI) subroutine igebs2ds(ictxt,scope,dat,top) integer, intent(in) :: ictxt,dat @@ -4398,6 +4784,7 @@ contains end if end subroutine zgamn2dm +#endif end module psb_penv_mod diff --git a/base/psblas/pdtreecomb.f b/base/psblas/pdtreecomb.F similarity index 99% rename from base/psblas/pdtreecomb.f rename to base/psblas/pdtreecomb.F index 0aecf730..b95a5475 100644 --- a/base/psblas/pdtreecomb.f +++ b/base/psblas/pdtreecomb.F @@ -100,8 +100,10 @@ C DOUBLE PRECISION HIS( 2 ) * .. * .. External Subroutines .. +#if !defined(SERIAL_MPI) EXTERNAL BLACS_GRIDINFO, DGEBR2D, DGEBS2D, $ DGERV2D, DGESD2D +#endif * .. * .. External Functions .. LOGICAL LSAME @@ -122,6 +124,8 @@ C TRDEST = RDEST0 TCDEST = CDEST0 END IF +#if !defined(SERIAL_MPI) + * * Get grid parameters. * @@ -234,6 +238,7 @@ C $ TRDEST, TCDEST ) END IF END IF +#endif * RETURN * diff --git a/base/tools/psb_cd_inloc.f90 b/base/tools/psb_cd_inloc.f90 index ea308925..b7a89237 100644 --- a/base/tools/psb_cd_inloc.f90 +++ b/base/tools/psb_cd_inloc.f90 @@ -69,12 +69,18 @@ subroutine psb_cd_inloc(v, ictxt, desc_a, info) call psb_info(ictxt, me, np) if (debug) write(*,*) 'psb_cdall: ',np,me - - loc_row = size(v) - m = loc_row - call psb_sum(ictxt,m) - + + if (.false.) then + loc_row = size(v) + m = loc_row + call psb_sum(ictxt,m) + else + m = maxval(v) + call psb_max(ictxt,m) + end if + n = m + !... check m and n parameters.... if (m < 1) then info = 10 diff --git a/base/tools/psb_icdasb.f90 b/base/tools/psb_icdasb.f90 index d8677c31..d8014a8c 100644 --- a/base/tools/psb_icdasb.f90 +++ b/base/tools/psb_icdasb.f90 @@ -37,6 +37,7 @@ ! desc_a - type(). The communication descriptor. ! info - integer. Eventually returns an error code. subroutine psb_icdasb(desc_a,info,ext_hv) + use mpi use psb_descriptor_type use psb_serial_mod use psb_const_mod @@ -44,8 +45,6 @@ subroutine psb_icdasb(desc_a,info,ext_hv) use psb_error_mod use psb_penv_mod implicit none - - include 'mpif.h' !...Parameters.... type(psb_desc_type), intent(inout) :: desc_a integer, intent(out) :: info diff --git a/base/tools/psb_zsphalo.f90 b/base/tools/psb_zsphalo.f90 index f45ca835..e796ea89 100644 --- a/base/tools/psb_zsphalo.f90 +++ b/base/tools/psb_zsphalo.f90 @@ -121,14 +121,14 @@ Subroutine psb_zsphalo(a,desc_a,blk,info,rwcnv,clcnv,outfmt) sdsz(:)=0 rvsz(:)=0 ipx = 1 + blk%k = a%k + blk%m = 0 brvindx(ipx) = 0 bsdindx(ipx) = 0 counter=1 idx = 0 idxs = 0 idxr = 0 - blk%k = a%k - blk%m = 0 ! For all rows in the halo descriptor, extract and send/receive. Do proc=desc_a%halo_index(counter) diff --git a/baseprec/psb_zbaseprc_aply.f90 b/baseprec/psb_zbaseprc_aply.f90 index 824a288c..cdabda41 100644 --- a/baseprec/psb_zbaseprc_aply.f90 +++ b/baseprec/psb_zbaseprc_aply.f90 @@ -52,7 +52,7 @@ subroutine psb_zbaseprc_aply(alpha,prec,x,beta,y,desc_data,trans,work,info) character ::diagl, diagu integer :: ictxt,np,me,i, isz, nrg, err_act real(kind(1.d0)) :: t1, t2, t3, t4, t5, t6, t7 - logical,parameter :: debug=.false., debugprt=. + logical,parameter :: debug=.false., debugprt=.false. character(len=20) :: name, ch_err interface psb_bjac_aply diff --git a/test/fileread/runs/dfs.inp b/test/fileread/runs/dfs.inp index 1fcfb735..a1b9913c 100644 --- a/test/fileread/runs/dfs.inp +++ b/test/fileread/runs/dfs.inp @@ -1,5 +1,5 @@ 10 Number of inputs -young1r.mtx This (and others) from: http://math.nist.gov/MatrixMarket/ or +lapl600x600.mtx young1r.mtx This (and others) from: http://math.nist.gov/MatrixMarket/ or NONE http://www.cise.ufl.edu/research/sparse/matrices/index.html BICGSTAB CSR @@ -7,6 +7,6 @@ CSR 1 ISTOPC 00800 ITMAX -1 ITRACE -4 IPREC 0:NONE 1:DIAGSC 2:ILU 3: AS 4: RAS 5: ASH 6: RASH +2 IPREC 0:NONE 1:DIAGSC 2:ILU 1 ML 1.d-6 EPS