diff --git a/.gitignore b/.gitignore index 9d711cb9..7227f784 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,8 @@ *~ # header files generated -cbind/*.h -util/psb_metis_int.h +/cbind/*.h +/util/psb_metis_int.h # Make.inc generated /Make.inc @@ -13,8 +13,8 @@ config.log config.status # generated folder -include/ -#modules/ +/include/ +/modules/ docs/src/tmp autom4te.cache diff --git a/Changelog b/Changelog index 7cfc2997..88684099 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,14 @@ Changelog. A lot less detailed than usual, at least for past history. +2022/05/20: Merge changes for REMOTE build. Bump v 3.8 +2022/03/28: Introduce new non-blocking collectives. +2021/06/01: New CTXT object +2021/04/20: OpenMP integration +2021/04/10: Recognize MPICXX in configure +2021/02/10: Take out precset interface, only prec%set now. +2020/09/20: New getelem function to extract vector entries +2020/07/21: Fix configure for METIS sizes +2020/06/01: reworked bild internals for descriptors 2019/12/18: New internals and algorithms for FND_OWNER, faster and less memory hungry. 2019/07/20: New SCAN collective; improve handling of SYMmetric diff --git a/LICENSE b/LICENSE index 861ebc4c..5ff86d89 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ - Parallel Sparse BLAS version 3.5 - (C) Copyright 2006-2018 + Parallel Sparse BLAS version 3.8 + (C) Copyright 2006-2022 Salvatore Filippone Alfredo Buttari diff --git a/Makefile b/Makefile index b28ae207..a0f5ec3e 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,38 @@ include Make.inc -all: libd based precd kryld utild cbindd +all: dirs based precd kryld utild cbindd libd @echo "=====================================" @echo "PSBLAS libraries Compilation Successful." -based: libd +dirs: + (if test ! -d lib ; then mkdir lib; fi) + (if test ! -d include ; then mkdir include; fi; $(INSTALL_DATA) Make.inc include/Make.inc.psblas) + (if test ! -d modules ; then mkdir modules; fi;) + precd: based utild: based kryld: precd -cbindd: precd kryld utild +cbindd: based precd kryld utild -libd: - (if test ! -d lib ; then mkdir lib; fi) - (if test ! -d include ; then mkdir include; fi; $(INSTALL_DATA) Make.inc include/Make.inc.psblas) - (if test ! -d modules ; then mkdir modules; fi;) -based: +libd: based precd kryld utild cbindd $(MAKE) -C base lib -precd: $(MAKE) -C prec lib -kryld: $(MAKE) -C krylov lib -utild: $(MAKE) -C util lib + $(MAKE) -C cbind lib + +based: + $(MAKE) -C base objs +precd: + $(MAKE) -C prec objs +kryld: + $(MAKE) -C krylov objs +utild: + $(MAKE) -C util objs cbindd: - $(MAKE) -C cbind lib + $(MAKE) -C cbind objs + install: all mkdir -p $(INSTALL_INCLUDEDIR) &&\ diff --git a/README.md b/README.md index a86db934..d2f19f95 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -PSBLAS library, version 3.7 +PSBLAS library, version 3.8 =========================== The architecture of the Fortran 2003 sparse BLAS is described in: @@ -25,7 +25,7 @@ Harwell-Boeing and MatrixMarket file formats. DOCUMENTATION ------------- -See docs/psblas-3.5.pdf; an HTML version of the same document is +See docs/psblas-3.8.pdf; an HTML version of the same document is available in docs/html. Please consult the sample programs, especially test/pargen/psb_[sd]_pde[23]d.f90 @@ -58,7 +58,8 @@ prerequisites (see also SERIAL below): directories but only if you specify `--with-metis`. 4. If you have the AMD package of Davis, Duff and Amestoy, you can - specify `--with-amd` (see `./configure --help` for more details). + specify `--with-amd` (see `./configure --help` for more details). + We use the C interface to AMD. The configure script will generate a Make.inc file suitable for building the library. The script is capable of recognizing the needed libraries @@ -97,11 +98,15 @@ that enables running in pure serial mode; no MPI installation is needed in this case (but note that the fake MPI stubs are only guaranteed to cover what we use internally, it's not a complete replacement). -LONG INTEGERS +INTEGER SIZES ------------- -We have an experimental flag `--enable-long-integers` that will enable -having 8-byte integer data, allowing an index space larger than 2G; some -small cases have been tested but we do not offer full guarantee (yet). +We have two kind of integers: IPK for local indices, and LPK for +global indices. They can be specified independently at configure time, +e.g. +--with-ipk=4 --with-lpk=8 +which is asking for 4-bytes local indices, and 8-bytes global indices +(this is the default). + TODO diff --git a/ReleaseNews b/ReleaseNews index 558b497c..5a6664c2 100644 --- a/ReleaseNews +++ b/ReleaseNews @@ -1,5 +1,13 @@ WHAT'S NEW +Version 3.8.0-2 + 1. CTXT is now an opaque object. + 2. OpenMP is now better integrated. + 3. New non-blocking collectives. + 4. Now allowing remote builds (i.e. local contributions can + now be sent to the final destination process) + 5. Restore Makefiles to work on parallel builds. + Version 3.7.0.1 1. PREC%DESCR method now requires a mandatory INFO argument. diff --git a/base/Makefile b/base/Makefile index 039a5963..3348013f 100644 --- a/base/Makefile +++ b/base/Makefile @@ -6,24 +6,31 @@ INCDIR=../include MODDIR=../modules LIBNAME=$(BASELIBNAME) -lib: mods sr cm in pb tl +objs: mods sr cm in pb tl + +lib: objs + $(MAKE) -C modules lib LIBNAME=$(BASELIBNAME) F90="$(MPF90)" F90COPT="$(F90COPT) $(MPI_OPT)" + $(MAKE) -C serial lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C comm lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C internals lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C psblas lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C tools lib LIBNAME=$(BASELIBNAME) /bin/cp -p $(CPUPDFLAG) $(HERE)/$(LIBNAME) $(LIBDIR) - /bin/cp -p $(CPUPDFLAG) *$(.mod) $(MODDIR) sr cm in pb tl: mods mods: - $(MAKE) -C modules lib LIBNAME=$(BASELIBNAME) F90="$(MPF90)" F90COPT="$(F90COPT) $(MPI_OPT)" + $(MAKE) -C modules objs F90="$(MPF90)" F90COPT="$(F90COPT) $(MPI_OPT)" sr: - $(MAKE) -C serial lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C serial objs cm: - $(MAKE) -C comm lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C comm objs in: - $(MAKE) -C internals lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C internals objs pb: - $(MAKE) -C psblas lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C psblas objs tl: - $(MAKE) -C tools lib LIBNAME=$(BASELIBNAME) + $(MAKE) -C tools objs clean: ($(MAKE) -C modules clean) diff --git a/base/comm/Makefile b/base/comm/Makefile index 950a95a0..dfa1bed8 100644 --- a/base/comm/Makefile +++ b/base/comm/Makefile @@ -27,12 +27,15 @@ INCDIR=.. MODDIR=../modules FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) -lib: interns mpfobjs $(OBJS) +objs: interns mpfobjs $(OBJS) + +lib: objs + $(MAKE) -C internals lib LIBNAME=$(LIBNAME) $(AR) $(LIBDIR)/$(LIBNAME) $(MPFOBJS) $(OBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) interns: - $(MAKE) -C internals lib + $(MAKE) -C internals objs mpfobjs: $(MAKE) $(MPFOBJS) FC="$(MPFC)" diff --git a/base/comm/internals/Makefile b/base/comm/internals/Makefile index 45a7ad46..695f2065 100644 --- a/base/comm/internals/Makefile +++ b/base/comm/internals/Makefile @@ -31,7 +31,8 @@ MODDIR=../../modules FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) CINCLUDES=-I. -lib: mpfobjs $(FOBJS) $(MPFOBJS) +objs: mpfobjs $(FOBJS) $(MPFOBJS) +lib: objs $(AR) $(LIBDIR)/$(LIBNAME) $(MPFOBJS) $(MPFOBJS2) $(FOBJS) $(FOBJS2) $(COBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) diff --git a/base/internals/Makefile b/base/internals/Makefile index 73fcfca4..1bb3f105 100644 --- a/base/internals/Makefile +++ b/base/internals/Makefile @@ -16,7 +16,8 @@ MODDIR=../modules FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) CINCLUDES=-I. -lib: mpfobjs $(FOBJS) $(FOBJS2) $(COBJS) $(MPFOBJS2) $(MPFOBJS) +objs: mpfobjs $(FOBJS) $(FOBJS2) $(COBJS) $(MPFOBJS2) $(MPFOBJS) +lib: objs $(AR) $(LIBDIR)/$(LIBNAME) $(MPFOBJS) $(MPFOBJS2) $(FOBJS) $(FOBJS2) $(COBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) diff --git a/base/internals/psi_graph_fnd_owner.F90 b/base/internals/psi_graph_fnd_owner.F90 index 966af403..e5eed8c6 100644 --- a/base/internals/psi_graph_fnd_owner.F90 +++ b/base/internals/psi_graph_fnd_owner.F90 @@ -41,6 +41,8 @@ ! ! iprc(:) - integer(psb_ipk_), allocatable Output: process identifiers ! for the corresponding indices +! ladj(:) - integer(psb_ipk_), allocatable Output: A list of adjacent processes +! ! idxmap - class(psb_indx_map). The index map ! info - integer. return code. ! @@ -76,7 +78,7 @@ ! thereby limiting the memory footprint to a predefined maximum ! (that the user can force with psb_cd_set_maxspace()). ! -subroutine psi_graph_fnd_owner(idx,iprc,idxmap,info) +subroutine psi_graph_fnd_owner(idx,iprc,ladj,idxmap,info) use psb_serial_mod use psb_const_mod use psb_error_mod @@ -93,13 +95,13 @@ subroutine psi_graph_fnd_owner(idx,iprc,idxmap,info) include 'mpif.h' #endif integer(psb_lpk_), intent(in) :: idx(:) - integer(psb_ipk_), allocatable, intent(out) :: iprc(:) - class(psb_indx_map), intent(inout) :: idxmap - integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), allocatable, intent(out) :: iprc(:), ladj(:) + class(psb_indx_map), intent(in) :: idxmap + integer(psb_ipk_), intent(out) :: info integer(psb_lpk_), allocatable :: tidx(:) - integer(psb_ipk_), allocatable :: tprc(:), tsmpl(:), ladj(:) + integer(psb_ipk_), allocatable :: tprc(:), tsmpl(:) integer(psb_mpk_) :: icomm, minfo integer(psb_ipk_) :: i,n_row,n_col,err_act,ip,j, nsampl_out,& & nv, n_answers, nqries, nsampl_in, locr_max, ist, iend,& @@ -208,7 +210,7 @@ subroutine psi_graph_fnd_owner(idx,iprc,idxmap,info) if (trace.and.(me == 0)) write(0,*) ' Initial sweep on user-defined topology',& & nsampl_in call psi_adj_fnd_sweep(idx,iprc,ladj,idxmap,nsampl_in,n_answers) - call idxmap%xtnd_p_adjcncy(ladj) + nqries = nv - n_answers nqries_max = nqries call psb_max(ctxt,nqries_max) @@ -253,13 +255,12 @@ subroutine psi_graph_fnd_owner(idx,iprc,idxmap,info) n_answers = n_answers + nlansw nqries = nv - n_answers ! - ! 3. Extract the resulting adjacency list and add it to the - ! indxmap; + ! 3. Extract the resulting adjacency list ? AND ADD IT TO THE EXISTING ONE ? ! ladj = tprc(1:nlansw) call psb_msort_unique(ladj,nadj) call psb_realloc(nadj,ladj,info) - call idxmap%xtnd_p_adjcncy(ladj) + ! call idxmap%xtnd_p_adjcncy(ladj) if (do_timings) call psb_toc(idx_loop_a2a) if (do_timings) call psb_tic(idx_loop_neigh) ! @@ -368,7 +369,7 @@ contains integer(psb_ipk_), intent(in) :: n_samples integer(psb_ipk_), intent(inout) :: iprc(:), n_answers integer(psb_ipk_), intent(in) :: adj(:) - class(psb_indx_map), intent(inout) :: idxmap + class(psb_indx_map), intent(in) :: idxmap ! type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: ipnt, ns_in, ns_out, n_rem, me, np, isw, n_reml,iend, nv diff --git a/base/internals/psi_indx_map_fnd_owner.F90 b/base/internals/psi_indx_map_fnd_owner.F90 index 0ecade3d..157b73a1 100644 --- a/base/internals/psi_indx_map_fnd_owner.F90 +++ b/base/internals/psi_indx_map_fnd_owner.F90 @@ -51,7 +51,7 @@ ! 2. Check if TEMPVG(:) is allocated, and use it; or ! 3. Call the general method PSI_GRAPH_FND_OWNER. ! -subroutine psi_indx_map_fnd_owner(idx,iprc,idxmap,info) +subroutine psi_indx_map_fnd_owner(idx,iprc,idxmap,info,adj) use psb_serial_mod use psb_const_mod use psb_error_mod @@ -66,15 +66,15 @@ subroutine psi_indx_map_fnd_owner(idx,iprc,idxmap,info) #ifdef MPI_H include 'mpif.h' #endif - integer(psb_lpk_), intent(in) :: idx(:) + integer(psb_lpk_), intent(in) :: idx(:) integer(psb_ipk_), allocatable, intent(out) :: iprc(:) - class(psb_indx_map), intent(inout) :: idxmap + class(psb_indx_map), intent(in) :: idxmap integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, allocatable, intent(out) :: adj(:) - - integer(psb_ipk_), allocatable :: hhidx(:) + integer(psb_ipk_), allocatable :: hhidx(:), ladj(:) integer(psb_mpk_) :: icomm, minfo - integer(psb_ipk_) :: i, err_act, hsize + integer(psb_ipk_) :: i, err_act, hsize, nadj integer(psb_lpk_) :: nv integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt @@ -131,7 +131,6 @@ subroutine psi_indx_map_fnd_owner(idx,iprc,idxmap,info) iprc(i) = -1 end if end do - else if (allocated(idxmap%tempvg)) then !!$ write(0,*) me,trim(name),' indxmap%tempvg shortcut' ! Use temporary vector @@ -183,7 +182,7 @@ subroutine psi_indx_map_fnd_owner(idx,iprc,idxmap,info) tidx(k2) = idx(k1) end if end do - call psi_graph_fnd_owner(tidx,tprc,idxmap,info) + call psi_graph_fnd_owner(tidx,tprc,ladj,idxmap,info) k2 = 0 do k1 = 1, nv if (iprc(k1) < 0) then @@ -198,12 +197,15 @@ subroutine psi_indx_map_fnd_owner(idx,iprc,idxmap,info) end do end block else - call psi_graph_fnd_owner(idx,iprc,idxmap,info) + call psi_graph_fnd_owner(idx,iprc,ladj,idxmap,info) end if - - + + end if + if (present(adj)) then + adj = iprc + call psb_msort_unique(adj,nadj) + call psb_realloc(nadj,adj,info) end if - if (gettime) then call psb_barrier(ctxt) t1 = psb_wtime() diff --git a/base/modules/Makefile b/base/modules/Makefile index 8d50011f..399add1f 100644 --- a/base/modules/Makefile +++ b/base/modules/Makefile @@ -108,15 +108,18 @@ UTIL_MODS = desc/psb_desc_const_mod.o desc/psb_indx_map_mod.o\ MODULES=$(BASIC_MODS) $(SERIAL_MODS) $(UTIL_MODS) OBJS = error.o psb_base_mod.o $(EXTRA_COBJS) cutil.o -LIBDIR=.. +MODDIR=../../modules +LIBDIR=../ CINCLUDES=-I. FINCLUDES=$(FMFLAG)$(LIBDIR) $(FMFLAG). $(FIFLAG). -lib: $(LIBDIR)/$(LIBNAME) - /bin/cp -p $(CPUPDFLAG) *$(.mod) $(LIBDIR) +objs: $(MODULES) $(OBJS) $(MPFOBJS) + /bin/cp -p $(CPUPDFLAG) *$(.mod) $(MODDIR) -$(LIBDIR)/$(LIBNAME): $(MODULES) $(OBJS) $(MPFOBJS) +lib: objs $(LIBDIR)/$(LIBNAME) + +$(LIBDIR)/$(LIBNAME): objs $(AR) $(LIBDIR)/$(LIBNAME) $(MODULES) $(OBJS) $(MPFOBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) @@ -358,8 +361,8 @@ tools/psb_c_tools_mod.o tools/psb_z_tools_mod.o tools/psb_m_tools_a_mod.o tools/ tools/psb_s_tools_a_mod.o tools/psb_d_tools_a_mod.o\ tools/psb_c_tools_a_mod.o tools/psb_z_tools_a_mod.o: desc/psb_desc_mod.o psi_mod.o serial/psb_mat_mod.o -tools/psb_i_tools_mod.o: serial/psb_i_vect_mod.o -tools/psb_l_tools_mod.o: serial/psb_l_vect_mod.o +tools/psb_i_tools_mod.o: serial/psb_i_vect_mod.o tools/psb_m_tools_a_mod.o tools/psb_e_tools_a_mod.o +tools/psb_l_tools_mod.o: serial/psb_l_vect_mod.o tools/psb_m_tools_a_mod.o tools/psb_e_tools_a_mod.o tools/psb_s_tools_mod.o: serial/psb_s_vect_mod.o tools/psb_d_tools_mod.o: serial/psb_d_vect_mod.o tools/psb_c_tools_mod.o: serial/psb_c_vect_mod.o @@ -375,7 +378,7 @@ psblas/psb_s_psblas_mod.o psblas/psb_c_psblas_mod.o psblas/psb_d_psblas_mod.o ps psb_base_mod.o: $(MODULES) -penv/psi_penv_mod.o: penv/psi_penv_mod.F90 psb_const_mod.o serial/psb_vect_mod.o serial/psb_mat_mod.o +penv/psi_penv_mod.o: penv/psi_penv_mod.F90 psb_const_mod.o serial/psb_vect_mod.o serial/psb_mat_mod.o desc/psb_desc_const_mod.o $(FC) $(FINCLUDES) $(FDEFINES) $(FCOPT) $(EXTRA_OPT) -c $< -o $@ psb_penv_mod.o: psb_penv_mod.F90 $(COMMINT) $(BASIC_MODS) diff --git a/base/modules/auxil/psb_c_realloc_mod.F90 b/base/modules/auxil/psb_c_realloc_mod.F90 index 938ef36f..9e6af5a8 100644 --- a/base/modules/auxil/psb_c_realloc_mod.F90 +++ b/base/modules/auxil/psb_c_realloc_mod.F90 @@ -131,7 +131,7 @@ Contains ! ...Local Variables complex(psb_spk_),allocatable :: tmp(:) - integer(psb_mpk_) :: dim, lb_, lbi,ub_ + integer(psb_mpk_) :: dim, lb_, lbi,ub_, i integer(psb_ipk_) :: err_act,err character(len=30) :: name logical, parameter :: debug=.false. @@ -179,7 +179,10 @@ Contains end if endif if (present(pad)) then - rrax(lb_-1+dim+1:lb_-1+len) = pad + !$omp parallel do private(i) shared(dim,len) + do i=lb_-1+dim+1,lb_-1+len + rrax(i) = pad + end do endif call psb_erractionrestore(err_act) return @@ -204,7 +207,7 @@ Contains complex(psb_spk_),allocatable :: tmp(:,:) integer(psb_ipk_) :: err_act,err - integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2 + integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2, i character(len=30) :: name name='psb_r_m_c_rk2' @@ -267,8 +270,14 @@ Contains end if endif if (present(pad)) then - rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad - rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad + !$omp parallel do private(i) shared(lb1_,dim,len1) + do i=lb1_-1+dim+1,lb1_-1+len1 + rrax(i,:) = pad + end do + !$omp parallel do private(i) shared(lb1_,dim,len1,lb2_,dim2,len2) + do i=lb1_,lb1_-1+len1 + rrax(i,lb2_-1+dim2+1:lb2_-1+len2) = pad + end do endif call psb_erractionrestore(err_act) return diff --git a/base/modules/auxil/psb_d_realloc_mod.F90 b/base/modules/auxil/psb_d_realloc_mod.F90 index 868a6657..672b4677 100644 --- a/base/modules/auxil/psb_d_realloc_mod.F90 +++ b/base/modules/auxil/psb_d_realloc_mod.F90 @@ -131,7 +131,7 @@ Contains ! ...Local Variables real(psb_dpk_),allocatable :: tmp(:) - integer(psb_mpk_) :: dim, lb_, lbi,ub_ + integer(psb_mpk_) :: dim, lb_, lbi,ub_, i integer(psb_ipk_) :: err_act,err character(len=30) :: name logical, parameter :: debug=.false. @@ -179,7 +179,10 @@ Contains end if endif if (present(pad)) then - rrax(lb_-1+dim+1:lb_-1+len) = pad + !$omp parallel do private(i) shared(dim,len) + do i=lb_-1+dim+1,lb_-1+len + rrax(i) = pad + end do endif call psb_erractionrestore(err_act) return @@ -204,7 +207,7 @@ Contains real(psb_dpk_),allocatable :: tmp(:,:) integer(psb_ipk_) :: err_act,err - integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2 + integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2, i character(len=30) :: name name='psb_r_m_d_rk2' @@ -267,8 +270,14 @@ Contains end if endif if (present(pad)) then - rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad - rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad + !$omp parallel do private(i) shared(lb1_,dim,len1) + do i=lb1_-1+dim+1,lb1_-1+len1 + rrax(i,:) = pad + end do + !$omp parallel do private(i) shared(lb1_,dim,len1,lb2_,dim2,len2) + do i=lb1_,lb1_-1+len1 + rrax(i,lb2_-1+dim2+1:lb2_-1+len2) = pad + end do endif call psb_erractionrestore(err_act) return diff --git a/base/modules/auxil/psb_e_realloc_mod.F90 b/base/modules/auxil/psb_e_realloc_mod.F90 index c5645bf0..0f2431fd 100644 --- a/base/modules/auxil/psb_e_realloc_mod.F90 +++ b/base/modules/auxil/psb_e_realloc_mod.F90 @@ -131,7 +131,7 @@ Contains ! ...Local Variables integer(psb_epk_),allocatable :: tmp(:) - integer(psb_mpk_) :: dim, lb_, lbi,ub_ + integer(psb_mpk_) :: dim, lb_, lbi,ub_, i integer(psb_ipk_) :: err_act,err character(len=30) :: name logical, parameter :: debug=.false. @@ -179,7 +179,10 @@ Contains end if endif if (present(pad)) then - rrax(lb_-1+dim+1:lb_-1+len) = pad + !$omp parallel do private(i) shared(dim,len) + do i=lb_-1+dim+1,lb_-1+len + rrax(i) = pad + end do endif call psb_erractionrestore(err_act) return @@ -204,7 +207,7 @@ Contains integer(psb_epk_),allocatable :: tmp(:,:) integer(psb_ipk_) :: err_act,err - integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2 + integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2, i character(len=30) :: name name='psb_r_m_e_rk2' @@ -267,8 +270,14 @@ Contains end if endif if (present(pad)) then - rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad - rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad + !$omp parallel do private(i) shared(lb1_,dim,len1) + do i=lb1_-1+dim+1,lb1_-1+len1 + rrax(i,:) = pad + end do + !$omp parallel do private(i) shared(lb1_,dim,len1,lb2_,dim2,len2) + do i=lb1_,lb1_-1+len1 + rrax(i,lb2_-1+dim2+1:lb2_-1+len2) = pad + end do endif call psb_erractionrestore(err_act) return diff --git a/base/modules/auxil/psb_i2_realloc_mod.F90 b/base/modules/auxil/psb_i2_realloc_mod.F90 index cbe0d130..22e85d36 100644 --- a/base/modules/auxil/psb_i2_realloc_mod.F90 +++ b/base/modules/auxil/psb_i2_realloc_mod.F90 @@ -131,7 +131,7 @@ Contains ! ...Local Variables integer(psb_i2pk_),allocatable :: tmp(:) - integer(psb_mpk_) :: dim, lb_, lbi,ub_ + integer(psb_mpk_) :: dim, lb_, lbi,ub_, i integer(psb_ipk_) :: err_act,err character(len=30) :: name logical, parameter :: debug=.false. @@ -179,7 +179,10 @@ Contains end if endif if (present(pad)) then - rrax(lb_-1+dim+1:lb_-1+len) = pad + !$omp parallel do private(i) shared(dim,len) + do i=lb_-1+dim+1,lb_-1+len + rrax(i) = pad + end do endif call psb_erractionrestore(err_act) return @@ -204,7 +207,7 @@ Contains integer(psb_i2pk_),allocatable :: tmp(:,:) integer(psb_ipk_) :: err_act,err - integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2 + integer(psb_mpk_) :: dim,dim2,lb1_, lb2_, ub1_, ub2_,lbi1, lbi2, i character(len=30) :: name name='psb_r_m_i2_rk2' @@ -267,8 +270,14 @@ Contains end if endif if (present(pad)) then - rrax(lb1_-1+dim+1:lb1_-1+len1,:) = pad - rrax(lb1_:lb1_-1+dim,lb2_-1+dim2+1:lb2_-1+len2) = pad + !$omp parallel do private(i) shared(lb1_,dim,len1) + do i=lb1_-1+dim+1,lb1_-1+len1 + rrax(i,:) = pad + end do + !$omp parallel do private(i) shared(lb1_,dim,len1,lb2_,dim2,len2) + do i=lb1_,lb1_-1+len1 + rrax(i,lb2_-1+dim2+1:lb2_-1+len2) = pad + end do endif call psb_erractionrestore(err_act) return diff --git a/base/modules/auxil/psb_i_sort_mod.f90 b/base/modules/auxil/psb_i_sort_mod.f90 deleted file mode 100644 index bd48f628..00000000 --- a/base/modules/auxil/psb_i_sort_mod.f90 +++ /dev/null @@ -1,578 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! Sorting routines -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -module psb_i_sort_mod - use psb_const_mod - - interface psb_isaperm - logical function psb_iisaperm(n,eip) - import - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_), intent(in) :: eip(n) - end function psb_iisaperm - end interface psb_isaperm - - - interface psb_msort_unique - subroutine psb_imsort_u(x,nout,dir) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(out) :: nout - integer(psb_ipk_), optional, intent(in) :: dir - end subroutine psb_imsort_u - end interface psb_msort_unique - - type psb_i_heap - integer(psb_ipk_) :: last, dir - integer(psb_ipk_), allocatable :: keys(:) - contains - procedure, pass(heap) :: init => psb_i_init_heap - procedure, pass(heap) :: howmany => psb_i_howmany - procedure, pass(heap) :: insert => psb_i_insert_heap - procedure, pass(heap) :: get_first => psb_i_heap_get_first - procedure, pass(heap) :: dump => psb_i_dump_heap - procedure, pass(heap) :: free => psb_i_free_heap - end type psb_i_heap - - type psb_i_idx_heap - integer(psb_ipk_) :: last, dir - integer(psb_ipk_), allocatable :: keys(:) - integer(psb_ipk_), allocatable :: idxs(:) - contains - procedure, pass(heap) :: init => psb_i_idx_init_heap - procedure, pass(heap) :: howmany => psb_i_idx_howmany - procedure, pass(heap) :: insert => psb_i_idx_insert_heap - procedure, pass(heap) :: get_first => psb_i_idx_heap_get_first - procedure, pass(heap) :: dump => psb_i_idx_dump_heap - procedure, pass(heap) :: free => psb_i_idx_free_heap - end type psb_i_idx_heap - - - interface psb_msort - subroutine psb_imsort(x,ix,dir,flag) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - end subroutine psb_imsort - end interface psb_msort - - - interface psb_bsrch - function psb_ibsrch(key,n,v) result(ipos) - import - integer(psb_ipk_) :: ipos, n - integer(psb_ipk_) :: key - integer(psb_ipk_) :: v(:) - end function psb_ibsrch - end interface psb_bsrch - - interface psb_ssrch - function psb_issrch(key,n,v) result(ipos) - import - implicit none - integer(psb_ipk_) :: ipos, n - integer(psb_ipk_) :: key - integer(psb_ipk_) :: v(:) - end function psb_issrch - end interface psb_ssrch - - interface - subroutine psi_i_msort_up(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - end subroutine psi_i_msort_up - subroutine psi_i_msort_dw(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - end subroutine psi_i_msort_dw - end interface - interface - subroutine psi_i_amsort_up(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - end subroutine psi_i_amsort_up - subroutine psi_i_amsort_dw(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - end subroutine psi_i_amsort_dw - end interface - - - interface psb_qsort - subroutine psb_iqsort(x,ix,dir,flag) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - end subroutine psb_iqsort - end interface psb_qsort - - interface psb_isort - subroutine psb_iisort(x,ix,dir,flag) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - end subroutine psb_iisort - end interface psb_isort - - - interface psb_hsort - subroutine psb_ihsort(x,ix,dir,flag) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - end subroutine psb_ihsort - end interface psb_hsort - - - interface - subroutine psi_i_insert_heap(key,last,heap,dir,info) - import - implicit none - - ! - ! Input: - ! key: the new value - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! dir: sorting direction - - integer(psb_ipk_), intent(in) :: key - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(out) :: info - end subroutine psi_i_insert_heap - end interface - - interface - subroutine psi_i_idx_insert_heap(key,index,last,heap,idxs,dir,info) - import - implicit none - - ! - ! Input: - ! key: the new value - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! dir: sorting direction - - integer(psb_ipk_), intent(in) :: key - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(in) :: index - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: idxs(:) - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(out) :: info - end subroutine psi_i_idx_insert_heap - end interface - - - interface - subroutine psi_i_heap_get_first(key,last,heap,dir,info) - import - implicit none - integer(psb_ipk_), intent(inout) :: key - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(out) :: info - end subroutine psi_i_heap_get_first - end interface - - interface - subroutine psi_i_idx_heap_get_first(key,index,last,heap,idxs,dir,info) - import - integer(psb_ipk_), intent(inout) :: key - integer(psb_ipk_), intent(out) :: index - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(inout) :: idxs(:) - integer(psb_ipk_), intent(out) :: info - end subroutine psi_i_idx_heap_get_first - end interface - - interface - subroutine psi_iisrx_up(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iisrx_up - subroutine psi_iisrx_dw(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iisrx_dw - subroutine psi_iisr_up(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iisr_up - subroutine psi_iisr_dw(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iisr_dw - subroutine psi_iaisrx_up(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaisrx_up - subroutine psi_iaisrx_dw(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaisrx_dw - subroutine psi_iaisr_up(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaisr_up - subroutine psi_iaisr_dw(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaisr_dw - end interface - - interface - subroutine psi_iqsrx_up(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iqsrx_up - subroutine psi_iqsrx_dw(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iqsrx_dw - subroutine psi_iqsr_up(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iqsr_up - subroutine psi_iqsr_dw(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iqsr_dw - subroutine psi_iaqsrx_up(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaqsrx_up - subroutine psi_iaqsrx_dw(n,x,ix) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: ix(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaqsrx_dw - subroutine psi_iaqsr_up(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaqsr_up - subroutine psi_iaqsr_dw(n,x) - import - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - end subroutine psi_iaqsr_dw - end interface - -contains - - subroutine psb_i_init_heap(heap,info,dir) - use psb_realloc_mod, only : psb_ensure_size - implicit none - class(psb_i_heap), intent(inout) :: heap - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), intent(in), optional :: dir - - info = psb_success_ - heap%last=0 - if (present(dir)) then - heap%dir = dir - else - heap%dir = psb_sort_up_ - endif - select case(heap%dir) - case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_) - ! ok, do nothing - case default - write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_' - heap%dir = psb_sort_up_ - end select - call psb_ensure_size(psb_heap_resize,heap%keys,info) - - return - end subroutine psb_i_init_heap - - - function psb_i_howmany(heap) result(res) - implicit none - class(psb_i_heap), intent(in) :: heap - integer(psb_ipk_) :: res - res = heap%last - end function psb_i_howmany - - subroutine psb_i_insert_heap(key,heap,info) - use psb_realloc_mod, only : psb_ensure_size - implicit none - - integer(psb_ipk_), intent(in) :: key - class(psb_i_heap), intent(inout) :: heap - integer(psb_ipk_), intent(out) :: info - - info = psb_success_ - if (heap%last < 0) then - write(psb_err_unit,*) 'Invalid last in heap ',heap%last - info = heap%last - return - endif - - call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize) - if (info /= psb_success_) then - write(psb_err_unit,*) 'Memory allocation failure in heap_insert' - info = -5 - return - end if - call psi_i_insert_heap(key,& - & heap%last,heap%keys,heap%dir,info) - - return - end subroutine psb_i_insert_heap - - subroutine psb_i_heap_get_first(key,heap,info) - implicit none - - class(psb_i_heap), intent(inout) :: heap - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), intent(out) :: key - - - info = psb_success_ - - call psi_i_heap_get_first(key,& - & heap%last,heap%keys,heap%dir,info) - - return - end subroutine psb_i_heap_get_first - - subroutine psb_i_dump_heap(iout,heap,info) - - implicit none - class(psb_i_heap), intent(in) :: heap - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), intent(in) :: iout - - info = psb_success_ - if (iout < 0) then - write(psb_err_unit,*) 'Invalid file ' - info =-1 - return - end if - - write(iout,*) 'Heap direction ',heap%dir - write(iout,*) 'Heap size ',heap%last - if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.& - & (size(heap%keys) 0).and.((.not.allocated(heap%keys)).or.& - & (size(heap%keys) 0).and.((.not.allocated(heap%idxs)).or.& - & (size(heap%idxs) psb_l_init_heap - procedure, pass(heap) :: howmany => psb_l_howmany - procedure, pass(heap) :: insert => psb_l_insert_heap - procedure, pass(heap) :: get_first => psb_l_heap_get_first - procedure, pass(heap) :: dump => psb_l_dump_heap - procedure, pass(heap) :: free => psb_l_free_heap - end type psb_l_heap - - type psb_l_idx_heap - integer(psb_ipk_) :: last, dir - integer(psb_lpk_), allocatable :: keys(:) - integer(psb_lpk_), allocatable :: idxs(:) - contains - procedure, pass(heap) :: init => psb_l_idx_init_heap - procedure, pass(heap) :: howmany => psb_l_idx_howmany - procedure, pass(heap) :: insert => psb_l_idx_insert_heap - procedure, pass(heap) :: get_first => psb_l_idx_heap_get_first - procedure, pass(heap) :: dump => psb_l_idx_dump_heap - procedure, pass(heap) :: free => psb_l_idx_free_heap - end type psb_l_idx_heap - - - interface psb_msort - subroutine psb_lmsort(x,ix,dir,flag) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - end subroutine psb_lmsort - end interface psb_msort - - - interface psb_bsrch - function psb_lbsrch(key,n,v) result(ipos) - import - integer(psb_ipk_) :: ipos, n - integer(psb_lpk_) :: key - integer(psb_lpk_) :: v(:) - end function psb_lbsrch - end interface psb_bsrch - - interface psb_ssrch - function psb_lssrch(key,n,v) result(ipos) - import - implicit none - integer(psb_ipk_) :: ipos, n - integer(psb_lpk_) :: key - integer(psb_lpk_) :: v(:) - end function psb_lssrch - end interface psb_ssrch - - interface - subroutine psi_l_msort_up(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - end subroutine psi_l_msort_up - subroutine psi_l_msort_dw(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - end subroutine psi_l_msort_dw - end interface - interface - subroutine psi_l_amsort_up(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - end subroutine psi_l_amsort_up - subroutine psi_l_amsort_dw(n,k,l,iret) - import - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - end subroutine psi_l_amsort_dw - end interface - - - interface psb_qsort - subroutine psb_lqsort(x,ix,dir,flag) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - end subroutine psb_lqsort - end interface psb_qsort - - interface psb_isort - subroutine psb_lisort(x,ix,dir,flag) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - end subroutine psb_lisort - end interface psb_isort - - - interface psb_hsort - subroutine psb_lhsort(x,ix,dir,flag) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - end subroutine psb_lhsort - end interface psb_hsort - - - interface - subroutine psi_l_insert_heap(key,last,heap,dir,info) - import - implicit none - - ! - ! Input: - ! key: the new value - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! dir: sorting direction - - integer(psb_lpk_), intent(in) :: key - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(out) :: info - end subroutine psi_l_insert_heap - end interface - - interface - subroutine psi_l_idx_insert_heap(key,index,last,heap,idxs,dir,info) - import - implicit none - - ! - ! Input: - ! key: the new value - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! dir: sorting direction - - integer(psb_lpk_), intent(in) :: key - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_lpk_), intent(in) :: index - integer(psb_ipk_), intent(in) :: dir - integer(psb_lpk_), intent(inout) :: idxs(:) - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(out) :: info - end subroutine psi_l_idx_insert_heap - end interface - - - interface - subroutine psi_l_heap_get_first(key,last,heap,dir,info) - import - implicit none - integer(psb_lpk_), intent(inout) :: key - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(in) :: dir - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(out) :: info - end subroutine psi_l_heap_get_first - end interface - - interface - subroutine psi_l_idx_heap_get_first(key,index,last,heap,idxs,dir,info) - import - integer(psb_lpk_), intent(inout) :: key - integer(psb_lpk_), intent(out) :: index - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: last - integer(psb_lpk_), intent(inout) :: idxs(:) - integer(psb_ipk_), intent(out) :: info - end subroutine psi_l_idx_heap_get_first - end interface - - interface - subroutine psi_lisrx_up(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lisrx_up - subroutine psi_lisrx_dw(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lisrx_dw - subroutine psi_lisr_up(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lisr_up - subroutine psi_lisr_dw(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lisr_dw - subroutine psi_laisrx_up(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laisrx_up - subroutine psi_laisrx_dw(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laisrx_dw - subroutine psi_laisr_up(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laisr_up - subroutine psi_laisr_dw(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laisr_dw - end interface - - interface - subroutine psi_lqsrx_up(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lqsrx_up - subroutine psi_lqsrx_dw(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lqsrx_dw - subroutine psi_lqsr_up(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lqsr_up - subroutine psi_lqsr_dw(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_lqsr_dw - subroutine psi_laqsrx_up(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laqsrx_up - subroutine psi_laqsrx_dw(n,x,ix) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: ix(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laqsrx_dw - subroutine psi_laqsr_up(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laqsr_up - subroutine psi_laqsr_dw(n,x) - import - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - end subroutine psi_laqsr_dw - end interface - -contains - - subroutine psb_l_init_heap(heap,info,dir) - use psb_realloc_mod, only : psb_ensure_size - implicit none - class(psb_l_heap), intent(inout) :: heap - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), intent(in), optional :: dir - - info = psb_success_ - heap%last=0 - if (present(dir)) then - heap%dir = dir - else - heap%dir = psb_sort_up_ - endif - select case(heap%dir) - case (psb_sort_up_,psb_sort_down_,psb_asort_up_,psb_asort_down_) - ! ok, do nothing - case default - write(psb_err_unit,*) 'Invalid direction, defaulting to psb_sort_up_' - heap%dir = psb_sort_up_ - end select - call psb_ensure_size(psb_heap_resize,heap%keys,info) - - return - end subroutine psb_l_init_heap - - - function psb_l_howmany(heap) result(res) - implicit none - class(psb_l_heap), intent(in) :: heap - integer(psb_ipk_) :: res - res = heap%last - end function psb_l_howmany - - subroutine psb_l_insert_heap(key,heap,info) - use psb_realloc_mod, only : psb_ensure_size - implicit none - - integer(psb_lpk_), intent(in) :: key - class(psb_l_heap), intent(inout) :: heap - integer(psb_ipk_), intent(out) :: info - - info = psb_success_ - if (heap%last < 0) then - write(psb_err_unit,*) 'Invalid last in heap ',heap%last - info = heap%last - return - endif - - call psb_ensure_size(heap%last+1,heap%keys,info,addsz=psb_heap_resize) - if (info /= psb_success_) then - write(psb_err_unit,*) 'Memory allocation failure in heap_insert' - info = -5 - return - end if - call psi_l_insert_heap(key,& - & heap%last,heap%keys,heap%dir,info) - - return - end subroutine psb_l_insert_heap - - subroutine psb_l_heap_get_first(key,heap,info) - implicit none - - class(psb_l_heap), intent(inout) :: heap - integer(psb_ipk_), intent(out) :: info - integer(psb_lpk_), intent(out) :: key - - - info = psb_success_ - - call psi_l_heap_get_first(key,& - & heap%last,heap%keys,heap%dir,info) - - return - end subroutine psb_l_heap_get_first - - subroutine psb_l_dump_heap(iout,heap,info) - - implicit none - class(psb_l_heap), intent(in) :: heap - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), intent(in) :: iout - - info = psb_success_ - if (iout < 0) then - write(psb_err_unit,*) 'Invalid file ' - info =-1 - return - end if - - write(iout,*) 'Heap direction ',heap%dir - write(iout,*) 'Heap size ',heap%last - if ((heap%last > 0).and.((.not.allocated(heap%keys)).or.& - & (size(heap%keys) 0).and.((.not.allocated(heap%keys)).or.& - & (size(heap%keys) 0).and.((.not.allocated(heap%idxs)).or.& - & (size(heap%idxs) psb_c_is_repeatable_updates procedure, pass(a) :: get_fmt => psb_c_get_fmt procedure, pass(a) :: sizeof => psb_c_sizeof + procedure, pass(a) :: is_remote_build => psb_c_is_remote_build + ! Setters procedure, pass(a) :: set_nrows => psb_c_set_nrows @@ -125,6 +129,7 @@ module psb_c_mat_mod procedure, pass(a) :: set_symmetric => psb_c_set_symmetric procedure, pass(a) :: set_unit => psb_c_set_unit procedure, pass(a) :: set_repeatable_updates => psb_c_set_repeatable_updates + procedure, pass(a) :: set_remote_build => psb_c_set_remote_build ! Memory/data management procedure, pass(a) :: csall => psb_c_csall @@ -2292,7 +2297,25 @@ contains end function c_mat_is_sync + function psb_c_is_remote_build(a) result(res) + implicit none + class(psb_cspmat_type), intent(in) :: a + logical :: res + res = (a%remote_build == psb_matbld_remote_) + end function psb_c_is_remote_build + subroutine psb_c_set_remote_build(a,val) + implicit none + class(psb_cspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + a%remote_build = val + else + a%remote_build = psb_matbld_remote_ + end if + end subroutine psb_c_set_remote_build + function psb_c_is_repeatable_updates(a) result(res) implicit none class(psb_cspmat_type), intent(in) :: a diff --git a/base/modules/serial/psb_c_vect_mod.F90 b/base/modules/serial/psb_c_vect_mod.F90 index 0edb7245..1a336d11 100644 --- a/base/modules/serial/psb_c_vect_mod.F90 +++ b/base/modules/serial/psb_c_vect_mod.F90 @@ -39,15 +39,27 @@ ! module psb_c_vect_mod + use psb_realloc_mod use psb_c_base_vect_mod use psb_i_vect_mod type psb_c_vect_type class(psb_c_base_vect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + complex(psb_spk_), allocatable :: rmtv(:) + integer(psb_lpk_), allocatable :: rmidx(:) contains procedure, pass(x) :: get_nrows => c_vect_get_nrows procedure, pass(x) :: sizeof => c_vect_sizeof procedure, pass(x) :: get_fmt => c_vect_get_fmt + procedure, pass(x) :: is_remote_build => c_vect_is_remote_build + procedure, pass(x) :: set_remote_build => c_vect_set_remote_build + procedure, pass(x) :: get_dupl => c_vect_get_dupl + procedure, pass(x) :: set_dupl => c_vect_set_dupl + procedure, pass(x) :: get_nrmv => c_vect_get_nrmv + procedure, pass(x) :: set_nrmv => c_vect_set_nrmv procedure, pass(x) :: all => c_vect_all procedure, pass(x) :: reall => c_vect_reall procedure, pass(x) :: zero => c_vect_zero @@ -145,7 +157,9 @@ module psb_c_vect_mod & c_vect_cnv, c_vect_set_scal, & & c_vect_set_vect, c_vect_clone, c_vect_sync, c_vect_is_host, & & c_vect_is_dev, c_vect_is_sync, c_vect_set_host, & - & c_vect_set_dev, c_vect_set_sync + & c_vect_set_dev, c_vect_set_sync, & + & c_vect_set_remote_build, c_is_remote_build, & + & c_vect_set_dupl, c_get_dupl, c_vect_set_nrmv, c_get_nrmv private :: c_vect_dot_v, c_vect_dot_a, c_vect_axpby_v, c_vect_axpby_a, & & c_vect_mlt_v, c_vect_mlt_a, c_vect_mlt_a_2, c_vect_mlt_v_2, & @@ -167,7 +181,60 @@ module psb_c_vect_mod contains + function c_vect_get_dupl(x) result(res) + implicit none + class(psb_c_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function c_vect_get_dupl + + subroutine c_vect_set_dupl(x,val) + implicit none + class(psb_c_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine c_vect_set_dupl + + function c_vect_get_nrmv(x) result(res) + implicit none + class(psb_c_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%nrmv + end function c_vect_get_nrmv + + subroutine c_vect_set_nrmv(x,val) + implicit none + class(psb_c_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in) :: val + x%nrmv = val + end subroutine c_vect_set_nrmv + + + function c_vect_is_remote_build(x) result(res) + implicit none + class(psb_c_vect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function c_vect_is_remote_build + + subroutine c_vect_set_remote_build(x,val) + implicit none + class(psb_c_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine c_vect_set_remote_build + subroutine psb_c_set_vect_default(v) implicit none class(psb_c_base_vect_type), intent(in) :: v @@ -365,8 +432,8 @@ contains implicit none integer(psb_ipk_), intent(in) :: n class(psb_c_vect_type), intent(inout) :: x - class(psb_c_base_vect_type), intent(in), optional :: mold integer(psb_ipk_), intent(out) :: info + class(psb_c_base_vect_type), intent(in), optional :: mold if (allocated(x%v)) & & call x%free(info) @@ -381,7 +448,6 @@ contains else info = psb_err_alloc_dealloc_ end if - end subroutine c_vect_all subroutine c_vect_reall(n, x, info) @@ -412,13 +478,13 @@ contains use psi_serial_mod use psb_realloc_mod implicit none - integer(psb_ipk_), intent(in) :: n + integer(psb_ipk_), intent(in) :: n class(psb_c_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(out) :: info - - if (allocated(x%v)) & - & call x%v%asb(n,info) + integer(psb_ipk_), intent(out) :: info + if (allocated(x%v)) then + call x%v%asb(n,info) + end if end subroutine c_vect_asb subroutine c_vect_gthab(n,idx,alpha,x,beta,y) @@ -469,44 +535,44 @@ contains end subroutine c_vect_free - subroutine c_vect_ins_a(n,irl,val,dupl,x,info) + subroutine c_vect_ins_a(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_c_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) complex(psb_spk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine c_vect_ins_a - subroutine c_vect_ins_v(n,irl,val,dupl,x,info) + subroutine c_vect_ins_v(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_c_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: irl class(psb_c_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl%v,val%v,dupl,info) end subroutine c_vect_ins_v @@ -526,9 +592,11 @@ contains allocate(tmp,stat=info,mold=psb_c_get_base_vect_default()) end if if (allocated(x%v)) then - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) + if (allocated(x%v%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + endif end if call move_alloc(tmp,x%v) @@ -1182,7 +1250,6 @@ contains end module psb_c_vect_mod - module psb_c_multivect_mod use psb_c_base_multivect_mod @@ -1194,11 +1261,19 @@ module psb_c_multivect_mod type psb_c_multivect_type class(psb_c_base_multivect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + complex(psb_spk_), allocatable :: rmtv(:,:) contains procedure, pass(x) :: get_nrows => c_vect_get_nrows procedure, pass(x) :: get_ncols => c_vect_get_ncols procedure, pass(x) :: sizeof => c_vect_sizeof procedure, pass(x) :: get_fmt => c_vect_get_fmt + procedure, pass(x) :: is_remote_build => c_mvect_is_remote_build + procedure, pass(x) :: set_remote_build => c_mvect_set_remote_build + procedure, pass(x) :: get_dupl => c_mvect_get_dupl + procedure, pass(x) :: set_dupl => c_mvect_set_dupl procedure, pass(x) :: all => c_vect_all procedure, pass(x) :: reall => c_vect_reall @@ -1266,6 +1341,46 @@ module psb_c_multivect_mod contains + + function c_mvect_get_dupl(x) result(res) + implicit none + class(psb_c_multivect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function c_mvect_get_dupl + + subroutine c_mvect_set_dupl(x,val) + implicit none + class(psb_c_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine c_mvect_set_dupl + + + function c_mvect_is_remote_build(x) result(res) + implicit none + class(psb_c_multivect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function c_mvect_is_remote_build + + subroutine c_mvect_set_remote_build(x,val) + implicit none + class(psb_c_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine c_mvect_set_remote_build + subroutine psb_c_set_multivect_default(v) implicit none @@ -1570,23 +1685,23 @@ contains end subroutine c_vect_free - subroutine c_vect_ins(n,irl,val,dupl,x,info) + subroutine c_vect_ins(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_c_multivect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) complex(psb_spk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine c_vect_ins diff --git a/base/modules/serial/psb_d_base_mat_mod.F90 b/base/modules/serial/psb_d_base_mat_mod.F90 index 48e9ec1e..eb49905d 100644 --- a/base/modules/serial/psb_d_base_mat_mod.F90 +++ b/base/modules/serial/psb_d_base_mat_mod.F90 @@ -1865,26 +1865,29 @@ module psb_d_base_mat_mod integer(psb_ipk_), intent(in), optional :: idir end subroutine psb_d_fix_coo_inner end interface - interface - subroutine psb_d_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,info) + + interface + subroutine psb_d_fix_coo_inner_colmajor(nr,nc,nzin,dupl,& + & ia,ja,val,iaux,nzout,info) import integer(psb_ipk_), intent(in) :: nr,nc,nzin,dupl integer(psb_ipk_), intent(inout) :: ia(:), ja(:), iaux(:) real(psb_dpk_), intent(inout) :: val(:) integer(psb_ipk_), intent(out) :: nzout integer(psb_ipk_), intent(out) :: info - end subroutine psb_d_fix_coo_inner_rowmajor + end subroutine psb_d_fix_coo_inner_colmajor end interface - interface - subroutine psb_d_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,info) + + interface + subroutine psb_d_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,& + & ia,ja,val,iaux,nzout,info) import integer(psb_ipk_), intent(in) :: nr,nc,nzin,dupl integer(psb_ipk_), intent(inout) :: ia(:), ja(:), iaux(:) real(psb_dpk_), intent(inout) :: val(:) integer(psb_ipk_), intent(out) :: nzout integer(psb_ipk_), intent(out) :: info - end subroutine psb_d_fix_coo_inner_colmajor - + end subroutine psb_d_fix_coo_inner_rowmajor end interface ! diff --git a/base/modules/serial/psb_d_base_vect_mod.F90 b/base/modules/serial/psb_d_base_vect_mod.F90 index ad64e6c9..a28d12f6 100644 --- a/base/modules/serial/psb_d_base_vect_mod.F90 +++ b/base/modules/serial/psb_d_base_vect_mod.F90 @@ -1215,7 +1215,7 @@ contains if (beta == done) then return else - !$omp parallel do private(i) shared(beta) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) end do @@ -1233,7 +1233,7 @@ contains z%v(i) = z%v(i) + y(i)*x(i) end do else - !$omp parallel do private(i) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) + y(i)*x(i) end do @@ -1250,24 +1250,24 @@ contains z%v(i) = z%v(i) - y(i)*x(i) end do else - !$omp parallel do private(i) shared(beta) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) - y(i)*x(i) end do end if else if (beta == dzero) then - !$omp parallel do private(i) shared(alpha) + !$omp parallel do private(i) shared(alpha) do i=1, n z%v(i) = alpha*y(i)*x(i) end do else if (beta == done) then - !$omp parallel do private(i) shared(alpha) + !$omp parallel do private(i) shared(alpha) do i=1, n z%v(i) = z%v(i) + alpha*y(i)*x(i) end do else - !$omp parallel do private(i) shared(alpha, beta) + !$omp parallel do private(i) shared(alpha, beta) do i=1, n z%v(i) = beta*z%v(i) + alpha*y(i)*x(i) end do diff --git a/base/modules/serial/psb_d_mat_mod.F90 b/base/modules/serial/psb_d_mat_mod.F90 index ff51d1cb..8f967ce1 100644 --- a/base/modules/serial/psb_d_mat_mod.F90 +++ b/base/modules/serial/psb_d_mat_mod.F90 @@ -84,7 +84,9 @@ module psb_d_mat_mod type :: psb_dspmat_type - class(psb_d_base_sparse_mat), allocatable :: a + class(psb_d_base_sparse_mat), allocatable :: a + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + type(psb_ld_coo_sparse_mat), allocatable :: rmta contains ! Getters @@ -109,6 +111,8 @@ module psb_d_mat_mod procedure, pass(a) :: is_repeatable_updates => psb_d_is_repeatable_updates procedure, pass(a) :: get_fmt => psb_d_get_fmt procedure, pass(a) :: sizeof => psb_d_sizeof + procedure, pass(a) :: is_remote_build => psb_d_is_remote_build + ! Setters procedure, pass(a) :: set_nrows => psb_d_set_nrows @@ -125,6 +129,7 @@ module psb_d_mat_mod procedure, pass(a) :: set_symmetric => psb_d_set_symmetric procedure, pass(a) :: set_unit => psb_d_set_unit procedure, pass(a) :: set_repeatable_updates => psb_d_set_repeatable_updates + procedure, pass(a) :: set_remote_build => psb_d_set_remote_build ! Memory/data management procedure, pass(a) :: csall => psb_d_csall @@ -2292,7 +2297,25 @@ contains end function d_mat_is_sync + function psb_d_is_remote_build(a) result(res) + implicit none + class(psb_dspmat_type), intent(in) :: a + logical :: res + res = (a%remote_build == psb_matbld_remote_) + end function psb_d_is_remote_build + subroutine psb_d_set_remote_build(a,val) + implicit none + class(psb_dspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + a%remote_build = val + else + a%remote_build = psb_matbld_remote_ + end if + end subroutine psb_d_set_remote_build + function psb_d_is_repeatable_updates(a) result(res) implicit none class(psb_dspmat_type), intent(in) :: a diff --git a/base/modules/serial/psb_d_vect_mod.F90 b/base/modules/serial/psb_d_vect_mod.F90 index ec928584..88fa3262 100644 --- a/base/modules/serial/psb_d_vect_mod.F90 +++ b/base/modules/serial/psb_d_vect_mod.F90 @@ -39,15 +39,27 @@ ! module psb_d_vect_mod + use psb_realloc_mod use psb_d_base_vect_mod use psb_i_vect_mod type psb_d_vect_type class(psb_d_base_vect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + real(psb_dpk_), allocatable :: rmtv(:) + integer(psb_lpk_), allocatable :: rmidx(:) contains procedure, pass(x) :: get_nrows => d_vect_get_nrows procedure, pass(x) :: sizeof => d_vect_sizeof procedure, pass(x) :: get_fmt => d_vect_get_fmt + procedure, pass(x) :: is_remote_build => d_vect_is_remote_build + procedure, pass(x) :: set_remote_build => d_vect_set_remote_build + procedure, pass(x) :: get_dupl => d_vect_get_dupl + procedure, pass(x) :: set_dupl => d_vect_set_dupl + procedure, pass(x) :: get_nrmv => d_vect_get_nrmv + procedure, pass(x) :: set_nrmv => d_vect_set_nrmv procedure, pass(x) :: all => d_vect_all procedure, pass(x) :: reall => d_vect_reall procedure, pass(x) :: zero => d_vect_zero @@ -152,7 +164,9 @@ module psb_d_vect_mod & d_vect_cnv, d_vect_set_scal, & & d_vect_set_vect, d_vect_clone, d_vect_sync, d_vect_is_host, & & d_vect_is_dev, d_vect_is_sync, d_vect_set_host, & - & d_vect_set_dev, d_vect_set_sync + & d_vect_set_dev, d_vect_set_sync, & + & d_vect_set_remote_build, d_is_remote_build, & + & d_vect_set_dupl, d_get_dupl, d_vect_set_nrmv, d_get_nrmv private :: d_vect_dot_v, d_vect_dot_a, d_vect_axpby_v, d_vect_axpby_a, & & d_vect_mlt_v, d_vect_mlt_a, d_vect_mlt_a_2, d_vect_mlt_v_2, & @@ -174,7 +188,60 @@ module psb_d_vect_mod contains + function d_vect_get_dupl(x) result(res) + implicit none + class(psb_d_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function d_vect_get_dupl + + subroutine d_vect_set_dupl(x,val) + implicit none + class(psb_d_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine d_vect_set_dupl + + function d_vect_get_nrmv(x) result(res) + implicit none + class(psb_d_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%nrmv + end function d_vect_get_nrmv + + subroutine d_vect_set_nrmv(x,val) + implicit none + class(psb_d_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in) :: val + x%nrmv = val + end subroutine d_vect_set_nrmv + + + function d_vect_is_remote_build(x) result(res) + implicit none + class(psb_d_vect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function d_vect_is_remote_build + + subroutine d_vect_set_remote_build(x,val) + implicit none + class(psb_d_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine d_vect_set_remote_build + subroutine psb_d_set_vect_default(v) implicit none class(psb_d_base_vect_type), intent(in) :: v @@ -372,8 +439,8 @@ contains implicit none integer(psb_ipk_), intent(in) :: n class(psb_d_vect_type), intent(inout) :: x - class(psb_d_base_vect_type), intent(in), optional :: mold integer(psb_ipk_), intent(out) :: info + class(psb_d_base_vect_type), intent(in), optional :: mold if (allocated(x%v)) & & call x%free(info) @@ -388,7 +455,6 @@ contains else info = psb_err_alloc_dealloc_ end if - end subroutine d_vect_all subroutine d_vect_reall(n, x, info) @@ -419,13 +485,13 @@ contains use psi_serial_mod use psb_realloc_mod implicit none - integer(psb_ipk_), intent(in) :: n + integer(psb_ipk_), intent(in) :: n class(psb_d_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(out) :: info - - if (allocated(x%v)) & - & call x%v%asb(n,info) + integer(psb_ipk_), intent(out) :: info + if (allocated(x%v)) then + call x%v%asb(n,info) + end if end subroutine d_vect_asb subroutine d_vect_gthab(n,idx,alpha,x,beta,y) @@ -476,44 +542,44 @@ contains end subroutine d_vect_free - subroutine d_vect_ins_a(n,irl,val,dupl,x,info) + subroutine d_vect_ins_a(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_d_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) real(psb_dpk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine d_vect_ins_a - subroutine d_vect_ins_v(n,irl,val,dupl,x,info) + subroutine d_vect_ins_v(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_d_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: irl class(psb_d_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl%v,val%v,dupl,info) end subroutine d_vect_ins_v @@ -533,9 +599,11 @@ contains allocate(tmp,stat=info,mold=psb_d_get_base_vect_default()) end if if (allocated(x%v)) then - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) + if (allocated(x%v%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + endif end if call move_alloc(tmp,x%v) @@ -1261,7 +1329,6 @@ contains end module psb_d_vect_mod - module psb_d_multivect_mod use psb_d_base_multivect_mod @@ -1273,11 +1340,19 @@ module psb_d_multivect_mod type psb_d_multivect_type class(psb_d_base_multivect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + real(psb_dpk_), allocatable :: rmtv(:,:) contains procedure, pass(x) :: get_nrows => d_vect_get_nrows procedure, pass(x) :: get_ncols => d_vect_get_ncols procedure, pass(x) :: sizeof => d_vect_sizeof procedure, pass(x) :: get_fmt => d_vect_get_fmt + procedure, pass(x) :: is_remote_build => d_mvect_is_remote_build + procedure, pass(x) :: set_remote_build => d_mvect_set_remote_build + procedure, pass(x) :: get_dupl => d_mvect_get_dupl + procedure, pass(x) :: set_dupl => d_mvect_set_dupl procedure, pass(x) :: all => d_vect_all procedure, pass(x) :: reall => d_vect_reall @@ -1345,6 +1420,46 @@ module psb_d_multivect_mod contains + + function d_mvect_get_dupl(x) result(res) + implicit none + class(psb_d_multivect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function d_mvect_get_dupl + + subroutine d_mvect_set_dupl(x,val) + implicit none + class(psb_d_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine d_mvect_set_dupl + + + function d_mvect_is_remote_build(x) result(res) + implicit none + class(psb_d_multivect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function d_mvect_is_remote_build + + subroutine d_mvect_set_remote_build(x,val) + implicit none + class(psb_d_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine d_mvect_set_remote_build + subroutine psb_d_set_multivect_default(v) implicit none @@ -1649,23 +1764,23 @@ contains end subroutine d_vect_free - subroutine d_vect_ins(n,irl,val,dupl,x,info) + subroutine d_vect_ins(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_d_multivect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) real(psb_dpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine d_vect_ins diff --git a/base/modules/serial/psb_i_vect_mod.F90 b/base/modules/serial/psb_i_vect_mod.F90 index 75064b81..ab371bd5 100644 --- a/base/modules/serial/psb_i_vect_mod.F90 +++ b/base/modules/serial/psb_i_vect_mod.F90 @@ -39,14 +39,26 @@ ! module psb_i_vect_mod + use psb_realloc_mod use psb_i_base_vect_mod type psb_i_vect_type class(psb_i_base_vect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + integer(psb_ipk_), allocatable :: rmtv(:) + integer(psb_lpk_), allocatable :: rmidx(:) contains procedure, pass(x) :: get_nrows => i_vect_get_nrows procedure, pass(x) :: sizeof => i_vect_sizeof procedure, pass(x) :: get_fmt => i_vect_get_fmt + procedure, pass(x) :: is_remote_build => i_vect_is_remote_build + procedure, pass(x) :: set_remote_build => i_vect_set_remote_build + procedure, pass(x) :: get_dupl => i_vect_get_dupl + procedure, pass(x) :: set_dupl => i_vect_set_dupl + procedure, pass(x) :: get_nrmv => i_vect_get_nrmv + procedure, pass(x) :: set_nrmv => i_vect_set_nrmv procedure, pass(x) :: all => i_vect_all procedure, pass(x) :: reall => i_vect_reall procedure, pass(x) :: zero => i_vect_zero @@ -97,7 +109,9 @@ module psb_i_vect_mod & i_vect_cnv, i_vect_set_scal, & & i_vect_set_vect, i_vect_clone, i_vect_sync, i_vect_is_host, & & i_vect_is_dev, i_vect_is_sync, i_vect_set_host, & - & i_vect_set_dev, i_vect_set_sync + & i_vect_set_dev, i_vect_set_sync, & + & i_vect_set_remote_build, i_is_remote_build, & + & i_vect_set_dupl, i_get_dupl, i_vect_set_nrmv, i_get_nrmv class(psb_i_base_vect_type), allocatable, target,& @@ -114,7 +128,60 @@ module psb_i_vect_mod contains + function i_vect_get_dupl(x) result(res) + implicit none + class(psb_i_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function i_vect_get_dupl + + subroutine i_vect_set_dupl(x,val) + implicit none + class(psb_i_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine i_vect_set_dupl + + function i_vect_get_nrmv(x) result(res) + implicit none + class(psb_i_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%nrmv + end function i_vect_get_nrmv + + subroutine i_vect_set_nrmv(x,val) + implicit none + class(psb_i_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in) :: val + + x%nrmv = val + end subroutine i_vect_set_nrmv + + + function i_vect_is_remote_build(x) result(res) + implicit none + class(psb_i_vect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function i_vect_is_remote_build + + subroutine i_vect_set_remote_build(x,val) + implicit none + class(psb_i_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine i_vect_set_remote_build + subroutine psb_i_set_vect_default(v) implicit none class(psb_i_base_vect_type), intent(in) :: v @@ -312,8 +379,8 @@ contains implicit none integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: x - class(psb_i_base_vect_type), intent(in), optional :: mold integer(psb_ipk_), intent(out) :: info + class(psb_i_base_vect_type), intent(in), optional :: mold if (allocated(x%v)) & & call x%free(info) @@ -328,7 +395,6 @@ contains else info = psb_err_alloc_dealloc_ end if - end subroutine i_vect_all subroutine i_vect_reall(n, x, info) @@ -359,13 +425,13 @@ contains use psi_serial_mod use psb_realloc_mod implicit none - integer(psb_ipk_), intent(in) :: n + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(out) :: info - - if (allocated(x%v)) & - & call x%v%asb(n,info) + integer(psb_ipk_), intent(out) :: info + if (allocated(x%v)) then + call x%v%asb(n,info) + end if end subroutine i_vect_asb subroutine i_vect_gthab(n,idx,alpha,x,beta,y) @@ -416,44 +482,44 @@ contains end subroutine i_vect_free - subroutine i_vect_ins_a(n,irl,val,dupl,x,info) + subroutine i_vect_ins_a(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_i_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) integer(psb_ipk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine i_vect_ins_a - subroutine i_vect_ins_v(n,irl,val,dupl,x,info) + subroutine i_vect_ins_v(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_i_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: irl class(psb_i_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl%v,val%v,dupl,info) end subroutine i_vect_ins_v @@ -473,9 +539,11 @@ contains allocate(tmp,stat=info,mold=psb_i_get_base_vect_default()) end if if (allocated(x%v)) then - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) + if (allocated(x%v%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + endif end if call move_alloc(tmp,x%v) @@ -557,7 +625,6 @@ contains end module psb_i_vect_mod - module psb_i_multivect_mod use psb_i_base_multivect_mod @@ -569,11 +636,19 @@ module psb_i_multivect_mod type psb_i_multivect_type class(psb_i_base_multivect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + integer(psb_ipk_), allocatable :: rmtv(:,:) contains procedure, pass(x) :: get_nrows => i_vect_get_nrows procedure, pass(x) :: get_ncols => i_vect_get_ncols procedure, pass(x) :: sizeof => i_vect_sizeof procedure, pass(x) :: get_fmt => i_vect_get_fmt + procedure, pass(x) :: is_remote_build => i_mvect_is_remote_build + procedure, pass(x) :: set_remote_build => i_mvect_set_remote_build + procedure, pass(x) :: get_dupl => i_mvect_get_dupl + procedure, pass(x) :: set_dupl => i_mvect_set_dupl procedure, pass(x) :: all => i_vect_all procedure, pass(x) :: reall => i_vect_reall @@ -623,6 +698,46 @@ module psb_i_multivect_mod contains + + function i_mvect_get_dupl(x) result(res) + implicit none + class(psb_i_multivect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function i_mvect_get_dupl + + subroutine i_mvect_set_dupl(x,val) + implicit none + class(psb_i_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine i_mvect_set_dupl + + + function i_mvect_is_remote_build(x) result(res) + implicit none + class(psb_i_multivect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function i_mvect_is_remote_build + + subroutine i_mvect_set_remote_build(x,val) + implicit none + class(psb_i_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine i_mvect_set_remote_build + subroutine psb_i_set_multivect_default(v) implicit none @@ -927,23 +1042,23 @@ contains end subroutine i_vect_free - subroutine i_vect_ins(n,irl,val,dupl,x,info) + subroutine i_vect_ins(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_i_multivect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) integer(psb_ipk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine i_vect_ins diff --git a/base/modules/serial/psb_l_vect_mod.F90 b/base/modules/serial/psb_l_vect_mod.F90 index 3c86f8a2..779d4723 100644 --- a/base/modules/serial/psb_l_vect_mod.F90 +++ b/base/modules/serial/psb_l_vect_mod.F90 @@ -39,15 +39,27 @@ ! module psb_l_vect_mod + use psb_realloc_mod use psb_l_base_vect_mod use psb_i_vect_mod type psb_l_vect_type class(psb_l_base_vect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + integer(psb_lpk_), allocatable :: rmtv(:) + integer(psb_lpk_), allocatable :: rmidx(:) contains procedure, pass(x) :: get_nrows => l_vect_get_nrows procedure, pass(x) :: sizeof => l_vect_sizeof procedure, pass(x) :: get_fmt => l_vect_get_fmt + procedure, pass(x) :: is_remote_build => l_vect_is_remote_build + procedure, pass(x) :: set_remote_build => l_vect_set_remote_build + procedure, pass(x) :: get_dupl => l_vect_get_dupl + procedure, pass(x) :: set_dupl => l_vect_set_dupl + procedure, pass(x) :: get_nrmv => l_vect_get_nrmv + procedure, pass(x) :: set_nrmv => l_vect_set_nrmv procedure, pass(x) :: all => l_vect_all procedure, pass(x) :: reall => l_vect_reall procedure, pass(x) :: zero => l_vect_zero @@ -98,7 +110,9 @@ module psb_l_vect_mod & l_vect_cnv, l_vect_set_scal, & & l_vect_set_vect, l_vect_clone, l_vect_sync, l_vect_is_host, & & l_vect_is_dev, l_vect_is_sync, l_vect_set_host, & - & l_vect_set_dev, l_vect_set_sync + & l_vect_set_dev, l_vect_set_sync, & + & l_vect_set_remote_build, l_is_remote_build, & + & l_vect_set_dupl, l_get_dupl, l_vect_set_nrmv, l_get_nrmv class(psb_l_base_vect_type), allocatable, target,& @@ -115,7 +129,60 @@ module psb_l_vect_mod contains + function l_vect_get_dupl(x) result(res) + implicit none + class(psb_l_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function l_vect_get_dupl + + subroutine l_vect_set_dupl(x,val) + implicit none + class(psb_l_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine l_vect_set_dupl + + function l_vect_get_nrmv(x) result(res) + implicit none + class(psb_l_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%nrmv + end function l_vect_get_nrmv + + subroutine l_vect_set_nrmv(x,val) + implicit none + class(psb_l_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in) :: val + x%nrmv = val + end subroutine l_vect_set_nrmv + + + function l_vect_is_remote_build(x) result(res) + implicit none + class(psb_l_vect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function l_vect_is_remote_build + + subroutine l_vect_set_remote_build(x,val) + implicit none + class(psb_l_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine l_vect_set_remote_build + subroutine psb_l_set_vect_default(v) implicit none class(psb_l_base_vect_type), intent(in) :: v @@ -313,8 +380,8 @@ contains implicit none integer(psb_ipk_), intent(in) :: n class(psb_l_vect_type), intent(inout) :: x - class(psb_l_base_vect_type), intent(in), optional :: mold integer(psb_ipk_), intent(out) :: info + class(psb_l_base_vect_type), intent(in), optional :: mold if (allocated(x%v)) & & call x%free(info) @@ -329,7 +396,6 @@ contains else info = psb_err_alloc_dealloc_ end if - end subroutine l_vect_all subroutine l_vect_reall(n, x, info) @@ -360,13 +426,13 @@ contains use psi_serial_mod use psb_realloc_mod implicit none - integer(psb_ipk_), intent(in) :: n + integer(psb_ipk_), intent(in) :: n class(psb_l_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(out) :: info - - if (allocated(x%v)) & - & call x%v%asb(n,info) + integer(psb_ipk_), intent(out) :: info + if (allocated(x%v)) then + call x%v%asb(n,info) + end if end subroutine l_vect_asb subroutine l_vect_gthab(n,idx,alpha,x,beta,y) @@ -417,44 +483,44 @@ contains end subroutine l_vect_free - subroutine l_vect_ins_a(n,irl,val,dupl,x,info) + subroutine l_vect_ins_a(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_l_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) integer(psb_lpk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine l_vect_ins_a - subroutine l_vect_ins_v(n,irl,val,dupl,x,info) + subroutine l_vect_ins_v(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_l_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: irl class(psb_l_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl%v,val%v,dupl,info) end subroutine l_vect_ins_v @@ -474,9 +540,11 @@ contains allocate(tmp,stat=info,mold=psb_l_get_base_vect_default()) end if if (allocated(x%v)) then - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) + if (allocated(x%v%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + endif end if call move_alloc(tmp,x%v) @@ -558,7 +626,6 @@ contains end module psb_l_vect_mod - module psb_l_multivect_mod use psb_l_base_multivect_mod @@ -570,11 +637,19 @@ module psb_l_multivect_mod type psb_l_multivect_type class(psb_l_base_multivect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + integer(psb_lpk_), allocatable :: rmtv(:,:) contains procedure, pass(x) :: get_nrows => l_vect_get_nrows procedure, pass(x) :: get_ncols => l_vect_get_ncols procedure, pass(x) :: sizeof => l_vect_sizeof procedure, pass(x) :: get_fmt => l_vect_get_fmt + procedure, pass(x) :: is_remote_build => l_mvect_is_remote_build + procedure, pass(x) :: set_remote_build => l_mvect_set_remote_build + procedure, pass(x) :: get_dupl => l_mvect_get_dupl + procedure, pass(x) :: set_dupl => l_mvect_set_dupl procedure, pass(x) :: all => l_vect_all procedure, pass(x) :: reall => l_vect_reall @@ -624,6 +699,46 @@ module psb_l_multivect_mod contains + + function l_mvect_get_dupl(x) result(res) + implicit none + class(psb_l_multivect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function l_mvect_get_dupl + + subroutine l_mvect_set_dupl(x,val) + implicit none + class(psb_l_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine l_mvect_set_dupl + + + function l_mvect_is_remote_build(x) result(res) + implicit none + class(psb_l_multivect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function l_mvect_is_remote_build + + subroutine l_mvect_set_remote_build(x,val) + implicit none + class(psb_l_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine l_mvect_set_remote_build + subroutine psb_l_set_multivect_default(v) implicit none @@ -928,23 +1043,23 @@ contains end subroutine l_vect_free - subroutine l_vect_ins(n,irl,val,dupl,x,info) + subroutine l_vect_ins(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_l_multivect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) integer(psb_lpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine l_vect_ins diff --git a/base/modules/serial/psb_s_base_mat_mod.F90 b/base/modules/serial/psb_s_base_mat_mod.F90 index 62706c1c..79c8222b 100644 --- a/base/modules/serial/psb_s_base_mat_mod.F90 +++ b/base/modules/serial/psb_s_base_mat_mod.F90 @@ -1865,26 +1865,29 @@ module psb_s_base_mat_mod integer(psb_ipk_), intent(in), optional :: idir end subroutine psb_s_fix_coo_inner end interface - interface - subroutine psb_s_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,info) + + interface + subroutine psb_s_fix_coo_inner_colmajor(nr,nc,nzin,dupl,& + & ia,ja,val,iaux,nzout,info) import integer(psb_ipk_), intent(in) :: nr,nc,nzin,dupl integer(psb_ipk_), intent(inout) :: ia(:), ja(:), iaux(:) real(psb_spk_), intent(inout) :: val(:) integer(psb_ipk_), intent(out) :: nzout integer(psb_ipk_), intent(out) :: info - end subroutine psb_s_fix_coo_inner_rowmajor + end subroutine psb_s_fix_coo_inner_colmajor end interface - interface - subroutine psb_s_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,info) + + interface + subroutine psb_s_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,& + & ia,ja,val,iaux,nzout,info) import integer(psb_ipk_), intent(in) :: nr,nc,nzin,dupl integer(psb_ipk_), intent(inout) :: ia(:), ja(:), iaux(:) real(psb_spk_), intent(inout) :: val(:) integer(psb_ipk_), intent(out) :: nzout integer(psb_ipk_), intent(out) :: info - end subroutine psb_s_fix_coo_inner_colmajor - + end subroutine psb_s_fix_coo_inner_rowmajor end interface ! diff --git a/base/modules/serial/psb_s_base_vect_mod.F90 b/base/modules/serial/psb_s_base_vect_mod.F90 index e3b1cbd5..4bd6bbfb 100644 --- a/base/modules/serial/psb_s_base_vect_mod.F90 +++ b/base/modules/serial/psb_s_base_vect_mod.F90 @@ -1215,7 +1215,7 @@ contains if (beta == sone) then return else - !$omp parallel do private(i) shared(beta) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) end do @@ -1233,7 +1233,7 @@ contains z%v(i) = z%v(i) + y(i)*x(i) end do else - !$omp parallel do private(i) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) + y(i)*x(i) end do @@ -1250,24 +1250,24 @@ contains z%v(i) = z%v(i) - y(i)*x(i) end do else - !$omp parallel do private(i) shared(beta) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) - y(i)*x(i) end do end if else if (beta == szero) then - !$omp parallel do private(i) shared(alpha) + !$omp parallel do private(i) shared(alpha) do i=1, n z%v(i) = alpha*y(i)*x(i) end do else if (beta == sone) then - !$omp parallel do private(i) shared(alpha) + !$omp parallel do private(i) shared(alpha) do i=1, n z%v(i) = z%v(i) + alpha*y(i)*x(i) end do else - !$omp parallel do private(i) shared(alpha, beta) + !$omp parallel do private(i) shared(alpha, beta) do i=1, n z%v(i) = beta*z%v(i) + alpha*y(i)*x(i) end do diff --git a/base/modules/serial/psb_s_mat_mod.F90 b/base/modules/serial/psb_s_mat_mod.F90 index 849c64c3..43f1c619 100644 --- a/base/modules/serial/psb_s_mat_mod.F90 +++ b/base/modules/serial/psb_s_mat_mod.F90 @@ -84,7 +84,9 @@ module psb_s_mat_mod type :: psb_sspmat_type - class(psb_s_base_sparse_mat), allocatable :: a + class(psb_s_base_sparse_mat), allocatable :: a + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + type(psb_ls_coo_sparse_mat), allocatable :: rmta contains ! Getters @@ -109,6 +111,8 @@ module psb_s_mat_mod procedure, pass(a) :: is_repeatable_updates => psb_s_is_repeatable_updates procedure, pass(a) :: get_fmt => psb_s_get_fmt procedure, pass(a) :: sizeof => psb_s_sizeof + procedure, pass(a) :: is_remote_build => psb_s_is_remote_build + ! Setters procedure, pass(a) :: set_nrows => psb_s_set_nrows @@ -125,6 +129,7 @@ module psb_s_mat_mod procedure, pass(a) :: set_symmetric => psb_s_set_symmetric procedure, pass(a) :: set_unit => psb_s_set_unit procedure, pass(a) :: set_repeatable_updates => psb_s_set_repeatable_updates + procedure, pass(a) :: set_remote_build => psb_s_set_remote_build ! Memory/data management procedure, pass(a) :: csall => psb_s_csall @@ -2292,7 +2297,25 @@ contains end function s_mat_is_sync + function psb_s_is_remote_build(a) result(res) + implicit none + class(psb_sspmat_type), intent(in) :: a + logical :: res + res = (a%remote_build == psb_matbld_remote_) + end function psb_s_is_remote_build + subroutine psb_s_set_remote_build(a,val) + implicit none + class(psb_sspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + a%remote_build = val + else + a%remote_build = psb_matbld_remote_ + end if + end subroutine psb_s_set_remote_build + function psb_s_is_repeatable_updates(a) result(res) implicit none class(psb_sspmat_type), intent(in) :: a diff --git a/base/modules/serial/psb_s_vect_mod.F90 b/base/modules/serial/psb_s_vect_mod.F90 index 8f378c6d..7a54ecf0 100644 --- a/base/modules/serial/psb_s_vect_mod.F90 +++ b/base/modules/serial/psb_s_vect_mod.F90 @@ -39,15 +39,27 @@ ! module psb_s_vect_mod + use psb_realloc_mod use psb_s_base_vect_mod use psb_i_vect_mod type psb_s_vect_type class(psb_s_base_vect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + real(psb_spk_), allocatable :: rmtv(:) + integer(psb_lpk_), allocatable :: rmidx(:) contains procedure, pass(x) :: get_nrows => s_vect_get_nrows procedure, pass(x) :: sizeof => s_vect_sizeof procedure, pass(x) :: get_fmt => s_vect_get_fmt + procedure, pass(x) :: is_remote_build => s_vect_is_remote_build + procedure, pass(x) :: set_remote_build => s_vect_set_remote_build + procedure, pass(x) :: get_dupl => s_vect_get_dupl + procedure, pass(x) :: set_dupl => s_vect_set_dupl + procedure, pass(x) :: get_nrmv => s_vect_get_nrmv + procedure, pass(x) :: set_nrmv => s_vect_set_nrmv procedure, pass(x) :: all => s_vect_all procedure, pass(x) :: reall => s_vect_reall procedure, pass(x) :: zero => s_vect_zero @@ -152,7 +164,9 @@ module psb_s_vect_mod & s_vect_cnv, s_vect_set_scal, & & s_vect_set_vect, s_vect_clone, s_vect_sync, s_vect_is_host, & & s_vect_is_dev, s_vect_is_sync, s_vect_set_host, & - & s_vect_set_dev, s_vect_set_sync + & s_vect_set_dev, s_vect_set_sync, & + & s_vect_set_remote_build, s_is_remote_build, & + & s_vect_set_dupl, s_get_dupl, s_vect_set_nrmv, s_get_nrmv private :: s_vect_dot_v, s_vect_dot_a, s_vect_axpby_v, s_vect_axpby_a, & & s_vect_mlt_v, s_vect_mlt_a, s_vect_mlt_a_2, s_vect_mlt_v_2, & @@ -174,7 +188,60 @@ module psb_s_vect_mod contains + function s_vect_get_dupl(x) result(res) + implicit none + class(psb_s_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function s_vect_get_dupl + + subroutine s_vect_set_dupl(x,val) + implicit none + class(psb_s_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine s_vect_set_dupl + + function s_vect_get_nrmv(x) result(res) + implicit none + class(psb_s_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%nrmv + end function s_vect_get_nrmv + + subroutine s_vect_set_nrmv(x,val) + implicit none + class(psb_s_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in) :: val + x%nrmv = val + end subroutine s_vect_set_nrmv + + + function s_vect_is_remote_build(x) result(res) + implicit none + class(psb_s_vect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function s_vect_is_remote_build + + subroutine s_vect_set_remote_build(x,val) + implicit none + class(psb_s_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine s_vect_set_remote_build + subroutine psb_s_set_vect_default(v) implicit none class(psb_s_base_vect_type), intent(in) :: v @@ -372,8 +439,8 @@ contains implicit none integer(psb_ipk_), intent(in) :: n class(psb_s_vect_type), intent(inout) :: x - class(psb_s_base_vect_type), intent(in), optional :: mold integer(psb_ipk_), intent(out) :: info + class(psb_s_base_vect_type), intent(in), optional :: mold if (allocated(x%v)) & & call x%free(info) @@ -388,7 +455,6 @@ contains else info = psb_err_alloc_dealloc_ end if - end subroutine s_vect_all subroutine s_vect_reall(n, x, info) @@ -419,13 +485,13 @@ contains use psi_serial_mod use psb_realloc_mod implicit none - integer(psb_ipk_), intent(in) :: n + integer(psb_ipk_), intent(in) :: n class(psb_s_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(out) :: info - - if (allocated(x%v)) & - & call x%v%asb(n,info) + integer(psb_ipk_), intent(out) :: info + if (allocated(x%v)) then + call x%v%asb(n,info) + end if end subroutine s_vect_asb subroutine s_vect_gthab(n,idx,alpha,x,beta,y) @@ -476,44 +542,44 @@ contains end subroutine s_vect_free - subroutine s_vect_ins_a(n,irl,val,dupl,x,info) + subroutine s_vect_ins_a(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_s_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) real(psb_spk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine s_vect_ins_a - subroutine s_vect_ins_v(n,irl,val,dupl,x,info) + subroutine s_vect_ins_v(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_s_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: irl class(psb_s_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl%v,val%v,dupl,info) end subroutine s_vect_ins_v @@ -533,9 +599,11 @@ contains allocate(tmp,stat=info,mold=psb_s_get_base_vect_default()) end if if (allocated(x%v)) then - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) + if (allocated(x%v%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + endif end if call move_alloc(tmp,x%v) @@ -1261,7 +1329,6 @@ contains end module psb_s_vect_mod - module psb_s_multivect_mod use psb_s_base_multivect_mod @@ -1273,11 +1340,19 @@ module psb_s_multivect_mod type psb_s_multivect_type class(psb_s_base_multivect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + real(psb_spk_), allocatable :: rmtv(:,:) contains procedure, pass(x) :: get_nrows => s_vect_get_nrows procedure, pass(x) :: get_ncols => s_vect_get_ncols procedure, pass(x) :: sizeof => s_vect_sizeof procedure, pass(x) :: get_fmt => s_vect_get_fmt + procedure, pass(x) :: is_remote_build => s_mvect_is_remote_build + procedure, pass(x) :: set_remote_build => s_mvect_set_remote_build + procedure, pass(x) :: get_dupl => s_mvect_get_dupl + procedure, pass(x) :: set_dupl => s_mvect_set_dupl procedure, pass(x) :: all => s_vect_all procedure, pass(x) :: reall => s_vect_reall @@ -1345,6 +1420,46 @@ module psb_s_multivect_mod contains + + function s_mvect_get_dupl(x) result(res) + implicit none + class(psb_s_multivect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function s_mvect_get_dupl + + subroutine s_mvect_set_dupl(x,val) + implicit none + class(psb_s_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine s_mvect_set_dupl + + + function s_mvect_is_remote_build(x) result(res) + implicit none + class(psb_s_multivect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function s_mvect_is_remote_build + + subroutine s_mvect_set_remote_build(x,val) + implicit none + class(psb_s_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine s_mvect_set_remote_build + subroutine psb_s_set_multivect_default(v) implicit none @@ -1649,23 +1764,23 @@ contains end subroutine s_vect_free - subroutine s_vect_ins(n,irl,val,dupl,x,info) + subroutine s_vect_ins(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_s_multivect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) real(psb_spk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine s_vect_ins diff --git a/base/modules/serial/psb_z_base_mat_mod.F90 b/base/modules/serial/psb_z_base_mat_mod.F90 index ea7e0de5..5b6ca07b 100644 --- a/base/modules/serial/psb_z_base_mat_mod.F90 +++ b/base/modules/serial/psb_z_base_mat_mod.F90 @@ -1865,26 +1865,29 @@ module psb_z_base_mat_mod integer(psb_ipk_), intent(in), optional :: idir end subroutine psb_z_fix_coo_inner end interface - interface - subroutine psb_z_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,info) + + interface + subroutine psb_z_fix_coo_inner_colmajor(nr,nc,nzin,dupl,& + & ia,ja,val,iaux,nzout,info) import integer(psb_ipk_), intent(in) :: nr,nc,nzin,dupl integer(psb_ipk_), intent(inout) :: ia(:), ja(:), iaux(:) complex(psb_dpk_), intent(inout) :: val(:) integer(psb_ipk_), intent(out) :: nzout integer(psb_ipk_), intent(out) :: info - end subroutine psb_z_fix_coo_inner_rowmajor + end subroutine psb_z_fix_coo_inner_colmajor end interface - interface - subroutine psb_z_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,info) + + interface + subroutine psb_z_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,& + & ia,ja,val,iaux,nzout,info) import integer(psb_ipk_), intent(in) :: nr,nc,nzin,dupl integer(psb_ipk_), intent(inout) :: ia(:), ja(:), iaux(:) complex(psb_dpk_), intent(inout) :: val(:) integer(psb_ipk_), intent(out) :: nzout integer(psb_ipk_), intent(out) :: info - end subroutine psb_z_fix_coo_inner_colmajor - + end subroutine psb_z_fix_coo_inner_rowmajor end interface ! diff --git a/base/modules/serial/psb_z_base_vect_mod.F90 b/base/modules/serial/psb_z_base_vect_mod.F90 index 3a95a983..c52dcd59 100644 --- a/base/modules/serial/psb_z_base_vect_mod.F90 +++ b/base/modules/serial/psb_z_base_vect_mod.F90 @@ -1208,7 +1208,7 @@ contains if (beta == zone) then return else - !$omp parallel do private(i) shared(beta) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) end do @@ -1226,7 +1226,7 @@ contains z%v(i) = z%v(i) + y(i)*x(i) end do else - !$omp parallel do private(i) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) + y(i)*x(i) end do @@ -1243,24 +1243,24 @@ contains z%v(i) = z%v(i) - y(i)*x(i) end do else - !$omp parallel do private(i) shared(beta) + !$omp parallel do private(i) shared(beta) do i=1, n z%v(i) = beta*z%v(i) - y(i)*x(i) end do end if else if (beta == zzero) then - !$omp parallel do private(i) shared(alpha) + !$omp parallel do private(i) shared(alpha) do i=1, n z%v(i) = alpha*y(i)*x(i) end do else if (beta == zone) then - !$omp parallel do private(i) shared(alpha) + !$omp parallel do private(i) shared(alpha) do i=1, n z%v(i) = z%v(i) + alpha*y(i)*x(i) end do else - !$omp parallel do private(i) shared(alpha, beta) + !$omp parallel do private(i) shared(alpha, beta) do i=1, n z%v(i) = beta*z%v(i) + alpha*y(i)*x(i) end do diff --git a/base/modules/serial/psb_z_mat_mod.F90 b/base/modules/serial/psb_z_mat_mod.F90 index fc16ca80..c534cad5 100644 --- a/base/modules/serial/psb_z_mat_mod.F90 +++ b/base/modules/serial/psb_z_mat_mod.F90 @@ -84,7 +84,9 @@ module psb_z_mat_mod type :: psb_zspmat_type - class(psb_z_base_sparse_mat), allocatable :: a + class(psb_z_base_sparse_mat), allocatable :: a + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + type(psb_lz_coo_sparse_mat), allocatable :: rmta contains ! Getters @@ -109,6 +111,8 @@ module psb_z_mat_mod procedure, pass(a) :: is_repeatable_updates => psb_z_is_repeatable_updates procedure, pass(a) :: get_fmt => psb_z_get_fmt procedure, pass(a) :: sizeof => psb_z_sizeof + procedure, pass(a) :: is_remote_build => psb_z_is_remote_build + ! Setters procedure, pass(a) :: set_nrows => psb_z_set_nrows @@ -125,6 +129,7 @@ module psb_z_mat_mod procedure, pass(a) :: set_symmetric => psb_z_set_symmetric procedure, pass(a) :: set_unit => psb_z_set_unit procedure, pass(a) :: set_repeatable_updates => psb_z_set_repeatable_updates + procedure, pass(a) :: set_remote_build => psb_z_set_remote_build ! Memory/data management procedure, pass(a) :: csall => psb_z_csall @@ -2292,7 +2297,25 @@ contains end function z_mat_is_sync + function psb_z_is_remote_build(a) result(res) + implicit none + class(psb_zspmat_type), intent(in) :: a + logical :: res + res = (a%remote_build == psb_matbld_remote_) + end function psb_z_is_remote_build + subroutine psb_z_set_remote_build(a,val) + implicit none + class(psb_zspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + a%remote_build = val + else + a%remote_build = psb_matbld_remote_ + end if + end subroutine psb_z_set_remote_build + function psb_z_is_repeatable_updates(a) result(res) implicit none class(psb_zspmat_type), intent(in) :: a diff --git a/base/modules/serial/psb_z_vect_mod.F90 b/base/modules/serial/psb_z_vect_mod.F90 index 60c5b6f0..e8a34859 100644 --- a/base/modules/serial/psb_z_vect_mod.F90 +++ b/base/modules/serial/psb_z_vect_mod.F90 @@ -39,15 +39,27 @@ ! module psb_z_vect_mod + use psb_realloc_mod use psb_z_base_vect_mod use psb_i_vect_mod type psb_z_vect_type class(psb_z_base_vect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + complex(psb_dpk_), allocatable :: rmtv(:) + integer(psb_lpk_), allocatable :: rmidx(:) contains procedure, pass(x) :: get_nrows => z_vect_get_nrows procedure, pass(x) :: sizeof => z_vect_sizeof procedure, pass(x) :: get_fmt => z_vect_get_fmt + procedure, pass(x) :: is_remote_build => z_vect_is_remote_build + procedure, pass(x) :: set_remote_build => z_vect_set_remote_build + procedure, pass(x) :: get_dupl => z_vect_get_dupl + procedure, pass(x) :: set_dupl => z_vect_set_dupl + procedure, pass(x) :: get_nrmv => z_vect_get_nrmv + procedure, pass(x) :: set_nrmv => z_vect_set_nrmv procedure, pass(x) :: all => z_vect_all procedure, pass(x) :: reall => z_vect_reall procedure, pass(x) :: zero => z_vect_zero @@ -145,7 +157,9 @@ module psb_z_vect_mod & z_vect_cnv, z_vect_set_scal, & & z_vect_set_vect, z_vect_clone, z_vect_sync, z_vect_is_host, & & z_vect_is_dev, z_vect_is_sync, z_vect_set_host, & - & z_vect_set_dev, z_vect_set_sync + & z_vect_set_dev, z_vect_set_sync, & + & z_vect_set_remote_build, z_is_remote_build, & + & z_vect_set_dupl, z_get_dupl, z_vect_set_nrmv, z_get_nrmv private :: z_vect_dot_v, z_vect_dot_a, z_vect_axpby_v, z_vect_axpby_a, & & z_vect_mlt_v, z_vect_mlt_a, z_vect_mlt_a_2, z_vect_mlt_v_2, & @@ -167,7 +181,60 @@ module psb_z_vect_mod contains + function z_vect_get_dupl(x) result(res) + implicit none + class(psb_z_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function z_vect_get_dupl + + subroutine z_vect_set_dupl(x,val) + implicit none + class(psb_z_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine z_vect_set_dupl + + function z_vect_get_nrmv(x) result(res) + implicit none + class(psb_z_vect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%nrmv + end function z_vect_get_nrmv + + subroutine z_vect_set_nrmv(x,val) + implicit none + class(psb_z_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in) :: val + x%nrmv = val + end subroutine z_vect_set_nrmv + + + function z_vect_is_remote_build(x) result(res) + implicit none + class(psb_z_vect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function z_vect_is_remote_build + + subroutine z_vect_set_remote_build(x,val) + implicit none + class(psb_z_vect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine z_vect_set_remote_build + subroutine psb_z_set_vect_default(v) implicit none class(psb_z_base_vect_type), intent(in) :: v @@ -365,8 +432,8 @@ contains implicit none integer(psb_ipk_), intent(in) :: n class(psb_z_vect_type), intent(inout) :: x - class(psb_z_base_vect_type), intent(in), optional :: mold integer(psb_ipk_), intent(out) :: info + class(psb_z_base_vect_type), intent(in), optional :: mold if (allocated(x%v)) & & call x%free(info) @@ -381,7 +448,6 @@ contains else info = psb_err_alloc_dealloc_ end if - end subroutine z_vect_all subroutine z_vect_reall(n, x, info) @@ -412,13 +478,13 @@ contains use psi_serial_mod use psb_realloc_mod implicit none - integer(psb_ipk_), intent(in) :: n + integer(psb_ipk_), intent(in) :: n class(psb_z_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(out) :: info - - if (allocated(x%v)) & - & call x%v%asb(n,info) + integer(psb_ipk_), intent(out) :: info + if (allocated(x%v)) then + call x%v%asb(n,info) + end if end subroutine z_vect_asb subroutine z_vect_gthab(n,idx,alpha,x,beta,y) @@ -469,44 +535,44 @@ contains end subroutine z_vect_free - subroutine z_vect_ins_a(n,irl,val,dupl,x,info) + subroutine z_vect_ins_a(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_z_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) complex(psb_dpk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine z_vect_ins_a - subroutine z_vect_ins_v(n,irl,val,dupl,x,info) + subroutine z_vect_ins_v(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_z_vect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n class(psb_i_vect_type), intent(inout) :: irl class(psb_z_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.(allocated(x%v).and.allocated(irl%v).and.allocated(val%v))) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl%v,val%v,dupl,info) end subroutine z_vect_ins_v @@ -526,9 +592,11 @@ contains allocate(tmp,stat=info,mold=psb_z_get_base_vect_default()) end if if (allocated(x%v)) then - call x%v%sync() - if (info == psb_success_) call tmp%bld(x%v%v) - call x%v%free(info) + if (allocated(x%v%v)) then + call x%v%sync() + if (info == psb_success_) call tmp%bld(x%v%v) + call x%v%free(info) + endif end if call move_alloc(tmp,x%v) @@ -1182,7 +1250,6 @@ contains end module psb_z_vect_mod - module psb_z_multivect_mod use psb_z_base_multivect_mod @@ -1194,11 +1261,19 @@ module psb_z_multivect_mod type psb_z_multivect_type class(psb_z_base_multivect_type), allocatable :: v + integer(psb_ipk_) :: nrmv = 0 + integer(psb_ipk_) :: remote_build=psb_matbld_noremote_ + integer(psb_ipk_) :: dupl = psb_dupl_add_ + complex(psb_dpk_), allocatable :: rmtv(:,:) contains procedure, pass(x) :: get_nrows => z_vect_get_nrows procedure, pass(x) :: get_ncols => z_vect_get_ncols procedure, pass(x) :: sizeof => z_vect_sizeof procedure, pass(x) :: get_fmt => z_vect_get_fmt + procedure, pass(x) :: is_remote_build => z_mvect_is_remote_build + procedure, pass(x) :: set_remote_build => z_mvect_set_remote_build + procedure, pass(x) :: get_dupl => z_mvect_get_dupl + procedure, pass(x) :: set_dupl => z_mvect_set_dupl procedure, pass(x) :: all => z_vect_all procedure, pass(x) :: reall => z_vect_reall @@ -1266,6 +1341,46 @@ module psb_z_multivect_mod contains + + function z_mvect_get_dupl(x) result(res) + implicit none + class(psb_z_multivect_type), intent(in) :: x + integer(psb_ipk_) :: res + res = x%dupl + end function z_mvect_get_dupl + + subroutine z_mvect_set_dupl(x,val) + implicit none + class(psb_z_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%dupl = val + else + x%dupl = psb_dupl_def_ + end if + end subroutine z_mvect_set_dupl + + + function z_mvect_is_remote_build(x) result(res) + implicit none + class(psb_z_multivect_type), intent(in) :: x + logical :: res + res = (x%remote_build == psb_matbld_remote_) + end function z_mvect_is_remote_build + + subroutine z_mvect_set_remote_build(x,val) + implicit none + class(psb_z_multivect_type), intent(inout) :: x + integer(psb_ipk_), intent(in), optional :: val + + if (present(val)) then + x%remote_build = val + else + x%remote_build = psb_matbld_remote_ + end if + end subroutine z_mvect_set_remote_build + subroutine psb_z_set_multivect_default(v) implicit none @@ -1570,23 +1685,23 @@ contains end subroutine z_vect_free - subroutine z_vect_ins(n,irl,val,dupl,x,info) + subroutine z_vect_ins(n,irl,val,x,info) use psi_serial_mod implicit none class(psb_z_multivect_type), intent(inout) :: x - integer(psb_ipk_), intent(in) :: n, dupl + integer(psb_ipk_), intent(in) :: n integer(psb_ipk_), intent(in) :: irl(:) complex(psb_dpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i + integer(psb_ipk_) :: i, dupl info = 0 if (.not.allocated(x%v)) then info = psb_err_invalid_vect_state_ return end if - + dupl = x%get_dupl() call x%v%ins(n,irl,val,dupl,info) end subroutine z_vect_ins diff --git a/base/modules/tools/psb_c_tools_a_mod.f90 b/base/modules/tools/psb_c_tools_a_mod.f90 index 6c864ead..8dd592b3 100644 --- a/base/modules/tools/psb_c_tools_a_mod.f90 +++ b/base/modules/tools/psb_c_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_c_tools_a_mod end subroutine psb_cinsvi end interface + + interface psb_remote_vect + subroutine psb_c_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + complex(psb_spk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + complex(psb_spk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_c_remote_vect + end interface psb_remote_vect + end module psb_c_tools_a_mod diff --git a/base/modules/tools/psb_c_tools_mod.F90 b/base/modules/tools/psb_c_tools_mod.F90 index 378e146b..2de8f906 100644 --- a/base/modules/tools/psb_c_tools_mod.F90 +++ b/base/modules/tools/psb_c_tools_mod.F90 @@ -40,28 +40,31 @@ Module psb_c_tools_mod use psi_mod, only : psb_snd, psb_rcv ! Needed only for psb_getelem interface psb_geall - subroutine psb_calloc_vect(x, desc_a,info) + subroutine psb_calloc_vect(x, desc_a,info, dupl, bldmode) import implicit none type(psb_c_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_calloc_vect - subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb) + subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) import implicit none type(psb_c_vect_type), allocatable, intent(out) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n, lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_calloc_vect_r2 - subroutine psb_calloc_multivect(x, desc_a,info,n) + subroutine psb_calloc_multivect(x, desc_a,info,n, dupl, bldmode) import implicit none type(psb_c_multivect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_calloc_multivect end interface @@ -123,7 +126,7 @@ Module psb_c_tools_mod interface psb_geins - subroutine psb_cins_vect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_cins_vect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -132,10 +135,9 @@ Module psb_c_tools_mod integer(psb_lpk_), intent(in) :: irw(:) complex(psb_spk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_cins_vect - subroutine psb_cins_vect_v(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_cins_vect_v(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -144,10 +146,9 @@ Module psb_c_tools_mod type(psb_l_vect_type), intent(inout) :: irw type(psb_c_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_cins_vect_v - subroutine psb_cins_vect_r2(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_cins_vect_r2(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -156,10 +157,9 @@ Module psb_c_tools_mod integer(psb_lpk_), intent(in) :: irw(:) complex(psb_spk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_cins_vect_r2 - subroutine psb_cins_multivect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_cins_multivect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -168,11 +168,10 @@ Module psb_c_tools_mod integer(psb_lpk_), intent(in) :: irw(:) complex(psb_spk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_cins_multivect end interface - + interface psb_cdbldext Subroutine psb_ccdbldext(a,desc_a,novr,desc_ov,info,extype) import @@ -239,29 +238,41 @@ Module psb_c_tools_mod interface psb_spall - subroutine psb_cspalloc(a, desc_a, info, nnz) + subroutine psb_cspalloc(a, desc_a, info, nnz, dupl, bldmode) import implicit none - type(psb_desc_type), intent(in) :: desc_a - type(psb_cspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_cspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz, bldmode + integer(psb_ipk_), optional, intent(in) :: dupl end subroutine psb_cspalloc end interface interface psb_spasb - subroutine psb_cspasb(a,desc_a, info, afmt, upd, dupl,mold) + subroutine psb_cspasb(a,desc_a, info, afmt, upd, mold) import implicit none type(psb_cspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a + type(psb_desc_type), intent(inout) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd + integer(psb_ipk_),optional, intent(in) :: upd character(len=*), optional, intent(in) :: afmt class(psb_c_base_sparse_mat), intent(in), optional :: mold end subroutine psb_cspasb end interface + interface psb_remote_mat + subroutine psb_lc_remote_mat(a,desc_a,b, info) + import + implicit none + type(psb_lc_coo_sparse_mat),Intent(inout) :: a + type(psb_desc_type),intent(inout) :: desc_a + type(psb_lc_coo_sparse_mat),Intent(inout) :: b + integer(psb_ipk_), intent(out) :: info + end subroutine psb_lc_remote_mat + end interface psb_remote_mat + interface psb_spfree subroutine psb_cspfree(a, desc_a,info) import diff --git a/base/modules/tools/psb_d_tools_a_mod.f90 b/base/modules/tools/psb_d_tools_a_mod.f90 index 1ce3d774..638953b4 100644 --- a/base/modules/tools/psb_d_tools_a_mod.f90 +++ b/base/modules/tools/psb_d_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_d_tools_a_mod end subroutine psb_dinsvi end interface + + interface psb_remote_vect + subroutine psb_d_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + real(psb_dpk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + real(psb_dpk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_d_remote_vect + end interface psb_remote_vect + end module psb_d_tools_a_mod diff --git a/base/modules/tools/psb_d_tools_mod.F90 b/base/modules/tools/psb_d_tools_mod.F90 index 81c75ece..30e45d53 100644 --- a/base/modules/tools/psb_d_tools_mod.F90 +++ b/base/modules/tools/psb_d_tools_mod.F90 @@ -40,28 +40,31 @@ Module psb_d_tools_mod use psi_mod, only : psb_snd, psb_rcv ! Needed only for psb_getelem interface psb_geall - subroutine psb_dalloc_vect(x, desc_a,info) + subroutine psb_dalloc_vect(x, desc_a,info, dupl, bldmode) import implicit none type(psb_d_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_dalloc_vect - subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb) + subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) import implicit none type(psb_d_vect_type), allocatable, intent(out) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n, lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_dalloc_vect_r2 - subroutine psb_dalloc_multivect(x, desc_a,info,n) + subroutine psb_dalloc_multivect(x, desc_a,info,n, dupl, bldmode) import implicit none type(psb_d_multivect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_dalloc_multivect end interface @@ -123,7 +126,7 @@ Module psb_d_tools_mod interface psb_geins - subroutine psb_dins_vect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_dins_vect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -132,10 +135,9 @@ Module psb_d_tools_mod integer(psb_lpk_), intent(in) :: irw(:) real(psb_dpk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_dins_vect - subroutine psb_dins_vect_v(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_dins_vect_v(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -144,10 +146,9 @@ Module psb_d_tools_mod type(psb_l_vect_type), intent(inout) :: irw type(psb_d_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_dins_vect_v - subroutine psb_dins_vect_r2(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_dins_vect_r2(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -156,10 +157,9 @@ Module psb_d_tools_mod integer(psb_lpk_), intent(in) :: irw(:) real(psb_dpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_dins_vect_r2 - subroutine psb_dins_multivect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_dins_multivect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -168,11 +168,10 @@ Module psb_d_tools_mod integer(psb_lpk_), intent(in) :: irw(:) real(psb_dpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_dins_multivect end interface - + interface psb_cdbldext Subroutine psb_dcdbldext(a,desc_a,novr,desc_ov,info,extype) import @@ -239,29 +238,41 @@ Module psb_d_tools_mod interface psb_spall - subroutine psb_dspalloc(a, desc_a, info, nnz) + subroutine psb_dspalloc(a, desc_a, info, nnz, dupl, bldmode) import implicit none - type(psb_desc_type), intent(in) :: desc_a - type(psb_dspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_dspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz, bldmode + integer(psb_ipk_), optional, intent(in) :: dupl end subroutine psb_dspalloc end interface interface psb_spasb - subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl,mold) + subroutine psb_dspasb(a,desc_a, info, afmt, upd, mold) import implicit none type(psb_dspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a + type(psb_desc_type), intent(inout) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd + integer(psb_ipk_),optional, intent(in) :: upd character(len=*), optional, intent(in) :: afmt class(psb_d_base_sparse_mat), intent(in), optional :: mold end subroutine psb_dspasb end interface + interface psb_remote_mat + subroutine psb_ld_remote_mat(a,desc_a,b, info) + import + implicit none + type(psb_ld_coo_sparse_mat),Intent(inout) :: a + type(psb_desc_type),intent(inout) :: desc_a + type(psb_ld_coo_sparse_mat),Intent(inout) :: b + integer(psb_ipk_), intent(out) :: info + end subroutine psb_ld_remote_mat + end interface psb_remote_mat + interface psb_spfree subroutine psb_dspfree(a, desc_a,info) import diff --git a/base/modules/tools/psb_e_tools_a_mod.f90 b/base/modules/tools/psb_e_tools_a_mod.f90 index bce8cb40..f8a27cb5 100644 --- a/base/modules/tools/psb_e_tools_a_mod.f90 +++ b/base/modules/tools/psb_e_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_e_tools_a_mod end subroutine psb_einsvi end interface + + interface psb_remote_vect + subroutine psb_e_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + integer(psb_epk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + integer(psb_epk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_e_remote_vect + end interface psb_remote_vect + end module psb_e_tools_a_mod diff --git a/base/modules/tools/psb_i2_tools_a_mod.f90 b/base/modules/tools/psb_i2_tools_a_mod.f90 index 860a55b1..b8d52bb4 100644 --- a/base/modules/tools/psb_i2_tools_a_mod.f90 +++ b/base/modules/tools/psb_i2_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_i2_tools_a_mod end subroutine psb_i2insvi end interface + + interface psb_remote_vect + subroutine psb_i2_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + integer(psb_i2pk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + integer(psb_i2pk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_i2_remote_vect + end interface psb_remote_vect + end module psb_i2_tools_a_mod diff --git a/base/modules/tools/psb_i_tools_mod.F90 b/base/modules/tools/psb_i_tools_mod.F90 index 5cc6e836..1c207fac 100644 --- a/base/modules/tools/psb_i_tools_mod.F90 +++ b/base/modules/tools/psb_i_tools_mod.F90 @@ -32,33 +32,38 @@ Module psb_i_tools_mod use psb_desc_mod, only : psb_desc_type, psb_ipk_, psb_lpk_, psb_success_ use psb_i_vect_mod, only : psb_i_base_vect_type, psb_i_vect_type + use psb_m_tools_a_mod + use psb_e_tools_a_mod use psb_l_vect_mod, only : psb_l_vect_type use psb_i_multivect_mod, only : psb_i_base_multivect_type, psb_i_multivect_type use psi_mod, only : psb_snd, psb_rcv ! Needed only for psb_getelem interface psb_geall - subroutine psb_ialloc_vect(x, desc_a,info) + subroutine psb_ialloc_vect(x, desc_a,info, dupl, bldmode) import implicit none type(psb_i_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_ialloc_vect - subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb) + subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) import implicit none type(psb_i_vect_type), allocatable, intent(out) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n, lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_ialloc_vect_r2 - subroutine psb_ialloc_multivect(x, desc_a,info,n) + subroutine psb_ialloc_multivect(x, desc_a,info,n, dupl, bldmode) import implicit none type(psb_i_multivect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_ialloc_multivect end interface @@ -120,7 +125,7 @@ Module psb_i_tools_mod interface psb_geins - subroutine psb_iins_vect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_iins_vect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -129,10 +134,9 @@ Module psb_i_tools_mod integer(psb_lpk_), intent(in) :: irw(:) integer(psb_ipk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_iins_vect - subroutine psb_iins_vect_v(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_iins_vect_v(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -141,10 +145,9 @@ Module psb_i_tools_mod type(psb_l_vect_type), intent(inout) :: irw type(psb_i_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_iins_vect_v - subroutine psb_iins_vect_r2(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_iins_vect_r2(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -153,10 +156,9 @@ Module psb_i_tools_mod integer(psb_lpk_), intent(in) :: irw(:) integer(psb_ipk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_iins_vect_r2 - subroutine psb_iins_multivect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_iins_multivect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -165,9 +167,8 @@ Module psb_i_tools_mod integer(psb_lpk_), intent(in) :: irw(:) integer(psb_ipk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_iins_multivect end interface - + end module psb_i_tools_mod diff --git a/base/modules/tools/psb_l_tools_mod.F90 b/base/modules/tools/psb_l_tools_mod.F90 index 56617798..058403d6 100644 --- a/base/modules/tools/psb_l_tools_mod.F90 +++ b/base/modules/tools/psb_l_tools_mod.F90 @@ -32,33 +32,38 @@ Module psb_l_tools_mod use psb_desc_mod, only : psb_desc_type, psb_ipk_, psb_lpk_, psb_success_ use psb_l_vect_mod, only : psb_l_base_vect_type, psb_l_vect_type + use psb_m_tools_a_mod + use psb_e_tools_a_mod ! use psb_i_vect_mod, only : psb_i_vect_type use psb_l_multivect_mod, only : psb_l_base_multivect_type, psb_l_multivect_type use psi_mod, only : psb_snd, psb_rcv ! Needed only for psb_getelem interface psb_geall - subroutine psb_lalloc_vect(x, desc_a,info) + subroutine psb_lalloc_vect(x, desc_a,info, dupl, bldmode) import implicit none type(psb_l_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_lalloc_vect - subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb) + subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) import implicit none type(psb_l_vect_type), allocatable, intent(out) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n, lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_lalloc_vect_r2 - subroutine psb_lalloc_multivect(x, desc_a,info,n) + subroutine psb_lalloc_multivect(x, desc_a,info,n, dupl, bldmode) import implicit none type(psb_l_multivect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_lalloc_multivect end interface @@ -120,7 +125,7 @@ Module psb_l_tools_mod interface psb_geins - subroutine psb_lins_vect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_lins_vect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -129,10 +134,9 @@ Module psb_l_tools_mod integer(psb_lpk_), intent(in) :: irw(:) integer(psb_lpk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_lins_vect - subroutine psb_lins_vect_v(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_lins_vect_v(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -141,10 +145,9 @@ Module psb_l_tools_mod type(psb_l_vect_type), intent(inout) :: irw type(psb_l_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_lins_vect_v - subroutine psb_lins_vect_r2(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_lins_vect_r2(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -153,10 +156,9 @@ Module psb_l_tools_mod integer(psb_lpk_), intent(in) :: irw(:) integer(psb_lpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_lins_vect_r2 - subroutine psb_lins_multivect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_lins_multivect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -165,9 +167,8 @@ Module psb_l_tools_mod integer(psb_lpk_), intent(in) :: irw(:) integer(psb_lpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_lins_multivect end interface - + end module psb_l_tools_mod diff --git a/base/modules/tools/psb_m_tools_a_mod.f90 b/base/modules/tools/psb_m_tools_a_mod.f90 index a5dfdd72..a1de6caa 100644 --- a/base/modules/tools/psb_m_tools_a_mod.f90 +++ b/base/modules/tools/psb_m_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_m_tools_a_mod end subroutine psb_minsvi end interface + + interface psb_remote_vect + subroutine psb_m_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + integer(psb_mpk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + integer(psb_mpk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_m_remote_vect + end interface psb_remote_vect + end module psb_m_tools_a_mod diff --git a/base/modules/tools/psb_s_tools_a_mod.f90 b/base/modules/tools/psb_s_tools_a_mod.f90 index 32f445cb..85a2b029 100644 --- a/base/modules/tools/psb_s_tools_a_mod.f90 +++ b/base/modules/tools/psb_s_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_s_tools_a_mod end subroutine psb_sinsvi end interface + + interface psb_remote_vect + subroutine psb_s_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + real(psb_spk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + real(psb_spk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_s_remote_vect + end interface psb_remote_vect + end module psb_s_tools_a_mod diff --git a/base/modules/tools/psb_s_tools_mod.F90 b/base/modules/tools/psb_s_tools_mod.F90 index fa82a53e..5d2f8d00 100644 --- a/base/modules/tools/psb_s_tools_mod.F90 +++ b/base/modules/tools/psb_s_tools_mod.F90 @@ -40,28 +40,31 @@ Module psb_s_tools_mod use psi_mod, only : psb_snd, psb_rcv ! Needed only for psb_getelem interface psb_geall - subroutine psb_salloc_vect(x, desc_a,info) + subroutine psb_salloc_vect(x, desc_a,info, dupl, bldmode) import implicit none type(psb_s_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_salloc_vect - subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb) + subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) import implicit none type(psb_s_vect_type), allocatable, intent(out) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n, lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_salloc_vect_r2 - subroutine psb_salloc_multivect(x, desc_a,info,n) + subroutine psb_salloc_multivect(x, desc_a,info,n, dupl, bldmode) import implicit none type(psb_s_multivect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_salloc_multivect end interface @@ -123,7 +126,7 @@ Module psb_s_tools_mod interface psb_geins - subroutine psb_sins_vect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_sins_vect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -132,10 +135,9 @@ Module psb_s_tools_mod integer(psb_lpk_), intent(in) :: irw(:) real(psb_spk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_sins_vect - subroutine psb_sins_vect_v(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_sins_vect_v(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -144,10 +146,9 @@ Module psb_s_tools_mod type(psb_l_vect_type), intent(inout) :: irw type(psb_s_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_sins_vect_v - subroutine psb_sins_vect_r2(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_sins_vect_r2(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -156,10 +157,9 @@ Module psb_s_tools_mod integer(psb_lpk_), intent(in) :: irw(:) real(psb_spk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_sins_vect_r2 - subroutine psb_sins_multivect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_sins_multivect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -168,11 +168,10 @@ Module psb_s_tools_mod integer(psb_lpk_), intent(in) :: irw(:) real(psb_spk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_sins_multivect end interface - + interface psb_cdbldext Subroutine psb_scdbldext(a,desc_a,novr,desc_ov,info,extype) import @@ -239,29 +238,41 @@ Module psb_s_tools_mod interface psb_spall - subroutine psb_sspalloc(a, desc_a, info, nnz) + subroutine psb_sspalloc(a, desc_a, info, nnz, dupl, bldmode) import implicit none - type(psb_desc_type), intent(in) :: desc_a - type(psb_sspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_sspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz, bldmode + integer(psb_ipk_), optional, intent(in) :: dupl end subroutine psb_sspalloc end interface interface psb_spasb - subroutine psb_sspasb(a,desc_a, info, afmt, upd, dupl,mold) + subroutine psb_sspasb(a,desc_a, info, afmt, upd, mold) import implicit none type(psb_sspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a + type(psb_desc_type), intent(inout) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd + integer(psb_ipk_),optional, intent(in) :: upd character(len=*), optional, intent(in) :: afmt class(psb_s_base_sparse_mat), intent(in), optional :: mold end subroutine psb_sspasb end interface + interface psb_remote_mat + subroutine psb_ls_remote_mat(a,desc_a,b, info) + import + implicit none + type(psb_ls_coo_sparse_mat),Intent(inout) :: a + type(psb_desc_type),intent(inout) :: desc_a + type(psb_ls_coo_sparse_mat),Intent(inout) :: b + integer(psb_ipk_), intent(out) :: info + end subroutine psb_ls_remote_mat + end interface psb_remote_mat + interface psb_spfree subroutine psb_sspfree(a, desc_a,info) import diff --git a/base/modules/tools/psb_z_tools_a_mod.f90 b/base/modules/tools/psb_z_tools_a_mod.f90 index 21f7ff0f..4c421f26 100644 --- a/base/modules/tools/psb_z_tools_a_mod.f90 +++ b/base/modules/tools/psb_z_tools_a_mod.f90 @@ -116,4 +116,19 @@ Module psb_z_tools_a_mod end subroutine psb_zinsvi end interface + + interface psb_remote_vect + subroutine psb_z_remote_vect(n,v,iv,desc_a,x,ix, info) + import + implicit none + integer(psb_ipk_), intent(in) :: n + complex(psb_dpk_), intent(in) :: v(:) + integer(psb_lpk_), intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + complex(psb_dpk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + end subroutine psb_z_remote_vect + end interface psb_remote_vect + end module psb_z_tools_a_mod diff --git a/base/modules/tools/psb_z_tools_mod.F90 b/base/modules/tools/psb_z_tools_mod.F90 index 233f2c20..9d6bd77b 100644 --- a/base/modules/tools/psb_z_tools_mod.F90 +++ b/base/modules/tools/psb_z_tools_mod.F90 @@ -40,28 +40,31 @@ Module psb_z_tools_mod use psi_mod, only : psb_snd, psb_rcv ! Needed only for psb_getelem interface psb_geall - subroutine psb_zalloc_vect(x, desc_a,info) + subroutine psb_zalloc_vect(x, desc_a,info, dupl, bldmode) import implicit none type(psb_z_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_zalloc_vect - subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb) + subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) import implicit none type(psb_z_vect_type), allocatable, intent(out) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n, lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_zalloc_vect_r2 - subroutine psb_zalloc_multivect(x, desc_a,info,n) + subroutine psb_zalloc_multivect(x, desc_a,info,n, dupl, bldmode) import implicit none type(psb_z_multivect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode end subroutine psb_zalloc_multivect end interface @@ -123,7 +126,7 @@ Module psb_z_tools_mod interface psb_geins - subroutine psb_zins_vect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_zins_vect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -132,10 +135,9 @@ Module psb_z_tools_mod integer(psb_lpk_), intent(in) :: irw(:) complex(psb_dpk_), intent(in) :: val(:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_zins_vect - subroutine psb_zins_vect_v(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_zins_vect_v(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -144,10 +146,9 @@ Module psb_z_tools_mod type(psb_l_vect_type), intent(inout) :: irw type(psb_z_vect_type), intent(inout) :: val integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_zins_vect_v - subroutine psb_zins_vect_r2(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_zins_vect_r2(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -156,10 +157,9 @@ Module psb_z_tools_mod integer(psb_lpk_), intent(in) :: irw(:) complex(psb_dpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_zins_vect_r2 - subroutine psb_zins_multivect(m,irw,val,x,desc_a,info,dupl,local) + subroutine psb_zins_multivect(m,irw,val,x,desc_a,info,local) import implicit none integer(psb_ipk_), intent(in) :: m @@ -168,11 +168,10 @@ Module psb_z_tools_mod integer(psb_lpk_), intent(in) :: irw(:) complex(psb_dpk_), intent(in) :: val(:,:) integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local end subroutine psb_zins_multivect end interface - + interface psb_cdbldext Subroutine psb_zcdbldext(a,desc_a,novr,desc_ov,info,extype) import @@ -239,29 +238,41 @@ Module psb_z_tools_mod interface psb_spall - subroutine psb_zspalloc(a, desc_a, info, nnz) + subroutine psb_zspalloc(a, desc_a, info, nnz, dupl, bldmode) import implicit none - type(psb_desc_type), intent(in) :: desc_a - type(psb_zspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_zspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz, bldmode + integer(psb_ipk_), optional, intent(in) :: dupl end subroutine psb_zspalloc end interface interface psb_spasb - subroutine psb_zspasb(a,desc_a, info, afmt, upd, dupl,mold) + subroutine psb_zspasb(a,desc_a, info, afmt, upd, mold) import implicit none type(psb_zspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a + type(psb_desc_type), intent(inout) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd + integer(psb_ipk_),optional, intent(in) :: upd character(len=*), optional, intent(in) :: afmt class(psb_z_base_sparse_mat), intent(in), optional :: mold end subroutine psb_zspasb end interface + interface psb_remote_mat + subroutine psb_lz_remote_mat(a,desc_a,b, info) + import + implicit none + type(psb_lz_coo_sparse_mat),Intent(inout) :: a + type(psb_desc_type),intent(inout) :: desc_a + type(psb_lz_coo_sparse_mat),Intent(inout) :: b + integer(psb_ipk_), intent(out) :: info + end subroutine psb_lz_remote_mat + end interface psb_remote_mat + interface psb_spfree subroutine psb_zspfree(a, desc_a,info) import diff --git a/base/psblas/Makefile b/base/psblas/Makefile index a16ab35c..7d03f1f0 100644 --- a/base/psblas/Makefile +++ b/base/psblas/Makefile @@ -24,7 +24,9 @@ MODDIR=../modules FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) -lib: $(OBJS) +objs: $(OBJS) + +lib: objs $(AR) $(LIBDIR)/$(LIBNAME) $(OBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) diff --git a/base/serial/Makefile b/base/serial/Makefile index 0f17a0a4..ec0e2c82 100644 --- a/base/serial/Makefile +++ b/base/serial/Makefile @@ -20,18 +20,19 @@ INCDIR=.. MODDIR=../modules FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) -lib: impld sortd lib1 $(FOBJS) + +objs: impld sortd $(FOBJS) +lib: objs + $(MAKE) -C impl lib + $(MAKE) -C sort lib $(AR) $(LIBDIR)/$(LIBNAME) $(FOBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) -#cood csrd jadd - -lib1: $(FOBJS) impld: - $(MAKE) -C impl lib + $(MAKE) -C impl objs sortd: - $(MAKE) -C sort lib + $(MAKE) -C sort objs clean: /bin/rm -f $(FOBJS) *$(.mod) ($(MAKE) -C impl clean) diff --git a/base/serial/impl/Makefile b/base/serial/impl/Makefile index 97662ba6..00088741 100644 --- a/base/serial/impl/Makefile +++ b/base/serial/impl/Makefile @@ -36,9 +36,9 @@ LIBFILE=$(LIBDIR)/$(LIBNAME) # -default: lib +objs: $(OBJS) -lib: $(OBJS) +lib: objs $(AR) $(LIBDIR)/$(LIBNAME) $(OBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) diff --git a/base/serial/impl/psb_c_coo_impl.F90 b/base/serial/impl/psb_c_coo_impl.F90 index 5818c77b..830b7400 100644 --- a/base/serial/impl/psb_c_coo_impl.F90 +++ b/base/serial/impl/psb_c_coo_impl.F90 @@ -728,7 +728,7 @@ subroutine psb_c_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmt integer(psb_ipk_) :: i,j, ni, nr, nc, nz - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' if (present(head)) write(iout,'(a,a)') '% ',head write(iout,'(a)') '%' write(iout,'(a,a)') '% COO' @@ -3172,9 +3172,9 @@ subroutine psb_c_cp_coo_from_coo(a,b,info) integer(psb_ipk_) :: i !$omp parallel do private(i) do i=1, nz - a%ia(i) = b%ia(i) - a%ja(i) = b%ja(i) - a%val(i) = b%val(i) + a%ia(i) = b%ia(i) + a%ja(i) = b%ja(i) + a%val(i) = b%val(i) end do end block #else @@ -3671,6 +3671,12 @@ subroutine psb_c_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + ! Row major order if (nr <= nzin) then ! Avoid strange situations with large indices @@ -4357,6 +4363,11 @@ subroutine psb_c_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_) :: saved_elem,old_val,nxt_val,err,act_row,act_col,maxthreads integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() if (nc <= nzin) then ! Avoid strange situations with large indices @@ -5268,13 +5279,13 @@ function psb_lc_coo_maxval(a) result(res) implicit none class(psb_lc_coo_sparse_mat), intent(in) :: a real(psb_spk_) :: res - + integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info character(len=20) :: name='c_coo_maxval' logical, parameter :: debug=.false. - + if (a%is_dev()) call a%sync() - + if (a%is_unit()) then res = sone else @@ -5284,18 +5295,18 @@ function psb_lc_coo_maxval(a) result(res) if (allocated(a%val)) then nnz = min(nnz,size(a%val)) #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, nnz - res = max(res,abs(a%val(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, nnz + res = max(res,abs(a%val(i))) + end do + end block #else res = maxval(abs(a%val(1:nnz))) #endif end if - + end function psb_lc_coo_maxval function psb_lc_coo_csnmi(a) result(res) @@ -5351,13 +5362,13 @@ function psb_lc_coo_csnmi(a) result(res) vt(i) = vt(i) + abs(a%val(j)) end do #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, m - res = max(res,abs(vt(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, m + res = max(res,abs(vt(i))) + end do + end block #else res = maxval(vt(1:m)) #endif @@ -5403,11 +5414,11 @@ function psb_lc_coo_csnm1(a) result(res) #if defined(OPENMP) block integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) + !$omp parallel do private(i) do i=1, n res = max(res,abs(vt(i))) end do - end block + end block #else res = maxval(vt(1:n)) #endif @@ -6661,7 +6672,7 @@ contains integer(psb_lpk_), optional :: iren(:) integer(psb_lpk_) :: nzin_, nza, idx,ip,jp,i,k, nzt, irw, lrw, nra, nca, nrd integer(psb_ipk_) :: debug_level, debug_unit, inza - character(len=20) :: name='coo_getrow' + character(len=20) :: name='lcoo_getrow' debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() @@ -6856,7 +6867,7 @@ subroutine psb_lc_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz < 0) then info = psb_err_iarg_neg_ -3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) +3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) goto 9999 end if if (size(ia) < nz) then @@ -6878,7 +6889,6 @@ subroutine psb_lc_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz == 0) return - nza = a%get_nzeros() isza = a%get_size() if (a%is_bld()) then diff --git a/base/serial/impl/psb_c_csr_impl.F90 b/base/serial/impl/psb_c_csr_impl.F90 index 87b0872b..fa5f2edf 100644 --- a/base/serial/impl/psb_c_csr_impl.F90 +++ b/base/serial/impl/psb_c_csr_impl.F90 @@ -1328,8 +1328,8 @@ function psb_c_csr_csnmi(a) result(res) res = szero if (a%is_dev()) call a%sync() - !$omp parallel do private(i,acc) reduction(max: res) - do i = 1, a%get_nrows() + !$omp parallel do private(i,j,acc) reduction(max: res) + do i = 1, a%get_nrows() acc = szero do j=a%irp(i),a%irp(i+1)-1 acc = acc + abs(a%val(j)) @@ -1562,8 +1562,12 @@ subroutine psb_c_csr_get_diag(a,d,info) if (a%is_unit()) then - d(1:mnm) = cone + !$omp parallel do private(i) + do i=1, mnm + d(i) = cone + end do else + !$omp parallel do private(i,j,k) do i=1, mnm d(i) = czero do k=a%irp(i),a%irp(i+1)-1 @@ -1574,6 +1578,7 @@ subroutine psb_c_csr_get_diag(a,d,info) enddo end do end if + !$omp parallel do private(i) do i=mnm+1,size(d) d(i) = czero end do @@ -1629,6 +1634,7 @@ subroutine psb_c_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1, m do j = a%irp(i), a%irp(i+1) -1 a%val(j) = a%val(j) * d(i) @@ -1643,6 +1649,7 @@ subroutine psb_c_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1,a%get_nzeros() j = a%ja(i) a%val(i) = a%val(i) * d(j) @@ -1681,6 +1688,7 @@ subroutine psb_c_csr_scals(d,a,info) call a%make_nonunit() end if + !$omp parallel do private(i) do i=1,a%get_nzeros() a%val(i) = a%val(i) * d enddo diff --git a/base/serial/impl/psb_c_mat_impl.F90 b/base/serial/impl/psb_c_mat_impl.F90 index 088b012d..df5c4cd9 100644 --- a/base/serial/impl/psb_c_mat_impl.F90 +++ b/base/serial/impl/psb_c_mat_impl.F90 @@ -675,7 +675,12 @@ subroutine psb_c_free(a) call a%a%free() deallocate(a%a) endif - + if (allocated(a%rmta)) then + call a%rmta%free() + deallocate(a%rmta) + end if + a%remote_build = psb_matbld_noremote_ + end subroutine psb_c_free diff --git a/base/serial/impl/psb_d_coo_impl.F90 b/base/serial/impl/psb_d_coo_impl.F90 index 21590eb2..24b486e2 100644 --- a/base/serial/impl/psb_d_coo_impl.F90 +++ b/base/serial/impl/psb_d_coo_impl.F90 @@ -728,7 +728,7 @@ subroutine psb_d_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmt integer(psb_ipk_) :: i,j, ni, nr, nc, nz - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' if (present(head)) write(iout,'(a,a)') '% ',head write(iout,'(a)') '%' write(iout,'(a,a)') '% COO' @@ -3172,9 +3172,9 @@ subroutine psb_d_cp_coo_from_coo(a,b,info) integer(psb_ipk_) :: i !$omp parallel do private(i) do i=1, nz - a%ia(i) = b%ia(i) - a%ja(i) = b%ja(i) - a%val(i) = b%val(i) + a%ia(i) = b%ia(i) + a%ja(i) = b%ja(i) + a%val(i) = b%val(i) end do end block #else @@ -3671,6 +3671,12 @@ subroutine psb_d_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + ! Row major order if (nr <= nzin) then ! Avoid strange situations with large indices @@ -4357,6 +4363,11 @@ subroutine psb_d_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_) :: saved_elem,old_val,nxt_val,err,act_row,act_col,maxthreads integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() if (nc <= nzin) then ! Avoid strange situations with large indices @@ -5268,13 +5279,13 @@ function psb_ld_coo_maxval(a) result(res) implicit none class(psb_ld_coo_sparse_mat), intent(in) :: a real(psb_dpk_) :: res - + integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info character(len=20) :: name='d_coo_maxval' logical, parameter :: debug=.false. - + if (a%is_dev()) call a%sync() - + if (a%is_unit()) then res = done else @@ -5284,18 +5295,18 @@ function psb_ld_coo_maxval(a) result(res) if (allocated(a%val)) then nnz = min(nnz,size(a%val)) #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, nnz - res = max(res,abs(a%val(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, nnz + res = max(res,abs(a%val(i))) + end do + end block #else res = maxval(abs(a%val(1:nnz))) #endif end if - + end function psb_ld_coo_maxval function psb_ld_coo_csnmi(a) result(res) @@ -5351,13 +5362,13 @@ function psb_ld_coo_csnmi(a) result(res) vt(i) = vt(i) + abs(a%val(j)) end do #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, m - res = max(res,abs(vt(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, m + res = max(res,abs(vt(i))) + end do + end block #else res = maxval(vt(1:m)) #endif @@ -5403,11 +5414,11 @@ function psb_ld_coo_csnm1(a) result(res) #if defined(OPENMP) block integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) + !$omp parallel do private(i) do i=1, n res = max(res,abs(vt(i))) end do - end block + end block #else res = maxval(vt(1:n)) #endif @@ -6661,7 +6672,7 @@ contains integer(psb_lpk_), optional :: iren(:) integer(psb_lpk_) :: nzin_, nza, idx,ip,jp,i,k, nzt, irw, lrw, nra, nca, nrd integer(psb_ipk_) :: debug_level, debug_unit, inza - character(len=20) :: name='coo_getrow' + character(len=20) :: name='lcoo_getrow' debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() @@ -6856,7 +6867,7 @@ subroutine psb_ld_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz < 0) then info = psb_err_iarg_neg_ -3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) +3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) goto 9999 end if if (size(ia) < nz) then @@ -6878,7 +6889,6 @@ subroutine psb_ld_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz == 0) return - nza = a%get_nzeros() isza = a%get_size() if (a%is_bld()) then diff --git a/base/serial/impl/psb_d_csr_impl.F90 b/base/serial/impl/psb_d_csr_impl.F90 index 3aadde20..faf422ae 100644 --- a/base/serial/impl/psb_d_csr_impl.F90 +++ b/base/serial/impl/psb_d_csr_impl.F90 @@ -1328,8 +1328,8 @@ function psb_d_csr_csnmi(a) result(res) res = dzero if (a%is_dev()) call a%sync() - !$omp parallel do private(i,acc) reduction(max: res) - do i = 1, a%get_nrows() + !$omp parallel do private(i,j,acc) reduction(max: res) + do i = 1, a%get_nrows() acc = dzero do j=a%irp(i),a%irp(i+1)-1 acc = acc + abs(a%val(j)) @@ -1562,8 +1562,12 @@ subroutine psb_d_csr_get_diag(a,d,info) if (a%is_unit()) then - d(1:mnm) = done + !$omp parallel do private(i) + do i=1, mnm + d(i) = done + end do else + !$omp parallel do private(i,j,k) do i=1, mnm d(i) = dzero do k=a%irp(i),a%irp(i+1)-1 @@ -1574,6 +1578,7 @@ subroutine psb_d_csr_get_diag(a,d,info) enddo end do end if + !$omp parallel do private(i) do i=mnm+1,size(d) d(i) = dzero end do @@ -1629,6 +1634,7 @@ subroutine psb_d_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1, m do j = a%irp(i), a%irp(i+1) -1 a%val(j) = a%val(j) * d(i) @@ -1643,6 +1649,7 @@ subroutine psb_d_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1,a%get_nzeros() j = a%ja(i) a%val(i) = a%val(i) * d(j) @@ -1681,6 +1688,7 @@ subroutine psb_d_csr_scals(d,a,info) call a%make_nonunit() end if + !$omp parallel do private(i) do i=1,a%get_nzeros() a%val(i) = a%val(i) * d enddo diff --git a/base/serial/impl/psb_d_mat_impl.F90 b/base/serial/impl/psb_d_mat_impl.F90 index b21fa40f..2a6fb9a5 100644 --- a/base/serial/impl/psb_d_mat_impl.F90 +++ b/base/serial/impl/psb_d_mat_impl.F90 @@ -675,7 +675,12 @@ subroutine psb_d_free(a) call a%a%free() deallocate(a%a) endif - + if (allocated(a%rmta)) then + call a%rmta%free() + deallocate(a%rmta) + end if + a%remote_build = psb_matbld_noremote_ + end subroutine psb_d_free diff --git a/base/serial/impl/psb_s_coo_impl.F90 b/base/serial/impl/psb_s_coo_impl.F90 index 8b29e565..be4218de 100644 --- a/base/serial/impl/psb_s_coo_impl.F90 +++ b/base/serial/impl/psb_s_coo_impl.F90 @@ -728,7 +728,7 @@ subroutine psb_s_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmt integer(psb_ipk_) :: i,j, ni, nr, nc, nz - write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' + write(iout,'(a)') '%%MatrixMarket matrix coordinate real general' if (present(head)) write(iout,'(a,a)') '% ',head write(iout,'(a)') '%' write(iout,'(a,a)') '% COO' @@ -3172,9 +3172,9 @@ subroutine psb_s_cp_coo_from_coo(a,b,info) integer(psb_ipk_) :: i !$omp parallel do private(i) do i=1, nz - a%ia(i) = b%ia(i) - a%ja(i) = b%ja(i) - a%val(i) = b%val(i) + a%ia(i) = b%ia(i) + a%ja(i) = b%ja(i) + a%val(i) = b%val(i) end do end block #else @@ -3671,6 +3671,12 @@ subroutine psb_s_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + ! Row major order if (nr <= nzin) then ! Avoid strange situations with large indices @@ -4357,6 +4363,11 @@ subroutine psb_s_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_) :: saved_elem,old_val,nxt_val,err,act_row,act_col,maxthreads integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() if (nc <= nzin) then ! Avoid strange situations with large indices @@ -5268,13 +5279,13 @@ function psb_ls_coo_maxval(a) result(res) implicit none class(psb_ls_coo_sparse_mat), intent(in) :: a real(psb_spk_) :: res - + integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info character(len=20) :: name='s_coo_maxval' logical, parameter :: debug=.false. - + if (a%is_dev()) call a%sync() - + if (a%is_unit()) then res = sone else @@ -5284,18 +5295,18 @@ function psb_ls_coo_maxval(a) result(res) if (allocated(a%val)) then nnz = min(nnz,size(a%val)) #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, nnz - res = max(res,abs(a%val(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, nnz + res = max(res,abs(a%val(i))) + end do + end block #else res = maxval(abs(a%val(1:nnz))) #endif end if - + end function psb_ls_coo_maxval function psb_ls_coo_csnmi(a) result(res) @@ -5351,13 +5362,13 @@ function psb_ls_coo_csnmi(a) result(res) vt(i) = vt(i) + abs(a%val(j)) end do #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, m - res = max(res,abs(vt(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, m + res = max(res,abs(vt(i))) + end do + end block #else res = maxval(vt(1:m)) #endif @@ -5403,11 +5414,11 @@ function psb_ls_coo_csnm1(a) result(res) #if defined(OPENMP) block integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) + !$omp parallel do private(i) do i=1, n res = max(res,abs(vt(i))) end do - end block + end block #else res = maxval(vt(1:n)) #endif @@ -6661,7 +6672,7 @@ contains integer(psb_lpk_), optional :: iren(:) integer(psb_lpk_) :: nzin_, nza, idx,ip,jp,i,k, nzt, irw, lrw, nra, nca, nrd integer(psb_ipk_) :: debug_level, debug_unit, inza - character(len=20) :: name='coo_getrow' + character(len=20) :: name='lcoo_getrow' debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() @@ -6856,7 +6867,7 @@ subroutine psb_ls_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz < 0) then info = psb_err_iarg_neg_ -3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) +3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) goto 9999 end if if (size(ia) < nz) then @@ -6878,7 +6889,6 @@ subroutine psb_ls_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz == 0) return - nza = a%get_nzeros() isza = a%get_size() if (a%is_bld()) then diff --git a/base/serial/impl/psb_s_csr_impl.F90 b/base/serial/impl/psb_s_csr_impl.F90 index a554e13b..446e6791 100644 --- a/base/serial/impl/psb_s_csr_impl.F90 +++ b/base/serial/impl/psb_s_csr_impl.F90 @@ -1328,8 +1328,8 @@ function psb_s_csr_csnmi(a) result(res) res = szero if (a%is_dev()) call a%sync() - !$omp parallel do private(i,acc) reduction(max: res) - do i = 1, a%get_nrows() + !$omp parallel do private(i,j,acc) reduction(max: res) + do i = 1, a%get_nrows() acc = szero do j=a%irp(i),a%irp(i+1)-1 acc = acc + abs(a%val(j)) @@ -1562,8 +1562,12 @@ subroutine psb_s_csr_get_diag(a,d,info) if (a%is_unit()) then - d(1:mnm) = sone + !$omp parallel do private(i) + do i=1, mnm + d(i) = sone + end do else + !$omp parallel do private(i,j,k) do i=1, mnm d(i) = szero do k=a%irp(i),a%irp(i+1)-1 @@ -1574,6 +1578,7 @@ subroutine psb_s_csr_get_diag(a,d,info) enddo end do end if + !$omp parallel do private(i) do i=mnm+1,size(d) d(i) = szero end do @@ -1629,6 +1634,7 @@ subroutine psb_s_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1, m do j = a%irp(i), a%irp(i+1) -1 a%val(j) = a%val(j) * d(i) @@ -1643,6 +1649,7 @@ subroutine psb_s_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1,a%get_nzeros() j = a%ja(i) a%val(i) = a%val(i) * d(j) @@ -1681,6 +1688,7 @@ subroutine psb_s_csr_scals(d,a,info) call a%make_nonunit() end if + !$omp parallel do private(i) do i=1,a%get_nzeros() a%val(i) = a%val(i) * d enddo diff --git a/base/serial/impl/psb_s_mat_impl.F90 b/base/serial/impl/psb_s_mat_impl.F90 index c624dc2f..ce7ce653 100644 --- a/base/serial/impl/psb_s_mat_impl.F90 +++ b/base/serial/impl/psb_s_mat_impl.F90 @@ -675,7 +675,12 @@ subroutine psb_s_free(a) call a%a%free() deallocate(a%a) endif - + if (allocated(a%rmta)) then + call a%rmta%free() + deallocate(a%rmta) + end if + a%remote_build = psb_matbld_noremote_ + end subroutine psb_s_free diff --git a/base/serial/impl/psb_z_coo_impl.F90 b/base/serial/impl/psb_z_coo_impl.F90 index 48ea3a50..4f99cb5c 100644 --- a/base/serial/impl/psb_z_coo_impl.F90 +++ b/base/serial/impl/psb_z_coo_impl.F90 @@ -728,7 +728,7 @@ subroutine psb_z_coo_print(iout,a,iv,head,ivr,ivc) character(len=80) :: frmt integer(psb_ipk_) :: i,j, ni, nr, nc, nz - write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' + write(iout,'(a)') '%%MatrixMarket matrix coordinate complex general' if (present(head)) write(iout,'(a,a)') '% ',head write(iout,'(a)') '%' write(iout,'(a,a)') '% COO' @@ -3172,9 +3172,9 @@ subroutine psb_z_cp_coo_from_coo(a,b,info) integer(psb_ipk_) :: i !$omp parallel do private(i) do i=1, nz - a%ia(i) = b%ia(i) - a%ja(i) = b%ja(i) - a%val(i) = b%val(i) + a%ia(i) = b%ia(i) + a%ja(i) = b%ja(i) + a%val(i) = b%val(i) end do end block #else @@ -3671,6 +3671,12 @@ subroutine psb_z_fix_coo_inner_rowmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + ! Row major order if (nr <= nzin) then ! Avoid strange situations with large indices @@ -4357,6 +4363,11 @@ subroutine psb_z_fix_coo_inner_colmajor(nr,nc,nzin,dupl,ia,ja,val,iaux,nzout,inf integer(psb_ipk_) :: saved_elem,old_val,nxt_val,err,act_row,act_col,maxthreads integer(psb_ipk_), allocatable :: sum(:),kaux(:),idxaux(:) #endif + info = psb_success_ + + call psb_erractionsave(err_act) + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() if (nc <= nzin) then ! Avoid strange situations with large indices @@ -5268,13 +5279,13 @@ function psb_lz_coo_maxval(a) result(res) implicit none class(psb_lz_coo_sparse_mat), intent(in) :: a real(psb_dpk_) :: res - + integer(psb_lpk_) :: i,j,k,m,n, nnz, ir, jc, nc, info character(len=20) :: name='z_coo_maxval' logical, parameter :: debug=.false. - + if (a%is_dev()) call a%sync() - + if (a%is_unit()) then res = done else @@ -5284,18 +5295,18 @@ function psb_lz_coo_maxval(a) result(res) if (allocated(a%val)) then nnz = min(nnz,size(a%val)) #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, nnz - res = max(res,abs(a%val(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, nnz + res = max(res,abs(a%val(i))) + end do + end block #else res = maxval(abs(a%val(1:nnz))) #endif end if - + end function psb_lz_coo_maxval function psb_lz_coo_csnmi(a) result(res) @@ -5351,13 +5362,13 @@ function psb_lz_coo_csnmi(a) result(res) vt(i) = vt(i) + abs(a%val(j)) end do #if defined(OPENMP) - block - integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) - do i=1, m - res = max(res,abs(vt(i))) - end do - end block + block + integer(psb_ipk_) :: i + !$omp parallel do private(i) + do i=1, m + res = max(res,abs(vt(i))) + end do + end block #else res = maxval(vt(1:m)) #endif @@ -5403,11 +5414,11 @@ function psb_lz_coo_csnm1(a) result(res) #if defined(OPENMP) block integer(psb_ipk_) :: i - !$omp parallel do private(i) reduction(max: res) + !$omp parallel do private(i) do i=1, n res = max(res,abs(vt(i))) end do - end block + end block #else res = maxval(vt(1:n)) #endif @@ -6661,7 +6672,7 @@ contains integer(psb_lpk_), optional :: iren(:) integer(psb_lpk_) :: nzin_, nza, idx,ip,jp,i,k, nzt, irw, lrw, nra, nca, nrd integer(psb_ipk_) :: debug_level, debug_unit, inza - character(len=20) :: name='coo_getrow' + character(len=20) :: name='lcoo_getrow' debug_unit = psb_get_debug_unit() debug_level = psb_get_debug_level() @@ -6856,7 +6867,7 @@ subroutine psb_lz_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz < 0) then info = psb_err_iarg_neg_ -3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) +3 call psb_errpush(info,name,i_err=(/1_psb_ipk_/)) goto 9999 end if if (size(ia) < nz) then @@ -6878,7 +6889,6 @@ subroutine psb_lz_coo_csput_a(nz,ia,ja,val,a,imin,imax,jmin,jmax,info) if (nz == 0) return - nza = a%get_nzeros() isza = a%get_size() if (a%is_bld()) then diff --git a/base/serial/impl/psb_z_csr_impl.F90 b/base/serial/impl/psb_z_csr_impl.F90 index b2b0d3d1..5ec579d5 100644 --- a/base/serial/impl/psb_z_csr_impl.F90 +++ b/base/serial/impl/psb_z_csr_impl.F90 @@ -1328,8 +1328,8 @@ function psb_z_csr_csnmi(a) result(res) res = dzero if (a%is_dev()) call a%sync() - !$omp parallel do private(i,acc) reduction(max: res) - do i = 1, a%get_nrows() + !$omp parallel do private(i,j,acc) reduction(max: res) + do i = 1, a%get_nrows() acc = dzero do j=a%irp(i),a%irp(i+1)-1 acc = acc + abs(a%val(j)) @@ -1562,8 +1562,12 @@ subroutine psb_z_csr_get_diag(a,d,info) if (a%is_unit()) then - d(1:mnm) = zone + !$omp parallel do private(i) + do i=1, mnm + d(i) = zone + end do else + !$omp parallel do private(i,j,k) do i=1, mnm d(i) = zzero do k=a%irp(i),a%irp(i+1)-1 @@ -1574,6 +1578,7 @@ subroutine psb_z_csr_get_diag(a,d,info) enddo end do end if + !$omp parallel do private(i) do i=mnm+1,size(d) d(i) = zzero end do @@ -1629,6 +1634,7 @@ subroutine psb_z_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1, m do j = a%irp(i), a%irp(i+1) -1 a%val(j) = a%val(j) * d(i) @@ -1643,6 +1649,7 @@ subroutine psb_z_csr_scal(d,a,info,side) goto 9999 end if + !$omp parallel do private(i,j) do i=1,a%get_nzeros() j = a%ja(i) a%val(i) = a%val(i) * d(j) @@ -1681,6 +1688,7 @@ subroutine psb_z_csr_scals(d,a,info) call a%make_nonunit() end if + !$omp parallel do private(i) do i=1,a%get_nzeros() a%val(i) = a%val(i) * d enddo diff --git a/base/serial/impl/psb_z_mat_impl.F90 b/base/serial/impl/psb_z_mat_impl.F90 index e008dfdb..2cebf9e7 100644 --- a/base/serial/impl/psb_z_mat_impl.F90 +++ b/base/serial/impl/psb_z_mat_impl.F90 @@ -675,7 +675,12 @@ subroutine psb_z_free(a) call a%a%free() deallocate(a%a) endif - + if (allocated(a%rmta)) then + call a%rmta%free() + deallocate(a%rmta) + end if + a%remote_build = psb_matbld_noremote_ + end subroutine psb_z_free diff --git a/base/serial/sort/Makefile b/base/serial/sort/Makefile index c381e3f5..2ef6420a 100644 --- a/base/serial/sort/Makefile +++ b/base/serial/sort/Makefile @@ -27,9 +27,9 @@ LIBFILE=$(LIBDIR)/$(LIBNAME) # -default: lib +objs: $(OBJS) -lib: $(OBJS) +lib: objs $(AR) $(LIBDIR)/$(LIBNAME) $(OBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) diff --git a/base/serial/sort/psb_i_hsort_impl.f90 b/base/serial/sort/psb_i_hsort_impl.f90 deleted file mode 100644 index 1c53650a..00000000 --- a/base/serial/sort/psb_i_hsort_impl.f90 +++ /dev/null @@ -1,678 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! The merge-sort and quicksort routines are implemented in the -! serial/aux directory -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -subroutine psb_ihsort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_ihsort - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, n, i, l, err_act,info - integer(psb_ipk_) :: key - integer(psb_ipk_) :: index - - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_hsort' - call psb_erractionsave(err_act) - - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case( psb_sort_ovw_idx_, psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - - select case(dir_) - case(psb_sort_up_,psb_sort_down_) - ! OK - case (psb_asort_up_,psb_asort_down_) - ! OK - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - n = size(x) - - ! - ! Dirty trick to sort with heaps: if we want - ! to sort in place upwards, first we set up a heap so that - ! we can easily get the LARGEST element, then we take it out - ! and put it in the last entry, and so on. - ! So, we invert dir_ - ! - dir_ = -dir_ - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (flag_ == psb_sort_ovw_idx_) then - do i=1, n - ix(i) = i - end do - end if - l = 0 - do i=1, n - key = x(i) - index = ix(i) - call psi_idx_insert_heap(key,index,l,x,ix,dir_,info) - if (l /= i) then - write(psb_err_unit,*) 'Mismatch while heapifying ! ' - end if - end do - do i=n, 2, -1 - call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info) - if (l /= i-1) then - write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i - end if - x(i) = key - ix(i) = index - end do - else if (.not.present(ix)) then - l = 0 - do i=1, n - key = x(i) - call psi_insert_heap(key,l,x,dir_,info) - if (l /= i) then - write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i - end if - end do - do i=n, 2, -1 - call psi_i_heap_get_first(key,l,x,dir_,info) - if (l /= i-1) then - write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i - end if - x(i) = key - end do - end if - - - return - -9999 call psb_error_handler(err_act) - - return -end subroutine psb_ihsort - - - -! -! These are packaged so that they can be used to implement -! a heapsort, should the need arise -! -! -! Programming note: -! In the implementation of the heap_get_first function -! we have code like this -! -! if ( ( heap(2*i) < heap(2*i+1) ) .or.& -! & (2*i == last)) then -! j = 2*i -! else -! j = 2*i + 1 -! end if -! -! It looks like the 2*i+1 could overflow the array, but this -! is not true because there is a guard statement -! if (i>last/2) exit -! and because last has just been reduced by 1 when defining the return value, -! therefore 2*i+1 may be greater than the current value of last, -! but cannot be greater than the value of last when the routine was entered -! hence it is safe. -! -! -! - -subroutine psi_i_insert_heap(key,last,heap,dir,info) - use psb_sort_mod, psb_protect_name => psi_i_insert_heap - implicit none - - ! - ! Input: - ! key: the new value - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! dir: sorting direction - - integer(psb_ipk_), intent(in) :: key - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i, i2 - integer(psb_ipk_) :: temp - - info = psb_success_ - if (last < 0) then - write(psb_err_unit,*) 'Invalid last in heap ',last - info = last - return - endif - last = last + 1 - if (last > size(heap)) then - write(psb_err_unit,*) 'out of bounds ' - info = -1 - return - end if - i = last - heap(i) = key - - select case(dir) - case (psb_sort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) < heap(i2)) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_sort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) > heap(i2)) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - case (psb_asort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) < abs(heap(i2))) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_asort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) > abs(heap(i2))) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_i_insert_heap - - -subroutine psi_i_heap_get_first(key,last,heap,dir,info) - use psb_sort_mod, psb_protect_name => psi_i_heap_get_first - implicit none - - integer(psb_ipk_), intent(inout) :: key - integer(psb_ipk_), intent(inout) :: last - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(out) :: info - - integer(psb_ipk_) :: i, j - integer(psb_ipk_) :: temp - - - info = psb_success_ - if (last <= 0) then - key = 0 - info = -1 - return - endif - - key = heap(1) - heap(1) = heap(last) - last = last - 1 - - select case(dir) - case (psb_sort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) < heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) > heap(j)) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_sort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) > heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) < heap(j)) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case (psb_asort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) < abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) > abs(heap(j))) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_asort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) > abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) < abs(heap(j))) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_i_heap_get_first - - -subroutine psi_i_idx_insert_heap(key,index,last,heap,idxs,dir,info) - use psb_sort_mod, psb_protect_name => psi_i_idx_insert_heap - - implicit none - ! - ! Input: - ! key: the new value - ! index: the new index - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! idxs: the indices - ! dir: sorting direction - - integer(psb_ipk_), intent(in) :: key - integer(psb_ipk_), intent(in) :: index,dir - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(inout) :: idxs(:),last - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i, i2, itemp - integer(psb_ipk_) :: temp - - info = psb_success_ - if (last < 0) then - write(psb_err_unit,*) 'Invalid last in heap ',last - info = last - return - endif - - last = last + 1 - if (last > size(heap)) then - write(psb_err_unit,*) 'out of bounds ' - info = -1 - return - end if - - i = last - heap(i) = key - idxs(i) = index - - select case(dir) - case (psb_sort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) < heap(i2)) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_sort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) > heap(i2)) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - case (psb_asort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) < abs(heap(i2))) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_asort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) > abs(heap(i2))) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_i_idx_insert_heap - -subroutine psi_i_idx_heap_get_first(key,index,last,heap,idxs,dir,info) - use psb_sort_mod, psb_protect_name => psi_i_idx_heap_get_first - implicit none - - integer(psb_ipk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(out) :: index,info - integer(psb_ipk_), intent(inout) :: last,idxs(:) - integer(psb_ipk_), intent(in) :: dir - integer(psb_ipk_), intent(out) :: key - - integer(psb_ipk_) :: i, j,itemp - integer(psb_ipk_) :: temp - - info = psb_success_ - if (last <= 0) then - key = 0 - index = 0 - info = -1 - return - endif - - key = heap(1) - index = idxs(1) - heap(1) = heap(last) - idxs(1) = idxs(last) - last = last - 1 - - select case(dir) - case (psb_sort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) < heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) > heap(j)) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_sort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) > heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) < heap(j)) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case (psb_asort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) < abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) > abs(heap(j))) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_asort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) > abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) < abs(heap(j))) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_i_idx_heap_get_first - - - - diff --git a/base/serial/sort/psb_i_isort_impl.f90 b/base/serial/sort/psb_i_isort_impl.f90 deleted file mode 100644 index 41c1381f..00000000 --- a/base/serial/sort/psb_i_isort_impl.f90 +++ /dev/null @@ -1,341 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! The insertion sort routines -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -subroutine psb_iisort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_iisort - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, err_act - integer(psb_ipk_) :: n, i - - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_iisort' - call psb_erractionsave(err_act) - - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case( psb_sort_ovw_idx_, psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - - n = size(x) - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (flag_==psb_sort_ovw_idx_) then - do i=1,n - ix(i) = i - end do - end if - - select case(dir_) - case (psb_sort_up_) - call psi_iisrx_up(n,x,ix) - case (psb_sort_down_) - call psi_iisrx_dw(n,x,ix) - case (psb_asort_up_) - call psi_iaisrx_up(n,x,ix) - case (psb_asort_down_) - call psi_iaisrx_dw(n,x,ix) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - else - select case(dir_) - case (psb_sort_up_) - call psi_iisr_up(n,x) - case (psb_sort_down_) - call psi_iisr_dw(n,x) - case (psb_asort_up_) - call psi_iaisr_up(n,x) - case (psb_asort_down_) - call psi_iaisr_dw(n,x) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - end if - - return - -9999 call psb_error_handler(err_act) - - return -end subroutine psb_iisort - -subroutine psi_iisrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iisrx_up - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j,ix - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) < x(j)) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (x(i) >= xx) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_iisrx_up - -subroutine psi_iisrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iisrx_dw - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j,ix - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) > x(j)) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (x(i) <= xx) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_iisrx_dw - - -subroutine psi_iisr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_iisr_up - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) < x(j)) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (x(i) >= xx) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_iisr_up - -subroutine psi_iisr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_iisr_dw - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) > x(j)) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (x(i) <= xx) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_iisr_dw - -subroutine psi_iaisrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iaisrx_up - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j,ix - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) < abs(x(j))) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) >= abs(xx)) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_iaisrx_up - -subroutine psi_iaisrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iaisrx_dw - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j,ix - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) > abs(x(j))) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) <= abs(xx)) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_iaisrx_dw - -subroutine psi_iaisr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_iaisr_up - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) < abs(x(j))) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) >= abs(xx)) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_iaisr_up - -subroutine psi_iaisr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_iaisr_dw - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_) :: i,j - integer(psb_ipk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) > abs(x(j))) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) <= abs(xx)) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_iaisr_dw - diff --git a/base/serial/sort/psb_i_msort_impl.f90 b/base/serial/sort/psb_i_msort_impl.f90 deleted file mode 100644 index 1e9ad9ec..00000000 --- a/base/serial/sort/psb_i_msort_impl.f90 +++ /dev/null @@ -1,713 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! - ! - ! The merge-sort routines - ! References: - ! D. Knuth - ! The Art of Computer Programming, vol. 3 - ! Addison-Wesley - ! - ! Aho, Hopcroft, Ullman - ! Data Structures and Algorithms - ! Addison-Wesley - ! - logical function psb_iisaperm(n,eip) - use psb_sort_mod, psb_protect_name => psb_iisaperm - implicit none - - integer(psb_ipk_), intent(in) :: n - integer(psb_ipk_), intent(in) :: eip(n) - integer(psb_ipk_), allocatable :: ip(:) - integer(psb_ipk_) :: i,j,m, info - - - psb_iisaperm = .true. - if (n <= 0) return - allocate(ip(n), stat=info) - if (info /= psb_success_) return - ! - ! sanity check first - ! - do i=1, n - ip(i) = eip(i) - if ((ip(i) < 1).or.(ip(i) > n)) then - write(psb_err_unit,*) 'Out of bounds in isaperm' ,ip(i), n - psb_iisaperm = .false. - return - endif - enddo - - ! - ! now work through the cycles, by marking each successive item as negative. - ! no cycle should intersect with any other, hence the >= 1 check. - ! - do m = 1, n - i = ip(m) - if (i < 0) then - ip(m) = -i - else if (i /= m) then - j = ip(i) - ip(i) = -j - i = j - do while ((j >= 1).and.(j /= m)) - j = ip(i) - ip(i) = -j - i = j - enddo - ip(m) = abs(ip(m)) - if (j /= m) then - psb_iisaperm = .false. - goto 9999 - endif - end if - enddo -9999 continue - - return - end function psb_iisaperm - - - subroutine psb_imsort_u(x,nout,dir) - use psb_sort_mod, psb_protect_name => psb_imsort_u - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(out) :: nout - integer(psb_ipk_), optional, intent(in) :: dir - - integer(psb_ipk_) :: n, k - integer(psb_ipk_) :: err_act - - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_msort_u' - call psb_erractionsave(err_act) - - n = size(x) - - call psb_msort(x,dir=dir) - nout = min(1,n) - do k=2,n - if (x(k) /= x(nout)) then - nout = nout + 1 - x(nout) = x(k) - endif - enddo - - return - -9999 call psb_error_handler(err_act) - - return - end subroutine psb_imsort_u - - - function psb_ibsrch(key,n,v) result(ipos) - use psb_sort_mod, psb_protect_name => psb_ibsrch - implicit none - integer(psb_ipk_) :: ipos, n - integer(psb_ipk_) :: key - integer(psb_ipk_) :: v(:) - - integer(psb_ipk_) :: lb, ub, m, i - - ipos = -1 - if (n<5) then - do i=1,n - if (key.eq.v(i)) then - ipos = i - return - end if - enddo - return - end if - - lb = 1 - ub = n - - do while (lb.le.ub) - m = (lb+ub)/2 - if (key.eq.v(m)) then - ipos = m - lb = ub + 1 - else if (key < v(m)) then - ub = m-1 - else - lb = m + 1 - end if - enddo - return - end function psb_ibsrch - - function psb_issrch(key,n,v) result(ipos) - use psb_sort_mod, psb_protect_name => psb_issrch - implicit none - integer(psb_ipk_) :: ipos, n - integer(psb_ipk_) :: key - integer(psb_ipk_) :: v(:) - - integer(psb_ipk_) :: i - - ipos = -1 - do i=1,n - if (key.eq.v(i)) then - ipos = i - return - end if - enddo - - return - end function psb_issrch - - subroutine psb_imsort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_imsort - use psb_error_mod - use psb_ip_reord_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, n, err_act - - integer(psb_ipk_), allocatable :: iaux(:) - integer(psb_ipk_) :: iret, info, i - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_imsort' - call psb_erractionsave(err_act) - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - select case(dir_) - case( psb_sort_up_, psb_sort_down_, psb_asort_up_, psb_asort_down_) - ! OK keep going - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - n = size(x) - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case(psb_sort_ovw_idx_) - do i=1,n - ix(i) = i - end do - case (psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - end if - - allocate(iaux(0:n+1),stat=info) - if (info /= psb_success_) then - call psb_errpush(psb_err_alloc_dealloc_,r_name='psb_i_msort') - goto 9999 - endif - - select case(dir_) - case (psb_sort_up_) - call psi_i_msort_up(n,x,iaux,iret) - case (psb_sort_down_) - call psi_i_msort_dw(n,x,iaux,iret) - case (psb_asort_up_) - call psi_i_amsort_up(n,x,iaux,iret) - case (psb_asort_down_) - call psi_i_amsort_dw(n,x,iaux,iret) - end select - ! - ! Do the actual reordering, since the inner routines - ! only provide linked pointers. - ! - if (iret == 0 ) then - if (present(ix)) then - call psb_ip_reord(n,x,ix,iaux) - else - call psb_ip_reord(n,x,iaux) - end if - end if - - - return - -9999 call psb_error_handler(err_act) - - return - - - end subroutine psb_imsort - - subroutine psi_i_msort_up(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - ! - integer(psb_ipk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (k(p) <= k(p+1)) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (k(p) > k(q)) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (k(p) <= k(q)) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (k(p) > k(q)) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_i_msort_up - - subroutine psi_i_msort_dw(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - ! - integer(psb_ipk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (k(p) >= k(p+1)) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (k(p) < k(q)) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (k(p) >= k(q)) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (k(p) < k(q)) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_i_msort_dw - - subroutine psi_i_amsort_up(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - ! - integer(psb_ipk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (abs(k(p)) <= abs(k(p+1))) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (abs(k(p)) > abs(k(q))) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (abs(k(p)) <= abs(k(q))) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (abs(k(p)) > abs(k(q))) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_i_amsort_up - - subroutine psi_i_amsort_dw(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_ipk_) :: k(n) - integer(psb_ipk_) :: l(0:n+1) - ! - integer(psb_ipk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (abs(k(p)) >= abs(k(p+1))) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (abs(k(p)) < abs(k(q))) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (abs(k(p)) >= abs(k(q))) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (abs(k(p)) < abs(k(q))) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_i_amsort_dw - - - - - - - - diff --git a/base/serial/sort/psb_i_qsort_impl.f90 b/base/serial/sort/psb_i_qsort_impl.f90 deleted file mode 100644 index e5f0ac92..00000000 --- a/base/serial/sort/psb_i_qsort_impl.f90 +++ /dev/null @@ -1,1318 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! The quicksort routines -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -subroutine psb_iqsort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_iqsort - use psb_error_mod - implicit none - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_ipk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, err_act, i - integer(psb_ipk_) :: n - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_iqsort' - call psb_erractionsave(err_act) - - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case( psb_sort_ovw_idx_, psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - - n = size(x) - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (flag_==psb_sort_ovw_idx_) then - do i=1,n - ix(i) = i - end do - end if - - select case(dir_) - case (psb_sort_up_) - call psi_iqsrx_up(n,x,ix) - case (psb_sort_down_) - call psi_iqsrx_dw(n,x,ix) - case (psb_asort_up_) - call psi_iaqsrx_up(n,x,ix) - case (psb_asort_down_) - call psi_iaqsrx_dw(n,x,ix) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - else - select case(dir_) - case (psb_sort_up_) - call psi_iqsr_up(n,x) - case (psb_sort_down_) - call psi_iqsr_dw(n,x) - case (psb_asort_up_) - call psi_iaqsr_up(n,x) - case (psb_asort_down_) - call psi_iaqsr_dw(n,x) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - end if - - return - -9999 call psb_error_handler(err_act) - - return -end subroutine psb_iqsort - -subroutine psi_iqsrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iqsrx_up - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xk, xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - integer(psb_ipk_) :: ixt - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv < x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv > x(j)) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv < x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = x(i) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_up2:do - j = j - 1 - xk = x(j) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_iqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisrx_up(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisrx_up(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_iisrx_up(n,x,idx) - endif -end subroutine psi_iqsrx_up - -subroutine psi_iqsrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iqsrx_dw - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xk, xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - integer(psb_ipk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv > x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv < x(j)) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv > x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = x(i) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_dw2:do - j = j - 1 - xk = x(j) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_iqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_iisrx_dw(n,x,idx) - endif - -end subroutine psi_iqsrx_dw - -subroutine psi_iqsr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_iqsr_up - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - ! .. - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xt, xk - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv < x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv > x(j)) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv < x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = x(i) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_up2:do - j = j - 1 - xk = x(j) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_iqsr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisr_up(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisr_up(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisr_up(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisr_up(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_iisr_up(n,x) - endif - -end subroutine psi_iqsr_up - -subroutine psi_iqsr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_iqsr_dw - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - ! .. - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xt, xk - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv > x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv < x(j)) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv > x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = x(i) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_dw2:do - j = j - 1 - xk = x(j) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_, & - & r_name='psi_iqsr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisr_dw(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisr_dw(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iisr_dw(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iisr_dw(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_iisr_dw(n,x) - endif - -end subroutine psi_iqsr_dw - -subroutine psi_iaqsrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iaqsrx_up - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xk - integer(psb_ipk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - integer(psb_ipk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv < abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(j))) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = abs(x(i)) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_up2:do - j = j - 1 - xk = abs(x(j)) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_, & - & r_name='psi_iaqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisrx_up(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisrx_up(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_iaisrx_up(n,x,idx) - endif - - -end subroutine psi_iaqsrx_up - -subroutine psi_iaqsrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_iaqsrx_dw - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(inout) :: idx(:) - integer(psb_ipk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xk - integer(psb_ipk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - integer(psb_ipk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv > abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(j))) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = abs(x(i)) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_dw2:do - j = j - 1 - xk = abs(x(j)) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_iaqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_iaisrx_dw(n,x,idx) - endif - -end subroutine psi_iaqsrx_dw - -subroutine psi_iaqsr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_iaqsr_up - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xk - integer(psb_ipk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - integer(psb_ipk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv < abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(j))) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = abs(x(i)) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_up2:do - j = j - 1 - xk = abs(x(j)) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_, & - & r_name='psi_iqasr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisr_up(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisr_up(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisr_up(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisr_up(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_iaisr_up(n,x) - endif - -end subroutine psi_iaqsr_up - -subroutine psi_iaqsr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_iaqsr_dw - use psb_error_mod - implicit none - - integer(psb_ipk_), intent(inout) :: x(:) - integer(psb_ipk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_ipk_) :: piv, xk - integer(psb_ipk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_ipk_) :: n1, n2 - integer(psb_ipk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv > abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(j))) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = abs(x(i)) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_dw2:do - j = j - 1 - xk = abs(x(j)) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_iqasr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisr_dw(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisr_dw(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_iaisr_dw(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_iaisr_dw(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_iaisr_dw(n,x) - endif - -end subroutine psi_iaqsr_dw - - diff --git a/base/serial/sort/psb_l_hsort_impl.f90 b/base/serial/sort/psb_l_hsort_impl.f90 deleted file mode 100644 index f8337eb4..00000000 --- a/base/serial/sort/psb_l_hsort_impl.f90 +++ /dev/null @@ -1,678 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! The merge-sort and quicksort routines are implemented in the -! serial/aux directory -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -subroutine psb_lhsort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_lhsort - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, n, i, l, err_act,info - integer(psb_lpk_) :: key - integer(psb_lpk_) :: index - - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_hsort' - call psb_erractionsave(err_act) - - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case( psb_sort_ovw_idx_, psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - - select case(dir_) - case(psb_sort_up_,psb_sort_down_) - ! OK - case (psb_asort_up_,psb_asort_down_) - ! OK - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - n = size(x) - - ! - ! Dirty trick to sort with heaps: if we want - ! to sort in place upwards, first we set up a heap so that - ! we can easily get the LARGEST element, then we take it out - ! and put it in the last entry, and so on. - ! So, we invert dir_ - ! - dir_ = -dir_ - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (flag_ == psb_sort_ovw_idx_) then - do i=1, n - ix(i) = i - end do - end if - l = 0 - do i=1, n - key = x(i) - index = ix(i) - call psi_idx_insert_heap(key,index,l,x,ix,dir_,info) - if (l /= i) then - write(psb_err_unit,*) 'Mismatch while heapifying ! ' - end if - end do - do i=n, 2, -1 - call psi_idx_heap_get_first(key,index,l,x,ix,dir_,info) - if (l /= i-1) then - write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i - end if - x(i) = key - ix(i) = index - end do - else if (.not.present(ix)) then - l = 0 - do i=1, n - key = x(i) - call psi_insert_heap(key,l,x,dir_,info) - if (l /= i) then - write(psb_err_unit,*) 'Mismatch while heapifying ! ',l,i - end if - end do - do i=n, 2, -1 - call psi_l_heap_get_first(key,l,x,dir_,info) - if (l /= i-1) then - write(psb_err_unit,*) 'Mismatch while pulling out of heap ',l,i - end if - x(i) = key - end do - end if - - - return - -9999 call psb_error_handler(err_act) - - return -end subroutine psb_lhsort - - - -! -! These are packaged so that they can be used to implement -! a heapsort, should the need arise -! -! -! Programming note: -! In the implementation of the heap_get_first function -! we have code like this -! -! if ( ( heap(2*i) < heap(2*i+1) ) .or.& -! & (2*i == last)) then -! j = 2*i -! else -! j = 2*i + 1 -! end if -! -! It looks like the 2*i+1 could overflow the array, but this -! is not true because there is a guard statement -! if (i>last/2) exit -! and because last has just been reduced by 1 when defining the return value, -! therefore 2*i+1 may be greater than the current value of last, -! but cannot be greater than the value of last when the routine was entered -! hence it is safe. -! -! -! - -subroutine psi_l_insert_heap(key,last,heap,dir,info) - use psb_sort_mod, psb_protect_name => psi_l_insert_heap - implicit none - - ! - ! Input: - ! key: the new value - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! dir: sorting direction - - integer(psb_lpk_), intent(in) :: key - integer(psb_ipk_), intent(in) :: dir - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_lpk_), intent(inout) :: last - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i, i2 - integer(psb_lpk_) :: temp - - info = psb_success_ - if (last < 0) then - write(psb_err_unit,*) 'Invalid last in heap ',last - info = last - return - endif - last = last + 1 - if (last > size(heap)) then - write(psb_err_unit,*) 'out of bounds ' - info = -1 - return - end if - i = last - heap(i) = key - - select case(dir) - case (psb_sort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) < heap(i2)) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_sort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) > heap(i2)) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - case (psb_asort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) < abs(heap(i2))) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_asort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) > abs(heap(i2))) then - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_l_insert_heap - - -subroutine psi_l_heap_get_first(key,last,heap,dir,info) - use psb_sort_mod, psb_protect_name => psi_l_heap_get_first - implicit none - - integer(psb_lpk_), intent(inout) :: key - integer(psb_lpk_), intent(inout) :: last - integer(psb_ipk_), intent(in) :: dir - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(out) :: info - - integer(psb_ipk_) :: i, j - integer(psb_lpk_) :: temp - - - info = psb_success_ - if (last <= 0) then - key = 0 - info = -1 - return - endif - - key = heap(1) - heap(1) = heap(last) - last = last - 1 - - select case(dir) - case (psb_sort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) < heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) > heap(j)) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_sort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) > heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) < heap(j)) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case (psb_asort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) < abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) > abs(heap(j))) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_asort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) > abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) < abs(heap(j))) then - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_l_heap_get_first - - -subroutine psi_l_idx_insert_heap(key,index,last,heap,idxs,dir,info) - use psb_sort_mod, psb_protect_name => psi_l_idx_insert_heap - - implicit none - ! - ! Input: - ! key: the new value - ! index: the new index - ! last: pointer to the last occupied element in heap - ! heap: the heap - ! idxs: the indices - ! dir: sorting direction - - integer(psb_lpk_), intent(in) :: key - integer(psb_ipk_), intent(in) :: index,dir - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(inout) :: idxs(:),last - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_) :: i, i2, itemp - integer(psb_lpk_) :: temp - - info = psb_success_ - if (last < 0) then - write(psb_err_unit,*) 'Invalid last in heap ',last - info = last - return - endif - - last = last + 1 - if (last > size(heap)) then - write(psb_err_unit,*) 'out of bounds ' - info = -1 - return - end if - - i = last - heap(i) = key - idxs(i) = index - - select case(dir) - case (psb_sort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) < heap(i2)) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_sort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (heap(i) > heap(i2)) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - case (psb_asort_up_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) < abs(heap(i2))) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case (psb_asort_down_) - - do - if (i<=1) exit - i2 = i/2 - if (abs(heap(i)) > abs(heap(i2))) then - itemp = idxs(i) - idxs(i) = idxs(i2) - idxs(i2) = itemp - temp = heap(i) - heap(i) = heap(i2) - heap(i2) = temp - i = i2 - else - exit - end if - end do - - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_l_idx_insert_heap - -subroutine psi_l_idx_heap_get_first(key,index,last,heap,idxs,dir,info) - use psb_sort_mod, psb_protect_name => psi_l_idx_heap_get_first - implicit none - - integer(psb_lpk_), intent(inout) :: heap(:) - integer(psb_ipk_), intent(out) :: index,info - integer(psb_ipk_), intent(inout) :: last,idxs(:) - integer(psb_ipk_), intent(in) :: dir - integer(psb_lpk_), intent(out) :: key - - integer(psb_ipk_) :: i, j,itemp - integer(psb_lpk_) :: temp - - info = psb_success_ - if (last <= 0) then - key = 0 - index = 0 - info = -1 - return - endif - - key = heap(1) - index = idxs(1) - heap(1) = heap(last) - idxs(1) = idxs(last) - last = last - 1 - - select case(dir) - case (psb_sort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) < heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) > heap(j)) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_sort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (heap(2*i) > heap(2*i+1)) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (heap(i) < heap(j)) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case (psb_asort_up_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) < abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) > abs(heap(j))) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - - case (psb_asort_down_) - - i = 1 - do - if (i > (last/2)) exit - if ( (abs(heap(2*i)) > abs(heap(2*i+1))) .or.& - & (2*i == last)) then - j = 2*i - else - j = 2*i + 1 - end if - - if (abs(heap(i)) < abs(heap(j))) then - itemp = idxs(i) - idxs(i) = idxs(j) - idxs(j) = itemp - temp = heap(i) - heap(i) = heap(j) - heap(j) = temp - i = j - else - exit - end if - end do - - case default - write(psb_err_unit,*) 'Invalid direction in heap ',dir - end select - - return -end subroutine psi_l_idx_heap_get_first - - - - diff --git a/base/serial/sort/psb_l_isort_impl.f90 b/base/serial/sort/psb_l_isort_impl.f90 deleted file mode 100644 index 8d101759..00000000 --- a/base/serial/sort/psb_l_isort_impl.f90 +++ /dev/null @@ -1,341 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! The insertion sort routines -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -subroutine psb_lisort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_lisort - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, err_act - integer(psb_lpk_) :: n, i - - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_lisort' - call psb_erractionsave(err_act) - - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case( psb_sort_ovw_idx_, psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - - n = size(x) - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (flag_==psb_sort_ovw_idx_) then - do i=1,n - ix(i) = i - end do - end if - - select case(dir_) - case (psb_sort_up_) - call psi_lisrx_up(n,x,ix) - case (psb_sort_down_) - call psi_lisrx_dw(n,x,ix) - case (psb_asort_up_) - call psi_laisrx_up(n,x,ix) - case (psb_asort_down_) - call psi_laisrx_dw(n,x,ix) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - else - select case(dir_) - case (psb_sort_up_) - call psi_lisr_up(n,x) - case (psb_sort_down_) - call psi_lisr_dw(n,x) - case (psb_asort_up_) - call psi_laisr_up(n,x) - case (psb_asort_down_) - call psi_laisr_dw(n,x) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - end if - - return - -9999 call psb_error_handler(err_act) - - return -end subroutine psb_lisort - -subroutine psi_lisrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_lisrx_up - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j,ix - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) < x(j)) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (x(i) >= xx) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_lisrx_up - -subroutine psi_lisrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_lisrx_dw - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j,ix - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) > x(j)) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (x(i) <= xx) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_lisrx_dw - - -subroutine psi_lisr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_lisr_up - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) < x(j)) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (x(i) >= xx) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_lisr_up - -subroutine psi_lisr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_lisr_dw - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (x(j+1) > x(j)) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (x(i) <= xx) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_lisr_dw - -subroutine psi_laisrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_laisrx_up - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j,ix - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) < abs(x(j))) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) >= abs(xx)) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_laisrx_up - -subroutine psi_laisrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_laisrx_dw - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j,ix - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) > abs(x(j))) then - xx = x(j) - ix = idx(j) - i=j+1 - do - x(i-1) = x(i) - idx(i-1) = idx(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) <= abs(xx)) exit - end do - x(i-1) = xx - idx(i-1) = ix - endif - enddo -end subroutine psi_laisrx_dw - -subroutine psi_laisr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_laisr_up - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) < abs(x(j))) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) >= abs(xx)) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_laisr_up - -subroutine psi_laisr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_laisr_dw - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_) :: i,j - integer(psb_lpk_) :: xx - - do j=n-1,1,-1 - if (abs(x(j+1)) > abs(x(j))) then - xx = x(j) - i=j+1 - do - x(i-1) = x(i) - i = i+1 - if (i>n) exit - if (abs(x(i)) <= abs(xx)) exit - end do - x(i-1) = xx - endif - enddo -end subroutine psi_laisr_dw - diff --git a/base/serial/sort/psb_l_msort_impl.f90 b/base/serial/sort/psb_l_msort_impl.f90 deleted file mode 100644 index 2508b332..00000000 --- a/base/serial/sort/psb_l_msort_impl.f90 +++ /dev/null @@ -1,713 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! - ! - ! The merge-sort routines - ! References: - ! D. Knuth - ! The Art of Computer Programming, vol. 3 - ! Addison-Wesley - ! - ! Aho, Hopcroft, Ullman - ! Data Structures and Algorithms - ! Addison-Wesley - ! - logical function psb_lisaperm(n,eip) - use psb_sort_mod, psb_protect_name => psb_lisaperm - implicit none - - integer(psb_lpk_), intent(in) :: n - integer(psb_lpk_), intent(in) :: eip(n) - integer(psb_lpk_), allocatable :: ip(:) - integer(psb_lpk_) :: i,j,m, info - - - psb_lisaperm = .true. - if (n <= 0) return - allocate(ip(n), stat=info) - if (info /= psb_success_) return - ! - ! sanity check first - ! - do i=1, n - ip(i) = eip(i) - if ((ip(i) < 1).or.(ip(i) > n)) then - write(psb_err_unit,*) 'Out of bounds in isaperm' ,ip(i), n - psb_lisaperm = .false. - return - endif - enddo - - ! - ! now work through the cycles, by marking each successive item as negative. - ! no cycle should intersect with any other, hence the >= 1 check. - ! - do m = 1, n - i = ip(m) - if (i < 0) then - ip(m) = -i - else if (i /= m) then - j = ip(i) - ip(i) = -j - i = j - do while ((j >= 1).and.(j /= m)) - j = ip(i) - ip(i) = -j - i = j - enddo - ip(m) = abs(ip(m)) - if (j /= m) then - psb_lisaperm = .false. - goto 9999 - endif - end if - enddo -9999 continue - - return - end function psb_lisaperm - - - subroutine psb_lmsort_u(x,nout,dir) - use psb_sort_mod, psb_protect_name => psb_lmsort_u - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(out) :: nout - integer(psb_ipk_), optional, intent(in) :: dir - - integer(psb_lpk_) :: n, k - integer(psb_ipk_) :: err_act - - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_msort_u' - call psb_erractionsave(err_act) - - n = size(x) - - call psb_msort(x,dir=dir) - nout = min(1,n) - do k=2,n - if (x(k) /= x(nout)) then - nout = nout + 1 - x(nout) = x(k) - endif - enddo - - return - -9999 call psb_error_handler(err_act) - - return - end subroutine psb_lmsort_u - - - function psb_lbsrch(key,n,v) result(ipos) - use psb_sort_mod, psb_protect_name => psb_lbsrch - implicit none - integer(psb_ipk_) :: ipos, n - integer(psb_lpk_) :: key - integer(psb_lpk_) :: v(:) - - integer(psb_ipk_) :: lb, ub, m, i - - ipos = -1 - if (n<5) then - do i=1,n - if (key.eq.v(i)) then - ipos = i - return - end if - enddo - return - end if - - lb = 1 - ub = n - - do while (lb.le.ub) - m = (lb+ub)/2 - if (key.eq.v(m)) then - ipos = m - lb = ub + 1 - else if (key < v(m)) then - ub = m-1 - else - lb = m + 1 - end if - enddo - return - end function psb_lbsrch - - function psb_lssrch(key,n,v) result(ipos) - use psb_sort_mod, psb_protect_name => psb_lssrch - implicit none - integer(psb_ipk_) :: ipos, n - integer(psb_lpk_) :: key - integer(psb_lpk_) :: v(:) - - integer(psb_ipk_) :: i - - ipos = -1 - do i=1,n - if (key.eq.v(i)) then - ipos = i - return - end if - enddo - - return - end function psb_lssrch - - subroutine psb_lmsort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_lmsort - use psb_error_mod - use psb_ip_reord_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, n, err_act - - integer(psb_lpk_), allocatable :: iaux(:) - integer(psb_ipk_) :: iret, info, i - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_lmsort' - call psb_erractionsave(err_act) - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - select case(dir_) - case( psb_sort_up_, psb_sort_down_, psb_asort_up_, psb_asort_down_) - ! OK keep going - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - n = size(x) - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case(psb_sort_ovw_idx_) - do i=1,n - ix(i) = i - end do - case (psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - end if - - allocate(iaux(0:n+1),stat=info) - if (info /= psb_success_) then - call psb_errpush(psb_err_alloc_dealloc_,r_name='psb_l_msort') - goto 9999 - endif - - select case(dir_) - case (psb_sort_up_) - call psi_l_msort_up(n,x,iaux,iret) - case (psb_sort_down_) - call psi_l_msort_dw(n,x,iaux,iret) - case (psb_asort_up_) - call psi_l_amsort_up(n,x,iaux,iret) - case (psb_asort_down_) - call psi_l_amsort_dw(n,x,iaux,iret) - end select - ! - ! Do the actual reordering, since the inner routines - ! only provide linked pointers. - ! - if (iret == 0 ) then - if (present(ix)) then - call psb_ip_reord(n,x,ix,iaux) - else - call psb_ip_reord(n,x,iaux) - end if - end if - - - return - -9999 call psb_error_handler(err_act) - - return - - - end subroutine psb_lmsort - - subroutine psi_l_msort_up(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - ! - integer(psb_lpk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (k(p) <= k(p+1)) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (k(p) > k(q)) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (k(p) <= k(q)) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (k(p) > k(q)) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_l_msort_up - - subroutine psi_l_msort_dw(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - ! - integer(psb_lpk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (k(p) >= k(p+1)) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (k(p) < k(q)) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (k(p) >= k(q)) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (k(p) < k(q)) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_l_msort_dw - - subroutine psi_l_amsort_up(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - ! - integer(psb_lpk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (abs(k(p)) <= abs(k(p+1))) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (abs(k(p)) > abs(k(q))) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (abs(k(p)) <= abs(k(q))) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (abs(k(p)) > abs(k(q))) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_l_amsort_up - - subroutine psi_l_amsort_dw(n,k,l,iret) - use psb_const_mod - implicit none - integer(psb_ipk_) :: n, iret - integer(psb_lpk_) :: k(n) - integer(psb_lpk_) :: l(0:n+1) - ! - integer(psb_lpk_) :: p,q,s,t - ! .. - iret = 0 - ! first step: we are preparing ordered sublists, exploiting - ! what order was already in the input data; negative links - ! mark the end of the sublists - l(0) = 1 - t = n + 1 - do p = 1,n - 1 - if (abs(k(p)) >= abs(k(p+1))) then - l(p) = p + 1 - else - l(t) = - (p+1) - t = p - end if - end do - l(t) = 0 - l(n) = 0 - ! see if the input was already sorted - if (l(n+1) == 0) then - iret = 1 - return - else - l(n+1) = abs(l(n+1)) - end if - - mergepass: do - ! otherwise, begin a pass through the list. - ! throughout all the subroutine we have: - ! p, q: pointing to the sublists being merged - ! s: pointing to the most recently processed record - ! t: pointing to the end of previously completed sublist - s = 0 - t = n + 1 - p = l(s) - q = l(t) - if (q == 0) exit mergepass - - outer: do - - if (abs(k(p)) < abs(k(q))) then - - l(s) = sign(q,l(s)) - s = q - q = l(q) - if (q > 0) then - do - if (abs(k(p)) >= abs(k(q))) cycle outer - s = q - q = l(q) - if (q <= 0) exit - end do - end if - l(s) = p - s = t - do - t = p - p = l(p) - if (p <= 0) exit - end do - - else - - l(s) = sign(p,l(s)) - s = p - p = l(p) - if (p>0) then - do - if (abs(k(p)) < abs(k(q))) cycle outer - s = p - p = l(p) - if (p <= 0) exit - end do - end if - ! otherwise, one sublist ended, and we append to it the rest - ! of the other one. - l(s) = q - s = t - do - t = q - q = l(q) - if (q <= 0) exit - end do - end if - - p = -p - q = -q - if (q == 0) then - l(s) = sign(p,l(s)) - l(t) = 0 - exit outer - end if - end do outer - end do mergepass - - end subroutine psi_l_amsort_dw - - - - - - - - diff --git a/base/serial/sort/psb_l_qsort_impl.f90 b/base/serial/sort/psb_l_qsort_impl.f90 deleted file mode 100644 index f02428e2..00000000 --- a/base/serial/sort/psb_l_qsort_impl.f90 +++ /dev/null @@ -1,1318 +0,0 @@ -! -! Parallel Sparse BLAS version 3.5 -! (C) Copyright 2006-2018 -! Salvatore Filippone -! Alfredo Buttari -! -! Redistribution and use in source and binary forms, with or without -! modification, are permitted provided that the following conditions -! are met: -! 1. Redistributions of source code must retain the above copyright -! notice, this list of conditions and the following disclaimer. -! 2. Redistributions in binary form must reproduce the above copyright -! notice, this list of conditions, and the following disclaimer in the -! documentation and/or other materials provided with the distribution. -! 3. The name of the PSBLAS group or the names of its contributors may -! not be used to endorse or promote products derived from this -! software without specific written permission. -! -! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS -! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -! POSSIBILITY OF SUCH DAMAGE. -! -! -! -! The quicksort routines -! References: -! D. Knuth -! The Art of Computer Programming, vol. 3 -! Addison-Wesley -! -! Aho, Hopcroft, Ullman -! Data Structures and Algorithms -! Addison-Wesley -! -subroutine psb_lqsort(x,ix,dir,flag) - use psb_sort_mod, psb_protect_name => psb_lqsort - use psb_error_mod - implicit none - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_ipk_), optional, intent(in) :: dir, flag - integer(psb_lpk_), optional, intent(inout) :: ix(:) - - integer(psb_ipk_) :: dir_, flag_, err_act, i - integer(psb_lpk_) :: n - integer(psb_ipk_) :: ierr(5) - character(len=20) :: name - - name='psb_lqsort' - call psb_erractionsave(err_act) - - if (present(flag)) then - flag_ = flag - else - flag_ = psb_sort_ovw_idx_ - end if - select case(flag_) - case( psb_sort_ovw_idx_, psb_sort_keep_idx_) - ! OK keep going - case default - ierr(1) = 4; ierr(2) = flag_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - if (present(dir)) then - dir_ = dir - else - dir_= psb_sort_up_ - end if - - n = size(x) - - if (present(ix)) then - if (size(ix) < n) then - ierr(1) = 2; ierr(2) = size(ix); - call psb_errpush(psb_err_input_asize_invalid_i_,name,i_err=ierr) - goto 9999 - end if - if (flag_==psb_sort_ovw_idx_) then - do i=1,n - ix(i) = i - end do - end if - - select case(dir_) - case (psb_sort_up_) - call psi_lqsrx_up(n,x,ix) - case (psb_sort_down_) - call psi_lqsrx_dw(n,x,ix) - case (psb_asort_up_) - call psi_laqsrx_up(n,x,ix) - case (psb_asort_down_) - call psi_laqsrx_dw(n,x,ix) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - else - select case(dir_) - case (psb_sort_up_) - call psi_lqsr_up(n,x) - case (psb_sort_down_) - call psi_lqsr_dw(n,x) - case (psb_asort_up_) - call psi_laqsr_up(n,x) - case (psb_asort_down_) - call psi_laqsr_dw(n,x) - case default - ierr(1) = 3; ierr(2) = dir_; - call psb_errpush(psb_err_input_value_invalid_i_,name,i_err=ierr) - goto 9999 - end select - - end if - - return - -9999 call psb_error_handler(err_act) - - return -end subroutine psb_lqsort - -subroutine psi_lqsrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_lqsrx_up - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xk, xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - integer(psb_lpk_) :: ixt - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv < x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv > x(j)) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv < x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = x(i) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_up2:do - j = j - 1 - xk = x(j) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_lqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisrx_up(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisrx_up(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_lisrx_up(n,x,idx) - endif -end subroutine psi_lqsrx_up - -subroutine psi_lqsrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_lqsrx_dw - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xk, xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - integer(psb_lpk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv > x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv < x(j)) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - if (piv > x(i)) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = x(lpiv) - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = x(i) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_dw2:do - j = j - 1 - xk = x(j) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_lqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_lisrx_dw(n,x,idx) - endif - -end subroutine psi_lqsrx_dw - -subroutine psi_lqsr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_lqsr_up - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - ! .. - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xt, xk - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv < x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv > x(j)) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv < x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = x(i) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_up2:do - j = j - 1 - xk = x(j) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_lqsr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisr_up(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisr_up(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisr_up(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisr_up(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_lisr_up(n,x) - endif - -end subroutine psi_lqsr_up - -subroutine psi_lqsr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_lqsr_dw - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - ! .. - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xt, xk - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = x(lpiv) - if (piv > x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv < x(j)) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - if (piv > x(i)) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = x(lpiv) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = x(i) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = xk - x(i) = piv - in_dw2:do - j = j - 1 - xk = x(j) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_, & - & r_name='psi_lqsr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisr_dw(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisr_dw(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_lisr_dw(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_lisr_dw(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_lisr_dw(n,x) - endif - -end subroutine psi_lqsr_dw - -subroutine psi_laqsrx_up(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_laqsrx_up - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xk - integer(psb_lpk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - integer(psb_lpk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv < abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(j))) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = abs(x(i)) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_up2:do - j = j - 1 - xk = abs(x(j)) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_, & - & r_name='psi_laqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisrx_up(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisrx_up(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisrx_up(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_laisrx_up(n,x,idx) - endif - - -end subroutine psi_laqsrx_up - -subroutine psi_laqsrx_dw(n,x,idx) - use psb_sort_mod, psb_protect_name => psi_laqsrx_dw - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(inout) :: idx(:) - integer(psb_lpk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xk - integer(psb_lpk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - integer(psb_lpk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv > abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(j))) then - xt = x(j) - ixt = idx(j) - x(j) = x(lpiv) - idx(j) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(i))) then - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - xt = x(i) - ixt = idx(i) - x(i) = x(lpiv) - idx(i) = idx(lpiv) - x(lpiv) = xt - idx(lpiv) = ixt - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = abs(x(i)) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_dw2:do - j = j - 1 - xk = abs(x(j)) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - ixt = idx(i) - x(i) = x(j) - idx(i) = idx(j) - x(j) = xt - idx(j) = ixt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_laqsrx',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisrx_dw(n2,x(i:iux),idx(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisrx_dw(n1,x(ilx:i-1),idx(ilx:i-1)) - endif - endif - enddo - else - call psi_laisrx_dw(n,x,idx) - endif - -end subroutine psi_laqsrx_dw - -subroutine psi_laqsr_up(n,x) - use psb_sort_mod, psb_protect_name => psi_laqsr_up - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xk - integer(psb_lpk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - integer(psb_lpk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv < abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(j))) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_up: do - in_up1: do - i = i + 1 - xk = abs(x(i)) - if (xk >= piv) exit in_up1 - end do in_up1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_up2:do - j = j - 1 - xk = abs(x(j)) - if (xk <= piv) exit in_up2 - end do in_up2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_up - end if - end do outer_up - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_, & - & r_name='psi_lqasr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisr_up(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisr_up(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisr_up(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisr_up(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_laisr_up(n,x) - endif - -end subroutine psi_laqsr_up - -subroutine psi_laqsr_dw(n,x) - use psb_sort_mod, psb_protect_name => psi_laqsr_dw - use psb_error_mod - implicit none - - integer(psb_lpk_), intent(inout) :: x(:) - integer(psb_lpk_), intent(in) :: n - ! .. Local Scalars .. - integer(psb_lpk_) :: piv, xk - integer(psb_lpk_) :: xt - integer(psb_ipk_) :: i, j, ilx, iux, istp, lpiv - integer(psb_lpk_) :: n1, n2 - integer(psb_lpk_) :: ixt - - integer(psb_ipk_), parameter :: maxstack=64,nparms=3,ithrs=72 - integer(psb_ipk_) :: istack(nparms,maxstack) - - if (n > ithrs) then - ! - ! Init stack pointer - ! - istp = 1 - istack(1,istp) = 1 - istack(2,istp) = n - - do - if (istp <= 0) exit - ilx = istack(1,istp) - iux = istack(2,istp) - istp = istp - 1 - ! - ! Choose a pivot with median-of-three heuristics, leave it - ! in the LPIV location - ! - i = ilx - j = iux - lpiv = (i+j)/2 - piv = abs(x(lpiv)) - if (piv > abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv < abs(x(j))) then - xt = x(j) - x(j) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - if (piv > abs(x(i))) then - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - piv = abs(x(lpiv)) - endif - ! - ! now piv is correct; place it into first location - - xt = x(i) - x(i) = x(lpiv) - x(lpiv) = xt - - i = ilx - 1 - j = iux + 1 - - outer_dw: do - in_dw1: do - i = i + 1 - xk = abs(x(i)) - if (xk <= piv) exit in_dw1 - end do in_dw1 - ! - ! Ensure finite termination for next loop - ! - xt = x(i) - x(i) = piv - in_dw2:do - j = j - 1 - xk = abs(x(j)) - if (xk >= piv) exit in_dw2 - end do in_dw2 - x(i) = xt - - if (j > i) then - xt = x(i) - x(i) = x(j) - x(j) = xt - else - exit outer_dw - end if - end do outer_dw - if (i == ilx) then - if (x(i) /= piv) then - call psb_errpush(psb_err_internal_error_,& - & r_name='psi_lqasr',a_err='impossible pivot condition') - call psb_error() - endif - i = i + 1 - endif - - n1 = (i-1)-ilx+1 - n2 = iux-(i)+1 - if (n1 > n2) then - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisr_dw(n1,x(ilx:i-1)) - endif - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisr_dw(n2,x(i:iux)) - endif - else - if (n2 > ithrs) then - istp = istp + 1 - istack(1,istp) = i - istack(2,istp) = iux - else - call psi_laisr_dw(n2,x(i:iux)) - endif - if (n1 > ithrs) then - istp = istp + 1 - istack(1,istp) = ilx - istack(2,istp) = i-1 - else - call psi_laisr_dw(n1,x(ilx:i-1)) - endif - endif - enddo - else - call psi_laisr_dw(n,x) - endif - -end subroutine psi_laqsr_dw - - diff --git a/base/tools/Makefile b/base/tools/Makefile index 2c160616..771e85fc 100644 --- a/base/tools/Makefile +++ b/base/tools/Makefile @@ -30,14 +30,19 @@ FOBJS = psb_cdall.o psb_cdals.o psb_cdalv.o psb_cd_inloc.o psb_cdins.o psb_cdprt psb_cgetelem.o psb_dgetelem.o psb_sgetelem.o psb_zgetelem.o MPFOBJS = psb_icdasb.o psb_ssphalo.o psb_dsphalo.o psb_csphalo.o psb_zsphalo.o \ - psb_dcdbldext.o psb_zcdbldext.o psb_scdbldext.o psb_ccdbldext.o + psb_dcdbldext.o psb_zcdbldext.o psb_scdbldext.o psb_ccdbldext.o \ + psb_s_remote_mat.o psb_d_remote_mat.o psb_c_remote_mat.o psb_z_remote_mat.o \ + psb_s_remote_vect.o psb_d_remote_vect.o psb_c_remote_vect.o psb_z_remote_vect.o \ + psb_e_remote_vect.o psb_m_remote_vect.o LIBDIR=.. INCDIR=.. MODDIR=../modules FINCLUDES=$(FMFLAG). $(FMFLAG)$(MODDIR) $(FMFLAG)$(INCDIR) $(FIFLAG)$(MODDIR) -lib: mpfobjs $(FOBJS) +objs: mpfobjs $(FOBJS) + +lib: objs $(AR) $(LIBDIR)/$(LIBNAME) $(MPFOBJS) $(FOBJS) $(RANLIB) $(LIBDIR)/$(LIBNAME) diff --git a/base/tools/psb_c_remote_mat.F90 b/base/tools/psb_c_remote_mat.F90 new file mode 100644 index 00000000..ae2eaaf2 --- /dev/null +++ b/base/tools/psb_c_remote_mat.F90 @@ -0,0 +1,276 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_c_remote_mat.f90 +! +! Subroutine: +! This routine does the retrieval of remote matrix rows. +! Retrieval is done through GETROW, therefore it should work +! for any matrix format in A; as for the output, default is CSR. +! +! There is also a specialized version lc_CSR whose interface +! is adapted for the needs of c_par_csr_spspmm. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! a - type(psb_cspmat_type) The local part of input matrix A +! desc_a - type(psb_desc_type). The communication descriptor. +! blck - type(psb_cspmat_type) The local part of output matrix BLCK +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +Subroutine psb_lc_remote_mat(a,desc_a,b,info) + use psb_base_mod, psb_protect_name => psb_lc_remote_mat + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + + Type(psb_lc_coo_sparse_mat),Intent(inout) :: a + Type(psb_lc_coo_sparse_mat),Intent(inout) :: b + Type(psb_desc_type), Intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, n_el_send,n_el_recv, & + & n_elem, j, ipx,idxs,idxr + integer(psb_lpk_) :: r, k, irmin, irmax, icmin, icmax, iszs, iszr, & + & lidx, l1, lnr, lnc, lnnz, idx, ngtz, tot_elem + integer(psb_lpk_) :: nz,nouth + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:),sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: iasnd(:), jasnd(:) + complex(psb_spk_), allocatable :: valsnd(:) + type(psb_lc_coo_sparse_mat), allocatable :: acoo + class(psb_i_base_vect_type), pointer :: pdxv + integer(psb_ipk_), allocatable :: ila(:), iprc(:) + logical :: rowcnv_,colcnv_,rowscale_,colscale_ + character(len=5) :: outfmt_ + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_c_remote_mat' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + + call b%free() + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), acoo,stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + + nz = a%get_nzeros() + !allocate(ila(nz)) + !write(0,*) me,name,' size :',nz,size(ila) + !call desc_a%g2l(a%ia(1:nz),ila(1:nz),info,owned=.false.) + !nouth = count(ila(1:nz)<0) + !write(0,*) me,name,' Count out of halo :',nouth + !call psb_max(ctxt,nouth) + !if ((nouth/=0).and.(me==0)) & + ! & write(0,*) 'Warning: would require reinit of DESC_A' + + call desc_a%indxmap%fnd_owner(a%ia(1:nz),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:)=0 + rvsz(:)=0 + sdsi(:)=0 + rvsi(:)=0 + ipx = 1 + brvindx(:) = 0 + bsdindx(:) = 0 + counter=1 + idx = 0 + idxs = 0 + idxr = 0 + do i=1,nz + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call acoo%allocate(desc_a%get_global_rows(),desc_a%get_global_cols(),iszr) + if (psb_errstatus_fatal()) then + write(0,*) 'Error from acoo%allocate ' + info = 4010 + goto 9999 + end if + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Sizes:',acoo%get_size(),& + & ' Send:',sdsz(:),' Receive:',rvsz(:) + !write(debug_unit,*) me,' ',trim(name),': ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),iasnd,info) + !write(debug_unit,*) me,' ',trim(name),' iasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),jasnd,info) + !write(debug_unit,*) me,' ',trim(name),' jasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),valsnd,info) + !write(debug_unit,*) me,' ',trim(name),' valsnd: ',info + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='ensure_size') + goto 9999 + end if + do k=1, nz + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + !rvsi(proc) = rvsi(proc) + 1 + iasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ia(k) + jasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ja(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = a%val(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_) + call psb_simple_triad_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& + & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & acoo%val,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(iasnd,sdsz,bsdindx,& + & acoo%ia,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(jasnd,sdsz,bsdindx,& + & acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_c_spk_,& + & acoo%val,rvsz,brvindx,psb_mpi_c_spk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(iasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ia,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(jasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ja,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + call acoo%set_nzeros(iszr) + call acoo%mv_to_coo(b,info) + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & iasnd,jasnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_lc_remote_mat diff --git a/base/tools/psb_c_remote_vect.F90 b/base/tools/psb_c_remote_vect.F90 new file mode 100644 index 00000000..bd5286fa --- /dev/null +++ b/base/tools/psb_c_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_c_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_c_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_c_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + complex(psb_spk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + complex(psb_spk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + complex(psb_spk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_c_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_c_spk_,& + & x,rvsz,brvindx,psb_mpi_c_spk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_c_remote_vect diff --git a/base/tools/psb_callc.f90 b/base/tools/psb_callc.f90 index 530a43a2..272ece8b 100644 --- a/base/tools/psb_callc.f90 +++ b/base/tools/psb_callc.f90 @@ -40,7 +40,7 @@ ! x - the vector to be allocated. ! desc_a - the communication descriptor. ! info - Return code -subroutine psb_calloc_vect(x, desc_a,info) +subroutine psb_calloc_vect(x, desc_a,info, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_calloc_vect use psi_mod implicit none @@ -49,9 +49,11 @@ subroutine psb_calloc_vect(x, desc_a,info) type(psb_c_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals integer(psb_ipk_) :: np,me,nr,i,err_act + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -102,6 +104,25 @@ subroutine psb_calloc_vect(x, desc_a,info) endif call x%zero() + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + call x%set_nrmv(0) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + call psb_ensure_size(nrmt_,x%rmtv,info) + call psb_ensure_size(nrmt_,x%rmidx,info) + end if + call psb_erractionrestore(err_act) return @@ -110,6 +131,7 @@ subroutine psb_calloc_vect(x, desc_a,info) return end subroutine psb_calloc_vect + ! Function: psb_calloc_vect_r2 ! Allocates a vector of dense vectors for PSBLAS routines. ! The descriptor may be in either the build or assembled state. @@ -121,7 +143,7 @@ end subroutine psb_calloc_vect ! n - optional number of columns. ! lb - optional lower bound on column indices -subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb) +subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_calloc_vect_r2 use psi_mod implicit none @@ -131,10 +153,12 @@ subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n,lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -208,6 +232,26 @@ subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb) if (info /= 0) exit end do end if + + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + + do i=lb_, lb_+n_-1 + call x(i)%set_dupl(dupl_) + call x(i)%set_remote_build(bldmode_) + if (x(i)%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x(i)%rmtv(nrmt_)) + end if + end do if (psb_errstatus_fatal()) then info=psb_err_alloc_request_ call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') @@ -224,7 +268,7 @@ subroutine psb_calloc_vect_r2(x, desc_a,info,n,lb) end subroutine psb_calloc_vect_r2 -subroutine psb_calloc_multivect(x, desc_a,info,n) +subroutine psb_calloc_multivect(x, desc_a,info,n, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_calloc_multivect use psi_mod implicit none @@ -234,10 +278,12 @@ subroutine psb_calloc_multivect(x, desc_a,info,n) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -306,6 +352,23 @@ subroutine psb_calloc_multivect(x, desc_a,info,n) call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') goto 9999 endif + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x%rmtv(nrmt_,n_)) + end if + call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_casb.f90 b/base/tools/psb_casb.f90 index de2e3890..83e2715b 100644 --- a/base/tools/psb_casb.f90 +++ b/base/tools/psb_casb.f90 @@ -64,7 +64,7 @@ subroutine psb_casb_vect(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -83,7 +83,7 @@ subroutine psb_casb_vect(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - + dupl_ = x%get_dupl() ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -104,6 +104,23 @@ subroutine psb_casb_vect(x, desc_a, info, mold, scratch) call x%free(info) call x%bld(ncol,mold=mold) else + + if (x%is_remote_build()) then + block + integer(psb_lpk_), allocatable :: lvx(:) + complex(psb_spk_), allocatable :: vx(:) + integer(psb_ipk_), allocatable :: ivx(:) + integer(psb_ipk_) :: nrmv, nx, i + + nrmv = x%get_nrmv() + call psb_remote_vect(nrmv,x%rmtv,x%rmidx,desc_a,vx,lvx,info) + nx = size(vx) + call psb_realloc(nx,ivx,info) + call desc_a%g2l(lvx,ivx,info,owned=.true.) + call x%ins(nx,ivx,vx,info) + end block + end if + call x%asb(ncol,info) ! ..update halo elements.. call psb_halo(x,desc_a,info) @@ -140,7 +157,7 @@ subroutine psb_casb_vect_r2(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, i, n - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -159,7 +176,6 @@ subroutine psb_casb_vect_r2(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -185,6 +201,7 @@ subroutine psb_casb_vect_r2(x, desc_a, info, mold, scratch) else do i=1, n + dupl_ = x(i)%get_dupl() call x(i)%asb(ncol,info) if (info /= 0) exit ! ..update halo elements.. @@ -225,7 +242,7 @@ subroutine psb_casb_multivect(x, desc_a, info, mold, scratch,n) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_ + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit @@ -271,6 +288,7 @@ subroutine psb_casb_multivect(x, desc_a, info, mold, scratch,n) if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol + dupl_ = x%get_dupl() if (scratch_) then call x%free(info) call x%bld(ncol,n_,mold=mold) diff --git a/base/tools/psb_cd_inloc.f90 b/base/tools/psb_cd_inloc.f90 index b12e845f..e8b9578e 100644 --- a/base/tools/psb_cd_inloc.f90 +++ b/base/tools/psb_cd_inloc.f90 @@ -93,7 +93,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) nrt = loc_row call psb_sum(ctxt,nrt) call psb_max(ctxt,m) - + if (present(globalcheck)) then check_ = globalcheck else @@ -167,7 +167,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) if (check_.or.(.not.islarge)) then if (debug_size) & & write(debug_unit,*) me,' ',trim(name),': Going for global checks' - + allocate(tmpgidx(m,2),stat=info) if (info /= psb_success_) then info=psb_err_alloc_dealloc_ @@ -210,7 +210,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) info = psb_err_inconsistent_index_lists_ end if end if - + else novrl = 0 norphan = 0 @@ -244,36 +244,40 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) call psb_errpush(info,name,l_err=l_err) goto 9999 end if - - ! Sort, eliminate duplicates, then - ! scramble back into original position. - ix(1) = -1 - if (present(idx)) then - if (size(idx) >= loc_row) then + if (check_) then + ! Sort, eliminate duplicates, then + ! scramble back into original position. + ix(1) = -1 + if (present(idx)) then + if (size(idx) >= loc_row) then + !$omp parallel do private(i) + do i=1, loc_row + ix(i) = idx(i) + end do + end if + end if + if (ix(1) == -1) then + !$omp parallel do private(i) do i=1, loc_row - ix(i) = idx(i) + ix(i) = i end do end if - end if - if (ix(1) == -1) then - do i=1, loc_row - ix(i) = i + call psb_msort(vl,ix,flag=psb_sort_keep_idx_) + nlu = min(1,loc_row) + do i=2,loc_row + if (vl(i) /= vl(nlu)) then + nlu = nlu + 1 + vl(nlu) = vl(i) + ix(nlu) = ix(i) + end if end do - end if - call psb_msort(vl,ix,flag=psb_sort_keep_idx_) - nlu = min(1,loc_row) - do i=2,loc_row - if (vl(i) /= vl(nlu)) then - nlu = nlu + 1 - vl(nlu) = vl(i) - ix(nlu) = ix(i) - end if - end do - call psb_msort(ix(1:nlu),vl(1:nlu),flag=psb_sort_keep_idx_) - - if (debug_size) & - & write(debug_unit,*) me,' ',trim(name),': After sort ',nlu + call psb_msort(ix(1:nlu),vl(1:nlu),flag=psb_sort_keep_idx_) + if (debug_size) & + & write(debug_unit,*) me,' ',trim(name),': After sort ',nlu + else + nlu = loc_row + end if call psb_nullify_desc(desc) if (do_timings) then call psb_barrier(ctxt) @@ -289,7 +293,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) if (novrl > 0) then if (debug_size) & & write(debug_unit,*) me,' ',trim(name),': Check overlap ' - + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': code for NOVRL>0',novrl,npr_ov @@ -335,7 +339,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) end if if (debug_size) & & write(debug_unit,*) me,' ',trim(name),': Done overlap ' - + ! allocate work vector allocate(l_temp_ovrlap(max(1,2*loc_row)),desc%lprm(1),& @@ -393,7 +397,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) end if if (debug_size) & & write(debug_unit,*) me,' ',trim(name),': Allocate indxmap' - + if (np == 1) then allocate(psb_repl_map :: desc%indxmap, stat=info) else @@ -414,7 +418,7 @@ subroutine psb_cd_inloc(v, ctxt, desc, info, globalcheck,idx,usehash) if (debug_size) & & write(debug_unit,*) me,' ',trim(name),': Done init indxmap' - + if (do_timings) then call psb_barrier(ctxt) t4 = psb_wtime() diff --git a/base/tools/psb_cdall.f90 b/base/tools/psb_cdall.f90 index bf5f4d52..e9ffdaf8 100644 --- a/base/tools/psb_cdall.f90 +++ b/base/tools/psb_cdall.f90 @@ -1,3 +1,39 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_cdall.f90 +! +! Subroutine: psb_cdall +! Allocate descriptor Outer routine +! subroutine psb_cdall(ctxt, desc, info,mg,ng,parts,& & vg,vl,flag,nl,repl,globalcheck,lidx,usehash) use psb_desc_mod @@ -62,14 +98,15 @@ subroutine psb_cdall(ctxt, desc, info,mg,ng,parts,& logical :: usehash_ integer(psb_ipk_), allocatable :: itmpv(:) integer(psb_lpk_), allocatable :: lvl(:) - + logical, parameter :: timings=.false. + real(psb_dpk_) :: t0, t1 if (psb_get_errstatus() /= 0) return info=psb_success_ name = 'psb_cdall' call psb_erractionsave(err_act) - + if (timings) t0 = psb_wtime() call psb_info(ctxt, me, np) if (count((/ present(vg),present(vl),& & present(parts),present(nl), present(repl) /)) < 1) then @@ -189,7 +226,11 @@ subroutine psb_cdall(ctxt, desc, info,mg,ng,parts,& endif if (info /= psb_success_) goto 9999 - + if (timings) then + t1 = psb_wtime() + write(0,*) name,' 1st phase:',t1-t0 + t0 = psb_wtime() + end if ! Finish off lr = desc%indxmap%get_lr() call psb_realloc(max(1,lr/2),desc%halo_index, info) @@ -203,6 +244,11 @@ subroutine psb_cdall(ctxt, desc, info,mg,ng,parts,& desc%ext_index(:) = -1 call psb_cd_set_bld(desc,info) if (info /= psb_success_) goto 9999 + if (timings) then + t1 = psb_wtime() + write(0,*) name,' 2nd phase:',t1-t0 + t0 = psb_wtime() + end if 9998 continue call psb_erractionrestore(err_act) diff --git a/base/tools/psb_cdalv.f90 b/base/tools/psb_cdalv.f90 index 28d2ecc3..fcc10c79 100644 --- a/base/tools/psb_cdalv.f90 +++ b/base/tools/psb_cdalv.f90 @@ -151,6 +151,7 @@ subroutine psb_cdalv(v, ctxt, desc, info, flag) itmpov = 0 temp_ovrlap(:) = -1 + !$omp parallel do private(i) reduction(+:counter) do i=1,m if (((v(i)-flag_) > np-1).or.((v(i)-flag_) < 0)) then @@ -158,7 +159,7 @@ subroutine psb_cdalv(v, ctxt, desc, info, flag) l_err(1)=3 l_err(2)=v(i) - flag_ l_err(3)=i - exit + !exit end if if ((v(i)-flag_) == me) then diff --git a/base/tools/psb_cins.f90 b/base/tools/psb_cins.f90 index e874c315..180520a3 100644 --- a/base/tools/psb_cins.f90 +++ b/base/tools/psb_cins.f90 @@ -42,10 +42,7 @@ ! x - type(psb_c_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_cins_vect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_cins_vect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_cins_vect use psi_mod implicit none @@ -57,14 +54,14 @@ subroutine psb_cins_vect(m, irw, val, x, desc_a, info, dupl,local) type(psb_c_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob + integer(psb_ipk_) :: dupl_ type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_,err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -112,7 +109,6 @@ subroutine psb_cins_vect(m, irw, val, x, desc_a, info, dupl,local) endif - allocate(irl(m),stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -120,11 +116,6 @@ subroutine psb_cins_vect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -136,11 +127,33 @@ subroutine psb_cins_vect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 end if + if (x%is_remote_build()) then + block + integer(psb_ipk_) :: j,k + k = x%get_nrmv() + do j=1,m + if (irl(j) < 0 ) then + k = k + 1 + call psb_ensure_size(k,x%rmtv,info) + if (info == 0) call psb_ensure_size(k,x%rmidx,info) + if (info /= 0) then + info = psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + x%rmtv(k) = val(j) + x%rmidx(k) = irw(j) + call x%set_nrmv(k) + end if + end do + end block + end if + deallocate(irl) call psb_erractionrestore(err_act) @@ -166,10 +179,7 @@ end subroutine psb_cins_vect ! x - type(psb_c_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_cins_vect_v(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_cins_vect_v(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_cins_vect_v use psi_mod implicit none @@ -185,14 +195,13 @@ subroutine psb_cins_vect_v(m, irw, val, x, desc_a, info, dupl,local) type(psb_c_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols,err_act integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_ + integer(psb_ipk_) :: np, me integer(psb_ipk_), allocatable :: irl(:) complex(psb_spk_), allocatable :: lval(:) logical :: local_ @@ -239,14 +248,6 @@ subroutine psb_cins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call psb_errpush(info,name) goto 9999 endif - - - - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -260,7 +261,7 @@ subroutine psb_cins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call desc_a%indxmap%g2l(irw%v%v(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,lval,dupl_,info) + call x%ins(m,irl,lval,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 @@ -275,7 +276,7 @@ subroutine psb_cins_vect_v(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_cins_vect_v -subroutine psb_cins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_cins_vect_r2(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_cins_vect_r2 use psi_mod implicit none @@ -291,14 +292,13 @@ subroutine psb_cins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) type(psb_c_vect_type), intent(inout) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols, n integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -353,11 +353,6 @@ subroutine psb_cins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -371,8 +366,9 @@ subroutine psb_cins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end if do i=1,n + if (.not.allocated(x(i)%v)) info = psb_err_invalid_vect_state_ - if (info == 0) call x(i)%ins(m,irl,val(:,i),dupl_,info) + if (info == 0) call x(i)%ins(m,irl,val(:,i),info) if (info /= 0) exit end do if (info /= 0) then @@ -390,7 +386,7 @@ subroutine psb_cins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_cins_vect_r2 -subroutine psb_cins_multivect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_cins_multivect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_cins_multivect use psi_mod implicit none @@ -406,14 +402,13 @@ subroutine psb_cins_multivect(m, irw, val, x, desc_a, info, dupl,local) type(psb_c_multivect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -469,11 +464,6 @@ subroutine psb_cins_multivect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -485,7 +475,7 @@ subroutine psb_cins_multivect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 diff --git a/base/tools/psb_cspalloc.f90 b/base/tools/psb_cspalloc.f90 index 69b9e1c2..7bec040c 100644 --- a/base/tools/psb_cspalloc.f90 +++ b/base/tools/psb_cspalloc.f90 @@ -41,21 +41,23 @@ ! nnz - integer(optional). The number of nonzeroes in the matrix. ! (local, user estimate) ! -subroutine psb_cspalloc(a, desc_a, info, nnz) +subroutine psb_cspalloc(a, desc_a, info, nnz, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_cspalloc implicit none !....parameters... - type(psb_desc_type), intent(in) :: desc_a - type(psb_cspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_cspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_) :: loc_row,loc_col, nnz_, dectype - integer(psb_lpk_) :: m, n + integer(psb_ipk_) :: dupl_, bldmode_ + integer(psb_lpk_) :: m, n, nnzrmt_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -96,7 +98,7 @@ subroutine psb_cspalloc(a, desc_a, info, nnz) else nnz_ = max(1,5*loc_row) endif - + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name), & & ':allocating size:',loc_row,loc_col,nnz_ @@ -109,6 +111,24 @@ subroutine psb_cspalloc(a, desc_a, info, nnz) goto 9999 end if + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call a%set_dupl(dupl_) + call a%set_remote_build(bldmode_) + if (a%is_remote_build()) then + allocate(a%rmta) + nnzrmt_ = max(100,(nnz_/100)) + call a%rmta%allocate(m,n,nnzrmt_) + end if + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': ', & & desc_a%get_dectype(),psb_desc_bld_ diff --git a/base/tools/psb_cspasb.f90 b/base/tools/psb_cspasb.f90 index 96ed7fe7..0c5f14ab 100644 --- a/base/tools/psb_cspasb.f90 +++ b/base/tools/psb_cspasb.f90 @@ -42,31 +42,29 @@ ! upd - character(optional). How will the matrix be updated? ! psb_upd_srch_ Simple strategy ! psb_upd_perm_ Permutation(more memory) -! dupl - integer(optional). Duplicate coefficient handling: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -! psb_dupl_err_ raise an error. ! ! -subroutine psb_cspasb(a,desc_a, info, afmt, upd, dupl, mold) +subroutine psb_cspasb(a,desc_a, info, afmt, upd, mold) use psb_base_mod, psb_protect_name => psb_cspasb + use psb_sort_mod use psi_mod implicit none !...Parameters.... - type(psb_cspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd - character(len=*), optional, intent(in) :: afmt + type(psb_cspmat_type), intent (inout) :: a + type(psb_desc_type), intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: upd + character(len=*), optional, intent(in) :: afmt class(psb_c_base_sparse_mat), intent(in), optional :: mold !....Locals.... type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, err_act - integer(psb_ipk_) :: n_row,n_col + integer(psb_ipk_) :: n_row,n_col, dupl_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name, ch_err + class(psb_i_base_vect_type), allocatable :: ivm info = psb_success_ name = 'psb_spasb' @@ -92,28 +90,79 @@ subroutine psb_cspasb(a,desc_a, info, afmt, upd, dupl, mold) goto 9999 end if - if (debug_level >= psb_debug_ext_)& & write(debug_unit, *) me,' ',trim(name),& & ' Begin matrix assembly...' !check on errors encountered in psdspins - - if (a%is_bld()) then + if (a%is_bld()) then + dupl_ = a%get_dupl() ! ! First case: we come from a fresh build. ! - - n_row = desc_a%get_local_rows() - n_col = desc_a%get_local_cols() - call a%set_nrows(n_row) - call a%set_ncols(n_col) - end if - - if (a%is_bld()) then - call a%cscnv(info,type=afmt,dupl=dupl, mold=mold) + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_lc_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() + nzt = nz + call psb_sum(ctxt,nzt) + if (nzt>0) then + allocate(ivm, mold=desc_a%v_halo_index%v) + call psb_cd_reinit(desc_a, info) + end if + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + if (nzt > 0) call psb_cdasb(desc_a,info,mold=ivm) + + end block + end if + call a%set_ncols(desc_a%get_local_cols()) + call a%cscnv(info,type=afmt,mold=mold,dupl=dupl_) else if (a%is_upd()) then + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_lc_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() +!!$ write(0,*) me,name,' Nz to be added',nz + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + end block + end if call a%asb(mold=mold) else info = psb_err_invalid_mat_state_ diff --git a/base/tools/psb_cspins.F90 b/base/tools/psb_cspins.F90 index 15ea556f..27cfbd8e 100644 --- a/base/tools/psb_cspins.F90 +++ b/base/tools/psb_cspins.F90 @@ -70,6 +70,10 @@ subroutine psb_cspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) integer(psb_ipk_), parameter :: relocsz=200 logical :: rebuild_, local_ integer(psb_ipk_), allocatable :: ila(:),jla(:) + integer(psb_ipk_) :: i,k + integer(psb_lpk_) :: nnl + integer(psb_lpk_), allocatable :: lila(:),ljla(:) + complex(psb_spk_), allocatable :: lval(:) character(len=20) :: name info = psb_success_ @@ -147,6 +151,27 @@ subroutine psb_cspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(i) + ljla(k) = ja(i) + lval(k) = val(i) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if + else info = psb_err_invalid_a_and_cd_state_ call psb_errpush(info,name) @@ -168,8 +193,9 @@ subroutine psb_cspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) ila(1:nz) = ia(1:nz) jla(1:nz) = ja(1:nz) else - call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info) - if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info) + call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info,& + & mask=(ila(1:nz)>0)) end if call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info) if (info /= psb_success_) then @@ -177,6 +203,25 @@ subroutine psb_cspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(k) + ljla(k) = ja(k) + lval(k) = val(k) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if else info = psb_err_invalid_cd_state_ call psb_errpush(info,name) diff --git a/base/tools/psb_d_remote_mat.F90 b/base/tools/psb_d_remote_mat.F90 new file mode 100644 index 00000000..35116dc5 --- /dev/null +++ b/base/tools/psb_d_remote_mat.F90 @@ -0,0 +1,276 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_d_remote_mat.f90 +! +! Subroutine: +! This routine does the retrieval of remote matrix rows. +! Retrieval is done through GETROW, therefore it should work +! for any matrix format in A; as for the output, default is CSR. +! +! There is also a specialized version ld_CSR whose interface +! is adapted for the needs of d_par_csr_spspmm. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! a - type(psb_dspmat_type) The local part of input matrix A +! desc_a - type(psb_desc_type). The communication descriptor. +! blck - type(psb_dspmat_type) The local part of output matrix BLCK +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +Subroutine psb_ld_remote_mat(a,desc_a,b,info) + use psb_base_mod, psb_protect_name => psb_ld_remote_mat + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + + Type(psb_ld_coo_sparse_mat),Intent(inout) :: a + Type(psb_ld_coo_sparse_mat),Intent(inout) :: b + Type(psb_desc_type), Intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, n_el_send,n_el_recv, & + & n_elem, j, ipx,idxs,idxr + integer(psb_lpk_) :: r, k, irmin, irmax, icmin, icmax, iszs, iszr, & + & lidx, l1, lnr, lnc, lnnz, idx, ngtz, tot_elem + integer(psb_lpk_) :: nz,nouth + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:),sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: iasnd(:), jasnd(:) + real(psb_dpk_), allocatable :: valsnd(:) + type(psb_ld_coo_sparse_mat), allocatable :: acoo + class(psb_i_base_vect_type), pointer :: pdxv + integer(psb_ipk_), allocatable :: ila(:), iprc(:) + logical :: rowcnv_,colcnv_,rowscale_,colscale_ + character(len=5) :: outfmt_ + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_d_remote_mat' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + + call b%free() + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), acoo,stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + + nz = a%get_nzeros() + !allocate(ila(nz)) + !write(0,*) me,name,' size :',nz,size(ila) + !call desc_a%g2l(a%ia(1:nz),ila(1:nz),info,owned=.false.) + !nouth = count(ila(1:nz)<0) + !write(0,*) me,name,' Count out of halo :',nouth + !call psb_max(ctxt,nouth) + !if ((nouth/=0).and.(me==0)) & + ! & write(0,*) 'Warning: would require reinit of DESC_A' + + call desc_a%indxmap%fnd_owner(a%ia(1:nz),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:)=0 + rvsz(:)=0 + sdsi(:)=0 + rvsi(:)=0 + ipx = 1 + brvindx(:) = 0 + bsdindx(:) = 0 + counter=1 + idx = 0 + idxs = 0 + idxr = 0 + do i=1,nz + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call acoo%allocate(desc_a%get_global_rows(),desc_a%get_global_cols(),iszr) + if (psb_errstatus_fatal()) then + write(0,*) 'Error from acoo%allocate ' + info = 4010 + goto 9999 + end if + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Sizes:',acoo%get_size(),& + & ' Send:',sdsz(:),' Receive:',rvsz(:) + !write(debug_unit,*) me,' ',trim(name),': ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),iasnd,info) + !write(debug_unit,*) me,' ',trim(name),' iasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),jasnd,info) + !write(debug_unit,*) me,' ',trim(name),' jasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),valsnd,info) + !write(debug_unit,*) me,' ',trim(name),' valsnd: ',info + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='ensure_size') + goto 9999 + end if + do k=1, nz + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + !rvsi(proc) = rvsi(proc) + 1 + iasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ia(k) + jasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ja(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = a%val(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_) + call psb_simple_triad_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& + & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & acoo%val,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(iasnd,sdsz,bsdindx,& + & acoo%ia,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(jasnd,sdsz,bsdindx,& + & acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_r_dpk_,& + & acoo%val,rvsz,brvindx,psb_mpi_r_dpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(iasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ia,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(jasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ja,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + call acoo%set_nzeros(iszr) + call acoo%mv_to_coo(b,info) + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & iasnd,jasnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_ld_remote_mat diff --git a/base/tools/psb_d_remote_vect.F90 b/base/tools/psb_d_remote_vect.F90 new file mode 100644 index 00000000..4a409fa5 --- /dev/null +++ b/base/tools/psb_d_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_d_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_d_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_d_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + real(psb_dpk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + real(psb_dpk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + real(psb_dpk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_d_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_r_dpk_,& + & x,rvsz,brvindx,psb_mpi_r_dpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_d_remote_vect diff --git a/base/tools/psb_dallc.f90 b/base/tools/psb_dallc.f90 index 7989929b..108e2000 100644 --- a/base/tools/psb_dallc.f90 +++ b/base/tools/psb_dallc.f90 @@ -40,7 +40,7 @@ ! x - the vector to be allocated. ! desc_a - the communication descriptor. ! info - Return code -subroutine psb_dalloc_vect(x, desc_a,info) +subroutine psb_dalloc_vect(x, desc_a,info, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_dalloc_vect use psi_mod implicit none @@ -49,9 +49,11 @@ subroutine psb_dalloc_vect(x, desc_a,info) type(psb_d_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals integer(psb_ipk_) :: np,me,nr,i,err_act + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -102,6 +104,25 @@ subroutine psb_dalloc_vect(x, desc_a,info) endif call x%zero() + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + call x%set_nrmv(0) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + call psb_ensure_size(nrmt_,x%rmtv,info) + call psb_ensure_size(nrmt_,x%rmidx,info) + end if + call psb_erractionrestore(err_act) return @@ -110,6 +131,7 @@ subroutine psb_dalloc_vect(x, desc_a,info) return end subroutine psb_dalloc_vect + ! Function: psb_dalloc_vect_r2 ! Allocates a vector of dense vectors for PSBLAS routines. ! The descriptor may be in either the build or assembled state. @@ -121,7 +143,7 @@ end subroutine psb_dalloc_vect ! n - optional number of columns. ! lb - optional lower bound on column indices -subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb) +subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_dalloc_vect_r2 use psi_mod implicit none @@ -131,10 +153,12 @@ subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n,lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -208,6 +232,26 @@ subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb) if (info /= 0) exit end do end if + + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + + do i=lb_, lb_+n_-1 + call x(i)%set_dupl(dupl_) + call x(i)%set_remote_build(bldmode_) + if (x(i)%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x(i)%rmtv(nrmt_)) + end if + end do if (psb_errstatus_fatal()) then info=psb_err_alloc_request_ call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') @@ -224,7 +268,7 @@ subroutine psb_dalloc_vect_r2(x, desc_a,info,n,lb) end subroutine psb_dalloc_vect_r2 -subroutine psb_dalloc_multivect(x, desc_a,info,n) +subroutine psb_dalloc_multivect(x, desc_a,info,n, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_dalloc_multivect use psi_mod implicit none @@ -234,10 +278,12 @@ subroutine psb_dalloc_multivect(x, desc_a,info,n) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -306,6 +352,23 @@ subroutine psb_dalloc_multivect(x, desc_a,info,n) call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') goto 9999 endif + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x%rmtv(nrmt_,n_)) + end if + call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_dasb.f90 b/base/tools/psb_dasb.f90 index 5ebee093..19a19ff1 100644 --- a/base/tools/psb_dasb.f90 +++ b/base/tools/psb_dasb.f90 @@ -64,7 +64,7 @@ subroutine psb_dasb_vect(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -83,7 +83,7 @@ subroutine psb_dasb_vect(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - + dupl_ = x%get_dupl() ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -104,6 +104,23 @@ subroutine psb_dasb_vect(x, desc_a, info, mold, scratch) call x%free(info) call x%bld(ncol,mold=mold) else + + if (x%is_remote_build()) then + block + integer(psb_lpk_), allocatable :: lvx(:) + real(psb_dpk_), allocatable :: vx(:) + integer(psb_ipk_), allocatable :: ivx(:) + integer(psb_ipk_) :: nrmv, nx, i + + nrmv = x%get_nrmv() + call psb_remote_vect(nrmv,x%rmtv,x%rmidx,desc_a,vx,lvx,info) + nx = size(vx) + call psb_realloc(nx,ivx,info) + call desc_a%g2l(lvx,ivx,info,owned=.true.) + call x%ins(nx,ivx,vx,info) + end block + end if + call x%asb(ncol,info) ! ..update halo elements.. call psb_halo(x,desc_a,info) @@ -140,7 +157,7 @@ subroutine psb_dasb_vect_r2(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, i, n - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -159,7 +176,6 @@ subroutine psb_dasb_vect_r2(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -185,6 +201,7 @@ subroutine psb_dasb_vect_r2(x, desc_a, info, mold, scratch) else do i=1, n + dupl_ = x(i)%get_dupl() call x(i)%asb(ncol,info) if (info /= 0) exit ! ..update halo elements.. @@ -225,7 +242,7 @@ subroutine psb_dasb_multivect(x, desc_a, info, mold, scratch,n) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_ + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit @@ -271,6 +288,7 @@ subroutine psb_dasb_multivect(x, desc_a, info, mold, scratch,n) if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol + dupl_ = x%get_dupl() if (scratch_) then call x%free(info) call x%bld(ncol,n_,mold=mold) diff --git a/base/tools/psb_dins.f90 b/base/tools/psb_dins.f90 index 3e873ded..d3529229 100644 --- a/base/tools/psb_dins.f90 +++ b/base/tools/psb_dins.f90 @@ -42,10 +42,7 @@ ! x - type(psb_d_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_dins_vect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_dins_vect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_dins_vect use psi_mod implicit none @@ -57,14 +54,14 @@ subroutine psb_dins_vect(m, irw, val, x, desc_a, info, dupl,local) type(psb_d_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob + integer(psb_ipk_) :: dupl_ type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_,err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -112,7 +109,6 @@ subroutine psb_dins_vect(m, irw, val, x, desc_a, info, dupl,local) endif - allocate(irl(m),stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -120,11 +116,6 @@ subroutine psb_dins_vect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -136,11 +127,33 @@ subroutine psb_dins_vect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 end if + if (x%is_remote_build()) then + block + integer(psb_ipk_) :: j,k + k = x%get_nrmv() + do j=1,m + if (irl(j) < 0 ) then + k = k + 1 + call psb_ensure_size(k,x%rmtv,info) + if (info == 0) call psb_ensure_size(k,x%rmidx,info) + if (info /= 0) then + info = psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + x%rmtv(k) = val(j) + x%rmidx(k) = irw(j) + call x%set_nrmv(k) + end if + end do + end block + end if + deallocate(irl) call psb_erractionrestore(err_act) @@ -166,10 +179,7 @@ end subroutine psb_dins_vect ! x - type(psb_d_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_dins_vect_v(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_dins_vect_v(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_dins_vect_v use psi_mod implicit none @@ -185,14 +195,13 @@ subroutine psb_dins_vect_v(m, irw, val, x, desc_a, info, dupl,local) type(psb_d_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols,err_act integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_ + integer(psb_ipk_) :: np, me integer(psb_ipk_), allocatable :: irl(:) real(psb_dpk_), allocatable :: lval(:) logical :: local_ @@ -239,14 +248,6 @@ subroutine psb_dins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call psb_errpush(info,name) goto 9999 endif - - - - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -260,7 +261,7 @@ subroutine psb_dins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call desc_a%indxmap%g2l(irw%v%v(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,lval,dupl_,info) + call x%ins(m,irl,lval,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 @@ -275,7 +276,7 @@ subroutine psb_dins_vect_v(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_dins_vect_v -subroutine psb_dins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_dins_vect_r2(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_dins_vect_r2 use psi_mod implicit none @@ -291,14 +292,13 @@ subroutine psb_dins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) type(psb_d_vect_type), intent(inout) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols, n integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -353,11 +353,6 @@ subroutine psb_dins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -371,8 +366,9 @@ subroutine psb_dins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end if do i=1,n + if (.not.allocated(x(i)%v)) info = psb_err_invalid_vect_state_ - if (info == 0) call x(i)%ins(m,irl,val(:,i),dupl_,info) + if (info == 0) call x(i)%ins(m,irl,val(:,i),info) if (info /= 0) exit end do if (info /= 0) then @@ -390,7 +386,7 @@ subroutine psb_dins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_dins_vect_r2 -subroutine psb_dins_multivect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_dins_multivect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_dins_multivect use psi_mod implicit none @@ -406,14 +402,13 @@ subroutine psb_dins_multivect(m, irw, val, x, desc_a, info, dupl,local) type(psb_d_multivect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -469,11 +464,6 @@ subroutine psb_dins_multivect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -485,7 +475,7 @@ subroutine psb_dins_multivect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 diff --git a/base/tools/psb_dspalloc.f90 b/base/tools/psb_dspalloc.f90 index 56ad6c93..433d7129 100644 --- a/base/tools/psb_dspalloc.f90 +++ b/base/tools/psb_dspalloc.f90 @@ -41,21 +41,23 @@ ! nnz - integer(optional). The number of nonzeroes in the matrix. ! (local, user estimate) ! -subroutine psb_dspalloc(a, desc_a, info, nnz) +subroutine psb_dspalloc(a, desc_a, info, nnz, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_dspalloc implicit none !....parameters... - type(psb_desc_type), intent(in) :: desc_a - type(psb_dspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_dspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_) :: loc_row,loc_col, nnz_, dectype - integer(psb_lpk_) :: m, n + integer(psb_ipk_) :: dupl_, bldmode_ + integer(psb_lpk_) :: m, n, nnzrmt_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -96,7 +98,7 @@ subroutine psb_dspalloc(a, desc_a, info, nnz) else nnz_ = max(1,5*loc_row) endif - + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name), & & ':allocating size:',loc_row,loc_col,nnz_ @@ -109,6 +111,24 @@ subroutine psb_dspalloc(a, desc_a, info, nnz) goto 9999 end if + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call a%set_dupl(dupl_) + call a%set_remote_build(bldmode_) + if (a%is_remote_build()) then + allocate(a%rmta) + nnzrmt_ = max(100,(nnz_/100)) + call a%rmta%allocate(m,n,nnzrmt_) + end if + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': ', & & desc_a%get_dectype(),psb_desc_bld_ diff --git a/base/tools/psb_dspasb.f90 b/base/tools/psb_dspasb.f90 index 457553f7..3132f249 100644 --- a/base/tools/psb_dspasb.f90 +++ b/base/tools/psb_dspasb.f90 @@ -42,31 +42,29 @@ ! upd - character(optional). How will the matrix be updated? ! psb_upd_srch_ Simple strategy ! psb_upd_perm_ Permutation(more memory) -! dupl - integer(optional). Duplicate coefficient handling: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -! psb_dupl_err_ raise an error. ! ! -subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl, mold) +subroutine psb_dspasb(a,desc_a, info, afmt, upd, mold) use psb_base_mod, psb_protect_name => psb_dspasb + use psb_sort_mod use psi_mod implicit none !...Parameters.... - type(psb_dspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd - character(len=*), optional, intent(in) :: afmt + type(psb_dspmat_type), intent (inout) :: a + type(psb_desc_type), intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: upd + character(len=*), optional, intent(in) :: afmt class(psb_d_base_sparse_mat), intent(in), optional :: mold !....Locals.... type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, err_act - integer(psb_ipk_) :: n_row,n_col + integer(psb_ipk_) :: n_row,n_col, dupl_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name, ch_err + class(psb_i_base_vect_type), allocatable :: ivm info = psb_success_ name = 'psb_spasb' @@ -92,28 +90,79 @@ subroutine psb_dspasb(a,desc_a, info, afmt, upd, dupl, mold) goto 9999 end if - if (debug_level >= psb_debug_ext_)& & write(debug_unit, *) me,' ',trim(name),& & ' Begin matrix assembly...' !check on errors encountered in psdspins - - if (a%is_bld()) then + if (a%is_bld()) then + dupl_ = a%get_dupl() ! ! First case: we come from a fresh build. ! - - n_row = desc_a%get_local_rows() - n_col = desc_a%get_local_cols() - call a%set_nrows(n_row) - call a%set_ncols(n_col) - end if - - if (a%is_bld()) then - call a%cscnv(info,type=afmt,dupl=dupl, mold=mold) + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_ld_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() + nzt = nz + call psb_sum(ctxt,nzt) + if (nzt>0) then + allocate(ivm, mold=desc_a%v_halo_index%v) + call psb_cd_reinit(desc_a, info) + end if + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + if (nzt > 0) call psb_cdasb(desc_a,info,mold=ivm) + + end block + end if + call a%set_ncols(desc_a%get_local_cols()) + call a%cscnv(info,type=afmt,mold=mold,dupl=dupl_) else if (a%is_upd()) then + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_ld_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() +!!$ write(0,*) me,name,' Nz to be added',nz + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + end block + end if call a%asb(mold=mold) else info = psb_err_invalid_mat_state_ diff --git a/base/tools/psb_dspins.F90 b/base/tools/psb_dspins.F90 index 3e9ef0cc..2a70ab83 100644 --- a/base/tools/psb_dspins.F90 +++ b/base/tools/psb_dspins.F90 @@ -70,6 +70,10 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) integer(psb_ipk_), parameter :: relocsz=200 logical :: rebuild_, local_ integer(psb_ipk_), allocatable :: ila(:),jla(:) + integer(psb_ipk_) :: i,k + integer(psb_lpk_) :: nnl + integer(psb_lpk_), allocatable :: lila(:),ljla(:) + real(psb_dpk_), allocatable :: lval(:) character(len=20) :: name info = psb_success_ @@ -147,6 +151,27 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(i) + ljla(k) = ja(i) + lval(k) = val(i) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if + else info = psb_err_invalid_a_and_cd_state_ call psb_errpush(info,name) @@ -168,8 +193,9 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) ila(1:nz) = ia(1:nz) jla(1:nz) = ja(1:nz) else - call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info) - if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info) + call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info,& + & mask=(ila(1:nz)>0)) end if call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info) if (info /= psb_success_) then @@ -177,6 +203,25 @@ subroutine psb_dspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(k) + ljla(k) = ja(k) + lval(k) = val(k) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if else info = psb_err_invalid_cd_state_ call psb_errpush(info,name) diff --git a/base/tools/psb_e_remote_vect.F90 b/base/tools/psb_e_remote_vect.F90 new file mode 100644 index 00000000..9fb15ff9 --- /dev/null +++ b/base/tools/psb_e_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_e_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_e_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_e_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + integer(psb_epk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + integer(psb_epk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + integer(psb_epk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_e_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_epk_,& + & x,rvsz,brvindx,psb_mpi_epk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_e_remote_vect diff --git a/base/tools/psb_i2_remote_vect.F90 b/base/tools/psb_i2_remote_vect.F90 new file mode 100644 index 00000000..3f6bffbd --- /dev/null +++ b/base/tools/psb_i2_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_i2_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_i2_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_i2_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + integer(psb_i2pk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + integer(psb_i2pk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + integer(psb_i2pk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_i2_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_i2pk_,& + & x,rvsz,brvindx,psb_mpi_i2pk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_i2_remote_vect diff --git a/base/tools/psb_iallc.f90 b/base/tools/psb_iallc.f90 index ac4ee840..7ed69ed6 100644 --- a/base/tools/psb_iallc.f90 +++ b/base/tools/psb_iallc.f90 @@ -40,7 +40,7 @@ ! x - the vector to be allocated. ! desc_a - the communication descriptor. ! info - Return code -subroutine psb_ialloc_vect(x, desc_a,info) +subroutine psb_ialloc_vect(x, desc_a,info, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_ialloc_vect use psi_mod implicit none @@ -49,9 +49,11 @@ subroutine psb_ialloc_vect(x, desc_a,info) type(psb_i_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals integer(psb_ipk_) :: np,me,nr,i,err_act + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -102,6 +104,25 @@ subroutine psb_ialloc_vect(x, desc_a,info) endif call x%zero() + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + call x%set_nrmv(0) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + call psb_ensure_size(nrmt_,x%rmtv,info) + call psb_ensure_size(nrmt_,x%rmidx,info) + end if + call psb_erractionrestore(err_act) return @@ -110,6 +131,7 @@ subroutine psb_ialloc_vect(x, desc_a,info) return end subroutine psb_ialloc_vect + ! Function: psb_ialloc_vect_r2 ! Allocates a vector of dense vectors for PSBLAS routines. ! The descriptor may be in either the build or assembled state. @@ -121,7 +143,7 @@ end subroutine psb_ialloc_vect ! n - optional number of columns. ! lb - optional lower bound on column indices -subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb) +subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_ialloc_vect_r2 use psi_mod implicit none @@ -131,10 +153,12 @@ subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n,lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -208,6 +232,26 @@ subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb) if (info /= 0) exit end do end if + + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + + do i=lb_, lb_+n_-1 + call x(i)%set_dupl(dupl_) + call x(i)%set_remote_build(bldmode_) + if (x(i)%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x(i)%rmtv(nrmt_)) + end if + end do if (psb_errstatus_fatal()) then info=psb_err_alloc_request_ call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') @@ -224,7 +268,7 @@ subroutine psb_ialloc_vect_r2(x, desc_a,info,n,lb) end subroutine psb_ialloc_vect_r2 -subroutine psb_ialloc_multivect(x, desc_a,info,n) +subroutine psb_ialloc_multivect(x, desc_a,info,n, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_ialloc_multivect use psi_mod implicit none @@ -234,10 +278,12 @@ subroutine psb_ialloc_multivect(x, desc_a,info,n) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -306,6 +352,23 @@ subroutine psb_ialloc_multivect(x, desc_a,info,n) call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') goto 9999 endif + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x%rmtv(nrmt_,n_)) + end if + call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_iasb.f90 b/base/tools/psb_iasb.f90 index d0cf2d83..f5e5669f 100644 --- a/base/tools/psb_iasb.f90 +++ b/base/tools/psb_iasb.f90 @@ -64,7 +64,7 @@ subroutine psb_iasb_vect(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -83,7 +83,7 @@ subroutine psb_iasb_vect(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - + dupl_ = x%get_dupl() ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -104,6 +104,23 @@ subroutine psb_iasb_vect(x, desc_a, info, mold, scratch) call x%free(info) call x%bld(ncol,mold=mold) else + + if (x%is_remote_build()) then + block + integer(psb_lpk_), allocatable :: lvx(:) + integer(psb_ipk_), allocatable :: vx(:) + integer(psb_ipk_), allocatable :: ivx(:) + integer(psb_ipk_) :: nrmv, nx, i + + nrmv = x%get_nrmv() + call psb_remote_vect(nrmv,x%rmtv,x%rmidx,desc_a,vx,lvx,info) + nx = size(vx) + call psb_realloc(nx,ivx,info) + call desc_a%g2l(lvx,ivx,info,owned=.true.) + call x%ins(nx,ivx,vx,info) + end block + end if + call x%asb(ncol,info) ! ..update halo elements.. call psb_halo(x,desc_a,info) @@ -140,7 +157,7 @@ subroutine psb_iasb_vect_r2(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, i, n - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -159,7 +176,6 @@ subroutine psb_iasb_vect_r2(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -185,6 +201,7 @@ subroutine psb_iasb_vect_r2(x, desc_a, info, mold, scratch) else do i=1, n + dupl_ = x(i)%get_dupl() call x(i)%asb(ncol,info) if (info /= 0) exit ! ..update halo elements.. @@ -225,7 +242,7 @@ subroutine psb_iasb_multivect(x, desc_a, info, mold, scratch,n) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_ + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit @@ -271,6 +288,7 @@ subroutine psb_iasb_multivect(x, desc_a, info, mold, scratch,n) if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol + dupl_ = x%get_dupl() if (scratch_) then call x%free(info) call x%bld(ncol,n_,mold=mold) diff --git a/base/tools/psb_iins.f90 b/base/tools/psb_iins.f90 index c9c0ed9b..4fa53429 100644 --- a/base/tools/psb_iins.f90 +++ b/base/tools/psb_iins.f90 @@ -42,10 +42,7 @@ ! x - type(psb_i_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_iins_vect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_iins_vect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_iins_vect use psi_mod implicit none @@ -57,14 +54,14 @@ subroutine psb_iins_vect(m, irw, val, x, desc_a, info, dupl,local) type(psb_i_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob + integer(psb_ipk_) :: dupl_ type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_,err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -112,7 +109,6 @@ subroutine psb_iins_vect(m, irw, val, x, desc_a, info, dupl,local) endif - allocate(irl(m),stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -120,11 +116,6 @@ subroutine psb_iins_vect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -136,11 +127,33 @@ subroutine psb_iins_vect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 end if + if (x%is_remote_build()) then + block + integer(psb_ipk_) :: j,k + k = x%get_nrmv() + do j=1,m + if (irl(j) < 0 ) then + k = k + 1 + call psb_ensure_size(k,x%rmtv,info) + if (info == 0) call psb_ensure_size(k,x%rmidx,info) + if (info /= 0) then + info = psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + x%rmtv(k) = val(j) + x%rmidx(k) = irw(j) + call x%set_nrmv(k) + end if + end do + end block + end if + deallocate(irl) call psb_erractionrestore(err_act) @@ -166,10 +179,7 @@ end subroutine psb_iins_vect ! x - type(psb_i_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_iins_vect_v(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_iins_vect_v(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_iins_vect_v use psi_mod implicit none @@ -185,14 +195,13 @@ subroutine psb_iins_vect_v(m, irw, val, x, desc_a, info, dupl,local) type(psb_i_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols,err_act integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_ + integer(psb_ipk_) :: np, me integer(psb_ipk_), allocatable :: irl(:) integer(psb_ipk_), allocatable :: lval(:) logical :: local_ @@ -239,14 +248,6 @@ subroutine psb_iins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call psb_errpush(info,name) goto 9999 endif - - - - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -260,7 +261,7 @@ subroutine psb_iins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call desc_a%indxmap%g2l(irw%v%v(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,lval,dupl_,info) + call x%ins(m,irl,lval,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 @@ -275,7 +276,7 @@ subroutine psb_iins_vect_v(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_iins_vect_v -subroutine psb_iins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_iins_vect_r2(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_iins_vect_r2 use psi_mod implicit none @@ -291,14 +292,13 @@ subroutine psb_iins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) type(psb_i_vect_type), intent(inout) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols, n integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -353,11 +353,6 @@ subroutine psb_iins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -371,8 +366,9 @@ subroutine psb_iins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end if do i=1,n + if (.not.allocated(x(i)%v)) info = psb_err_invalid_vect_state_ - if (info == 0) call x(i)%ins(m,irl,val(:,i),dupl_,info) + if (info == 0) call x(i)%ins(m,irl,val(:,i),info) if (info /= 0) exit end do if (info /= 0) then @@ -390,7 +386,7 @@ subroutine psb_iins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_iins_vect_r2 -subroutine psb_iins_multivect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_iins_multivect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_iins_multivect use psi_mod implicit none @@ -406,14 +402,13 @@ subroutine psb_iins_multivect(m, irw, val, x, desc_a, info, dupl,local) type(psb_i_multivect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -469,11 +464,6 @@ subroutine psb_iins_multivect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -485,7 +475,7 @@ subroutine psb_iins_multivect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 diff --git a/base/tools/psb_lallc.f90 b/base/tools/psb_lallc.f90 index 85fd67e7..53857029 100644 --- a/base/tools/psb_lallc.f90 +++ b/base/tools/psb_lallc.f90 @@ -40,7 +40,7 @@ ! x - the vector to be allocated. ! desc_a - the communication descriptor. ! info - Return code -subroutine psb_lalloc_vect(x, desc_a,info) +subroutine psb_lalloc_vect(x, desc_a,info, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_lalloc_vect use psi_mod implicit none @@ -49,9 +49,11 @@ subroutine psb_lalloc_vect(x, desc_a,info) type(psb_l_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals integer(psb_ipk_) :: np,me,nr,i,err_act + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -102,6 +104,25 @@ subroutine psb_lalloc_vect(x, desc_a,info) endif call x%zero() + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + call x%set_nrmv(0) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + call psb_ensure_size(nrmt_,x%rmtv,info) + call psb_ensure_size(nrmt_,x%rmidx,info) + end if + call psb_erractionrestore(err_act) return @@ -110,6 +131,7 @@ subroutine psb_lalloc_vect(x, desc_a,info) return end subroutine psb_lalloc_vect + ! Function: psb_lalloc_vect_r2 ! Allocates a vector of dense vectors for PSBLAS routines. ! The descriptor may be in either the build or assembled state. @@ -121,7 +143,7 @@ end subroutine psb_lalloc_vect ! n - optional number of columns. ! lb - optional lower bound on column indices -subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb) +subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_lalloc_vect_r2 use psi_mod implicit none @@ -131,10 +153,12 @@ subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n,lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -208,6 +232,26 @@ subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb) if (info /= 0) exit end do end if + + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + + do i=lb_, lb_+n_-1 + call x(i)%set_dupl(dupl_) + call x(i)%set_remote_build(bldmode_) + if (x(i)%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x(i)%rmtv(nrmt_)) + end if + end do if (psb_errstatus_fatal()) then info=psb_err_alloc_request_ call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') @@ -224,7 +268,7 @@ subroutine psb_lalloc_vect_r2(x, desc_a,info,n,lb) end subroutine psb_lalloc_vect_r2 -subroutine psb_lalloc_multivect(x, desc_a,info,n) +subroutine psb_lalloc_multivect(x, desc_a,info,n, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_lalloc_multivect use psi_mod implicit none @@ -234,10 +278,12 @@ subroutine psb_lalloc_multivect(x, desc_a,info,n) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -306,6 +352,23 @@ subroutine psb_lalloc_multivect(x, desc_a,info,n) call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') goto 9999 endif + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x%rmtv(nrmt_,n_)) + end if + call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_lasb.f90 b/base/tools/psb_lasb.f90 index 1618abdb..baf55320 100644 --- a/base/tools/psb_lasb.f90 +++ b/base/tools/psb_lasb.f90 @@ -64,7 +64,7 @@ subroutine psb_lasb_vect(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -83,7 +83,7 @@ subroutine psb_lasb_vect(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - + dupl_ = x%get_dupl() ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -104,6 +104,23 @@ subroutine psb_lasb_vect(x, desc_a, info, mold, scratch) call x%free(info) call x%bld(ncol,mold=mold) else + + if (x%is_remote_build()) then + block + integer(psb_lpk_), allocatable :: lvx(:) + integer(psb_lpk_), allocatable :: vx(:) + integer(psb_ipk_), allocatable :: ivx(:) + integer(psb_ipk_) :: nrmv, nx, i + + nrmv = x%get_nrmv() + call psb_remote_vect(nrmv,x%rmtv,x%rmidx,desc_a,vx,lvx,info) + nx = size(vx) + call psb_realloc(nx,ivx,info) + call desc_a%g2l(lvx,ivx,info,owned=.true.) + call x%ins(nx,ivx,vx,info) + end block + end if + call x%asb(ncol,info) ! ..update halo elements.. call psb_halo(x,desc_a,info) @@ -140,7 +157,7 @@ subroutine psb_lasb_vect_r2(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, i, n - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -159,7 +176,6 @@ subroutine psb_lasb_vect_r2(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -185,6 +201,7 @@ subroutine psb_lasb_vect_r2(x, desc_a, info, mold, scratch) else do i=1, n + dupl_ = x(i)%get_dupl() call x(i)%asb(ncol,info) if (info /= 0) exit ! ..update halo elements.. @@ -225,7 +242,7 @@ subroutine psb_lasb_multivect(x, desc_a, info, mold, scratch,n) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_ + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit @@ -271,6 +288,7 @@ subroutine psb_lasb_multivect(x, desc_a, info, mold, scratch,n) if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol + dupl_ = x%get_dupl() if (scratch_) then call x%free(info) call x%bld(ncol,n_,mold=mold) diff --git a/base/tools/psb_lins.f90 b/base/tools/psb_lins.f90 index 42559a94..90da8111 100644 --- a/base/tools/psb_lins.f90 +++ b/base/tools/psb_lins.f90 @@ -42,10 +42,7 @@ ! x - type(psb_l_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_lins_vect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_lins_vect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_lins_vect use psi_mod implicit none @@ -57,14 +54,14 @@ subroutine psb_lins_vect(m, irw, val, x, desc_a, info, dupl,local) type(psb_l_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob + integer(psb_ipk_) :: dupl_ type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_,err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -112,7 +109,6 @@ subroutine psb_lins_vect(m, irw, val, x, desc_a, info, dupl,local) endif - allocate(irl(m),stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -120,11 +116,6 @@ subroutine psb_lins_vect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -136,11 +127,33 @@ subroutine psb_lins_vect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 end if + if (x%is_remote_build()) then + block + integer(psb_ipk_) :: j,k + k = x%get_nrmv() + do j=1,m + if (irl(j) < 0 ) then + k = k + 1 + call psb_ensure_size(k,x%rmtv,info) + if (info == 0) call psb_ensure_size(k,x%rmidx,info) + if (info /= 0) then + info = psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + x%rmtv(k) = val(j) + x%rmidx(k) = irw(j) + call x%set_nrmv(k) + end if + end do + end block + end if + deallocate(irl) call psb_erractionrestore(err_act) @@ -166,10 +179,7 @@ end subroutine psb_lins_vect ! x - type(psb_l_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_lins_vect_v(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_lins_vect_v(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_lins_vect_v use psi_mod implicit none @@ -185,14 +195,13 @@ subroutine psb_lins_vect_v(m, irw, val, x, desc_a, info, dupl,local) type(psb_l_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols,err_act integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_ + integer(psb_ipk_) :: np, me integer(psb_ipk_), allocatable :: irl(:) integer(psb_lpk_), allocatable :: lval(:) logical :: local_ @@ -239,14 +248,6 @@ subroutine psb_lins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call psb_errpush(info,name) goto 9999 endif - - - - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -260,7 +261,7 @@ subroutine psb_lins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call desc_a%indxmap%g2l(irw%v%v(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,lval,dupl_,info) + call x%ins(m,irl,lval,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 @@ -275,7 +276,7 @@ subroutine psb_lins_vect_v(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_lins_vect_v -subroutine psb_lins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_lins_vect_r2(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_lins_vect_r2 use psi_mod implicit none @@ -291,14 +292,13 @@ subroutine psb_lins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) type(psb_l_vect_type), intent(inout) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols, n integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -353,11 +353,6 @@ subroutine psb_lins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -371,8 +366,9 @@ subroutine psb_lins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end if do i=1,n + if (.not.allocated(x(i)%v)) info = psb_err_invalid_vect_state_ - if (info == 0) call x(i)%ins(m,irl,val(:,i),dupl_,info) + if (info == 0) call x(i)%ins(m,irl,val(:,i),info) if (info /= 0) exit end do if (info /= 0) then @@ -390,7 +386,7 @@ subroutine psb_lins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_lins_vect_r2 -subroutine psb_lins_multivect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_lins_multivect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_lins_multivect use psi_mod implicit none @@ -406,14 +402,13 @@ subroutine psb_lins_multivect(m, irw, val, x, desc_a, info, dupl,local) type(psb_l_multivect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -469,11 +464,6 @@ subroutine psb_lins_multivect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -485,7 +475,7 @@ subroutine psb_lins_multivect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 diff --git a/base/tools/psb_m_remote_vect.F90 b/base/tools/psb_m_remote_vect.F90 new file mode 100644 index 00000000..01b5aeb3 --- /dev/null +++ b/base/tools/psb_m_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_m_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_m_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_m_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + integer(psb_mpk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + integer(psb_mpk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + integer(psb_mpk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_m_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_mpk_,& + & x,rvsz,brvindx,psb_mpi_mpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_m_remote_vect diff --git a/base/tools/psb_s_remote_mat.F90 b/base/tools/psb_s_remote_mat.F90 new file mode 100644 index 00000000..df64266b --- /dev/null +++ b/base/tools/psb_s_remote_mat.F90 @@ -0,0 +1,276 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_s_remote_mat.f90 +! +! Subroutine: +! This routine does the retrieval of remote matrix rows. +! Retrieval is done through GETROW, therefore it should work +! for any matrix format in A; as for the output, default is CSR. +! +! There is also a specialized version ls_CSR whose interface +! is adapted for the needs of s_par_csr_spspmm. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! a - type(psb_sspmat_type) The local part of input matrix A +! desc_a - type(psb_desc_type). The communication descriptor. +! blck - type(psb_sspmat_type) The local part of output matrix BLCK +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +Subroutine psb_ls_remote_mat(a,desc_a,b,info) + use psb_base_mod, psb_protect_name => psb_ls_remote_mat + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + + Type(psb_ls_coo_sparse_mat),Intent(inout) :: a + Type(psb_ls_coo_sparse_mat),Intent(inout) :: b + Type(psb_desc_type), Intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, n_el_send,n_el_recv, & + & n_elem, j, ipx,idxs,idxr + integer(psb_lpk_) :: r, k, irmin, irmax, icmin, icmax, iszs, iszr, & + & lidx, l1, lnr, lnc, lnnz, idx, ngtz, tot_elem + integer(psb_lpk_) :: nz,nouth + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:),sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: iasnd(:), jasnd(:) + real(psb_spk_), allocatable :: valsnd(:) + type(psb_ls_coo_sparse_mat), allocatable :: acoo + class(psb_i_base_vect_type), pointer :: pdxv + integer(psb_ipk_), allocatable :: ila(:), iprc(:) + logical :: rowcnv_,colcnv_,rowscale_,colscale_ + character(len=5) :: outfmt_ + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_s_remote_mat' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + + call b%free() + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), acoo,stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + + nz = a%get_nzeros() + !allocate(ila(nz)) + !write(0,*) me,name,' size :',nz,size(ila) + !call desc_a%g2l(a%ia(1:nz),ila(1:nz),info,owned=.false.) + !nouth = count(ila(1:nz)<0) + !write(0,*) me,name,' Count out of halo :',nouth + !call psb_max(ctxt,nouth) + !if ((nouth/=0).and.(me==0)) & + ! & write(0,*) 'Warning: would require reinit of DESC_A' + + call desc_a%indxmap%fnd_owner(a%ia(1:nz),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:)=0 + rvsz(:)=0 + sdsi(:)=0 + rvsi(:)=0 + ipx = 1 + brvindx(:) = 0 + bsdindx(:) = 0 + counter=1 + idx = 0 + idxs = 0 + idxr = 0 + do i=1,nz + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call acoo%allocate(desc_a%get_global_rows(),desc_a%get_global_cols(),iszr) + if (psb_errstatus_fatal()) then + write(0,*) 'Error from acoo%allocate ' + info = 4010 + goto 9999 + end if + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Sizes:',acoo%get_size(),& + & ' Send:',sdsz(:),' Receive:',rvsz(:) + !write(debug_unit,*) me,' ',trim(name),': ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),iasnd,info) + !write(debug_unit,*) me,' ',trim(name),' iasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),jasnd,info) + !write(debug_unit,*) me,' ',trim(name),' jasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),valsnd,info) + !write(debug_unit,*) me,' ',trim(name),' valsnd: ',info + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='ensure_size') + goto 9999 + end if + do k=1, nz + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + !rvsi(proc) = rvsi(proc) + 1 + iasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ia(k) + jasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ja(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = a%val(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_) + call psb_simple_triad_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& + & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & acoo%val,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(iasnd,sdsz,bsdindx,& + & acoo%ia,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(jasnd,sdsz,bsdindx,& + & acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_r_spk_,& + & acoo%val,rvsz,brvindx,psb_mpi_r_spk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(iasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ia,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(jasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ja,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + call acoo%set_nzeros(iszr) + call acoo%mv_to_coo(b,info) + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & iasnd,jasnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_ls_remote_mat diff --git a/base/tools/psb_s_remote_vect.F90 b/base/tools/psb_s_remote_vect.F90 new file mode 100644 index 00000000..a8464663 --- /dev/null +++ b/base/tools/psb_s_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_s_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_s_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_s_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + real(psb_spk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + real(psb_spk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + real(psb_spk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_s_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_r_spk_,& + & x,rvsz,brvindx,psb_mpi_r_spk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_s_remote_vect diff --git a/base/tools/psb_sallc.f90 b/base/tools/psb_sallc.f90 index 941ce917..951d8128 100644 --- a/base/tools/psb_sallc.f90 +++ b/base/tools/psb_sallc.f90 @@ -40,7 +40,7 @@ ! x - the vector to be allocated. ! desc_a - the communication descriptor. ! info - Return code -subroutine psb_salloc_vect(x, desc_a,info) +subroutine psb_salloc_vect(x, desc_a,info, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_salloc_vect use psi_mod implicit none @@ -49,9 +49,11 @@ subroutine psb_salloc_vect(x, desc_a,info) type(psb_s_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals integer(psb_ipk_) :: np,me,nr,i,err_act + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -102,6 +104,25 @@ subroutine psb_salloc_vect(x, desc_a,info) endif call x%zero() + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + call x%set_nrmv(0) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + call psb_ensure_size(nrmt_,x%rmtv,info) + call psb_ensure_size(nrmt_,x%rmidx,info) + end if + call psb_erractionrestore(err_act) return @@ -110,6 +131,7 @@ subroutine psb_salloc_vect(x, desc_a,info) return end subroutine psb_salloc_vect + ! Function: psb_salloc_vect_r2 ! Allocates a vector of dense vectors for PSBLAS routines. ! The descriptor may be in either the build or assembled state. @@ -121,7 +143,7 @@ end subroutine psb_salloc_vect ! n - optional number of columns. ! lb - optional lower bound on column indices -subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb) +subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_salloc_vect_r2 use psi_mod implicit none @@ -131,10 +153,12 @@ subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n,lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -208,6 +232,26 @@ subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb) if (info /= 0) exit end do end if + + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + + do i=lb_, lb_+n_-1 + call x(i)%set_dupl(dupl_) + call x(i)%set_remote_build(bldmode_) + if (x(i)%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x(i)%rmtv(nrmt_)) + end if + end do if (psb_errstatus_fatal()) then info=psb_err_alloc_request_ call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') @@ -224,7 +268,7 @@ subroutine psb_salloc_vect_r2(x, desc_a,info,n,lb) end subroutine psb_salloc_vect_r2 -subroutine psb_salloc_multivect(x, desc_a,info,n) +subroutine psb_salloc_multivect(x, desc_a,info,n, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_salloc_multivect use psi_mod implicit none @@ -234,10 +278,12 @@ subroutine psb_salloc_multivect(x, desc_a,info,n) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -306,6 +352,23 @@ subroutine psb_salloc_multivect(x, desc_a,info,n) call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') goto 9999 endif + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x%rmtv(nrmt_,n_)) + end if + call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_sasb.f90 b/base/tools/psb_sasb.f90 index ac3a0684..315e24ff 100644 --- a/base/tools/psb_sasb.f90 +++ b/base/tools/psb_sasb.f90 @@ -64,7 +64,7 @@ subroutine psb_sasb_vect(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -83,7 +83,7 @@ subroutine psb_sasb_vect(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - + dupl_ = x%get_dupl() ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -104,6 +104,23 @@ subroutine psb_sasb_vect(x, desc_a, info, mold, scratch) call x%free(info) call x%bld(ncol,mold=mold) else + + if (x%is_remote_build()) then + block + integer(psb_lpk_), allocatable :: lvx(:) + real(psb_spk_), allocatable :: vx(:) + integer(psb_ipk_), allocatable :: ivx(:) + integer(psb_ipk_) :: nrmv, nx, i + + nrmv = x%get_nrmv() + call psb_remote_vect(nrmv,x%rmtv,x%rmidx,desc_a,vx,lvx,info) + nx = size(vx) + call psb_realloc(nx,ivx,info) + call desc_a%g2l(lvx,ivx,info,owned=.true.) + call x%ins(nx,ivx,vx,info) + end block + end if + call x%asb(ncol,info) ! ..update halo elements.. call psb_halo(x,desc_a,info) @@ -140,7 +157,7 @@ subroutine psb_sasb_vect_r2(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, i, n - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -159,7 +176,6 @@ subroutine psb_sasb_vect_r2(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -185,6 +201,7 @@ subroutine psb_sasb_vect_r2(x, desc_a, info, mold, scratch) else do i=1, n + dupl_ = x(i)%get_dupl() call x(i)%asb(ncol,info) if (info /= 0) exit ! ..update halo elements.. @@ -225,7 +242,7 @@ subroutine psb_sasb_multivect(x, desc_a, info, mold, scratch,n) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_ + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit @@ -271,6 +288,7 @@ subroutine psb_sasb_multivect(x, desc_a, info, mold, scratch,n) if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol + dupl_ = x%get_dupl() if (scratch_) then call x%free(info) call x%bld(ncol,n_,mold=mold) diff --git a/base/tools/psb_sins.f90 b/base/tools/psb_sins.f90 index cb878c64..ddead81f 100644 --- a/base/tools/psb_sins.f90 +++ b/base/tools/psb_sins.f90 @@ -42,10 +42,7 @@ ! x - type(psb_s_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_sins_vect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_sins_vect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_sins_vect use psi_mod implicit none @@ -57,14 +54,14 @@ subroutine psb_sins_vect(m, irw, val, x, desc_a, info, dupl,local) type(psb_s_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob + integer(psb_ipk_) :: dupl_ type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_,err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -112,7 +109,6 @@ subroutine psb_sins_vect(m, irw, val, x, desc_a, info, dupl,local) endif - allocate(irl(m),stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -120,11 +116,6 @@ subroutine psb_sins_vect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -136,11 +127,33 @@ subroutine psb_sins_vect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 end if + if (x%is_remote_build()) then + block + integer(psb_ipk_) :: j,k + k = x%get_nrmv() + do j=1,m + if (irl(j) < 0 ) then + k = k + 1 + call psb_ensure_size(k,x%rmtv,info) + if (info == 0) call psb_ensure_size(k,x%rmidx,info) + if (info /= 0) then + info = psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + x%rmtv(k) = val(j) + x%rmidx(k) = irw(j) + call x%set_nrmv(k) + end if + end do + end block + end if + deallocate(irl) call psb_erractionrestore(err_act) @@ -166,10 +179,7 @@ end subroutine psb_sins_vect ! x - type(psb_s_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_sins_vect_v(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_sins_vect_v(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_sins_vect_v use psi_mod implicit none @@ -185,14 +195,13 @@ subroutine psb_sins_vect_v(m, irw, val, x, desc_a, info, dupl,local) type(psb_s_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols,err_act integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_ + integer(psb_ipk_) :: np, me integer(psb_ipk_), allocatable :: irl(:) real(psb_spk_), allocatable :: lval(:) logical :: local_ @@ -239,14 +248,6 @@ subroutine psb_sins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call psb_errpush(info,name) goto 9999 endif - - - - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -260,7 +261,7 @@ subroutine psb_sins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call desc_a%indxmap%g2l(irw%v%v(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,lval,dupl_,info) + call x%ins(m,irl,lval,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 @@ -275,7 +276,7 @@ subroutine psb_sins_vect_v(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_sins_vect_v -subroutine psb_sins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_sins_vect_r2(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_sins_vect_r2 use psi_mod implicit none @@ -291,14 +292,13 @@ subroutine psb_sins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) type(psb_s_vect_type), intent(inout) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols, n integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -353,11 +353,6 @@ subroutine psb_sins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -371,8 +366,9 @@ subroutine psb_sins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end if do i=1,n + if (.not.allocated(x(i)%v)) info = psb_err_invalid_vect_state_ - if (info == 0) call x(i)%ins(m,irl,val(:,i),dupl_,info) + if (info == 0) call x(i)%ins(m,irl,val(:,i),info) if (info /= 0) exit end do if (info /= 0) then @@ -390,7 +386,7 @@ subroutine psb_sins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_sins_vect_r2 -subroutine psb_sins_multivect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_sins_multivect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_sins_multivect use psi_mod implicit none @@ -406,14 +402,13 @@ subroutine psb_sins_multivect(m, irw, val, x, desc_a, info, dupl,local) type(psb_s_multivect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -469,11 +464,6 @@ subroutine psb_sins_multivect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -485,7 +475,7 @@ subroutine psb_sins_multivect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 diff --git a/base/tools/psb_sspalloc.f90 b/base/tools/psb_sspalloc.f90 index 15c3c538..8004e742 100644 --- a/base/tools/psb_sspalloc.f90 +++ b/base/tools/psb_sspalloc.f90 @@ -41,21 +41,23 @@ ! nnz - integer(optional). The number of nonzeroes in the matrix. ! (local, user estimate) ! -subroutine psb_sspalloc(a, desc_a, info, nnz) +subroutine psb_sspalloc(a, desc_a, info, nnz, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_sspalloc implicit none !....parameters... - type(psb_desc_type), intent(in) :: desc_a - type(psb_sspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_sspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_) :: loc_row,loc_col, nnz_, dectype - integer(psb_lpk_) :: m, n + integer(psb_ipk_) :: dupl_, bldmode_ + integer(psb_lpk_) :: m, n, nnzrmt_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -96,7 +98,7 @@ subroutine psb_sspalloc(a, desc_a, info, nnz) else nnz_ = max(1,5*loc_row) endif - + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name), & & ':allocating size:',loc_row,loc_col,nnz_ @@ -109,6 +111,24 @@ subroutine psb_sspalloc(a, desc_a, info, nnz) goto 9999 end if + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call a%set_dupl(dupl_) + call a%set_remote_build(bldmode_) + if (a%is_remote_build()) then + allocate(a%rmta) + nnzrmt_ = max(100,(nnz_/100)) + call a%rmta%allocate(m,n,nnzrmt_) + end if + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': ', & & desc_a%get_dectype(),psb_desc_bld_ diff --git a/base/tools/psb_sspasb.f90 b/base/tools/psb_sspasb.f90 index f4e6169d..cfa316eb 100644 --- a/base/tools/psb_sspasb.f90 +++ b/base/tools/psb_sspasb.f90 @@ -42,31 +42,29 @@ ! upd - character(optional). How will the matrix be updated? ! psb_upd_srch_ Simple strategy ! psb_upd_perm_ Permutation(more memory) -! dupl - integer(optional). Duplicate coefficient handling: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -! psb_dupl_err_ raise an error. ! ! -subroutine psb_sspasb(a,desc_a, info, afmt, upd, dupl, mold) +subroutine psb_sspasb(a,desc_a, info, afmt, upd, mold) use psb_base_mod, psb_protect_name => psb_sspasb + use psb_sort_mod use psi_mod implicit none !...Parameters.... - type(psb_sspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd - character(len=*), optional, intent(in) :: afmt + type(psb_sspmat_type), intent (inout) :: a + type(psb_desc_type), intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: upd + character(len=*), optional, intent(in) :: afmt class(psb_s_base_sparse_mat), intent(in), optional :: mold !....Locals.... type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, err_act - integer(psb_ipk_) :: n_row,n_col + integer(psb_ipk_) :: n_row,n_col, dupl_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name, ch_err + class(psb_i_base_vect_type), allocatable :: ivm info = psb_success_ name = 'psb_spasb' @@ -92,28 +90,79 @@ subroutine psb_sspasb(a,desc_a, info, afmt, upd, dupl, mold) goto 9999 end if - if (debug_level >= psb_debug_ext_)& & write(debug_unit, *) me,' ',trim(name),& & ' Begin matrix assembly...' !check on errors encountered in psdspins - - if (a%is_bld()) then + if (a%is_bld()) then + dupl_ = a%get_dupl() ! ! First case: we come from a fresh build. ! - - n_row = desc_a%get_local_rows() - n_col = desc_a%get_local_cols() - call a%set_nrows(n_row) - call a%set_ncols(n_col) - end if - - if (a%is_bld()) then - call a%cscnv(info,type=afmt,dupl=dupl, mold=mold) + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_ls_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() + nzt = nz + call psb_sum(ctxt,nzt) + if (nzt>0) then + allocate(ivm, mold=desc_a%v_halo_index%v) + call psb_cd_reinit(desc_a, info) + end if + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + if (nzt > 0) call psb_cdasb(desc_a,info,mold=ivm) + + end block + end if + call a%set_ncols(desc_a%get_local_cols()) + call a%cscnv(info,type=afmt,mold=mold,dupl=dupl_) else if (a%is_upd()) then + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_ls_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() +!!$ write(0,*) me,name,' Nz to be added',nz + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + end block + end if call a%asb(mold=mold) else info = psb_err_invalid_mat_state_ diff --git a/base/tools/psb_sspins.F90 b/base/tools/psb_sspins.F90 index 1fd6eed0..aee7a900 100644 --- a/base/tools/psb_sspins.F90 +++ b/base/tools/psb_sspins.F90 @@ -70,6 +70,10 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) integer(psb_ipk_), parameter :: relocsz=200 logical :: rebuild_, local_ integer(psb_ipk_), allocatable :: ila(:),jla(:) + integer(psb_ipk_) :: i,k + integer(psb_lpk_) :: nnl + integer(psb_lpk_), allocatable :: lila(:),ljla(:) + real(psb_spk_), allocatable :: lval(:) character(len=20) :: name info = psb_success_ @@ -147,6 +151,27 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(i) + ljla(k) = ja(i) + lval(k) = val(i) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if + else info = psb_err_invalid_a_and_cd_state_ call psb_errpush(info,name) @@ -168,8 +193,9 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) ila(1:nz) = ia(1:nz) jla(1:nz) = ja(1:nz) else - call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info) - if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info) + call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info,& + & mask=(ila(1:nz)>0)) end if call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info) if (info /= psb_success_) then @@ -177,6 +203,25 @@ subroutine psb_sspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(k) + ljla(k) = ja(k) + lval(k) = val(k) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if else info = psb_err_invalid_cd_state_ call psb_errpush(info,name) diff --git a/base/tools/psb_z_remote_mat.F90 b/base/tools/psb_z_remote_mat.F90 new file mode 100644 index 00000000..5461c5d5 --- /dev/null +++ b/base/tools/psb_z_remote_mat.F90 @@ -0,0 +1,276 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_z_remote_mat.f90 +! +! Subroutine: +! This routine does the retrieval of remote matrix rows. +! Retrieval is done through GETROW, therefore it should work +! for any matrix format in A; as for the output, default is CSR. +! +! There is also a specialized version lz_CSR whose interface +! is adapted for the needs of z_par_csr_spspmm. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! a - type(psb_zspmat_type) The local part of input matrix A +! desc_a - type(psb_desc_type). The communication descriptor. +! blck - type(psb_zspmat_type) The local part of output matrix BLCK +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +Subroutine psb_lz_remote_mat(a,desc_a,b,info) + use psb_base_mod, psb_protect_name => psb_lz_remote_mat + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + + Type(psb_lz_coo_sparse_mat),Intent(inout) :: a + Type(psb_lz_coo_sparse_mat),Intent(inout) :: b + Type(psb_desc_type), Intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, n_el_send,n_el_recv, & + & n_elem, j, ipx,idxs,idxr + integer(psb_lpk_) :: r, k, irmin, irmax, icmin, icmax, iszs, iszr, & + & lidx, l1, lnr, lnc, lnnz, idx, ngtz, tot_elem + integer(psb_lpk_) :: nz,nouth + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:),sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: iasnd(:), jasnd(:) + complex(psb_dpk_), allocatable :: valsnd(:) + type(psb_lz_coo_sparse_mat), allocatable :: acoo + class(psb_i_base_vect_type), pointer :: pdxv + integer(psb_ipk_), allocatable :: ila(:), iprc(:) + logical :: rowcnv_,colcnv_,rowscale_,colscale_ + character(len=5) :: outfmt_ + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_z_remote_mat' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + + call b%free() + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), acoo,stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + + nz = a%get_nzeros() + !allocate(ila(nz)) + !write(0,*) me,name,' size :',nz,size(ila) + !call desc_a%g2l(a%ia(1:nz),ila(1:nz),info,owned=.false.) + !nouth = count(ila(1:nz)<0) + !write(0,*) me,name,' Count out of halo :',nouth + !call psb_max(ctxt,nouth) + !if ((nouth/=0).and.(me==0)) & + ! & write(0,*) 'Warning: would require reinit of DESC_A' + + call desc_a%indxmap%fnd_owner(a%ia(1:nz),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:)=0 + rvsz(:)=0 + sdsi(:)=0 + rvsi(:)=0 + ipx = 1 + brvindx(:) = 0 + bsdindx(:) = 0 + counter=1 + idx = 0 + idxs = 0 + idxr = 0 + do i=1,nz + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call acoo%allocate(desc_a%get_global_rows(),desc_a%get_global_cols(),iszr) + if (psb_errstatus_fatal()) then + write(0,*) 'Error from acoo%allocate ' + info = 4010 + goto 9999 + end if + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Sizes:',acoo%get_size(),& + & ' Send:',sdsz(:),' Receive:',rvsz(:) + !write(debug_unit,*) me,' ',trim(name),': ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),iasnd,info) + !write(debug_unit,*) me,' ',trim(name),' iasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),jasnd,info) + !write(debug_unit,*) me,' ',trim(name),' jasnd: ',info + if (info == psb_success_) call psb_ensure_size(max(iszs,1),valsnd,info) + !write(debug_unit,*) me,' ',trim(name),' valsnd: ',info + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='ensure_size') + goto 9999 + end if + do k=1, nz + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + !rvsi(proc) = rvsi(proc) + 1 + iasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ia(k) + jasnd(bsdindx(proc+1)+sdsi(proc+1)) = a%ja(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = a%val(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_) + call psb_simple_triad_a2av(valsnd,iasnd,jasnd,sdsz,bsdindx,& + & acoo%val,acoo%ia,acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & acoo%val,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(iasnd,sdsz,bsdindx,& + & acoo%ia,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(jasnd,sdsz,bsdindx,& + & acoo%ja,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_c_dpk_,& + & acoo%val,rvsz,brvindx,psb_mpi_c_dpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(iasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ia,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(jasnd,sdsz,bsdindx,psb_mpi_lpk_,& + & acoo%ja,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + call acoo%set_nzeros(iszr) + call acoo%mv_to_coo(b,info) + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & iasnd,jasnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_lz_remote_mat diff --git a/base/tools/psb_z_remote_vect.F90 b/base/tools/psb_z_remote_vect.F90 new file mode 100644 index 00000000..ed705bb5 --- /dev/null +++ b/base/tools/psb_z_remote_vect.F90 @@ -0,0 +1,223 @@ +! +! Parallel Sparse BLAS version 3.5 +! (C) Copyright 2006-2018 +! Salvatore Filippone +! Alfredo Buttari +! +! Redistribution and use in source and binary forms, with or without +! modification, are permitted provided that the following conditions +! are met: +! 1. Redistributions of source code must retain the above copyright +! notice, this list of conditions and the following disclaimer. +! 2. Redistributions in binary form must reproduce the above copyright +! notice, this list of conditions, and the following disclaimer in the +! documentation and/or other materials provided with the distribution. +! 3. The name of the PSBLAS group or the names of its contributors may +! not be used to endorse or promote products derived from this +! software without specific written permission. +! +! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +! ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +! TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +! PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PSBLAS GROUP OR ITS CONTRIBUTORS +! BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +! POSSIBILITY OF SUCH DAMAGE. +! +! +! File: psb_z_remote_vect.f90 +! +! Subroutine: +! This routine does the retrieval of remote vector entries. +! +! There are three possible exchange algorithms: +! 1. Use MPI_Alltoallv +! 2. Use psb_simple_a2av +! 3. Use psb_simple_triad_a2av +! Default choice is 3. The MPI variant has proved to be inefficient; +! that is because it is not persistent, therefore you pay the initialization price +! every time, and it is not optimized for a sparse communication pattern, +! most MPI implementations assume that all communications are non-empty. +! The PSB_SIMPLE variants reuse the same communicator, and go for a simplistic +! sequence of sends/receive that is quite efficient for a sparse communication +! pattern. To be refined/reviewed in the future to compare with neighbour +! persistent collectives. +! +! Arguments: +! desc_a - type(psb_desc_type). The communication descriptor. +! info - integer. Return code +! rowcnv - logical Should row/col indices be converted +! colcnv - logical to/from global numbering when sent/received? +! default is .TRUE. +! rowscale - logical Should row/col indices on output be remapped +! colscale - logical from MIN:MAX to 1:(MAX-MIN+1) ? +! default is .FALSE. +! (commmon use is ROWSCALE=.TRUE., COLSCALE=.FALSE.) +! data - integer Which index list in desc_a should be used to retrieve +! rows, default psb_comm_halo_ +! psb_comm_halo_ use halo_index +! psb_comm_ext_ use ext_index +! psb_comm_ovrl_ DISABLED for this routine. +! +subroutine psb_z_remote_vect(n,v,iv,desc_a,x,ix, info) + use psb_base_mod, psb_protect_name => psb_z_remote_vect + +#ifdef MPI_MOD + use mpi +#endif + Implicit None +#ifdef MPI_H + include 'mpif.h' +#endif + integer(psb_ipk_), intent(in) :: n + complex(psb_dpk_), Intent(in) :: v(:) + integer(psb_lpk_), Intent(in) :: iv(:) + type(psb_desc_type),intent(in) :: desc_a + complex(psb_dpk_), allocatable, intent(out) :: x(:) + integer(psb_lpk_), allocatable, intent(out) :: ix(:) + integer(psb_ipk_), intent(out) :: info + ! ...local scalars.... + type(psb_ctxt_type) :: ctxt + integer(psb_ipk_) :: np,me + integer(psb_ipk_) :: counter, proc, i, & + & j, idxs,idxr, k, iszs, iszr + integer(psb_ipk_) :: nrcvs, nsnds + integer(psb_mpk_) :: icomm, minfo + integer(psb_mpk_), allocatable :: brvindx(:), & + & rvsz(:), bsdindx(:), sdsz(:), sdsi(:), rvsi(:) + integer(psb_lpk_), allocatable :: lsnd(:) + complex(psb_dpk_), allocatable :: valsnd(:) + integer(psb_ipk_), allocatable :: iprc(:) + integer(psb_ipk_) :: debug_level, debug_unit, err_act + character(len=20) :: name, ch_err + + info=psb_success_ + name='psb_z_remote_vect' + call psb_erractionsave(err_act) + if (psb_errstatus_fatal()) then + info = psb_err_internal_error_ ; goto 9999 + end if + debug_unit = psb_get_debug_unit() + debug_level = psb_get_debug_level() + + ctxt = desc_a%get_context() + icomm = desc_a%get_mpic() + + Call psb_info(ctxt, me, np) + + if (debug_level >= psb_debug_outer_) & + & write(debug_unit,*) me,' ',trim(name),': Start' + + Allocate(rvsz(np),sdsz(np),sdsi(np),rvsi(np),brvindx(np+1),& + & bsdindx(np+1), stat=info) + + if (info /= psb_success_) then + info=psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + + call desc_a%indxmap%fnd_owner(iv(1:n),iprc,info) + + icomm = desc_a%get_mpic() + sdsz(:) = 0 + rvsz(:) = 0 + sdsi(:) = 0 + rvsi(:) = 0 + brvindx(:) = 0 + bsdindx(:) = 0 + counter = 1 + idxs = 0 + idxr = 0 + do i=1,n + if (iprc(i) >=0) then + sdsz(iprc(i)+1) = sdsz(iprc(i)+1) +1 + else + write(0,*)me,name,' Error from fnd_owner: ',iprc(i) + end if + end do + call mpi_alltoall(sdsz,1,psb_mpi_mpk_,& + & rvsz,1,psb_mpi_mpk_,icomm,minfo) + if (minfo /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='mpi_alltoall') + goto 9999 + end if + !write(0,*)me,name,' sdsz ',sdsz(:),' rvsz:',rvsz(:) + nsnds = count(sdsz /= 0) + nrcvs = count(rvsz /= 0) + idxs = 0 + idxr = 0 + counter = 1 + Do proc=0,np-1 + bsdindx(proc+1) = idxs + idxs = idxs + sdsz(proc+1) + brvindx(proc+1) = idxr + idxr = idxr + rvsz(proc+1) + Enddo + + iszs = sum(sdsz) + iszr = sum(rvsz) + call psb_realloc(iszs,lsnd,info) + if (info == 0) call psb_realloc(iszs,valsnd,info) + if (info == 0) call psb_realloc(iszr,x,info) + if (info == 0) call psb_realloc(iszr,ix,info) + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='realloc') + goto 9999 + end if + do k=1, n + proc = iprc(k) + sdsi(proc+1) = sdsi(proc+1) + 1 + lsnd(bsdindx(proc+1)+sdsi(proc+1)) = iv(k) + valsnd(bsdindx(proc+1)+sdsi(proc+1)) = v(k) + end do + do proc=0,np-1 + if (sdsi(proc+1) /= sdsz(proc+1)) & + & write(0,*) me,name,'Send mismacth ',sdsi(proc+1),sdsz(proc+1) + end do + + select case(psb_get_sp_a2av_alg()) + case(psb_sp_a2av_smpl_triad_,psb_sp_a2av_smpl_v_) + call psb_simple_a2av(valsnd,sdsz,bsdindx,& + & x,rvsz,brvindx,ctxt,info) + if (info == psb_success_) call psb_simple_a2av(lsnd,sdsz,bsdindx,& + & ix,rvsz,brvindx,ctxt,info) + case(psb_sp_a2av_mpi_) + + call mpi_alltoallv(valsnd,sdsz,bsdindx,psb_mpi_c_dpk_,& + & x,rvsz,brvindx,psb_mpi_c_dpk_,icomm,minfo) + if (minfo == mpi_success) & + & call mpi_alltoallv(lsnd,sdsz,bsdindx,psb_mpi_lpk_,& + & ix,rvsz,brvindx,psb_mpi_lpk_,icomm,minfo) + if (minfo /= mpi_success) info = minfo + case default + info = psb_err_internal_error_ + call psb_errpush(info,name,a_err='wrong A2AV alg selector') + goto 9999 + end select + + if (info /= psb_success_) then + info=psb_err_from_subroutine_ + call psb_errpush(info,name,a_err='alltoallv') + goto 9999 + end if + + Deallocate(brvindx,bsdindx,rvsz,sdsz,& + & lsnd,valsnd,stat=info) + if (debug_level >= psb_debug_outer_)& + & write(debug_unit,*) me,' ',trim(name),': Done' + + call psb_erractionrestore(err_act) + return + +9999 call psb_error_handler(ctxt,err_act) + + return + +End Subroutine psb_z_remote_vect diff --git a/base/tools/psb_zallc.f90 b/base/tools/psb_zallc.f90 index fa84827e..be4d9089 100644 --- a/base/tools/psb_zallc.f90 +++ b/base/tools/psb_zallc.f90 @@ -40,7 +40,7 @@ ! x - the vector to be allocated. ! desc_a - the communication descriptor. ! info - Return code -subroutine psb_zalloc_vect(x, desc_a,info) +subroutine psb_zalloc_vect(x, desc_a,info, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_zalloc_vect use psi_mod implicit none @@ -49,9 +49,11 @@ subroutine psb_zalloc_vect(x, desc_a,info) type(psb_z_vect_type), intent(out) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals integer(psb_ipk_) :: np,me,nr,i,err_act + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -102,6 +104,25 @@ subroutine psb_zalloc_vect(x, desc_a,info) endif call x%zero() + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + call x%set_nrmv(0) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + call psb_ensure_size(nrmt_,x%rmtv,info) + call psb_ensure_size(nrmt_,x%rmidx,info) + end if + call psb_erractionrestore(err_act) return @@ -110,6 +131,7 @@ subroutine psb_zalloc_vect(x, desc_a,info) return end subroutine psb_zalloc_vect + ! Function: psb_zalloc_vect_r2 ! Allocates a vector of dense vectors for PSBLAS routines. ! The descriptor may be in either the build or assembled state. @@ -121,7 +143,7 @@ end subroutine psb_zalloc_vect ! n - optional number of columns. ! lb - optional lower bound on column indices -subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb) +subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_zalloc_vect_r2 use psi_mod implicit none @@ -131,10 +153,12 @@ subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n,lb + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -208,6 +232,26 @@ subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb) if (info /= 0) exit end do end if + + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + + do i=lb_, lb_+n_-1 + call x(i)%set_dupl(dupl_) + call x(i)%set_remote_build(bldmode_) + if (x(i)%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x(i)%rmtv(nrmt_)) + end if + end do if (psb_errstatus_fatal()) then info=psb_err_alloc_request_ call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') @@ -224,7 +268,7 @@ subroutine psb_zalloc_vect_r2(x, desc_a,info,n,lb) end subroutine psb_zalloc_vect_r2 -subroutine psb_zalloc_multivect(x, desc_a,info,n) +subroutine psb_zalloc_multivect(x, desc_a,info,n, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_zalloc_multivect use psi_mod implicit none @@ -234,10 +278,12 @@ subroutine psb_zalloc_multivect(x, desc_a,info,n) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_),intent(out) :: info integer(psb_ipk_), optional, intent(in) :: n + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me,nr,i,err_act, n_, lb_ + integer(psb_ipk_) :: dupl_, bldmode_, nrmt_ integer(psb_ipk_) :: exch(1) integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -306,6 +352,23 @@ subroutine psb_zalloc_multivect(x, desc_a,info,n) call psb_errpush(info,name,i_err=(/nr/),a_err='real(psb_spk_)') goto 9999 endif + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call x%set_dupl(dupl_) + call x%set_remote_build(bldmode_) + if (x%is_remote_build()) then + nrmt_ = max(100,(desc_a%get_local_cols()-desc_a%get_local_rows())) + allocate(x%rmtv(nrmt_,n_)) + end if + call psb_erractionrestore(err_act) return diff --git a/base/tools/psb_zasb.f90 b/base/tools/psb_zasb.f90 index 34706841..decbfdec 100644 --- a/base/tools/psb_zasb.f90 +++ b/base/tools/psb_zasb.f90 @@ -64,7 +64,7 @@ subroutine psb_zasb_vect(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -83,7 +83,7 @@ subroutine psb_zasb_vect(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - + dupl_ = x%get_dupl() ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -104,6 +104,23 @@ subroutine psb_zasb_vect(x, desc_a, info, mold, scratch) call x%free(info) call x%bld(ncol,mold=mold) else + + if (x%is_remote_build()) then + block + integer(psb_lpk_), allocatable :: lvx(:) + complex(psb_dpk_), allocatable :: vx(:) + integer(psb_ipk_), allocatable :: ivx(:) + integer(psb_ipk_) :: nrmv, nx, i + + nrmv = x%get_nrmv() + call psb_remote_vect(nrmv,x%rmtv,x%rmidx,desc_a,vx,lvx,info) + nx = size(vx) + call psb_realloc(nx,ivx,info) + call desc_a%g2l(lvx,ivx,info,owned=.true.) + call x%ins(nx,ivx,vx,info) + end block + end if + call x%asb(ncol,info) ! ..update halo elements.. call psb_halo(x,desc_a,info) @@ -140,7 +157,7 @@ subroutine psb_zasb_vect_r2(x, desc_a, info, mold, scratch) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, i, n - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name,ch_err @@ -159,7 +176,6 @@ subroutine psb_zasb_vect_r2(x, desc_a, info, mold, scratch) scratch_ = .false. if (present(scratch)) scratch_ = scratch call psb_info(ctxt, me, np) - ! ....verify blacs grid correctness.. if (np == -1) then info = psb_err_context_error_ @@ -185,6 +201,7 @@ subroutine psb_zasb_vect_r2(x, desc_a, info, mold, scratch) else do i=1, n + dupl_ = x(i)%get_dupl() call x(i)%asb(ncol,info) if (info /= 0) exit ! ..update halo elements.. @@ -225,7 +242,7 @@ subroutine psb_zasb_multivect(x, desc_a, info, mold, scratch,n) ! local variables type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me - integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_ + integer(psb_ipk_) :: i1sz,nrow,ncol, err_act, n_, dupl_ logical :: scratch_ integer(psb_ipk_) :: debug_level, debug_unit @@ -271,6 +288,7 @@ subroutine psb_zasb_multivect(x, desc_a, info, mold, scratch,n) if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': sizes: ',nrow,ncol + dupl_ = x%get_dupl() if (scratch_) then call x%free(info) call x%bld(ncol,n_,mold=mold) diff --git a/base/tools/psb_zins.f90 b/base/tools/psb_zins.f90 index 19020379..43e5d5cd 100644 --- a/base/tools/psb_zins.f90 +++ b/base/tools/psb_zins.f90 @@ -42,10 +42,7 @@ ! x - type(psb_z_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_zins_vect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_zins_vect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_zins_vect use psi_mod implicit none @@ -57,14 +54,14 @@ subroutine psb_zins_vect(m, irw, val, x, desc_a, info, dupl,local) type(psb_z_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob + integer(psb_ipk_) :: dupl_ type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_,err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -112,7 +109,6 @@ subroutine psb_zins_vect(m, irw, val, x, desc_a, info, dupl,local) endif - allocate(irl(m),stat=info) if (info /= psb_success_) then info = psb_err_alloc_dealloc_ @@ -120,11 +116,6 @@ subroutine psb_zins_vect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -136,11 +127,33 @@ subroutine psb_zins_vect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 end if + if (x%is_remote_build()) then + block + integer(psb_ipk_) :: j,k + k = x%get_nrmv() + do j=1,m + if (irl(j) < 0 ) then + k = k + 1 + call psb_ensure_size(k,x%rmtv,info) + if (info == 0) call psb_ensure_size(k,x%rmidx,info) + if (info /= 0) then + info = psb_err_alloc_dealloc_ + call psb_errpush(info,name) + goto 9999 + end if + x%rmtv(k) = val(j) + x%rmidx(k) = irw(j) + call x%set_nrmv(k) + end if + end do + end block + end if + deallocate(irl) call psb_erractionrestore(err_act) @@ -166,10 +179,7 @@ end subroutine psb_zins_vect ! x - type(psb_z_vect_type) The destination vector ! desc_a - type(psb_desc_type). The communication descriptor. ! info - integer. return code -! dupl - integer What to do with duplicates: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -subroutine psb_zins_vect_v(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_zins_vect_v(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_zins_vect_v use psi_mod implicit none @@ -185,14 +195,13 @@ subroutine psb_zins_vect_v(m, irw, val, x, desc_a, info, dupl,local) type(psb_z_vect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols,err_act integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_ + integer(psb_ipk_) :: np, me integer(psb_ipk_), allocatable :: irl(:) complex(psb_dpk_), allocatable :: lval(:) logical :: local_ @@ -239,14 +248,6 @@ subroutine psb_zins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call psb_errpush(info,name) goto 9999 endif - - - - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -260,7 +261,7 @@ subroutine psb_zins_vect_v(m, irw, val, x, desc_a, info, dupl,local) call desc_a%indxmap%g2l(irw%v%v(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,lval,dupl_,info) + call x%ins(m,irl,lval,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 @@ -275,7 +276,7 @@ subroutine psb_zins_vect_v(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_zins_vect_v -subroutine psb_zins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_zins_vect_r2(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_zins_vect_r2 use psi_mod implicit none @@ -291,14 +292,13 @@ subroutine psb_zins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) type(psb_z_vect_type), intent(inout) :: x(:) type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols, n integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -353,11 +353,6 @@ subroutine psb_zins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -371,8 +366,9 @@ subroutine psb_zins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end if do i=1,n + if (.not.allocated(x(i)%v)) info = psb_err_invalid_vect_state_ - if (info == 0) call x(i)%ins(m,irl,val(:,i),dupl_,info) + if (info == 0) call x(i)%ins(m,irl,val(:,i),info) if (info /= 0) exit end do if (info /= 0) then @@ -390,7 +386,7 @@ subroutine psb_zins_vect_r2(m, irw, val, x, desc_a, info, dupl,local) end subroutine psb_zins_vect_r2 -subroutine psb_zins_multivect(m, irw, val, x, desc_a, info, dupl,local) +subroutine psb_zins_multivect(m, irw, val, x, desc_a, info, local) use psb_base_mod, psb_protect_name => psb_zins_multivect use psi_mod implicit none @@ -406,14 +402,13 @@ subroutine psb_zins_multivect(m, irw, val, x, desc_a, info, dupl,local) type(psb_z_multivect_type), intent(inout) :: x type(psb_desc_type), intent(in) :: desc_a integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: dupl logical, intent(in), optional :: local !locals..... integer(psb_ipk_) :: i, loc_rows,loc_cols integer(psb_lpk_) :: mglob type(psb_ctxt_type) :: ctxt - integer(psb_ipk_) :: np, me, dupl_, err_act + integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_), allocatable :: irl(:) logical :: local_ character(len=20) :: name @@ -469,11 +464,6 @@ subroutine psb_zins_multivect(m, irw, val, x, desc_a, info, dupl,local) goto 9999 endif - if (present(dupl)) then - dupl_ = dupl - else - dupl_ = psb_dupl_ovwrt_ - endif if (present(local)) then local_ = local else @@ -485,7 +475,7 @@ subroutine psb_zins_multivect(m, irw, val, x, desc_a, info, dupl,local) else call desc_a%indxmap%g2l(irw(1:m),irl(1:m),info,owned=.true.) end if - call x%ins(m,irl,val,dupl_,info) + call x%ins(m,irl,val,info) if (info /= 0) then call psb_errpush(info,name) goto 9999 diff --git a/base/tools/psb_zspalloc.f90 b/base/tools/psb_zspalloc.f90 index 16d48734..308774ef 100644 --- a/base/tools/psb_zspalloc.f90 +++ b/base/tools/psb_zspalloc.f90 @@ -41,21 +41,23 @@ ! nnz - integer(optional). The number of nonzeroes in the matrix. ! (local, user estimate) ! -subroutine psb_zspalloc(a, desc_a, info, nnz) +subroutine psb_zspalloc(a, desc_a, info, nnz, dupl, bldmode) use psb_base_mod, psb_protect_name => psb_zspalloc implicit none !....parameters... - type(psb_desc_type), intent(in) :: desc_a - type(psb_zspmat_type), intent(inout) :: a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_), optional, intent(in) :: nnz + type(psb_desc_type), intent(in) :: desc_a + type(psb_zspmat_type), intent(inout) :: a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: nnz + integer(psb_ipk_), optional, intent(in) :: dupl, bldmode !locals type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np, me, err_act integer(psb_ipk_) :: loc_row,loc_col, nnz_, dectype - integer(psb_lpk_) :: m, n + integer(psb_ipk_) :: dupl_, bldmode_ + integer(psb_lpk_) :: m, n, nnzrmt_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name @@ -96,7 +98,7 @@ subroutine psb_zspalloc(a, desc_a, info, nnz) else nnz_ = max(1,5*loc_row) endif - + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name), & & ':allocating size:',loc_row,loc_col,nnz_ @@ -109,6 +111,24 @@ subroutine psb_zspalloc(a, desc_a, info, nnz) goto 9999 end if + if (present(bldmode)) then + bldmode_ = bldmode + else + bldmode_ = psb_matbld_noremote_ + end if + if (present(dupl)) then + dupl_ = dupl + else + dupl_ = psb_dupl_def_ + end if + call a%set_dupl(dupl_) + call a%set_remote_build(bldmode_) + if (a%is_remote_build()) then + allocate(a%rmta) + nnzrmt_ = max(100,(nnz_/100)) + call a%rmta%allocate(m,n,nnzrmt_) + end if + if (debug_level >= psb_debug_ext_) & & write(debug_unit,*) me,' ',trim(name),': ', & & desc_a%get_dectype(),psb_desc_bld_ diff --git a/base/tools/psb_zspasb.f90 b/base/tools/psb_zspasb.f90 index b5966110..aeeef94d 100644 --- a/base/tools/psb_zspasb.f90 +++ b/base/tools/psb_zspasb.f90 @@ -42,31 +42,29 @@ ! upd - character(optional). How will the matrix be updated? ! psb_upd_srch_ Simple strategy ! psb_upd_perm_ Permutation(more memory) -! dupl - integer(optional). Duplicate coefficient handling: -! psb_dupl_ovwrt_ overwrite -! psb_dupl_add_ add -! psb_dupl_err_ raise an error. ! ! -subroutine psb_zspasb(a,desc_a, info, afmt, upd, dupl, mold) +subroutine psb_zspasb(a,desc_a, info, afmt, upd, mold) use psb_base_mod, psb_protect_name => psb_zspasb + use psb_sort_mod use psi_mod implicit none !...Parameters.... - type(psb_zspmat_type), intent (inout) :: a - type(psb_desc_type), intent(in) :: desc_a - integer(psb_ipk_), intent(out) :: info - integer(psb_ipk_),optional, intent(in) :: dupl, upd - character(len=*), optional, intent(in) :: afmt + type(psb_zspmat_type), intent (inout) :: a + type(psb_desc_type), intent(inout) :: desc_a + integer(psb_ipk_), intent(out) :: info + integer(psb_ipk_), optional, intent(in) :: upd + character(len=*), optional, intent(in) :: afmt class(psb_z_base_sparse_mat), intent(in), optional :: mold !....Locals.... type(psb_ctxt_type) :: ctxt integer(psb_ipk_) :: np,me, err_act - integer(psb_ipk_) :: n_row,n_col + integer(psb_ipk_) :: n_row,n_col, dupl_ integer(psb_ipk_) :: debug_level, debug_unit character(len=20) :: name, ch_err + class(psb_i_base_vect_type), allocatable :: ivm info = psb_success_ name = 'psb_spasb' @@ -92,28 +90,79 @@ subroutine psb_zspasb(a,desc_a, info, afmt, upd, dupl, mold) goto 9999 end if - if (debug_level >= psb_debug_ext_)& & write(debug_unit, *) me,' ',trim(name),& & ' Begin matrix assembly...' !check on errors encountered in psdspins - - if (a%is_bld()) then + if (a%is_bld()) then + dupl_ = a%get_dupl() ! ! First case: we come from a fresh build. ! - - n_row = desc_a%get_local_rows() - n_col = desc_a%get_local_cols() - call a%set_nrows(n_row) - call a%set_ncols(n_col) - end if - - if (a%is_bld()) then - call a%cscnv(info,type=afmt,dupl=dupl, mold=mold) + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_lz_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() + nzt = nz + call psb_sum(ctxt,nzt) + if (nzt>0) then + allocate(ivm, mold=desc_a%v_halo_index%v) + call psb_cd_reinit(desc_a, info) + end if + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + if (nzt > 0) call psb_cdasb(desc_a,info,mold=ivm) + + end block + end if + call a%set_ncols(desc_a%get_local_cols()) + call a%cscnv(info,type=afmt,mold=mold,dupl=dupl_) else if (a%is_upd()) then + if (a%is_remote_build()) then + !write(0,*) me,name,' Size of rmta:',a%rmta%get_nzeros() + block + type(psb_lz_coo_sparse_mat) :: a_add + integer(psb_ipk_), allocatable :: ila(:), jla(:) + integer(psb_ipk_) :: nz, nzt,k + call psb_remote_mat(a%rmta,desc_a,a_add,info) + nz = a_add%get_nzeros() +!!$ write(0,*) me,name,' Nz to be added',nz + if (nz > 0) then + ! + ! Should we check for new indices here? + ! + call psb_realloc(nz,ila,info) + call psb_realloc(nz,jla,info) + call desc_a%indxmap%g2l(a_add%ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l_ins(a_add%ja(1:nz),jla(1:nz),info) + !write(0,*) me,name,' Check before insert',a%get_nzeros() + n_row = desc_a%get_local_rows() + n_col = desc_a%get_local_cols() + call a%set_ncols(desc_a%get_local_cols()) + call a%csput(nz,ila,jla,a_add%val,ione,n_row,ione,n_col,info) + !write(0,*) me,name,' Check after insert',a%get_nzeros(),nz + end if + end block + end if call a%asb(mold=mold) else info = psb_err_invalid_mat_state_ diff --git a/base/tools/psb_zspins.F90 b/base/tools/psb_zspins.F90 index 525ed415..abe64251 100644 --- a/base/tools/psb_zspins.F90 +++ b/base/tools/psb_zspins.F90 @@ -70,6 +70,10 @@ subroutine psb_zspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) integer(psb_ipk_), parameter :: relocsz=200 logical :: rebuild_, local_ integer(psb_ipk_), allocatable :: ila(:),jla(:) + integer(psb_ipk_) :: i,k + integer(psb_lpk_) :: nnl + integer(psb_lpk_), allocatable :: lila(:),ljla(:) + complex(psb_dpk_), allocatable :: lval(:) character(len=20) :: name info = psb_success_ @@ -147,6 +151,27 @@ subroutine psb_zspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(i) + ljla(k) = ja(i) + lval(k) = val(i) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if + else info = psb_err_invalid_a_and_cd_state_ call psb_errpush(info,name) @@ -168,8 +193,9 @@ subroutine psb_zspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) ila(1:nz) = ia(1:nz) jla(1:nz) = ja(1:nz) else - call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info) - if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info) + call desc_a%indxmap%g2l(ia(1:nz),ila(1:nz),info,owned=.true.) + if (info == 0) call desc_a%indxmap%g2l(ja(1:nz),jla(1:nz),info,& + & mask=(ila(1:nz)>0)) end if call a%csput(nz,ila,jla,val,ione,nrow,ione,ncol,info) if (info /= psb_success_) then @@ -177,6 +203,25 @@ subroutine psb_zspins(nz,ia,ja,val,a,desc_a,info,rebuild,local) call psb_errpush(info,name,a_err='a%csput') goto 9999 end if + if (a%is_remote_build()) then + nnl = count(ila(1:nz)<0) + if (nnl > 0) then + !write(0,*) 'Check on insert ',nnl + allocate(lila(nnl),ljla(nnl),lval(nnl)) + k = 0 + do i=1,nz + if (ila(i)<0) then + k=k+1 + lila(k) = ia(k) + ljla(k) = ja(k) + lval(k) = val(k) + end if + end do + if (k /= nnl) write(0,*) name,' Wrong conversion?',k,nnl + call a%rmta%csput(nnl,lila,ljla,lval,1_psb_lpk_,desc_a%get_global_rows(),& + & 1_psb_lpk_,desc_a%get_global_rows(),info) + end if + end if else info = psb_err_invalid_cd_state_ call psb_errpush(info,name) diff --git a/cbind/Makefile b/cbind/Makefile index 2abb6cfe..acc82fa9 100644 --- a/cbind/Makefile +++ b/cbind/Makefile @@ -6,20 +6,25 @@ INCDIR=../include MODDIR=../modules/ LIBNAME=$(CBINDLIBNAME) -lib: based precd krylovd utild - /bin/cp -p $(CPUPDFLAG) $(HERE)/$(LIBNAME) $(LIBDIR) +objs: based precd krylovd utild /bin/cp -p $(CPUPDFLAG) *.h $(INCDIR) /bin/cp -p $(CPUPDFLAG) *$(.mod) $(MODDIR) +lib: objs + cd base && $(MAKE) lib LIBNAME=$(LIBNAME) + cd prec && $(MAKE) lib LIBNAME=$(LIBNAME) + cd krylov && $(MAKE) lib LIBNAME=$(LIBNAME) + cd util && $(MAKE) lib LIBNAME=$(LIBNAME) + /bin/cp -p $(CPUPDFLAG) $(HERE)/$(LIBNAME) $(LIBDIR) based: - cd base && $(MAKE) lib LIBNAME=$(LIBNAME) + cd base && $(MAKE) objs LIBNAME=$(LIBNAME) precd: based - cd prec && $(MAKE) lib LIBNAME=$(LIBNAME) + cd prec && $(MAKE) objs LIBNAME=$(LIBNAME) krylovd: based precd - cd krylov && $(MAKE) lib LIBNAME=$(LIBNAME) + cd krylov && $(MAKE) objs LIBNAME=$(LIBNAME) utild: based - cd util && $(MAKE) lib LIBNAME=$(LIBNAME) + cd util && $(MAKE) objs LIBNAME=$(LIBNAME) clean: cd base && $(MAKE) clean diff --git a/cbind/base/Makefile b/cbind/base/Makefile index e66da0c4..2b744829 100644 --- a/cbind/base/Makefile +++ b/cbind/base/Makefile @@ -27,10 +27,11 @@ OBJS=$(FOBJS) $(COBJS) LIBNAME=$(CBINDLIBNAME) -lib: $(OBJS) $(CMOD) +objs: $(OBJS) $(CMOD) + /bin/cp -p *$(.mod) $(CMOD) $(HERE) +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) - /bin/cp -p *$(.mod) $(CMOD) $(HERE) $(COBJS): $(CMOD) diff --git a/cbind/base/psb_base_tools_cbind_mod.F90 b/cbind/base/psb_base_tools_cbind_mod.F90 index dc05fd66..7126ced8 100644 --- a/cbind/base/psb_base_tools_cbind_mod.F90 +++ b/cbind/base/psb_base_tools_cbind_mod.F90 @@ -100,6 +100,47 @@ contains end function psb_c_cdall_vl + function psb_c_cdall_vl_opt(nl,vl,cctxt,cdh) bind(c,name='psb_c_cdall_vl_opt') result(res) + implicit none + + integer(psb_c_ipk_) :: res + type(psb_c_object_type), value :: cctxt + integer(psb_c_ipk_), value :: nl + integer(psb_c_lpk_) :: vl(*) + type(psb_c_object_type) :: cdh + type(psb_desc_type), pointer :: descp + integer(psb_c_ipk_) :: info, ixb + type(psb_ctxt_type) :: ctxt + ctxt = psb_c2f_ctxt(cctxt) + + res = -1 + if (nl <=0) then + write(0,*) 'Invalid size' + return + end if + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + call descp%free(info) + if (info == 0) deallocate(descp,stat=info) + if (info /= 0) return + end if + + allocate(descp,stat=info) + if (info < 0) return + + ixb = psb_c_get_index_base() + + if (ixb == 1) then + call psb_cdall(ctxt,descp,info,vl=vl(1:nl),globalcheck=.true.) + else + call psb_cdall(ctxt,descp,info,vl=(vl(1:nl)+(1-ixb)),globalcheck=.true.) + end if + cdh%item = c_loc(descp) + res = info + + end function psb_c_cdall_vl_opt + function psb_c_cdall_nl(nl,cctxt,cdh) bind(c,name='psb_c_cdall_nl') result(res) implicit none diff --git a/cbind/base/psb_c_cbase.h b/cbind/base/psb_c_cbase.h index dd64d6e2..bff9633a 100644 --- a/cbind/base/psb_c_cbase.h +++ b/cbind/base/psb_c_cbase.h @@ -24,6 +24,7 @@ psb_i_t psb_c_cvect_zero(psb_c_cvector *xh); psb_i_t *psb_c_cvect_f_get_pnt(psb_c_cvector *xh); psb_i_t psb_c_cgeall(psb_c_cvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_cgeall_remote(psb_c_cvector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_cgeins(psb_i_t nz, const psb_l_t *irw, const psb_c_t *val, psb_c_cvector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_cgeins_add(psb_i_t nz, const psb_l_t *irw, const psb_c_t *val, @@ -35,6 +36,7 @@ psb_c_t psb_c_cgetelem(psb_c_cvector *xh,psb_l_t index,psb_c_descriptor *cd); /* sparse matrices*/ psb_c_cspmat* psb_c_new_cspmat(); psb_i_t psb_c_cspall(psb_c_cspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_cspall_remote(psb_c_cspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_cspasb(psb_c_cspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_cspfree(psb_c_cspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_cspins(psb_i_t nz, const psb_l_t *irw, const psb_l_t *icl, diff --git a/cbind/base/psb_c_dbase.h b/cbind/base/psb_c_dbase.h index 8c2c6a61..591f885b 100644 --- a/cbind/base/psb_c_dbase.h +++ b/cbind/base/psb_c_dbase.h @@ -24,6 +24,7 @@ psb_i_t psb_c_dvect_zero(psb_c_dvector *xh); psb_d_t *psb_c_dvect_f_get_pnt( psb_c_dvector *xh); psb_i_t psb_c_dgeall(psb_c_dvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_dgeall_remote(psb_c_dvector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_dgeins(psb_i_t nz, const psb_l_t *irw, const psb_d_t *val, psb_c_dvector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_dgeins_add(psb_i_t nz, const psb_l_t *irw, const psb_d_t *val, @@ -35,6 +36,7 @@ psb_d_t psb_c_dgetelem(psb_c_dvector *xh,psb_l_t index,psb_c_descriptor *cd); /* sparse matrices*/ psb_c_dspmat* psb_c_new_dspmat(); psb_i_t psb_c_dspall(psb_c_dspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_dspall_remote(psb_c_dspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_dspasb(psb_c_dspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_dspfree(psb_c_dspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_dspins(psb_i_t nz, const psb_l_t *irw, const psb_l_t *icl, diff --git a/cbind/base/psb_c_sbase.h b/cbind/base/psb_c_sbase.h index b2e18ba5..68abefdd 100644 --- a/cbind/base/psb_c_sbase.h +++ b/cbind/base/psb_c_sbase.h @@ -24,6 +24,7 @@ psb_i_t psb_c_svect_zero(psb_c_svector *xh); psb_s_t *psb_c_svect_f_get_pnt( psb_c_svector *xh); psb_i_t psb_c_sgeall(psb_c_svector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_sgeall_remote(psb_c_svector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_sgeins(psb_i_t nz, const psb_l_t *irw, const psb_s_t *val, psb_c_svector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_sgeins_add(psb_i_t nz, const psb_l_t *irw, const psb_s_t *val, @@ -35,6 +36,7 @@ psb_s_t psb_c_sgetelem(psb_c_svector *xh,psb_l_t index,psb_c_descriptor *cd); /* sparse matrices*/ psb_c_sspmat* psb_c_new_sspmat(); psb_i_t psb_c_sspall(psb_c_sspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_sspall_remote(psb_c_sspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_sspasb(psb_c_sspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_sspfree(psb_c_sspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_sspins(psb_i_t nz, const psb_l_t *irw, const psb_l_t *icl, diff --git a/cbind/base/psb_c_tools_cbind_mod.F90 b/cbind/base/psb_c_tools_cbind_mod.F90 index 84fea6d7..8f64cbb0 100644 --- a/cbind/base/psb_c_tools_cbind_mod.F90 +++ b/cbind/base/psb_c_tools_cbind_mod.F90 @@ -5,10 +5,11 @@ module psb_c_tools_cbind_mod use psb_objhandle_mod use psb_base_string_cbind_mod use psb_base_tools_cbind_mod - + contains - function psb_c_cgeall(xh,cdh) bind(c) result(res) + ! Should define geall_opt with DUPL argument + function psb_c_cgeall(xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -37,6 +38,35 @@ contains return end function psb_c_cgeall + function psb_c_cgeall_remote(xh,cdh) bind(c) result(res) + + implicit none + integer(psb_c_ipk_) :: res + type(psb_c_cvector) :: xh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_c_vect_type), pointer :: xp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(xh%item)) then + return + end if + allocate(xp) + call psb_geall(xp,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) + xh%item = c_loc(xp) + res = min(0,info) + + return + end function psb_c_cgeall_remote + function psb_c_cgeasb(xh,cdh) bind(c) result(res) implicit none @@ -101,7 +131,7 @@ contains end function psb_c_cgefree - function psb_c_cgeins(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_cgeins(nz,irw,val,xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -131,10 +161,10 @@ contains ixb = psb_c_get_index_base() if (ixb == 1) then call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) else call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) end if res = min(0,info) @@ -142,20 +172,16 @@ contains return end function psb_c_cgeins - - function psb_c_cgeins_add(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_cspall(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res - integer(psb_c_ipk_), value :: nz - integer(psb_c_lpk_) :: irw(*) - complex(c_float_complex) :: val(*) - type(psb_c_cvector) :: xh + type(psb_c_cspmat) :: mh type(psb_c_descriptor) :: cdh type(psb_desc_type), pointer :: descp - type(psb_c_vect_type), pointer :: xp - integer(psb_c_ipk_) :: ixb, info + type(psb_cspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info,n res = -1 if (c_associated(cdh%item)) then @@ -163,27 +189,19 @@ contains else return end if - if (c_associated(xh%item)) then - call c_f_pointer(xh%item,xp) - else + if (c_associated(mh%item)) then return end if - - ixb = psb_c_get_index_base() - if (ixb == 1) then - call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - else - call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - end if + allocate(ap) + call psb_spall(ap,descp,info) + mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_cgeins_add + end function psb_c_cspall - function psb_c_cspall(mh,cdh) bind(c) result(res) + function psb_c_cspall_remote(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -204,14 +222,12 @@ contains return end if allocate(ap) - call psb_spall(ap,descp,info) + call psb_spall(ap,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_cspall - - + end function psb_c_cspall_remote function psb_c_cspasb(mh,cdh) bind(c) result(res) @@ -241,7 +257,6 @@ contains return end function psb_c_cspasb - function psb_c_cspfree(mh,cdh) bind(c) result(res) implicit none @@ -275,7 +290,7 @@ contains #if 0 - function psb_c_cspasb_opt(mh,cdh,afmt,upd,dupl) bind(c) result(res) + function psb_c_cspasb_opt(mh,cdh,afmt,upd) bind(c) result(res) #ifdef HAVE_LIBRSB use psb_c_rsb_mat_mod @@ -284,7 +299,7 @@ contains integer(psb_c_ipk_) :: res integer(psb_c_ipk_), value :: cdh, mh,upd,dupl character(c_char) :: afmt(*) - integer(psb_c_ipk_) :: info,n, fdupl + integer(psb_c_ipk_) :: info,n character(len=5) :: fafmt #ifdef HAVE_LIBRSB type(psb_c_rsb_sparse_mat) :: arsb @@ -301,11 +316,11 @@ contains #ifdef HAVE_LIBRSB case('RSB') call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & upd=upd,dupl=dupl,mold=arsb) + & upd=upd,mold=arsb) #endif case default call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & afmt=fafmt,upd=upd,dupl=dupl) + & afmt=fafmt,upd=upd) end select res = min(0,info) diff --git a/cbind/base/psb_c_zbase.h b/cbind/base/psb_c_zbase.h index 16ee1ac4..9a27e9c0 100644 --- a/cbind/base/psb_c_zbase.h +++ b/cbind/base/psb_c_zbase.h @@ -24,6 +24,7 @@ psb_i_t psb_c_zvect_zero(psb_c_zvector *xh); psb_z_t *psb_c_zvect_f_get_pnt( psb_c_zvector *xh); psb_i_t psb_c_zgeall(psb_c_zvector *xh, psb_c_descriptor *cdh); +psb_i_t psb_c_zgeall_remote(psb_c_zvector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_zgeins(psb_i_t nz, const psb_l_t *irw, const psb_z_t *val, psb_c_zvector *xh, psb_c_descriptor *cdh); psb_i_t psb_c_zgeins_add(psb_i_t nz, const psb_l_t *irw, const psb_z_t *val, @@ -35,6 +36,7 @@ psb_z_t psb_c_zgetelem(psb_c_zvector *xh,psb_l_t index,psb_c_descriptor *cd); /* sparse matrices*/ psb_c_zspmat* psb_c_new_zspmat(); psb_i_t psb_c_zspall(psb_c_zspmat *mh, psb_c_descriptor *cdh); +psb_i_t psb_c_zspall_remote(psb_c_zspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_zspasb(psb_c_zspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_zspfree(psb_c_zspmat *mh, psb_c_descriptor *cdh); psb_i_t psb_c_zspins(psb_i_t nz, const psb_l_t *irw, const psb_l_t *icl, diff --git a/cbind/base/psb_d_tools_cbind_mod.F90 b/cbind/base/psb_d_tools_cbind_mod.F90 index 08e214a5..67ae8b86 100644 --- a/cbind/base/psb_d_tools_cbind_mod.F90 +++ b/cbind/base/psb_d_tools_cbind_mod.F90 @@ -5,10 +5,11 @@ module psb_d_tools_cbind_mod use psb_objhandle_mod use psb_base_string_cbind_mod use psb_base_tools_cbind_mod - + contains - function psb_c_dgeall(xh,cdh) bind(c) result(res) + ! Should define geall_opt with DUPL argument + function psb_c_dgeall(xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -37,6 +38,35 @@ contains return end function psb_c_dgeall + function psb_c_dgeall_remote(xh,cdh) bind(c) result(res) + + implicit none + integer(psb_c_ipk_) :: res + type(psb_c_dvector) :: xh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_d_vect_type), pointer :: xp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(xh%item)) then + return + end if + allocate(xp) + call psb_geall(xp,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) + xh%item = c_loc(xp) + res = min(0,info) + + return + end function psb_c_dgeall_remote + function psb_c_dgeasb(xh,cdh) bind(c) result(res) implicit none @@ -101,7 +131,7 @@ contains end function psb_c_dgefree - function psb_c_dgeins(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_dgeins(nz,irw,val,xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -131,10 +161,10 @@ contains ixb = psb_c_get_index_base() if (ixb == 1) then call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) else call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) end if res = min(0,info) @@ -142,20 +172,16 @@ contains return end function psb_c_dgeins - - function psb_c_dgeins_add(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_dspall(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res - integer(psb_c_ipk_), value :: nz - integer(psb_c_lpk_) :: irw(*) - real(c_double) :: val(*) - type(psb_c_dvector) :: xh + type(psb_c_dspmat) :: mh type(psb_c_descriptor) :: cdh type(psb_desc_type), pointer :: descp - type(psb_d_vect_type), pointer :: xp - integer(psb_c_ipk_) :: ixb, info + type(psb_dspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info,n res = -1 if (c_associated(cdh%item)) then @@ -163,27 +189,19 @@ contains else return end if - if (c_associated(xh%item)) then - call c_f_pointer(xh%item,xp) - else + if (c_associated(mh%item)) then return end if - - ixb = psb_c_get_index_base() - if (ixb == 1) then - call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - else - call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - end if + allocate(ap) + call psb_spall(ap,descp,info) + mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_dgeins_add + end function psb_c_dspall - function psb_c_dspall(mh,cdh) bind(c) result(res) + function psb_c_dspall_remote(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -204,14 +222,12 @@ contains return end if allocate(ap) - call psb_spall(ap,descp,info) + call psb_spall(ap,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_dspall - - + end function psb_c_dspall_remote function psb_c_dspasb(mh,cdh) bind(c) result(res) @@ -241,7 +257,6 @@ contains return end function psb_c_dspasb - function psb_c_dspfree(mh,cdh) bind(c) result(res) implicit none @@ -275,7 +290,7 @@ contains #if 0 - function psb_c_dspasb_opt(mh,cdh,afmt,upd,dupl) bind(c) result(res) + function psb_c_dspasb_opt(mh,cdh,afmt,upd) bind(c) result(res) #ifdef HAVE_LIBRSB use psb_d_rsb_mat_mod @@ -284,7 +299,7 @@ contains integer(psb_c_ipk_) :: res integer(psb_c_ipk_), value :: cdh, mh,upd,dupl character(c_char) :: afmt(*) - integer(psb_c_ipk_) :: info,n, fdupl + integer(psb_c_ipk_) :: info,n character(len=5) :: fafmt #ifdef HAVE_LIBRSB type(psb_d_rsb_sparse_mat) :: arsb @@ -301,11 +316,11 @@ contains #ifdef HAVE_LIBRSB case('RSB') call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & upd=upd,dupl=dupl,mold=arsb) + & upd=upd,mold=arsb) #endif case default call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & afmt=fafmt,upd=upd,dupl=dupl) + & afmt=fafmt,upd=upd) end select res = min(0,info) diff --git a/cbind/base/psb_s_tools_cbind_mod.F90 b/cbind/base/psb_s_tools_cbind_mod.F90 index d9584338..91d9b322 100644 --- a/cbind/base/psb_s_tools_cbind_mod.F90 +++ b/cbind/base/psb_s_tools_cbind_mod.F90 @@ -5,10 +5,11 @@ module psb_s_tools_cbind_mod use psb_objhandle_mod use psb_base_string_cbind_mod use psb_base_tools_cbind_mod - + contains - function psb_c_sgeall(xh,cdh) bind(c) result(res) + ! Should define geall_opt with DUPL argument + function psb_c_sgeall(xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -37,6 +38,35 @@ contains return end function psb_c_sgeall + function psb_c_sgeall_remote(xh,cdh) bind(c) result(res) + + implicit none + integer(psb_c_ipk_) :: res + type(psb_c_svector) :: xh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_s_vect_type), pointer :: xp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(xh%item)) then + return + end if + allocate(xp) + call psb_geall(xp,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) + xh%item = c_loc(xp) + res = min(0,info) + + return + end function psb_c_sgeall_remote + function psb_c_sgeasb(xh,cdh) bind(c) result(res) implicit none @@ -101,7 +131,7 @@ contains end function psb_c_sgefree - function psb_c_sgeins(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_sgeins(nz,irw,val,xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -131,10 +161,10 @@ contains ixb = psb_c_get_index_base() if (ixb == 1) then call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) else call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) end if res = min(0,info) @@ -142,20 +172,16 @@ contains return end function psb_c_sgeins - - function psb_c_sgeins_add(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_sspall(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res - integer(psb_c_ipk_), value :: nz - integer(psb_c_lpk_) :: irw(*) - real(c_float) :: val(*) - type(psb_c_svector) :: xh + type(psb_c_sspmat) :: mh type(psb_c_descriptor) :: cdh type(psb_desc_type), pointer :: descp - type(psb_s_vect_type), pointer :: xp - integer(psb_c_ipk_) :: ixb, info + type(psb_sspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info,n res = -1 if (c_associated(cdh%item)) then @@ -163,27 +189,19 @@ contains else return end if - if (c_associated(xh%item)) then - call c_f_pointer(xh%item,xp) - else + if (c_associated(mh%item)) then return end if - - ixb = psb_c_get_index_base() - if (ixb == 1) then - call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - else - call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - end if + allocate(ap) + call psb_spall(ap,descp,info) + mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_sgeins_add + end function psb_c_sspall - function psb_c_sspall(mh,cdh) bind(c) result(res) + function psb_c_sspall_remote(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -204,14 +222,12 @@ contains return end if allocate(ap) - call psb_spall(ap,descp,info) + call psb_spall(ap,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_sspall - - + end function psb_c_sspall_remote function psb_c_sspasb(mh,cdh) bind(c) result(res) @@ -241,7 +257,6 @@ contains return end function psb_c_sspasb - function psb_c_sspfree(mh,cdh) bind(c) result(res) implicit none @@ -275,7 +290,7 @@ contains #if 0 - function psb_c_sspasb_opt(mh,cdh,afmt,upd,dupl) bind(c) result(res) + function psb_c_sspasb_opt(mh,cdh,afmt,upd) bind(c) result(res) #ifdef HAVE_LIBRSB use psb_s_rsb_mat_mod @@ -284,7 +299,7 @@ contains integer(psb_c_ipk_) :: res integer(psb_c_ipk_), value :: cdh, mh,upd,dupl character(c_char) :: afmt(*) - integer(psb_c_ipk_) :: info,n, fdupl + integer(psb_c_ipk_) :: info,n character(len=5) :: fafmt #ifdef HAVE_LIBRSB type(psb_s_rsb_sparse_mat) :: arsb @@ -301,11 +316,11 @@ contains #ifdef HAVE_LIBRSB case('RSB') call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & upd=upd,dupl=dupl,mold=arsb) + & upd=upd,mold=arsb) #endif case default call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & afmt=fafmt,upd=upd,dupl=dupl) + & afmt=fafmt,upd=upd) end select res = min(0,info) diff --git a/cbind/base/psb_z_tools_cbind_mod.F90 b/cbind/base/psb_z_tools_cbind_mod.F90 index 572eeb95..59d4cca8 100644 --- a/cbind/base/psb_z_tools_cbind_mod.F90 +++ b/cbind/base/psb_z_tools_cbind_mod.F90 @@ -5,10 +5,11 @@ module psb_z_tools_cbind_mod use psb_objhandle_mod use psb_base_string_cbind_mod use psb_base_tools_cbind_mod - + contains - function psb_c_zgeall(xh,cdh) bind(c) result(res) + ! Should define geall_opt with DUPL argument + function psb_c_zgeall(xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -37,6 +38,35 @@ contains return end function psb_c_zgeall + function psb_c_zgeall_remote(xh,cdh) bind(c) result(res) + + implicit none + integer(psb_c_ipk_) :: res + type(psb_c_zvector) :: xh + type(psb_c_descriptor) :: cdh + + type(psb_desc_type), pointer :: descp + type(psb_z_vect_type), pointer :: xp + integer(psb_c_ipk_) :: info + + res = -1 + + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(xh%item)) then + return + end if + allocate(xp) + call psb_geall(xp,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) + xh%item = c_loc(xp) + res = min(0,info) + + return + end function psb_c_zgeall_remote + function psb_c_zgeasb(xh,cdh) bind(c) result(res) implicit none @@ -101,7 +131,7 @@ contains end function psb_c_zgefree - function psb_c_zgeins(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_zgeins(nz,irw,val,xh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -131,10 +161,10 @@ contains ixb = psb_c_get_index_base() if (ixb == 1) then call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) else call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_ovwrt_) + & xp,descp,info) end if res = min(0,info) @@ -142,20 +172,16 @@ contains return end function psb_c_zgeins - - function psb_c_zgeins_add(nz,irw,val,xh,cdh) bind(c) result(res) + function psb_c_zspall(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res - integer(psb_c_ipk_), value :: nz - integer(psb_c_lpk_) :: irw(*) - complex(c_double_complex) :: val(*) - type(psb_c_zvector) :: xh + type(psb_c_zspmat) :: mh type(psb_c_descriptor) :: cdh type(psb_desc_type), pointer :: descp - type(psb_z_vect_type), pointer :: xp - integer(psb_c_ipk_) :: ixb, info + type(psb_zspmat_type), pointer :: ap + integer(psb_c_ipk_) :: info,n res = -1 if (c_associated(cdh%item)) then @@ -163,27 +189,19 @@ contains else return end if - if (c_associated(xh%item)) then - call c_f_pointer(xh%item,xp) - else + if (c_associated(mh%item)) then return end if - - ixb = psb_c_get_index_base() - if (ixb == 1) then - call psb_geins(nz,irw(1:nz),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - else - call psb_geins(nz,(irw(1:nz)+(1-ixb)),val(1:nz),& - & xp,descp,info, dupl=psb_dupl_add_) - end if + allocate(ap) + call psb_spall(ap,descp,info) + mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_zgeins_add + end function psb_c_zspall - function psb_c_zspall(mh,cdh) bind(c) result(res) + function psb_c_zspall_remote(mh,cdh) bind(c) result(res) implicit none integer(psb_c_ipk_) :: res @@ -204,14 +222,12 @@ contains return end if allocate(ap) - call psb_spall(ap,descp,info) + call psb_spall(ap,descp,info,bldmode=psb_matbld_remote_,dupl=psb_dupl_add_) mh%item = c_loc(ap) res = min(0,info) return - end function psb_c_zspall - - + end function psb_c_zspall_remote function psb_c_zspasb(mh,cdh) bind(c) result(res) @@ -241,7 +257,6 @@ contains return end function psb_c_zspasb - function psb_c_zspfree(mh,cdh) bind(c) result(res) implicit none @@ -275,7 +290,7 @@ contains #if 0 - function psb_c_zspasb_opt(mh,cdh,afmt,upd,dupl) bind(c) result(res) + function psb_c_zspasb_opt(mh,cdh,afmt,upd) bind(c) result(res) #ifdef HAVE_LIBRSB use psb_z_rsb_mat_mod @@ -284,7 +299,7 @@ contains integer(psb_c_ipk_) :: res integer(psb_c_ipk_), value :: cdh, mh,upd,dupl character(c_char) :: afmt(*) - integer(psb_c_ipk_) :: info,n, fdupl + integer(psb_c_ipk_) :: info,n character(len=5) :: fafmt #ifdef HAVE_LIBRSB type(psb_z_rsb_sparse_mat) :: arsb @@ -301,11 +316,11 @@ contains #ifdef HAVE_LIBRSB case('RSB') call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & upd=upd,dupl=dupl,mold=arsb) + & upd=upd,mold=arsb) #endif case default call psb_spasb(double_spmat_pool(mh)%item,descriptor_pool(cdh)%item,info,& - & afmt=fafmt,upd=upd,dupl=dupl) + & afmt=fafmt,upd=upd) end select res = min(0,info) diff --git a/cbind/krylov/Makefile b/cbind/krylov/Makefile index 2706271a..041e23d4 100644 --- a/cbind/krylov/Makefile +++ b/cbind/krylov/Makefile @@ -16,11 +16,12 @@ CMOD=psb_krylov_cbind.h LIBNAME=$(CKRYLOVLIBNAME) -lib: $(OBJS) $(CMOD) +objs: $(OBJS) $(CMOD) + /bin/cp -p *$(.mod) $(CMOD) $(HERE) +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) /bin/cp -p $(HERE)/$(LIBNAME) $(LIBDIR) - /bin/cp -p *$(.mod) $(CMOD) $(HERE) psb_skrylov_cbind_mod.o psb_dkrylov_cbind_mod.o psb_ckrylov_cbind_mod.o psb_zkrylov_cbind_mod.o: psb_base_krylov_cbind_mod.o veryclean: clean diff --git a/cbind/prec/Makefile b/cbind/prec/Makefile index 8dee57e8..c6f53bf8 100644 --- a/cbind/prec/Makefile +++ b/cbind/prec/Makefile @@ -18,11 +18,12 @@ CMOD=psb_prec_cbind.h psb_c_sprec.h psb_c_dprec.h psb_c_cprec.h psb_c_zprec.h LIBNAME=$(CPRECLIBNAME) -lib: $(OBJS) $(CMOD) +objs: $(OBJS) $(CMOD) + /bin/cp -p *$(.mod) $(CMOD) $(HERE) +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) /bin/cp -p $(HERE)/$(LIBNAME) $(LIBDIR) - /bin/cp -p *$(.mod) $(CMOD) $(HERE) psb_prec_cbind_mod.o: psb_sprec_cbind_mod.o psb_dprec_cbind_mod.o psb_cprec_cbind_mod.o psb_zprec_cbind_mod.o veryclean: clean diff --git a/cbind/util/Makefile b/cbind/util/Makefile index d37cb680..62733d4a 100644 --- a/cbind/util/Makefile +++ b/cbind/util/Makefile @@ -18,11 +18,12 @@ CMOD=psb_util_cbind.h psb_c_cutil.h psb_c_zutil.h psb_c_dutil.h psb_c_sutil.h LIBNAME=$(CUTILLIBNAME) -lib: $(OBJS) $(CMOD) +objs: $(OBJS) $(CMOD) + /bin/cp -p *$(.mod) $(CMOD) $(HERE) +lib: objs $(AR) $(HERE)/$(LIBNAME) $(OBJS) $(RANLIB) $(HERE)/$(LIBNAME) /bin/cp -p $(HERE)/$(LIBNAME) $(LIBDIR) - /bin/cp -p *$(.mod) $(CMOD) $(HERE) psb_util_cbind_mod.o: psb_c_util_cbind_mod.o psb_d_util_cbind_mod.o psb_s_util_cbind_mod.o psb_z_util_cbind_mod.o veryclean: clean diff --git a/cbind/util/psb_c_cutil.h b/cbind/util/psb_c_cutil.h index 4d2755d6..9da81aa1 100644 --- a/cbind/util/psb_c_cutil.h +++ b/cbind/util/psb_c_cutil.h @@ -8,6 +8,8 @@ extern "C" { /* I/O Routine */ psb_i_t psb_c_cmm_mat_write(psb_c_cspmat *ah, char *matrixtitle, char *filename); +psb_i_t psb_c_cglobal_mat_write(psb_c_cspmat *ah,psb_c_descriptor *cdh); +psb_i_t psb_c_cglobal_vec_write(psb_c_cvector *vh,psb_c_descriptor *cdh); #ifdef __cplusplus } diff --git a/cbind/util/psb_c_dutil.h b/cbind/util/psb_c_dutil.h index 306d7310..144e156d 100644 --- a/cbind/util/psb_c_dutil.h +++ b/cbind/util/psb_c_dutil.h @@ -8,6 +8,8 @@ extern "C" { /* I/O Routine */ psb_i_t psb_c_dmm_mat_write(psb_c_dspmat *ah, char *matrixtitle, char *filename); +psb_i_t psb_c_dglobal_mat_write(psb_c_dspmat *ah,psb_c_descriptor *cdh); +psb_i_t psb_c_dglobal_vec_write(psb_c_dvector *vh,psb_c_descriptor *cdh); #ifdef __cplusplus } diff --git a/cbind/util/psb_c_sutil.h b/cbind/util/psb_c_sutil.h index 9dd1ed54..a70097ed 100644 --- a/cbind/util/psb_c_sutil.h +++ b/cbind/util/psb_c_sutil.h @@ -8,6 +8,8 @@ extern "C" { /* I/O Routine */ psb_i_t psb_c_smm_mat_write(psb_c_sspmat *ah, char *matrixtitle, char *filename); +psb_i_t psb_c_sglobal_mat_write(psb_c_sspmat *ah,psb_c_descriptor *cdh); +psb_i_t psb_c_sglobal_vec_write(psb_c_svector *vh,psb_c_descriptor *cdh); #ifdef __cplusplus } diff --git a/cbind/util/psb_c_util_cbind_mod.f90 b/cbind/util/psb_c_util_cbind_mod.f90 index 3761cd08..ae3f6cf8 100644 --- a/cbind/util/psb_c_util_cbind_mod.f90 +++ b/cbind/util/psb_c_util_cbind_mod.f90 @@ -41,4 +41,91 @@ contains end function psb_c_cmm_mat_write + function psb_c_cglobal_mat_write(ah,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_cspmat_type), pointer :: ap + type(psb_desc_type), pointer :: descp + ! Local variables + type(psb_cspmat_type) :: aglobal + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: matrixname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(aglobal,ap,descp,info) + if (iam == psb_root_) then + write(matrixname,'("A-np-",I1,".mtx")') np + call mm_mat_write(aglobal,"Global matrix",info,filename=trim(matrixname)) + end if + + call psb_spfree(aglobal,descp,info) + res = info + + end function psb_c_cglobal_mat_write + + function psb_c_cglobal_vec_write(vh,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_cvector) :: vh + type(psb_c_descriptor) :: cdh + + type(psb_c_vect_type), pointer :: vp + type(psb_desc_type), pointer :: descp + ! Local variables + complex(psb_spk_), allocatable :: vglobal(:) + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: vecname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(vh%item)) then + call c_f_pointer(vh%item,vp) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(vglobal,vp,descp,info) + if (iam == psb_root_) then + write(vecname,'("v-np-",I1,".mtx")') np + call mm_array_write(vglobal,"Global vector",info,filename=trim(vecname)) + end if + + deallocate(vglobal,stat=info) + res = info + + end function psb_c_cglobal_vec_write + + end module psb_cutil_cbind_mod diff --git a/cbind/util/psb_c_zutil.h b/cbind/util/psb_c_zutil.h index f5d0f225..4e308c36 100644 --- a/cbind/util/psb_c_zutil.h +++ b/cbind/util/psb_c_zutil.h @@ -8,6 +8,8 @@ extern "C" { /* I/O Routine */ psb_i_t psb_c_zmm_mat_write(psb_c_zspmat *ah, char *matrixtitle, char *filename); +psb_i_t psb_c_zglobal_mat_write(psb_c_zspmat *ah,psb_c_descriptor *cdh); +psb_i_t psb_c_zglobal_vec_write(psb_c_zvector *vh,psb_c_descriptor *cdh); #ifdef __cplusplus } diff --git a/cbind/util/psb_d_util_cbind_mod.f90 b/cbind/util/psb_d_util_cbind_mod.f90 index 245cff5e..29fec75b 100644 --- a/cbind/util/psb_d_util_cbind_mod.f90 +++ b/cbind/util/psb_d_util_cbind_mod.f90 @@ -41,4 +41,91 @@ contains end function psb_c_dmm_mat_write + function psb_c_dglobal_mat_write(ah,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_dspmat_type), pointer :: ap + type(psb_desc_type), pointer :: descp + ! Local variables + type(psb_dspmat_type) :: aglobal + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: matrixname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(aglobal,ap,descp,info) + if (iam == psb_root_) then + write(matrixname,'("A-np-",I1,".mtx")') np + call mm_mat_write(aglobal,"Global matrix",info,filename=trim(matrixname)) + end if + + call psb_spfree(aglobal,descp,info) + res = info + + end function psb_c_dglobal_mat_write + + function psb_c_dglobal_vec_write(vh,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_dvector) :: vh + type(psb_c_descriptor) :: cdh + + type(psb_d_vect_type), pointer :: vp + type(psb_desc_type), pointer :: descp + ! Local variables + real(psb_dpk_), allocatable :: vglobal(:) + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: vecname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(vh%item)) then + call c_f_pointer(vh%item,vp) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(vglobal,vp,descp,info) + if (iam == psb_root_) then + write(vecname,'("v-np-",I1,".mtx")') np + call mm_array_write(vglobal,"Global vector",info,filename=trim(vecname)) + end if + + deallocate(vglobal,stat=info) + res = info + + end function psb_c_dglobal_vec_write + + end module psb_dutil_cbind_mod diff --git a/cbind/util/psb_s_util_cbind_mod.f90 b/cbind/util/psb_s_util_cbind_mod.f90 index e857cde9..0dfe3ddc 100644 --- a/cbind/util/psb_s_util_cbind_mod.f90 +++ b/cbind/util/psb_s_util_cbind_mod.f90 @@ -41,4 +41,91 @@ contains end function psb_c_smm_mat_write + function psb_c_sglobal_mat_write(ah,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_sspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_sspmat_type), pointer :: ap + type(psb_desc_type), pointer :: descp + ! Local variables + type(psb_sspmat_type) :: aglobal + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: matrixname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(aglobal,ap,descp,info) + if (iam == psb_root_) then + write(matrixname,'("A-np-",I1,".mtx")') np + call mm_mat_write(aglobal,"Global matrix",info,filename=trim(matrixname)) + end if + + call psb_spfree(aglobal,descp,info) + res = info + + end function psb_c_sglobal_mat_write + + function psb_c_sglobal_vec_write(vh,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_svector) :: vh + type(psb_c_descriptor) :: cdh + + type(psb_s_vect_type), pointer :: vp + type(psb_desc_type), pointer :: descp + ! Local variables + real(psb_spk_), allocatable :: vglobal(:) + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: vecname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(vh%item)) then + call c_f_pointer(vh%item,vp) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(vglobal,vp,descp,info) + if (iam == psb_root_) then + write(vecname,'("v-np-",I1,".mtx")') np + call mm_array_write(vglobal,"Global vector",info,filename=trim(vecname)) + end if + + deallocate(vglobal,stat=info) + res = info + + end function psb_c_sglobal_vec_write + + end module psb_sutil_cbind_mod diff --git a/cbind/util/psb_z_util_cbind_mod.f90 b/cbind/util/psb_z_util_cbind_mod.f90 index e0b60005..792f836f 100644 --- a/cbind/util/psb_z_util_cbind_mod.f90 +++ b/cbind/util/psb_z_util_cbind_mod.f90 @@ -41,4 +41,91 @@ contains end function psb_c_zmm_mat_write + function psb_c_zglobal_mat_write(ah,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zspmat) :: ah + type(psb_c_descriptor) :: cdh + + type(psb_zspmat_type), pointer :: ap + type(psb_desc_type), pointer :: descp + ! Local variables + type(psb_zspmat_type) :: aglobal + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: matrixname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(ah%item)) then + call c_f_pointer(ah%item,ap) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(aglobal,ap,descp,info) + if (iam == psb_root_) then + write(matrixname,'("A-np-",I1,".mtx")') np + call mm_mat_write(aglobal,"Global matrix",info,filename=trim(matrixname)) + end if + + call psb_spfree(aglobal,descp,info) + res = info + + end function psb_c_zglobal_mat_write + + function psb_c_zglobal_vec_write(vh,cdh) bind(c) result(res) + use psb_base_mod + use psb_util_mod + use psb_base_string_cbind_mod + implicit none + integer(psb_c_ipk_) :: res + + type(psb_c_zvector) :: vh + type(psb_c_descriptor) :: cdh + + type(psb_z_vect_type), pointer :: vp + type(psb_desc_type), pointer :: descp + ! Local variables + complex(psb_dpk_), allocatable :: vglobal(:) + integer(psb_ipk_) :: info, iam, np + type(psb_ctxt_type) :: ctxt + character(len=40) :: vecname + + res = -1 + if (c_associated(cdh%item)) then + call c_f_pointer(cdh%item,descp) + else + return + end if + if (c_associated(vh%item)) then + call c_f_pointer(vh%item,vp) + else + return + end if + + ctxt = descp%get_ctxt() + call psb_info(ctxt,iam,np) + call psb_gather(vglobal,vp,descp,info) + if (iam == psb_root_) then + write(vecname,'("v-np-",I1,".mtx")') np + call mm_array_write(vglobal,"Global vector",info,filename=trim(vecname)) + end if + + deallocate(vglobal,stat=info) + res = info + + end function psb_c_zglobal_vec_write + + end module psb_zutil_cbind_mod diff --git a/compile b/compile new file mode 100644 index 00000000..e69de29b diff --git a/config/acx_mpi.m4 b/config/acx_mpi.m4 index 77f433d8..c3231a93 100644 --- a/config/acx_mpi.m4 +++ b/config/acx_mpi.m4 @@ -105,16 +105,16 @@ if test x = x"$MPILIBS"; then AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) fi -dnl We have to use AC_TRY_COMPILE and not AC_CHECK_HEADER because the +dnl We have to use AC_COMPILE_IFELSE and not AC_CHECK_HEADER because the dnl latter uses $CPP, not $CC (which may be mpicc). AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then AC_MSG_CHECKING([for mpi.h]) - AC_TRY_COMPILE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" + AC_COMPILE_IFELSE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" AC_MSG_RESULT(no)]) fi], [C++], [if test x != x"$MPILIBS"; then AC_MSG_CHECKING([for mpi.h]) - AC_TRY_COMPILE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" + AC_COMPILE_IFELSE([#include ],[],[AC_MSG_RESULT(yes)], [MPILIBS="" AC_MSG_RESULT(no)]) fi], [Fortran 77], [if test x != x"$MPILIBS"; then diff --git a/config/pac.m4 b/config/pac.m4 index 08554d67..773b7e59 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -79,8 +79,8 @@ dnl Warning : square brackets are EVIL! [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -117,8 +117,8 @@ dnl Warning : square brackets are EVIL! [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -154,8 +154,8 @@ AC_DEFUN(PAC_CHECK_HAVE_GFORTRAN, [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -188,8 +188,8 @@ AC_DEFUN(PAC_HAVE_MODERN_GFORTRAN, ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) AC_MSG_NOTICE([Sorry, we require GNU Fortran version 4.9 or later.]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -249,8 +249,8 @@ AC_DEFUN(PAC_FORTRAN_CHECK_HAVE_MPI_MOD, [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -282,8 +282,8 @@ dnl Warning : square brackets are EVIL! ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) pac_cv_mpi_f08="no"; - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -318,7 +318,7 @@ AC_DEFUN([PAC_ARG_WITH_FLAGS], AC_MSG_CHECKING([whether additional [$2] flags should be added (should be invoked only once)]) dnl AC_MSG_CHECKING([whether additional [$2] flags should be added]) AC_ARG_WITH($1, -AC_HELP_STRING([--with-$1], +AS_HELP_STRING([--with-$1], [additional [$2] flags to be added: will prepend to [$2]]), [ $2="${withval} ${$2}" @@ -350,7 +350,7 @@ AC_DEFUN([PAC_ARG_WITH_LIBS], [ AC_MSG_CHECKING([whether additional libraries are needed]) AC_ARG_WITH(libs, -AC_HELP_STRING([--with-libs], +AS_HELP_STRING([--with-libs], [List additional link flags here. For example, --with-libs=-lspecial_system_lib or --with-libs=-L/path/to/libs]), [ @@ -377,7 +377,7 @@ dnl AC_DEFUN([PAC_ARG_SERIAL_MPI], [AC_MSG_CHECKING([whether we want serial mpi stubs]) AC_ARG_ENABLE(serial, -AC_HELP_STRING([--enable-serial], +AS_HELP_STRING([--enable-serial], [Specify whether to enable a fake mpi library to run in serial mode. ]), [ pac_cv_serial_mpi="yes"; @@ -408,7 +408,7 @@ dnl AC_DEFUN([PAC_ARG_OPENMP], [AC_MSG_CHECKING([whether we want openmp ]) AC_ARG_ENABLE(openmp, -AC_HELP_STRING([--enable-openmp], +AS_HELP_STRING([--enable-openmp], [Specify whether to enable openmp. ]), [ pac_cv_openmp="yes"; @@ -452,7 +452,7 @@ AC_DEFUN([PAC_ARG_LONG_INTEGERS], [ AC_MSG_CHECKING([whether we want long (8 bytes) integers]) AC_ARG_ENABLE(long-integers, -AC_HELP_STRING([--enable-long-integers], +AS_HELP_STRING([--enable-long-integers], [Specify usage of 64 bits integers. ]), [ pac_cv_long_integers="yes"; @@ -484,7 +484,7 @@ AC_DEFUN([PAC_ARG_WITH_IPK], [ AC_MSG_CHECKING([what size in bytes we want for local indices and data]) AC_ARG_WITH(ipk, - AC_HELP_STRING([--with-ipk=], + AS_HELP_STRING([--with-ipk=], [Specify the size in bytes for local indices and data, default 4 bytes. ]), [pac_cv_ipk_size=$withval;], [pac_cv_ipk_size=4;] @@ -513,7 +513,7 @@ AC_DEFUN([PAC_ARG_WITH_LPK], [ AC_MSG_CHECKING([what size in bytes we want for global indices and data]) AC_ARG_WITH(lpk, - AC_HELP_STRING([--with-lpk=], + AS_HELP_STRING([--with-lpk=], [Specify the size in bytes for global indices and data, default 8 bytes. ]), [pac_cv_lpk_size=$withval;], [pac_cv_lpk_size=8;] @@ -552,8 +552,8 @@ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then ifelse([$1], , :, [rm -rf conftest* $1]) else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ rm -rf conftest* $2 ])dnl @@ -634,8 +634,8 @@ end program testtr15581], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -669,8 +669,8 @@ end program conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -715,8 +715,8 @@ end module conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -759,8 +759,8 @@ end program conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -818,8 +818,8 @@ end program conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -867,8 +867,8 @@ end program conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -912,8 +912,8 @@ end program stt], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -955,8 +955,8 @@ end program xtt], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -977,7 +977,7 @@ dnl @author Michele Martone dnl @author Salvatore Filippone dnl AC_DEFUN(PAC_CHECK_BLACS, -[AC_ARG_WITH(blacs, AC_HELP_STRING([--with-blacs=LIB], [Specify BLACSLIBNAME or -lBLACSLIBNAME or the absolute library filename.]), +[AC_ARG_WITH(blacs, AS_HELP_STRING([--with-blacs=LIB], [Specify BLACSLIBNAME or -lBLACSLIBNAME or the absolute library filename.]), [psblas_cv_blacs=$withval], [psblas_cv_blacs='']) @@ -1212,7 +1212,7 @@ dnl AC_REQUIRE([AC_FC_LIBRARY_LDFLAGS]) pac_blas_ok=no AC_ARG_WITH(blas, - [AC_HELP_STRING([--with-blas=], [use BLAS library ])]) + [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) case $with_blas in yes | "") ;; no) pac_blas_ok=disable ;; @@ -1220,7 +1220,7 @@ case $with_blas in *) BLAS_LIBS="-l$with_blas" ;; esac AC_ARG_WITH(blasdir, - [AC_HELP_STRING([--with-blasdir=], [search for BLAS library in ])]) + [AS_HELP_STRING([--with-blasdir=], [search for BLAS library in ])]) case $with_blasdir in "") ;; *) if test -d $with_blasdir; then @@ -1456,7 +1456,7 @@ AC_REQUIRE([PAC_BLAS]) pac_lapack_ok=no AC_ARG_WITH(lapack, - [AC_HELP_STRING([--with-lapack=], [use LAPACK library ])]) + [AS_HELP_STRING([--with-lapack=], [use LAPACK library ])]) case $with_lapack in yes | "") ;; no) pac_lapack_ok=disable ;; @@ -1488,8 +1488,8 @@ EOF AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD fi rm -f conftest* LIBS="$save_LIBS" @@ -1515,8 +1515,8 @@ EOF AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD fi rm -f conftest* LIBS="$save_LIBS" @@ -1580,8 +1580,8 @@ end program conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -1608,8 +1608,8 @@ AC_DEFUN(PAC_FORTRAN_TEST_ISO_FORTRAN_ENV, [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -1642,8 +1642,8 @@ end program conftest], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -1686,8 +1686,8 @@ end program xtt], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -1731,8 +1731,8 @@ end program xtt], [ AC_MSG_RESULT([yes]) ifelse([$1], , :, [ $1])], [ AC_MSG_RESULT([no]) - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD ifelse([$2], , , [ $2])]) AC_LANG_POP([Fortran]) ]) @@ -1752,17 +1752,17 @@ dnl dnl @author Salvatore Filippone dnl AC_DEFUN(PAC_CHECK_AMD, -[AC_ARG_WITH(amd, AC_HELP_STRING([--with-amd=LIBNAME], [Specify the library name for AMD library. +[AC_ARG_WITH(amd, AS_HELP_STRING([--with-amd=LIBNAME], [Specify the library name for AMD library. Default: "-lamd"]), [psblas_cv_amd=$withval], [psblas_cv_amd='-lamd']) -AC_ARG_WITH(amddir, AC_HELP_STRING([--with-amddir=DIR], [Specify the directory for AMD library and includes.]), +AC_ARG_WITH(amddir, AS_HELP_STRING([--with-amddir=DIR], [Specify the directory for AMD library and includes.]), [psblas_cv_amddir=$withval], [psblas_cv_amddir='']) -AC_ARG_WITH(amdincdir, AC_HELP_STRING([--with-amdincdir=DIR], [Specify the directory for AMD includes.]), +AC_ARG_WITH(amdincdir, AS_HELP_STRING([--with-amdincdir=DIR], [Specify the directory for AMD includes.]), [psblas_cv_amdincdir=$withval], [psblas_cv_amdincdir='']) -AC_ARG_WITH(amdlibdir, AC_HELP_STRING([--with-amdlibdir=DIR], [Specify the directory for AMD library.]), +AC_ARG_WITH(amdlibdir, AS_HELP_STRING([--with-amdlibdir=DIR], [Specify the directory for AMD library.]), [psblas_cv_amdlibdir=$withval], [psblas_cv_amdlibdir='']) @@ -1862,20 +1862,20 @@ dnl dnl @author Salvatore Filippone dnl AC_DEFUN(PAC_CHECK_METIS, -[AC_ARG_WITH(metis, AC_HELP_STRING([--with-metis=LIBNAME], [Specify the library name for METIS library. +[AC_ARG_WITH(metis, AS_HELP_STRING([--with-metis=LIBNAME], [Specify the library name for METIS library. Default: "-lmetis"]), [psblas_cv_metis=$withval], [psblas_cv_metis='-lmetis']) -AC_ARG_WITH(metisincfile, AC_HELP_STRING([--with-metisincfile=DIR], [Specify the name for METIS include file.]), +AC_ARG_WITH(metisincfile, AS_HELP_STRING([--with-metisincfile=DIR], [Specify the name for METIS include file.]), [psblas_cv_metisincfile=$withval], [psblas_cv_metisincfile='metis.h']) -AC_ARG_WITH(metisdir, AC_HELP_STRING([--with-metisdir=DIR], [Specify the directory for METIS library and includes.]), +AC_ARG_WITH(metisdir, AS_HELP_STRING([--with-metisdir=DIR], [Specify the directory for METIS library and includes.]), [psblas_cv_metisdir=$withval], [psblas_cv_metisdir='']) -AC_ARG_WITH(metisincdir, AC_HELP_STRING([--with-metisincdir=DIR], [Specify the directory for METIS includes.]), +AC_ARG_WITH(metisincdir, AS_HELP_STRING([--with-metisincdir=DIR], [Specify the directory for METIS includes.]), [psblas_cv_metisincdir=$withval], [psblas_cv_metisincdir='']) -AC_ARG_WITH(metislibdir, AC_HELP_STRING([--with-metislibdir=DIR], [Specify the directory for METIS library.]), +AC_ARG_WITH(metislibdir, AS_HELP_STRING([--with-metislibdir=DIR], [Specify the directory for METIS library.]), [psblas_cv_metislibdir=$withval], [psblas_cv_metislibdir='']) @@ -1898,7 +1898,7 @@ if test "x$psblas_cv_metislibdir" != "x"; then fi AC_MSG_NOTICE([metis dir $psblas_cv_metisdir]) -AC_CHECK_HEADERS([limits.h $psblas_cv_metisincfile], +AC_CHECK_HEADERS([limits.h "$psblas_cv_metisincfile"], [pac_metis_header_ok=yes], [pac_metis_header_ok=no; METIS_INCLUDES=""]) if test "x$pac_metis_header_ok" == "xno" ; then @@ -1908,7 +1908,7 @@ dnl Maybe Include or include subdirs? CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS" AC_MSG_CHECKING([for metis_h in $METIS_INCLUDES]) - AC_CHECK_HEADERS([limits.h $psblas_cv_metisincfile], + AC_CHECK_HEADERS([limits.h "$psblas_cv_metisincfile"], [pac_metis_header_ok=yes], [pac_metis_header_ok=no; METIS_INCLUDES=""]) fi @@ -1917,7 +1917,7 @@ dnl Maybe new structure with METIS UFconfig METIS? unset ac_cv_header_metis_h METIS_INCLUDES="-I$psblas_cv_metisdir/UFconfig -I$psblas_cv_metisdir/METIS/Include -I$psblas_cv_metisdir/METIS/Include" CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS" - AC_CHECK_HEADERS([limits.h $psblas_cv_metisincfile], + AC_CHECK_HEADERS([limits.h "$psblas_cv_metisincfile"], [pac_metis_header_ok=yes], [pac_metis_header_ok=no; METIS_INCLUDES=""]) fi diff --git a/configure b/configure index fb8d0800..c20b7686 100755 --- a/configure +++ b/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for PSBLAS 3.7.0. +# Generated by GNU Autoconf 2.71 for PSBLAS 3.7.0. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,53 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +223,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +255,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: https://github.com/sfilippone/psblas3/issues about your $0: system, including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -294,6 +295,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +313,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +335,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +344,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +383,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +401,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +433,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +462,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +506,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +520,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +537,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -588,40 +619,36 @@ PACKAGE_URL='' ac_unique_file="base/modules/psb_base_mod.f90" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -667,13 +694,13 @@ LAPACK_LIBS OPENMP_CXXFLAGS OPENMP_CFLAGS OPENMP_FCFLAGS -EGREP -GREP -CPP AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V +CSCOPE +ETAGS +CTAGS am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE @@ -814,8 +841,7 @@ CXXFLAGS CCC MPICC MPICXX -MPIFC -CPP' +MPIFC' # Initialize some variables set by options. @@ -884,8 +910,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -926,9 +950,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -952,9 +976,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1165,9 +1189,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1181,9 +1205,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1227,9 +1251,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1245,7 +1269,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1309,7 +1333,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1515,7 +1539,6 @@ Some influential environment variables: MPICC MPI C compiler command MPICXX MPI C++ compiler command MPIFC MPI Fortran compiler command - CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1536,9 +1559,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1566,7 +1589,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1574,7 +1598,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1584,9 +1608,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF PSBLAS configure 3.7.0 -generated by GNU Autoconf 2.69 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1603,14 +1627,14 @@ fi ac_fn_fc_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1618,14 +1642,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_fc_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1641,14 +1666,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1656,14 +1681,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1679,14 +1705,14 @@ fi ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1694,14 +1720,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1717,14 +1744,14 @@ fi ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1732,17 +1759,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1763,11 +1791,12 @@ fi ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1775,16 +1804,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1802,24 +1824,25 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func @@ -1830,14 +1853,14 @@ $as_echo "$ac_res" >&6; } ac_fn_cxx_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1845,17 +1868,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1876,11 +1900,12 @@ fi ac_fn_cxx_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1888,16 +1913,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1915,24 +1933,25 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_cxx_check_func @@ -1943,14 +1962,14 @@ $as_echo "$ac_res" >&6; } ac_fn_fc_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1958,17 +1977,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1985,8 +2005,8 @@ fi # ac_fn_c_try_run LINENO # ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack @@ -1996,25 +2016,26 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status @@ -2039,7 +2060,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; @@ -2049,14 +2070,15 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2066,9 +2088,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid; break -else +else $as_nop as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= @@ -2076,14 +2099,14 @@ else fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; @@ -2093,14 +2116,15 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; @@ -2110,9 +2134,10 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_lo=$ac_mid; break -else +else $as_nop as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= @@ -2120,14 +2145,14 @@ else fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done -else +else $as_nop ac_lo= ac_hi= fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val @@ -2135,7 +2160,7 @@ while test "x$ac_lo" != "x$ac_hi"; do /* end confdefs.h. */ $4 int -main () +main (void) { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; @@ -2145,12 +2170,13 @@ return test_array [0]; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_hi=$ac_mid -else +else $as_nop as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; @@ -2160,12 +2186,12 @@ esac cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } #include #include int -main () +main (void) { FILE *f = fopen ("conftest.val", "w"); @@ -2193,9 +2219,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : echo >>conftest.val; read $3 &5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -2252,128 +2242,59 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ----------------------------------------------------------- ## -## Report this to https://github.com/sfilippone/psblas3/issues ## -## ----------------------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by PSBLAS $as_me 3.7.0, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -2406,8 +2327,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2442,7 +2367,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2477,11 +2402,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2492,8 +2419,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2517,7 +2444,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2525,14 +2452,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2540,15 +2467,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2556,8 +2483,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2571,63 +2498,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2637,112 +2549,744 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} -# VERSION is the file containing the PSBLAS version code -# FIXME -psblas_cv_version="3.7.0" +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; -# A sample source file +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' -# Our custom M4 macros are in the 'config' directory +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' -{ $as_echo "$as_me:${as_lineno-$LINENO}: --------------------------------------------------------------------------------- - Welcome to the $PACKAGE_NAME $psblas_cv_version configure Script. +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif - This creates Make.inc, but if you read carefully the - documentation, you can make your own by hand for your needs. +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); - Be sure to specify the library paths of your interest. Examples: - ./configure --with-libs=-L/some/directory/LIB <- will append to LIBS +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="missing compile install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.." + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# VERSION is the file containing the PSBLAS version code +# FIXME +psblas_cv_version="3.7.0" + +# A sample source file + + +# Our custom M4 macros are in the 'config' directory + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: +-------------------------------------------------------------------------------- + Welcome to the $PACKAGE_NAME $psblas_cv_version configure Script. + + This creates Make.inc, but if you read carefully the + documentation, you can make your own by hand for your needs. + + Be sure to specify the library paths of your interest. Examples: + ./configure --with-libs=-L/some/directory/LIB <- will append to LIBS FC=mpif90 CC=mpicc ./configure <- will force FC,CC See ./configure --help=short fore more info. -------------------------------------------------------------------------------- " >&5 -$as_echo "$as_me: +printf "%s\n" "$as_me: -------------------------------------------------------------------------------- Welcome to the $PACKAGE_NAME $psblas_cv_version configure Script. @@ -2763,36 +3307,9 @@ $as_echo "$as_me: # Installation. # # -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - -# Find a good install program. We prefer a C program (faster), + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install @@ -2806,20 +3323,25 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; @@ -2829,13 +3351,13 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else @@ -2843,12 +3365,12 @@ case $as_dir/ in #(( echo one > conftest.one echo two > conftest.two mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" break 3 fi fi @@ -2864,7 +3386,7 @@ IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi - if test "${ac_cv_path_install+set}" = set; then + if test ${ac_cv_path_install+y}; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a @@ -2874,8 +3396,8 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -2886,8 +3408,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to install" >&5 -$as_echo_n "checking where to install... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking where to install" >&5 +printf %s "checking where to install... " >&6; } case $prefix in \/* ) eval "INSTALL_DIR=$prefix";; * ) eval "INSTALL_DIR=/usr/local/psblas";; @@ -2909,8 +3431,8 @@ case $samplesdir in * ) eval "INSTALL_SAMPLESDIR=$INSTALL_DIR/samples";; esac INSTALL_MODULESDIR=$INSTALL_DIR/modules -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_MODULESDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR" >&5 -$as_echo "$INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_MODULESDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_MODULESDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR" >&5 +printf "%s\n" "$INSTALL_DIR $INSTALL_INCLUDEDIR $INSTALL_MODULESDIR $INSTALL_LIBDIR $INSTALL_DOCSDIR $INSTALL_SAMPLESDIR" >&6; } save_FCFLAGS="$FCFLAGS"; ac_ext=${ac_fc_srcext-f} @@ -2922,11 +3444,12 @@ if test -n "$ac_tool_prefix"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_FC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_FC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$FC"; then ac_cv_prog_FC="$FC" # Let the user override the test. else @@ -2934,11 +3457,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_FC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2949,11 +3476,11 @@ fi fi FC=$ac_cv_prog_FC if test -n "$FC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FC" >&5 -$as_echo "$FC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $FC" >&5 +printf "%s\n" "$FC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -2966,11 +3493,12 @@ if test -z "$FC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_FC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_FC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_FC"; then ac_cv_prog_ac_ct_FC="$ac_ct_FC" # Let the user override the test. else @@ -2978,11 +3506,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_FC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2993,11 +3525,11 @@ fi fi ac_ct_FC=$ac_cv_prog_ac_ct_FC if test -n "$ac_ct_FC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FC" >&5 -$as_echo "$ac_ct_FC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FC" >&5 +printf "%s\n" "$ac_ct_FC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3009,8 +3541,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac FC=$ac_ct_FC @@ -3019,7 +3551,7 @@ fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -3029,7 +3561,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3039,7 +3571,7 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done rm -f a.out @@ -3054,9 +3586,9 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Fortran compiler works" >&5 -$as_echo_n "checking whether the Fortran compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the Fortran compiler works" >&5 +printf %s "checking whether the Fortran compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" @@ -3077,11 +3609,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3098,7 +3631,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3114,44 +3647,46 @@ do done test "$ac_cv_exeext" = no && ac_cv_exeext= -else +else $as_nop ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "Fortran compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler default output file name" >&5 -$as_echo_n "checking for Fortran compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran compiler default output file name" >&5 +printf %s "checking for Fortran compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3165,15 +3700,15 @@ for ac_file in conftest.exe conftest conftest.*; do * ) break;; esac done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext @@ -3188,8 +3723,8 @@ _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in @@ -3197,10 +3732,10 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in @@ -3208,34 +3743,35 @@ $as_echo "$ac_try_echo"; } >&5 *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run Fortran compiled programs. + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run Fortran compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main @@ -3248,11 +3784,12 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3261,30 +3798,31 @@ $as_echo "$ac_try_echo"; } >&5 break;; esac done -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT # If we don't use `.F' as extension, the preprocessor is not run on the # input file. (Note that this only needs to work for GNU compilers.) ac_save_ext=$ac_ext ac_ext=F -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Fortran compiler" >&5 -$as_echo_n "checking whether we are using the GNU Fortran compiler... " >&6; } -if ${ac_cv_fc_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU Fortran" >&5 +printf %s "checking whether the compiler supports GNU Fortran... " >&6; } +if test ${ac_cv_fc_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF program main #ifndef __GNUC__ @@ -3293,43 +3831,48 @@ else end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : +if ac_fn_fc_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_fc_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_compiler_gnu" >&5 -$as_echo "$ac_cv_fc_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_fc_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_fc_compiler_gnu + ac_ext=$ac_save_ext -ac_test_FCFLAGS=${FCFLAGS+set} +ac_test_FCFLAGS=${FCFLAGS+y} ac_save_FCFLAGS=$FCFLAGS FCFLAGS= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -g" >&5 -$as_echo_n "checking whether $FC accepts -g... " >&6; } -if ${ac_cv_prog_fc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $FC accepts -g" >&5 +printf %s "checking whether $FC accepts -g... " >&6; } +if test ${ac_cv_prog_fc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop FCFLAGS=-g cat > conftest.$ac_ext <<_ACEOF program main end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : +if ac_fn_fc_try_compile "$LINENO" +then : ac_cv_prog_fc_g=yes -else +else $as_nop ac_cv_prog_fc_g=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_g" >&5 -$as_echo "$ac_cv_prog_fc_g" >&6; } -if test "$ac_test_FCFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_g" >&5 +printf "%s\n" "$ac_cv_prog_fc_g" >&6; } +if test $ac_test_FCFLAGS; then FCFLAGS=$ac_save_FCFLAGS elif test $ac_cv_prog_fc_g = yes; then if test "x$ac_cv_fc_compiler_gnu" = xyes; then @@ -3358,6 +3901,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu FCFLAGS="$save_FCFLAGS"; save_CFLAGS="$CFLAGS"; + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3368,11 +3920,12 @@ if test -n "$ac_tool_prefix"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else @@ -3380,11 +3933,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3395,11 +3952,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3412,11 +3969,12 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else @@ -3424,11 +3982,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3439,11 +4001,11 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3455,8 +4017,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -3464,23 +4026,23 @@ esac fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do +for ac_option in --version -v -V -qversion -version; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3490,20 +4052,21 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3513,29 +4076,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi -ac_test_CFLAGS=${CFLAGS+set} +ac_test_CFLAGS=${CFLAGS+y} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no @@ -3544,57 +4111,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes -else +else $as_nop CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : -else +else $as_nop ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then @@ -3609,94 +4179,144 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c89=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi fi ac_ext=c @@ -3705,24 +4325,27 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` -ac_ext=c + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; @@ -3750,8 +4373,8 @@ _ACEOF rm -f core conftest* unset am_i fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. @@ -3767,7 +4390,18 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test "x$ac_cv_prog_cc_stdc" == "xno" ; then + as_fn_error $? "Problem : Need a C99 compiler ! " "$LINENO" 5 +else + C99OPT="$ac_cv_prog_cc_stdc"; +fi CFLAGS="$save_CFLAGS"; + + + + + + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3782,11 +4416,12 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else @@ -3794,11 +4429,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3809,11 +4448,11 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3826,11 +4465,12 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else @@ -3838,11 +4478,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3853,11 +4497,11 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -3869,8 +4513,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX @@ -3880,7 +4524,7 @@ fi fi fi # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do @@ -3890,7 +4534,7 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -3900,20 +4544,21 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { #ifndef __GNUC__ choke me @@ -3923,29 +4568,33 @@ main () return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_compiler_gnu=yes -else +else $as_nop ac_compiler_gnu=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi -ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_test_CXXFLAGS=${CXXFLAGS+y} ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no @@ -3954,57 +4603,60 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes -else +else $as_nop CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : -else +else $as_nop ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO" +then : ac_cv_prog_cxx_g=yes fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then @@ -4019,318 +4671,115 @@ else CXXFLAGS= fi fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# Sanity checks, although redundant (useful when debugging this configure.ac)! -if test "X$FC" == "X" ; then - as_fn_error $? "Problem : No Fortran compiler specified nor found!" "$LINENO" 5 -fi - -if test "X$CC" == "X" ; then - as_fn_error $? "Problem : No C compiler specified nor found!" "$LINENO" 5 -fi - case $ac_cv_prog_cc_stdc in #( - no) : - ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_11=no +ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} +$ac_cxx_conftest_cxx11_program _ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC +CXX=$ac_save_CXX +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_98+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_98=no +ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} +$ac_cxx_conftest_cxx98_program _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break done rm -f conftest.$ac_ext -CC=$ac_save_CC +CXX=$ac_save_CXX +fi +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Sanity checks, although redundant (useful when debugging this configure.ac)! +if test "X$FC" == "X" ; then + as_fn_error $? "Problem : No Fortran compiler specified nor found!" "$LINENO" 5 fi - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 -$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } - if ${ac_cv_prog_cc_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - case $ac_cv_prog_cc_stdc in #( - no) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; #( - '') : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 -$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_stdc" == "xno" ; then - as_fn_error $? "Problem : Need a C99 compiler ! " "$LINENO" 5 -else - C99OPT="$ac_cv_prog_cc_stdc"; +if test "X$CC" == "X" ; then + as_fn_error $? "Problem : No C compiler specified nor found!" "$LINENO" 5 fi @@ -4341,10 +4790,11 @@ fi # Note: Someday we will contemplate a fake MPI - configured version of PSBLAS ############################################################################### # First check whether the user required our serial (fake) mpi. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we want serial mpi stubs" >&5 -$as_echo_n "checking whether we want serial mpi stubs... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we want serial mpi stubs" >&5 +printf %s "checking whether we want serial mpi stubs... " >&6; } # Check whether --enable-serial was given. -if test "${enable_serial+set}" = set; then : +if test ${enable_serial+y} +then : enableval=$enable_serial; pac_cv_serial_mpi="yes"; @@ -4352,12 +4802,12 @@ pac_cv_serial_mpi="yes"; fi if test x"$pac_cv_serial_mpi" == x"yes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes." >&5 -$as_echo "yes." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes." >&5 +printf "%s\n" "yes." >&6; } else pac_cv_serial_mpi="no"; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no." >&5 -$as_echo "no." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no." >&5 +printf "%s\n" "no." >&6; } fi @@ -4381,11 +4831,12 @@ if test "X$MPICC" = "X" ; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MPICC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPICC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MPICC"; then ac_cv_prog_MPICC="$MPICC" # Let the user override the test. else @@ -4393,11 +4844,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MPICC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4408,11 +4863,11 @@ fi fi MPICC=$ac_cv_prog_MPICC if test -n "$MPICC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5 -$as_echo "$MPICC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5 +printf "%s\n" "$MPICC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4430,11 +4885,12 @@ fi do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MPICC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPICC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MPICC"; then ac_cv_prog_MPICC="$MPICC" # Let the user override the test. else @@ -4442,11 +4898,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MPICC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4457,11 +4917,11 @@ fi fi MPICC=$ac_cv_prog_MPICC if test -n "$MPICC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5 -$as_echo "$MPICC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICC" >&5 +printf "%s\n" "$MPICC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4476,18 +4936,20 @@ test -n "$MPICC" || MPICC="$CC" if test x = x"$MPILIBS"; then ac_fn_c_check_func "$LINENO" "MPI_Init" "ac_cv_func_MPI_Init" -if test "x$ac_cv_func_MPI_Init" = xyes; then : +if test "x$ac_cv_func_MPI_Init" = xyes +then : MPILIBS=" " fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 -$as_echo_n "checking for MPI_Init in -lmpi... " >&6; } -if ${ac_cv_lib_mpi_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 +printf %s "checking for MPI_Init in -lmpi... " >&6; } +if test ${ac_cv_lib_mpi_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpi $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4496,40 +4958,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char MPI_Init (); int -main () +main (void) { return MPI_Init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_mpi_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpi_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes +then : MPILIBS="-lmpi" fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 -$as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if ${ac_cv_lib_mpich_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 +printf %s "checking for MPI_Init in -lmpich... " >&6; } +if test ${ac_cv_lib_mpich_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpich $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4538,58 +5000,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char MPI_Init (); int -main () +main (void) { return MPI_Init (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_mpich_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpich_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpich_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes +then : MPILIBS="-lmpich" fi fi if test x != x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpi.h" >&5 -$as_echo_n "checking for mpi.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpi.h" >&5 +printf %s "checking for mpi.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -int -main () -{ - - ; - return 0; -} _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - MPILIBS="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi CC="$acx_mpi_save_CC" @@ -4602,302 +5055,10 @@ if test x = x"$MPILIBS"; then : else -$as_echo "#define HAVE_MPI 1" >>confdefs.h - - : -fi - - case $ac_cv_prog_cc_stdc in #( - no) : - ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_cv_prog_cc_stdc=no -fi - -fi - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 -$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } - if ${ac_cv_prog_cc_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - case $ac_cv_prog_cc_stdc in #( - no) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; #( - '') : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 -$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; -esac +printf "%s\n" "#define HAVE_MPI 1" >>confdefs.h + + : +fi ac_ext=${ac_fc_srcext-f} @@ -4917,11 +5078,12 @@ if test "X$MPICXX" = "X" ; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MPICXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPICXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MPICXX"; then ac_cv_prog_MPICXX="$MPICXX" # Let the user override the test. else @@ -4929,11 +5091,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MPICXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4944,11 +5110,11 @@ fi fi MPICXX=$ac_cv_prog_MPICXX if test -n "$MPICXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5 -$as_echo "$MPICXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5 +printf "%s\n" "$MPICXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -4966,11 +5132,12 @@ fi do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MPICXX+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPICXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MPICXX"; then ac_cv_prog_MPICXX="$MPICXX" # Let the user override the test. else @@ -4978,11 +5145,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MPICXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4993,11 +5164,11 @@ fi fi MPICXX=$ac_cv_prog_MPICXX if test -n "$MPICXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5 -$as_echo "$MPICXX" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5 +printf "%s\n" "$MPICXX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5012,120 +5183,111 @@ test -n "$MPICXX" || MPICXX="$CXX" if test x = x"$MPILIBS"; then ac_fn_cxx_check_func "$LINENO" "MPI_Init" "ac_cv_func_MPI_Init" -if test "x$ac_cv_func_MPI_Init" = xyes; then : +if test "x$ac_cv_func_MPI_Init" = xyes +then : MPILIBS=" " fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 -$as_echo_n "checking for MPI_Init in -lmpi... " >&6; } -if ${ac_cv_lib_mpi_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 +printf %s "checking for MPI_Init in -lmpi... " >&6; } +if test ${ac_cv_lib_mpi_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpi $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char MPI_Init (); +namespace conftest { + extern "C" int MPI_Init (); +} int -main () +main (void) { -return MPI_Init (); +return conftest::MPI_Init (); ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : ac_cv_lib_mpi_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpi_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes +then : MPILIBS="-lmpi" fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 -$as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if ${ac_cv_lib_mpich_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 +printf %s "checking for MPI_Init in -lmpich... " >&6; } +if test ${ac_cv_lib_mpich_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpich $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char MPI_Init (); +namespace conftest { + extern "C" int MPI_Init (); +} int -main () +main (void) { -return MPI_Init (); +return conftest::MPI_Init (); ; return 0; } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : ac_cv_lib_mpich_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpich_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpich_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes +then : MPILIBS="-lmpich" fi fi if test x != x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpi.h" >&5 -$as_echo_n "checking for mpi.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpi.h" >&5 +printf %s "checking for mpi.h... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -int -main () -{ - - ; - return 0; -} _ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - MPILIBS="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi CXX="$acx_mpi_save_CXX" @@ -5138,7 +5300,7 @@ if test x = x"$MPILIBS"; then : else -$as_echo "#define HAVE_MPI 1" >>confdefs.h +printf "%s\n" "#define HAVE_MPI 1" >>confdefs.h : fi @@ -5155,11 +5317,12 @@ if test "X$MPIFC" = "X" ; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MPIFC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPIFC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MPIFC"; then ac_cv_prog_MPIFC="$MPIFC" # Let the user override the test. else @@ -5167,11 +5330,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MPIFC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5182,11 +5349,11 @@ fi fi MPIFC=$ac_cv_prog_MPIFC if test -n "$MPIFC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPIFC" >&5 -$as_echo "$MPIFC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPIFC" >&5 +printf "%s\n" "$MPIFC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5205,11 +5372,12 @@ fi do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MPIFC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPIFC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MPIFC"; then ac_cv_prog_MPIFC="$MPIFC" # Let the user override the test. else @@ -5217,11 +5385,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MPIFC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5232,11 +5404,11 @@ fi fi MPIFC=$ac_cv_prog_MPIFC if test -n "$MPIFC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPIFC" >&5 -$as_echo "$MPIFC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPIFC" >&5 +printf "%s\n" "$MPIFC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5250,31 +5422,33 @@ test -n "$MPIFC" || MPIFC="$FC" if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init" >&5 -$as_echo_n "checking for MPI_Init... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init" >&5 +printf %s "checking for MPI_Init... " >&6; } cat > conftest.$ac_ext <<_ACEOF program main call MPI_Init end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : MPILIBS=" " - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lfmpi" >&5 -$as_echo_n "checking for MPI_Init in -lfmpi... " >&6; } -if ${ac_cv_lib_fmpi_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lfmpi" >&5 +printf %s "checking for MPI_Init in -lfmpi... " >&6; } +if test ${ac_cv_lib_fmpi_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lfmpi $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -5282,28 +5456,31 @@ cat > conftest.$ac_ext <<_ACEOF call MPI_Init end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_fmpi_MPI_Init=yes -else +else $as_nop ac_cv_lib_fmpi_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fmpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_fmpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_fmpi_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fmpi_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_fmpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_fmpi_MPI_Init" = xyes +then : MPILIBS="-lfmpi" fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpichf90" >&5 -$as_echo_n "checking for MPI_Init in -lmpichf90... " >&6; } -if ${ac_cv_lib_mpichf90_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpichf90" >&5 +printf %s "checking for MPI_Init in -lmpichf90... " >&6; } +if test ${ac_cv_lib_mpichf90_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpichf90 $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -5311,29 +5488,32 @@ cat > conftest.$ac_ext <<_ACEOF call MPI_Init end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_mpichf90_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpichf90_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpichf90_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpichf90_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpichf90_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpichf90_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpichf90_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpichf90_MPI_Init" = xyes +then : MPILIBS="-lmpichf90" fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 -$as_echo_n "checking for MPI_Init in -lmpi... " >&6; } -if ${ac_cv_lib_mpi_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 +printf %s "checking for MPI_Init in -lmpi... " >&6; } +if test ${ac_cv_lib_mpi_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpi $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -5341,28 +5521,31 @@ cat > conftest.$ac_ext <<_ACEOF call MPI_Init end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_mpi_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpi_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes +then : MPILIBS="-lmpi" fi fi if test x = x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 -$as_echo_n "checking for MPI_Init in -lmpich... " >&6; } -if ${ac_cv_lib_mpich_MPI_Init+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 +printf %s "checking for MPI_Init in -lmpich... " >&6; } +if test ${ac_cv_lib_mpich_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmpich $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -5370,40 +5553,43 @@ cat > conftest.$ac_ext <<_ACEOF call MPI_Init end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_mpich_MPI_Init=yes -else +else $as_nop ac_cv_lib_mpich_MPI_Init=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 -$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; } -if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpich_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes +then : MPILIBS="-lmpich" fi fi if test x != x"$MPILIBS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mpif.h" >&5 -$as_echo_n "checking for mpif.h... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpif.h" >&5 +printf %s "checking for mpif.h... " >&6; } cat > conftest.$ac_ext <<_ACEOF program main include 'mpif.h' end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop MPILIBS="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi FC="$acx_mpi_save_FC" @@ -5416,7 +5602,7 @@ if test x = x"$MPILIBS"; then : else -$as_echo "#define HAVE_MPI 1" >>confdefs.h +printf "%s\n" "#define HAVE_MPI 1" >>confdefs.h : fi @@ -5452,165 +5638,174 @@ fi ############################################################################### -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional CCOPT flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional CCOPT flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional CCOPT flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional CCOPT flags should be added (should be invoked only once)... " >&6; } # Check whether --with-ccopt was given. -if test "${with_ccopt+set}" = set; then : +if test ${with_ccopt+y} +then : withval=$with_ccopt; CCOPT="${withval} ${CCOPT}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CCOPT = ${CCOPT}" >&5 -$as_echo "CCOPT = ${CCOPT}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CCOPT = ${CCOPT}" >&5 +printf "%s\n" "CCOPT = ${CCOPT}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional CXXOPT flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional CXXOPT flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional CXXOPT flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional CXXOPT flags should be added (should be invoked only once)... " >&6; } # Check whether --with-cxxopt was given. -if test "${with_cxxopt+set}" = set; then : +if test ${with_cxxopt+y} +then : withval=$with_cxxopt; CXXOPT="${withval} ${CXXOPT}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CXXOPT = ${CXXOPT}" >&5 -$as_echo "CXXOPT = ${CXXOPT}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CXXOPT = ${CXXOPT}" >&5 +printf "%s\n" "CXXOPT = ${CXXOPT}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional FCOPT flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional FCOPT flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional FCOPT flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional FCOPT flags should be added (should be invoked only once)... " >&6; } # Check whether --with-fcopt was given. -if test "${with_fcopt+set}" = set; then : +if test ${with_fcopt+y} +then : withval=$with_fcopt; FCOPT="${withval} ${FCOPT}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: FCOPT = ${FCOPT}" >&5 -$as_echo "FCOPT = ${FCOPT}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: FCOPT = ${FCOPT}" >&5 +printf "%s\n" "FCOPT = ${FCOPT}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional libraries are needed" >&5 -$as_echo_n "checking whether additional libraries are needed... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional libraries are needed" >&5 +printf %s "checking whether additional libraries are needed... " >&6; } # Check whether --with-libs was given. -if test "${with_libs+set}" = set; then : +if test ${with_libs+y} +then : withval=$with_libs; LIBS="${withval} ${LIBS}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LIBS = ${LIBS}" >&5 -$as_echo "LIBS = ${LIBS}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: LIBS = ${LIBS}" >&5 +printf "%s\n" "LIBS = ${LIBS}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional CLIBS flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional CLIBS flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional CLIBS flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional CLIBS flags should be added (should be invoked only once)... " >&6; } # Check whether --with-clibs was given. -if test "${with_clibs+set}" = set; then : +if test ${with_clibs+y} +then : withval=$with_clibs; CLIBS="${withval} ${CLIBS}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CLIBS = ${CLIBS}" >&5 -$as_echo "CLIBS = ${CLIBS}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: CLIBS = ${CLIBS}" >&5 +printf "%s\n" "CLIBS = ${CLIBS}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional FLIBS flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional FLIBS flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional FLIBS flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional FLIBS flags should be added (should be invoked only once)... " >&6; } # Check whether --with-flibs was given. -if test "${with_flibs+set}" = set; then : +if test ${with_flibs+y} +then : withval=$with_flibs; FLIBS="${withval} ${FLIBS}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: FLIBS = ${FLIBS}" >&5 -$as_echo "FLIBS = ${FLIBS}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: FLIBS = ${FLIBS}" >&5 +printf "%s\n" "FLIBS = ${FLIBS}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional LIBRARYPATH flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional LIBRARYPATH flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional LIBRARYPATH flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional LIBRARYPATH flags should be added (should be invoked only once)... " >&6; } # Check whether --with-library-path was given. -if test "${with_library_path+set}" = set; then : +if test ${with_library_path+y} +then : withval=$with_library_path; LIBRARYPATH="${withval} ${LIBRARYPATH}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LIBRARYPATH = ${LIBRARYPATH}" >&5 -$as_echo "LIBRARYPATH = ${LIBRARYPATH}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: LIBRARYPATH = ${LIBRARYPATH}" >&5 +printf "%s\n" "LIBRARYPATH = ${LIBRARYPATH}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional INCLUDEPATH flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional INCLUDEPATH flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional INCLUDEPATH flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional INCLUDEPATH flags should be added (should be invoked only once)... " >&6; } # Check whether --with-include-path was given. -if test "${with_include_path+set}" = set; then : +if test ${with_include_path+y} +then : withval=$with_include_path; INCLUDEPATH="${withval} ${INCLUDEPATH}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: INCLUDEPATH = ${INCLUDEPATH}" >&5 -$as_echo "INCLUDEPATH = ${INCLUDEPATH}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: INCLUDEPATH = ${INCLUDEPATH}" >&5 +printf "%s\n" "INCLUDEPATH = ${INCLUDEPATH}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether additional MODULE_PATH flags should be added (should be invoked only once)" >&5 -$as_echo_n "checking whether additional MODULE_PATH flags should be added (should be invoked only once)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether additional MODULE_PATH flags should be added (should be invoked only once)" >&5 +printf %s "checking whether additional MODULE_PATH flags should be added (should be invoked only once)... " >&6; } # Check whether --with-module-path was given. -if test "${with_module_path+set}" = set; then : +if test ${with_module_path+y} +then : withval=$with_module_path; MODULE_PATH="${withval} ${MODULE_PATH}" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: MODULE_PATH = ${MODULE_PATH}" >&5 -$as_echo "MODULE_PATH = ${MODULE_PATH}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: MODULE_PATH = ${MODULE_PATH}" >&5 +printf "%s\n" "MODULE_PATH = ${MODULE_PATH}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5624,11 +5819,12 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else @@ -5636,11 +5832,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5651,11 +5851,11 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5664,11 +5864,12 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else @@ -5676,11 +5877,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5691,11 +5896,11 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -5703,8 +5908,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -5716,8 +5921,8 @@ fi am__api_version='1.16' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -5771,8 +5976,8 @@ else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= @@ -5791,23 +5996,19 @@ test "$program_suffix" != NONE && # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then @@ -5827,11 +6028,12 @@ if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else @@ -5839,11 +6041,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5854,11 +6060,11 @@ fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -5867,11 +6073,12 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else @@ -5879,11 +6086,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5894,11 +6105,11 @@ fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then @@ -5906,8 +6117,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -5919,25 +6130,31 @@ fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext break 3;; esac done @@ -5948,7 +6165,7 @@ IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then + if test ${ac_cv_path_mkdir+y}; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a @@ -5958,18 +6175,19 @@ fi MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else @@ -5977,11 +6195,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -5992,24 +6214,25 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @@ -6025,12 +6248,12 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -6047,8 +6270,8 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out @@ -6084,11 +6307,12 @@ esac fi done rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test ${enable_dependency_tracking+y} +then : enableval=$enable_dependency_tracking; fi @@ -6107,7 +6331,8 @@ fi # Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : +if test ${enable_silent_rules+y} +then : enableval=$enable_silent_rules; fi @@ -6117,12 +6342,13 @@ case $enable_silent_rules in # ((( *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 @@ -6134,8 +6360,8 @@ else am_cv_make_support_nested_variables=no fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' @@ -6170,14 +6396,10 @@ fi VERSION='3.7.0' -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h # Some tools Automake needs. @@ -6219,11 +6441,12 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -6330,8 +6553,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if @@ -6347,11 +6570,12 @@ fi depcc="$CXX" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CXX_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For @@ -6458,8 +6682,8 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if @@ -6473,6 +6697,20 @@ else fi +# Variables for tags utilities; see am/tags.am +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile @@ -6525,8 +6763,8 @@ fi psblas_cv_fc="" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU Fortran" >&5 -$as_echo_n "checking for GNU Fortran... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU Fortran" >&5 +printf %s "checking for GNU Fortran... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -6545,18 +6783,19 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu #endif end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } psblas_cv_fc="gcc" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6565,8 +6804,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cray Fortran" >&5 -$as_echo_n "checking for Cray Fortran... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Cray Fortran" >&5 +printf %s "checking for Cray Fortran... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -6585,18 +6824,19 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu #endif end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } psblas_cv_fc="cray" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6636,13 +6876,13 @@ if test x"$psblas_cv_fc" == "x" ; then else psblas_cv_fc="" # unsupported MPI Fortran compiler - { $as_echo "$as_me:${as_lineno-$LINENO}: Unknown Fortran compiler, proceeding with fingers crossed !" >&5 -$as_echo "$as_me: Unknown Fortran compiler, proceeding with fingers crossed !" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Unknown Fortran compiler, proceeding with fingers crossed !" >&5 +printf "%s\n" "$as_me: Unknown Fortran compiler, proceeding with fingers crossed !" >&6;} fi fi if test "X$psblas_cv_fc" == "Xgcc" ; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent GNU Fortran" >&5 -$as_echo_n "checking for recent GNU Fortran... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for recent GNU Fortran" >&5 +printf %s "checking for recent GNU Fortran... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -6661,21 +6901,22 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu #endif end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: Sorry, we require GNU Fortran version 4.9 or later." >&5 -$as_echo "$as_me: Sorry, we require GNU Fortran version 4.9 or later." >&6;} +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Sorry, we require GNU Fortran version 4.9 or later." >&5 +printf "%s\n" "$as_me: Sorry, we require GNU Fortran version 4.9 or later." >&6;} echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Bailing out." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6697,418 +6938,52 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif +done -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h -fi -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF -fi -done +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h +fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : - -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +printf %s "checking size of void *... " >&6; } +if test ${ac_cv_sizeof_void_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default" +then : + +else $as_nop if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) See \`config.log' for more details" "$LINENO" 5; } else @@ -7117,14 +6992,12 @@ See \`config.log' for more details" "$LINENO" 5; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +printf "%s\n" "$ac_cv_sizeof_void_p" >&6; } -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF +printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h # Define for platforms with 64 bit (void * ) pointers @@ -7136,11 +7009,12 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran name-mangling scheme" >&5 -$as_echo_n "checking for Fortran name-mangling scheme... " >&6; } -if ${ac_cv_fc_mangling+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran name-mangling scheme" >&5 +printf %s "checking for Fortran name-mangling scheme... " >&6; } +if test ${ac_cv_fc_mangling+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat > conftest.$ac_ext <<_ACEOF subroutine foobar() return @@ -7149,7 +7023,8 @@ else return end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : +if ac_fn_fc_try_compile "$LINENO" +then : mv conftest.$ac_objext cfortran_test.$ac_objext ac_save_LIBS=$LIBS @@ -7170,22 +7045,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char $ac_func (); int -main () +main (void) { return $ac_func (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_success=yes; break 2 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done done @@ -7220,22 +7093,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char $ac_func (); int -main () +main (void) { return $ac_func (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_success_extra=yes; break fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done ac_ext=${ac_fc_srcext-f} @@ -7265,17 +7136,17 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu LIBS=$ac_save_LIBS rm -rf conftest* rm -f cfortran_test* -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compile a simple Fortran program See \`config.log' for more details" "$LINENO" 5; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_mangling" >&5 -$as_echo "$ac_cv_fc_mangling" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fc_mangling" >&5 +printf "%s\n" "$ac_cv_fc_mangling" >&6; } if test "X$psblas_cv_fc" == X"pg" ; then FC=$save_FC @@ -7292,8 +7163,8 @@ pac_fc_sec_under=${pac_fc_under#*,} pac_fc_sec_under=${pac_fc_sec_under# } pac_fc_under=${pac_fc_under%%,*} pac_fc_under=${pac_fc_under# } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking defines for C/Fortran name interfaces" >&5 -$as_echo_n "checking defines for C/Fortran name interfaces... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking defines for C/Fortran name interfaces" >&5 +printf %s "checking defines for C/Fortran name interfaces... " >&6; } if test "x$pac_fc_case" == "xlower case"; then if test "x$pac_fc_under" == "xunderscore"; then if test "x$pac_fc_sec_under" == "xno extra underscore"; then @@ -7327,8 +7198,8 @@ else fi CDEFINES="$pac_f_c_names $CDEFINES" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_f_c_names " >&5 -$as_echo " $pac_f_c_names " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_f_c_names " >&5 +printf "%s\n" " $pac_f_c_names " >&6; } ############################################################################### # Make.inc generation logic @@ -7408,8 +7279,8 @@ if test "X$FCOPT" == "X" ; then # note that no space should be placed around the equality symbol in assignations # Note : 'native' is valid _only_ on GCC/x86 (32/64 bits) FCOPT="-g -O3 -frecursive $FCOPT" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 10 or later of GNU Fortran" >&5 -$as_echo_n "checking for version 10 or later of GNU Fortran... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for version 10 or later of GNU Fortran" >&5 +printf %s "checking for version 10 or later of GNU Fortran... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -7428,16 +7299,17 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu #endif end _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } FCOPT="-fallow-argument-mismatch $FCOPT" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7516,11 +7388,12 @@ then else -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking fortran 90 modules extension" >&5 -$as_echo_n "checking fortran 90 modules extension... " >&6; } -if ${ax_cv_f90_modext+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking fortran 90 modules extension" >&5 +printf %s "checking fortran 90 modules extension... " >&6; } +if test ${ax_cv_f90_modext+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -7542,7 +7415,8 @@ cat > conftest.$ac_ext <<_ACEOF end module conftest_module _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : +if ac_fn_fc_try_compile "$LINENO" +then : ax_cv_f90_modext=`ls | sed -n 's,conftest_module\.,,p'` if test x$ax_cv_f90_modext = x ; then ax_cv_f90_modext=`ls | sed -n 's,CONFTEST_MODULE\.,,p'` @@ -7551,10 +7425,10 @@ if ac_fn_fc_try_compile "$LINENO"; then : fi fi -else +else $as_nop ax_cv_f90_modext=unknown fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cd .. rm -fr tmpdir_$i ac_ext=c @@ -7565,14 +7439,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_f90_modext" >&5 -$as_echo "$ax_cv_f90_modext" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_f90_modext" >&5 +printf "%s\n" "$ax_cv_f90_modext" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking fortran 90 modules inclusion flag" >&5 -$as_echo_n "checking fortran 90 modules inclusion flag... " >&6; } -if ${ax_cv_f90_modflag+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking fortran 90 modules inclusion flag" >&5 +printf %s "checking fortran 90 modules inclusion flag... " >&6; } +if test ${ax_cv_f90_modflag+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -7595,10 +7470,11 @@ cat > conftest.$ac_ext <<_ACEOF end module conftest_module _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : +if ac_fn_fc_try_compile "$LINENO" +then : fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext cd ..; ax_cv_f90_modflag="not found" for ax_flag in "-I " "-M" "-p"; do @@ -7613,10 +7489,11 @@ for ax_flag in "-I " "-M" "-p"; do end program conftest_program _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : +if ac_fn_fc_try_compile "$LINENO" +then : ax_cv_f90_modflag="$ax_flag" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext FCFLAGS="$ax_save_FCFLAGS" fi done @@ -7632,8 +7509,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_f90_modflag" >&5 -$as_echo "$ax_cv_f90_modflag" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_f90_modflag" >&5 +printf "%s\n" "$ax_cv_f90_modflag" >&6; } MODEXT=".$ax_cv_f90_modext" FMFLAG="${ax_cv_f90_modflag%% *}" FIFLAG=-I @@ -7654,8 +7531,8 @@ fi if test x"$pac_cv_serial_mpi" == x"yes" ; then FDEFINES="$psblas_cv_define_prepend-DSERIAL_MPI $psblas_cv_define_prepend-DMPI_MOD $FDEFINES"; else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking MPI Fortran 2008 interface" >&5 -$as_echo_n "checking MPI Fortran 2008 interface... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking MPI Fortran 2008 interface" >&5 +printf %s "checking MPI Fortran 2008 interface... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -7670,20 +7547,21 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu use mpi_f08 end program test _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } pac_cv_mpi_f08="yes"; : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } pac_cv_mpi_f08="no"; echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7694,8 +7572,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x"$pac_cv_mpi_f08" == x"yes" ; then FDEFINES="$psblas_cv_define_prepend-DMPI_MOD $FDEFINES"; else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran MPI mod" >&5 -$as_echo_n "checking for Fortran MPI mod... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Fortran MPI mod" >&5 +printf %s "checking for Fortran MPI mod... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -7710,18 +7588,19 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu use mpi end program test _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } FDEFINES="$psblas_cv_define_prepend-DMPI_MOD $FDEFINES" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 FDEFINES="$psblas_cv_define_prepend-DMPI_H $FDEFINES" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7733,45 +7612,47 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what size in bytes we want for local indices and data" >&5 -$as_echo_n "checking what size in bytes we want for local indices and data... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking what size in bytes we want for local indices and data" >&5 +printf %s "checking what size in bytes we want for local indices and data... " >&6; } # Check whether --with-ipk was given. -if test "${with_ipk+set}" = set; then : +if test ${with_ipk+y} +then : withval=$with_ipk; pac_cv_ipk_size=$withval; -else +else $as_nop pac_cv_ipk_size=4; fi if test x"$pac_cv_ipk_size" == x"4" || test x"$pac_cv_ipk_size" == x"8" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Size: $pac_cv_ipk_size." >&5 -$as_echo "Size: $pac_cv_ipk_size." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Size: $pac_cv_ipk_size." >&5 +printf "%s\n" "Size: $pac_cv_ipk_size." >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unsupported value for IPK: $pac_cv_ipk_size, defaulting to 4." >&5 -$as_echo "Unsupported value for IPK: $pac_cv_ipk_size, defaulting to 4." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Unsupported value for IPK: $pac_cv_ipk_size, defaulting to 4." >&5 +printf "%s\n" "Unsupported value for IPK: $pac_cv_ipk_size, defaulting to 4." >&6; } pac_cv_ipk_size=4; fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking what size in bytes we want for global indices and data" >&5 -$as_echo_n "checking what size in bytes we want for global indices and data... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking what size in bytes we want for global indices and data" >&5 +printf %s "checking what size in bytes we want for global indices and data... " >&6; } # Check whether --with-lpk was given. -if test "${with_lpk+set}" = set; then : +if test ${with_lpk+y} +then : withval=$with_lpk; pac_cv_lpk_size=$withval; -else +else $as_nop pac_cv_lpk_size=8; fi if test x"$pac_cv_lpk_size" == x"4" || test x"$pac_cv_lpk_size" == x"8"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Size: $pac_cv_lpk_size." >&5 -$as_echo "Size: $pac_cv_lpk_size." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Size: $pac_cv_lpk_size." >&5 +printf "%s\n" "Size: $pac_cv_lpk_size." >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unsupported value for LPK: $pac_cv_lpk_size, defaulting to 8." >&5 -$as_echo "Unsupported value for LPK: $pac_cv_lpk_size, defaulting to 8." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Unsupported value for LPK: $pac_cv_lpk_size, defaulting to 8." >&5 +printf "%s\n" "Unsupported value for LPK: $pac_cv_lpk_size, defaulting to 8." >&6; } pac_cv_lpk_size=8; fi @@ -7785,10 +7666,10 @@ if test x"$pac_cv_lpk_size" == x"" ; then fi # Enforce sensible combination if (( $pac_cv_lpk_size < $pac_cv_ipk_size )); then - { $as_echo "$as_me:${as_lineno-$LINENO}: Invalid combination of size specs IPK ${pac_cv_ipk_size} LPK ${pac_cv_lpk_size}. " >&5 -$as_echo "$as_me: Invalid combination of size specs IPK ${pac_cv_ipk_size} LPK ${pac_cv_lpk_size}. " >&6;}; - { $as_echo "$as_me:${as_lineno-$LINENO}: Forcing equal values" >&5 -$as_echo "$as_me: Forcing equal values" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Invalid combination of size specs IPK ${pac_cv_ipk_size} LPK ${pac_cv_lpk_size}. " >&5 +printf "%s\n" "$as_me: Invalid combination of size specs IPK ${pac_cv_ipk_size} LPK ${pac_cv_lpk_size}. " >&6;}; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Forcing equal values" >&5 +printf "%s\n" "$as_me: Forcing equal values" >&6;} pac_cv_lpk_size=$pac_cv_ipk_size; fi FDEFINES="$psblas_cv_define_prepend-DIPK${pac_cv_ipk_size} $FDEFINES"; @@ -7796,10 +7677,14 @@ FDEFINES="$psblas_cv_define_prepend-DLPK${pac_cv_lpk_size} $FDEFINES"; CDEFINES="-DIPK${pac_cv_ipk_size} -DLPK${pac_cv_lpk_size} $CDEFINES" FLINK="$MPIFC" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we want openmp " >&5 -$as_echo_n "checking whether we want openmp ... " >&6; } +if test -e penmp || test -e mp; then + as_fn_error $? "AC_OPENMP clobbers files named 'mp' and 'penmp'. Aborting configure because one of these files already exists." "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we want openmp " >&5 +printf %s "checking whether we want openmp ... " >&6; } # Check whether --enable-openmp was given. -if test "${enable_openmp+set}" = set; then : +if test ${enable_openmp+y} +then : enableval=$enable_openmp; pac_cv_openmp="yes"; @@ -7807,27 +7692,34 @@ pac_cv_openmp="yes"; fi if test x"$pac_cv_openmp" == x"yes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes." >&5 -$as_echo "yes." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes." >&5 +printf "%s\n" "yes." >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - - OPENMP_FCFLAGS= - # Check whether --enable-openmp was given. -if test "${enable_openmp+set}" = set; then : + # Check whether --enable-openmp was given. +if test ${enable_openmp+y} +then : enableval=$enable_openmp; fi + OPENMP_FCFLAGS= if test "$enable_openmp" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $FC option to support OpenMP" >&5 -$as_echo_n "checking for $FC option to support OpenMP... " >&6; } -if ${ac_cv_prog_fc_openmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest.$ac_ext <<_ACEOF + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $FC option to support OpenMP" >&5 +printf %s "checking for $FC option to support OpenMP... " >&6; } +if test ${ac_cv_prog_fc_openmp+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_fc_openmp='not found' + for ac_option in '' -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ + -Popenmp --openmp; do + + ac_save_FCFLAGS=$FCFLAGS + FCFLAGS="$FCFLAGS $ac_option" + cat > conftest.$ac_ext <<_ACEOF program main implicit none @@ -7837,15 +7729,9 @@ else end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : - ac_cv_prog_fc_openmp='none needed' -else - ac_cv_prog_fc_openmp='unsupported' - for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ - -Popenmp --openmp; do - ac_save_FCFLAGS=$FCFLAGS - FCFLAGS="$FCFLAGS $ac_option" - cat > conftest.$ac_ext <<_ACEOF +if ac_fn_fc_try_compile "$LINENO" +then : + cat > conftest.$ac_ext <<_ACEOF program main implicit none @@ -7855,28 +7741,35 @@ else end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_prog_fc_openmp=$ac_option +else $as_nop + ac_cv_prog_fc_openmp='unsupported' fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - FCFLAGS=$ac_save_FCFLAGS - if test "$ac_cv_prog_fc_openmp" != unsupported; then - break - fi - done fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + FCFLAGS=$ac_save_FCFLAGS + + if test "$ac_cv_prog_fc_openmp" != 'not found'; then + break + fi + done + if test "$ac_cv_prog_fc_openmp" = 'not found'; then + ac_cv_prog_fc_openmp='unsupported' + elif test "$ac_cv_prog_fc_openmp" = ''; then + ac_cv_prog_fc_openmp='none needed' + fi + rm -f penmp mp fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_openmp" >&5 -$as_echo "$ac_cv_prog_fc_openmp" >&6; } - case $ac_cv_prog_fc_openmp in #( - "none needed" | unsupported) - ;; #( - *) - OPENMP_FCFLAGS=$ac_cv_prog_fc_openmp ;; - esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_fc_openmp" >&5 +printf "%s\n" "$ac_cv_prog_fc_openmp" >&6; } + if test "$ac_cv_prog_fc_openmp" != 'unsupported' && \ + test "$ac_cv_prog_fc_openmp" != 'none needed'; then + OPENMP_FCFLAGS="$ac_cv_prog_fc_openmp" + fi fi @@ -7893,69 +7786,77 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - - OPENMP_CFLAGS= - # Check whether --enable-openmp was given. -if test "${enable_openmp+set}" = set; then : + # Check whether --enable-openmp was given. +if test ${enable_openmp+y} +then : enableval=$enable_openmp; fi + OPENMP_CFLAGS= if test "$enable_openmp" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to support OpenMP" >&5 -$as_echo_n "checking for $CC option to support OpenMP... " >&6; } -if ${ac_cv_prog_c_openmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to support OpenMP" >&5 +printf %s "checking for $CC option to support OpenMP... " >&6; } +if test ${ac_cv_prog_c_openmp+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_c_openmp='not found' + for ac_option in '' -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ + -Popenmp --openmp; do + + ac_save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $ac_option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP - choke me +#error "OpenMP not supported" #endif #include -int main () { return omp_get_num_threads (); } +int main (void) { return omp_get_num_threads (); } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_prog_c_openmp='none needed' -else - ac_cv_prog_c_openmp='unsupported' - for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ - -Popenmp --openmp; do - ac_save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $ac_option" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP - choke me +#error "OpenMP not supported" #endif #include -int main () { return omp_get_num_threads (); } +int main (void) { return omp_get_num_threads (); } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_prog_c_openmp=$ac_option +else $as_nop + ac_cv_prog_c_openmp='unsupported' fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS=$ac_save_CFLAGS - if test "$ac_cv_prog_c_openmp" != unsupported; then - break - fi - done fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ac_save_CFLAGS + + if test "$ac_cv_prog_c_openmp" != 'not found'; then + break + fi + done + if test "$ac_cv_prog_c_openmp" = 'not found'; then + ac_cv_prog_c_openmp='unsupported' + elif test "$ac_cv_prog_c_openmp" = ''; then + ac_cv_prog_c_openmp='none needed' + fi + rm -f penmp mp fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_c_openmp" >&5 -$as_echo "$ac_cv_prog_c_openmp" >&6; } - case $ac_cv_prog_c_openmp in #( - "none needed" | unsupported) - ;; #( - *) - OPENMP_CFLAGS=$ac_cv_prog_c_openmp ;; - esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_c_openmp" >&5 +printf "%s\n" "$ac_cv_prog_c_openmp" >&6; } + if test "$ac_cv_prog_c_openmp" != 'unsupported' && \ + test "$ac_cv_prog_c_openmp" != 'none needed'; then + OPENMP_CFLAGS="$ac_cv_prog_c_openmp" + fi fi @@ -7972,69 +7873,77 @@ ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - OPENMP_CXXFLAGS= - # Check whether --enable-openmp was given. -if test "${enable_openmp+set}" = set; then : + # Check whether --enable-openmp was given. +if test ${enable_openmp+y} +then : enableval=$enable_openmp; fi + OPENMP_CXXFLAGS= if test "$enable_openmp" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to support OpenMP" >&5 -$as_echo_n "checking for $CXX option to support OpenMP... " >&6; } -if ${ac_cv_prog_cxx_openmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to support OpenMP" >&5 +printf %s "checking for $CXX option to support OpenMP... " >&6; } +if test ${ac_cv_prog_cxx_openmp+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cxx_openmp='not found' + for ac_option in '' -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ + -Popenmp --openmp; do + + ac_save_CXXFLAGS=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $ac_option" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP - choke me +#error "OpenMP not supported" #endif #include -int main () { return omp_get_num_threads (); } +int main (void) { return omp_get_num_threads (); } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - ac_cv_prog_cxx_openmp='none needed' -else - ac_cv_prog_cxx_openmp='unsupported' - for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \ - -Popenmp --openmp; do - ac_save_CXXFLAGS=$CXXFLAGS - CXXFLAGS="$CXXFLAGS $ac_option" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ac_fn_cxx_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _OPENMP - choke me +#error "OpenMP not supported" #endif #include -int main () { return omp_get_num_threads (); } +int main (void) { return omp_get_num_threads (); } _ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO" +then : ac_cv_prog_cxx_openmp=$ac_option +else $as_nop + ac_cv_prog_cxx_openmp='unsupported' fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=$ac_save_CXXFLAGS - if test "$ac_cv_prog_cxx_openmp" != unsupported; then - break - fi - done fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CXXFLAGS=$ac_save_CXXFLAGS + + if test "$ac_cv_prog_cxx_openmp" != 'not found'; then + break + fi + done + if test "$ac_cv_prog_cxx_openmp" = 'not found'; then + ac_cv_prog_cxx_openmp='unsupported' + elif test "$ac_cv_prog_cxx_openmp" = ''; then + ac_cv_prog_cxx_openmp='none needed' + fi + rm -f penmp mp fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_openmp" >&5 -$as_echo "$ac_cv_prog_cxx_openmp" >&6; } - case $ac_cv_prog_cxx_openmp in #( - "none needed" | unsupported) - ;; #( - *) - OPENMP_CXXFLAGS=$ac_cv_prog_cxx_openmp ;; - esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_openmp" >&5 +printf "%s\n" "$ac_cv_prog_cxx_openmp" >&6; } + if test "$ac_cv_prog_cxx_openmp" != 'unsupported' && \ + test "$ac_cv_prog_cxx_openmp" != 'none needed'; then + OPENMP_CXXFLAGS="$ac_cv_prog_cxx_openmp" + fi fi @@ -8047,8 +7956,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu else pac_cv_openmp="no"; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no." >&5 -$as_echo "no." >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no." >&5 +printf "%s\n" "no." >&6; } fi @@ -8068,8 +7977,8 @@ fi # # Critical features # -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran allocatables TR15581" >&5 -$as_echo_n "checking support for Fortran allocatables TR15581... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran allocatables TR15581" >&5 +printf %s "checking support for Fortran allocatables TR15581... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8130,20 +8039,21 @@ program testtr15581 end program testtr15581 _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for TR15581. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8155,8 +8065,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_exeext='' ac_ext='f90' ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FCFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran EXTENDS" >&5 -$as_echo_n "checking support for Fortran EXTENDS... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran EXTENDS" >&5 +printf %s "checking support for Fortran EXTENDS... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8177,20 +8087,21 @@ program conftest type(bar) :: barvar end program conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for EXTENDS. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8199,8 +8110,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran CLASS TBP" >&5 -$as_echo_n "checking support for Fortran CLASS TBP... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran CLASS TBP" >&5 +printf %s "checking support for Fortran CLASS TBP... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8240,20 +8151,21 @@ program conftest type(foo) :: foovar end program conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for CLASS and type bound procedures. Please get a Fortran compiler that supports them, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8262,8 +8174,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran SOURCE= allocation" >&5 -$as_echo_n "checking support for Fortran SOURCE= allocation... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran SOURCE= allocation" >&5 +printf %s "checking support for Fortran SOURCE= allocation... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8289,20 +8201,21 @@ program xtt end program xtt _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for SOURCE= allocation. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8311,8 +8224,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran MOVE_ALLOC intrinsic" >&5 -$as_echo_n "checking support for Fortran MOVE_ALLOC intrinsic... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran MOVE_ALLOC intrinsic" >&5 +printf %s "checking support for Fortran MOVE_ALLOC intrinsic... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8328,20 +8241,21 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu print *, b end program test_move_alloc _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for MOVE_ALLOC. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8350,8 +8264,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran ISO_C_BINDING module" >&5 -$as_echo_n "checking support for Fortran ISO_C_BINDING module... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran ISO_C_BINDING module" >&5 +printf %s "checking support for Fortran ISO_C_BINDING module... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8366,20 +8280,21 @@ program conftest use iso_c_binding end program conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for ISO_C_BINDING. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8388,8 +8303,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran SAME_TYPE_AS" >&5 -$as_echo_n "checking support for Fortran SAME_TYPE_AS... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran SAME_TYPE_AS" >&5 +printf %s "checking support for Fortran SAME_TYPE_AS... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8415,20 +8330,21 @@ program stt write(*,*) 'nfv2 == nfv1? ', same_type_as(nfv2,nfv1) end program stt _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for SAME_TYPE_AS. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8437,8 +8353,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran EXTENDS_TYPE_OF" >&5 -$as_echo_n "checking support for Fortran EXTENDS_TYPE_OF... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran EXTENDS_TYPE_OF" >&5 +printf %s "checking support for Fortran EXTENDS_TYPE_OF... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8462,20 +8378,21 @@ program xtt write(*,*) 'nfv1 extends foov? ', extends_type_of(nfv1,foov) end program xtt _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for EXTENDS_TYPE_OF. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8484,8 +8401,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran MOLD= allocation" >&5 -$as_echo_n "checking support for Fortran MOLD= allocation... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran MOLD= allocation" >&5 +printf %s "checking support for Fortran MOLD= allocation... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8511,20 +8428,21 @@ program xtt end program xtt _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for MOLD= allocation. Please get a Fortran compiler that supports it, e.g. GNU Fortran 4.8." "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8533,8 +8451,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran VOLATILE" >&5 -$as_echo_n "checking support for Fortran VOLATILE... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran VOLATILE" >&5 +printf %s "checking support for Fortran VOLATILE... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8549,19 +8467,20 @@ program conftest integer, volatile :: i, j end program conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for VOLATILE" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8570,8 +8489,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for ISO_FORTRAN_ENV" >&5 -$as_echo_n "checking support for ISO_FORTRAN_ENV... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for ISO_FORTRAN_ENV" >&5 +printf %s "checking support for ISO_FORTRAN_ENV... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8586,19 +8505,20 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu use iso_fortran_env end program test _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for ISO_FORTRAN_ENV" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8607,8 +8527,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran FINAL" >&5 -$as_echo_n "checking support for Fortran FINAL... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran FINAL" >&5 +printf %s "checking support for Fortran FINAL... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8638,19 +8558,20 @@ program conftest type(foo) :: foovar end program conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 as_fn_error $? "Sorry, cannot build PSBLAS without support for FINAL" "$LINENO" 5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8665,8 +8586,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking test GENERIC interfaces" >&5 -$as_echo_n "checking test GENERIC interfaces... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking test GENERIC interfaces" >&5 +printf %s "checking test GENERIC interfaces... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8691,19 +8612,20 @@ module conftest end module conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 FDEFINES="$psblas_cv_define_prepend-DHAVE_BUGGY_GENERICS $FDEFINES" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8712,8 +8634,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking support for Fortran FLUSH statement" >&5 -$as_echo_n "checking support for Fortran FLUSH statement... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking support for Fortran FLUSH statement" >&5 +printf %s "checking support for Fortran FLUSH statement... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -8732,18 +8654,19 @@ program conftest close(10) end program conftest _ACEOF -if ac_fn_fc_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +if ac_fn_fc_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } FDEFINES="$psblas_cv_define_prepend-DHAVE_FLUSH_STMT $FDEFINES" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -8806,7 +8729,8 @@ pac_blas_ok=no # Check whether --with-blas was given. -if test "${with_blas+set}" = set; then : +if test ${with_blas+y} +then : withval=$with_blas; fi @@ -8818,7 +8742,8 @@ case $with_blas in esac # Check whether --with-blasdir was given. -if test "${with_blasdir+set}" = set; then : +if test ${with_blasdir+y} +then : withval=$with_blasdir; fi @@ -8844,22 +8769,23 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu if test $pac_blas_ok = no; then if test "x$BLAS_LIBS" != x; then save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $BLAS_LIBDIR $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in $BLAS_LIBS" >&5 -$as_echo_n "checking for sgemm in $BLAS_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in $BLAS_LIBS" >&5 +printf %s "checking for sgemm in $BLAS_LIBS... " >&6; } cat > conftest.$ac_ext <<_ACEOF program main call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : pac_blas_ok=yes -else +else $as_nop BLAS_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_blas_ok" >&5 -$as_echo "$pac_blas_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_blas_ok" >&5 +printf "%s\n" "$pac_blas_ok" >&6; } LIBS="$save_LIBS" fi fi @@ -8873,11 +8799,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ATL_xerbla in -latlas" >&5 -$as_echo_n "checking for ATL_xerbla in -latlas... " >&6; } -if ${ac_cv_lib_atlas_ATL_xerbla+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ATL_xerbla in -latlas" >&5 +printf %s "checking for ATL_xerbla in -latlas... " >&6; } +if test ${ac_cv_lib_atlas_ATL_xerbla+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-latlas $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8886,40 +8813,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char ATL_xerbla (); int -main () +main (void) { return ATL_xerbla (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_atlas_ATL_xerbla=yes -else +else $as_nop ac_cv_lib_atlas_ATL_xerbla=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_atlas_ATL_xerbla" >&5 -$as_echo "$ac_cv_lib_atlas_ATL_xerbla" >&6; } -if test "x$ac_cv_lib_atlas_ATL_xerbla" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_atlas_ATL_xerbla" >&5 +printf "%s\n" "$ac_cv_lib_atlas_ATL_xerbla" >&6; } +if test "x$ac_cv_lib_atlas_ATL_xerbla" = xyes +then : ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lf77blas" >&5 -$as_echo_n "checking for sgemm in -lf77blas... " >&6; } -if ${ac_cv_lib_f77blas_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lf77blas" >&5 +printf %s "checking for sgemm in -lf77blas... " >&6; } +if test ${ac_cv_lib_f77blas_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lf77blas -latlas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -8927,29 +8854,32 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_f77blas_sgemm=yes -else +else $as_nop ac_cv_lib_f77blas_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_f77blas_sgemm" >&5 -$as_echo "$ac_cv_lib_f77blas_sgemm" >&6; } -if test "x$ac_cv_lib_f77blas_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_f77blas_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_f77blas_sgemm" >&6; } +if test "x$ac_cv_lib_f77blas_sgemm" = xyes +then : ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cblas_dgemm in -lcblas" >&5 -$as_echo_n "checking for cblas_dgemm in -lcblas... " >&6; } -if ${ac_cv_lib_cblas_cblas_dgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cblas_dgemm in -lcblas" >&5 +printf %s "checking for cblas_dgemm in -lcblas... " >&6; } +if test ${ac_cv_lib_cblas_cblas_dgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcblas -lf77blas -latlas $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -8958,30 +8888,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char cblas_dgemm (); int -main () +main (void) { return cblas_dgemm (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_cblas_cblas_dgemm=yes -else +else $as_nop ac_cv_lib_cblas_cblas_dgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cblas_cblas_dgemm" >&5 -$as_echo "$ac_cv_lib_cblas_cblas_dgemm" >&6; } -if test "x$ac_cv_lib_cblas_cblas_dgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cblas_cblas_dgemm" >&5 +printf "%s\n" "$ac_cv_lib_cblas_cblas_dgemm" >&6; } +if test "x$ac_cv_lib_cblas_cblas_dgemm" = xyes +then : pac_blas_ok=yes BLAS_LIBS="-lcblas -lf77blas -latlas $BLAS_LIBDIR" fi @@ -8999,11 +8928,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ATL_xerbla in -lsatlas" >&5 -$as_echo_n "checking for ATL_xerbla in -lsatlas... " >&6; } -if ${ac_cv_lib_satlas_ATL_xerbla+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ATL_xerbla in -lsatlas" >&5 +printf %s "checking for ATL_xerbla in -lsatlas... " >&6; } +if test ${ac_cv_lib_satlas_ATL_xerbla+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsatlas $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9012,40 +8942,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char ATL_xerbla (); int -main () +main (void) { return ATL_xerbla (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_satlas_ATL_xerbla=yes -else +else $as_nop ac_cv_lib_satlas_ATL_xerbla=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_satlas_ATL_xerbla" >&5 -$as_echo "$ac_cv_lib_satlas_ATL_xerbla" >&6; } -if test "x$ac_cv_lib_satlas_ATL_xerbla" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_satlas_ATL_xerbla" >&5 +printf "%s\n" "$ac_cv_lib_satlas_ATL_xerbla" >&6; } +if test "x$ac_cv_lib_satlas_ATL_xerbla" = xyes +then : ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lsatlas" >&5 -$as_echo_n "checking for sgemm in -lsatlas... " >&6; } -if ${ac_cv_lib_satlas_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lsatlas" >&5 +printf %s "checking for sgemm in -lsatlas... " >&6; } +if test ${ac_cv_lib_satlas_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsatlas -lsatlas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9053,29 +8983,32 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_satlas_sgemm=yes -else +else $as_nop ac_cv_lib_satlas_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_satlas_sgemm" >&5 -$as_echo "$ac_cv_lib_satlas_sgemm" >&6; } -if test "x$ac_cv_lib_satlas_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_satlas_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_satlas_sgemm" >&6; } +if test "x$ac_cv_lib_satlas_sgemm" = xyes +then : ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cblas_dgemm in -lsatlas" >&5 -$as_echo_n "checking for cblas_dgemm in -lsatlas... " >&6; } -if ${ac_cv_lib_satlas_cblas_dgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cblas_dgemm in -lsatlas" >&5 +printf %s "checking for cblas_dgemm in -lsatlas... " >&6; } +if test ${ac_cv_lib_satlas_cblas_dgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsatlas -lsatlas $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -9084,30 +9017,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char cblas_dgemm (); int -main () +main (void) { return cblas_dgemm (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_satlas_cblas_dgemm=yes -else +else $as_nop ac_cv_lib_satlas_cblas_dgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_satlas_cblas_dgemm" >&5 -$as_echo "$ac_cv_lib_satlas_cblas_dgemm" >&6; } -if test "x$ac_cv_lib_satlas_cblas_dgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_satlas_cblas_dgemm" >&5 +printf "%s\n" "$ac_cv_lib_satlas_cblas_dgemm" >&6; } +if test "x$ac_cv_lib_satlas_cblas_dgemm" = xyes +then : pac_blas_ok=yes BLAS_LIBS="-lsatlas $BLAS_LIBDIR" fi @@ -9126,11 +9058,12 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lblas" >&5 -$as_echo_n "checking for sgemm in -lblas... " >&6; } -if ${ac_cv_lib_blas_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lblas" >&5 +printf %s "checking for sgemm in -lblas... " >&6; } +if test ${ac_cv_lib_blas_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9138,23 +9071,26 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_blas_sgemm=yes -else +else $as_nop ac_cv_lib_blas_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_sgemm" >&5 -$as_echo "$ac_cv_lib_blas_sgemm" >&6; } -if test "x$ac_cv_lib_blas_sgemm" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgemm in -ldgemm" >&5 -$as_echo_n "checking for dgemm in -ldgemm... " >&6; } -if ${ac_cv_lib_dgemm_dgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_blas_sgemm" >&6; } +if test "x$ac_cv_lib_blas_sgemm" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dgemm in -ldgemm" >&5 +printf %s "checking for dgemm in -ldgemm... " >&6; } +if test ${ac_cv_lib_dgemm_dgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldgemm -lblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9162,23 +9098,26 @@ cat > conftest.$ac_ext <<_ACEOF call dgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_dgemm_dgemm=yes -else +else $as_nop ac_cv_lib_dgemm_dgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dgemm_dgemm" >&5 -$as_echo "$ac_cv_lib_dgemm_dgemm" >&6; } -if test "x$ac_cv_lib_dgemm_dgemm" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lsgemm" >&5 -$as_echo_n "checking for sgemm in -lsgemm... " >&6; } -if ${ac_cv_lib_sgemm_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dgemm_dgemm" >&5 +printf "%s\n" "$ac_cv_lib_dgemm_dgemm" >&6; } +if test "x$ac_cv_lib_dgemm_dgemm" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lsgemm" >&5 +printf %s "checking for sgemm in -lsgemm... " >&6; } +if test ${ac_cv_lib_sgemm_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsgemm -lblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9186,18 +9125,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_sgemm_sgemm=yes -else +else $as_nop ac_cv_lib_sgemm_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sgemm_sgemm" >&5 -$as_echo "$ac_cv_lib_sgemm_sgemm" >&6; } -if test "x$ac_cv_lib_sgemm_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sgemm_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_sgemm_sgemm" >&6; } +if test "x$ac_cv_lib_sgemm_sgemm" = xyes +then : pac_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas $BLAS_LIBDIR" fi @@ -9215,11 +9156,12 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lopenblas" >&5 -$as_echo_n "checking for sgemm in -lopenblas... " >&6; } -if ${ac_cv_lib_openblas_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lopenblas" >&5 +printf %s "checking for sgemm in -lopenblas... " >&6; } +if test ${ac_cv_lib_openblas_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lopenblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9227,18 +9169,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_openblas_sgemm=yes -else +else $as_nop ac_cv_lib_openblas_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openblas_sgemm" >&5 -$as_echo "$ac_cv_lib_openblas_sgemm" >&6; } -if test "x$ac_cv_lib_openblas_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openblas_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_openblas_sgemm" >&6; } +if test "x$ac_cv_lib_openblas_sgemm" = xyes +then : pac_blas_ok=yes;BLAS_LIBS="-lopenblas $BLAS_LIBDIR" fi @@ -9250,12 +9194,13 @@ if test $pac_blas_ok = no; then if test x"$ac_cv_fc_compiler_gnu" = xyes; then # 64 bit if test $host_cpu = x86_64; then - as_ac_Lib=`$as_echo "ac_cv_lib_mkl_gf_lp64_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_gf_lp64" >&5 -$as_echo_n "checking for $sgemm in -lmkl_gf_lp64... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_mkl_gf_lp64_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_gf_lp64" >&5 +printf %s "checking for $sgemm in -lmkl_gf_lp64... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmkl_gf_lp64 -lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9263,30 +9208,33 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread $BLAS_LIBDIR" fi # 32 bit elif test $host_cpu = i686; then - as_ac_Lib=`$as_echo "ac_cv_lib_mkl_gf_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_gf" >&5 -$as_echo_n "checking for $sgemm in -lmkl_gf... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_mkl_gf_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_gf" >&5 +printf %s "checking for $sgemm in -lmkl_gf... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmkl_gf -lmkl_gf -lmkl_sequential -lmkl_core -lpthread $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9294,19 +9242,21 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread $BLAS_LIBDIR" fi @@ -9315,12 +9265,13 @@ fi else # 64-bit if test $host_cpu = x86_64; then - as_ac_Lib=`$as_echo "ac_cv_lib_mkl_intel_lp64_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_intel_lp64" >&5 -$as_echo_n "checking for $sgemm in -lmkl_intel_lp64... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_mkl_intel_lp64_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_intel_lp64" >&5 +printf %s "checking for $sgemm in -lmkl_intel_lp64... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmkl_intel_lp64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9328,30 +9279,33 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread $BLAS_LIBDIR" fi # 32-bit elif test $host_cpu = i686; then - as_ac_Lib=`$as_echo "ac_cv_lib_mkl_intel_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_intel" >&5 -$as_echo_n "checking for $sgemm in -lmkl_intel... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_mkl_intel_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl_intel" >&5 +printf %s "checking for $sgemm in -lmkl_intel... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmkl_intel -lmkl_intel -lmkl_sequential -lmkl_core -lpthread $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9359,19 +9313,21 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread $BLAS_LIBDIR" fi @@ -9380,12 +9336,13 @@ fi fi # Old versions of MKL if test $pac_blas_ok = no; then - as_ac_Lib=`$as_echo "ac_cv_lib_mkl_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl" >&5 -$as_echo_n "checking for $sgemm in -lmkl... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_mkl_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lmkl" >&5 +printf %s "checking for $sgemm in -lmkl... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lmkl -lguide -lpthread $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9393,19 +9350,21 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread $BLAS_LIBDIR" fi @@ -9414,29 +9373,31 @@ fi # BLAS in Apple vecLib library? if test $pac_blas_ok = no; then save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -framework vecLib" >&5 -$as_echo_n "checking for $sgemm in -framework vecLib... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -framework vecLib" >&5 +printf %s "checking for $sgemm in -framework vecLib... " >&6; } cat > conftest.$ac_ext <<_ACEOF program main call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : pac_blas_ok=yes;BLAS_LIBS="-framework vecLib $BLAS_LIBDIR" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_blas_ok" >&5 -$as_echo "$pac_blas_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_blas_ok" >&5 +printf "%s\n" "$pac_blas_ok" >&6; } LIBS="$save_LIBS" fi # BLAS in Alpha CXML library? if test $pac_blas_ok = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lcxml" >&5 -$as_echo_n "checking for sgemm in -lcxml... " >&6; } -if ${ac_cv_lib_cxml_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lcxml" >&5 +printf %s "checking for sgemm in -lcxml... " >&6; } +if test ${ac_cv_lib_cxml_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcxml $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9444,18 +9405,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_cxml_sgemm=yes -else +else $as_nop ac_cv_lib_cxml_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cxml_sgemm" >&5 -$as_echo "$ac_cv_lib_cxml_sgemm" >&6; } -if test "x$ac_cv_lib_cxml_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cxml_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_cxml_sgemm" >&6; } +if test "x$ac_cv_lib_cxml_sgemm" = xyes +then : pac_blas_ok=yes;BLAS_LIBS="-lcxml $BLAS_LIBDIR" fi @@ -9463,11 +9426,12 @@ fi # BLAS in Alpha DXML library? (now called CXML, see above) if test $pac_blas_ok = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -ldxml" >&5 -$as_echo_n "checking for sgemm in -ldxml... " >&6; } -if ${ac_cv_lib_dxml_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -ldxml" >&5 +printf %s "checking for sgemm in -ldxml... " >&6; } +if test ${ac_cv_lib_dxml_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldxml $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9475,18 +9439,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_dxml_sgemm=yes -else +else $as_nop ac_cv_lib_dxml_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dxml_sgemm" >&5 -$as_echo "$ac_cv_lib_dxml_sgemm" >&6; } -if test "x$ac_cv_lib_dxml_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dxml_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_dxml_sgemm" >&6; } +if test "x$ac_cv_lib_dxml_sgemm" = xyes +then : pac_blas_ok=yes;BLAS_LIBS="-ldxml $BLAS_LIBDIR" fi @@ -9496,11 +9462,12 @@ fi # BLAS in Sun Performance library? if test $pac_blas_ok = no; then if test "x$GCC" != xyes; then # only works with Sun CC - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for acosp in -lsunmath" >&5 -$as_echo_n "checking for acosp in -lsunmath... " >&6; } -if ${ac_cv_lib_sunmath_acosp+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for acosp in -lsunmath" >&5 +printf %s "checking for acosp in -lsunmath... " >&6; } +if test ${ac_cv_lib_sunmath_acosp+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsunmath $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9508,23 +9475,26 @@ cat > conftest.$ac_ext <<_ACEOF call acosp end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_sunmath_acosp=yes -else +else $as_nop ac_cv_lib_sunmath_acosp=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sunmath_acosp" >&5 -$as_echo "$ac_cv_lib_sunmath_acosp" >&6; } -if test "x$ac_cv_lib_sunmath_acosp" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lsunperf" >&5 -$as_echo_n "checking for sgemm in -lsunperf... " >&6; } -if ${ac_cv_lib_sunperf_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sunmath_acosp" >&5 +printf "%s\n" "$ac_cv_lib_sunmath_acosp" >&6; } +if test "x$ac_cv_lib_sunmath_acosp" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lsunperf" >&5 +printf %s "checking for sgemm in -lsunperf... " >&6; } +if test ${ac_cv_lib_sunperf_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lsunperf -lsunmath $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9532,18 +9502,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_sunperf_sgemm=yes -else +else $as_nop ac_cv_lib_sunperf_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sunperf_sgemm" >&5 -$as_echo "$ac_cv_lib_sunperf_sgemm" >&6; } -if test "x$ac_cv_lib_sunperf_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sunperf_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_sunperf_sgemm" >&6; } +if test "x$ac_cv_lib_sunperf_sgemm" = xyes +then : BLAS_LIBS="-xlic_lib=sunperf -lsunmath $BLAS_LIBDIR" pac_blas_ok=yes fi @@ -9556,11 +9528,12 @@ fi # BLAS in SCSL library? (SGI/Cray Scientific Library) if test $pac_blas_ok = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lscs" >&5 -$as_echo_n "checking for sgemm in -lscs... " >&6; } -if ${ac_cv_lib_scs_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lscs" >&5 +printf %s "checking for sgemm in -lscs... " >&6; } +if test ${ac_cv_lib_scs_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lscs $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9568,18 +9541,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_scs_sgemm=yes -else +else $as_nop ac_cv_lib_scs_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_scs_sgemm" >&5 -$as_echo "$ac_cv_lib_scs_sgemm" >&6; } -if test "x$ac_cv_lib_scs_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_scs_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_scs_sgemm" >&6; } +if test "x$ac_cv_lib_scs_sgemm" = xyes +then : pac_blas_ok=yes; BLAS_LIBS="-lscs $BLAS_LIBDIR" fi @@ -9587,12 +9562,13 @@ fi # BLAS in SGIMATH library? if test $pac_blas_ok = no; then - as_ac_Lib=`$as_echo "ac_cv_lib_complib.sgimath_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lcomplib.sgimath" >&5 -$as_echo_n "checking for $sgemm in -lcomplib.sgimath... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_complib.sgimath_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lcomplib.sgimath" >&5 +printf %s "checking for $sgemm in -lcomplib.sgimath... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcomplib.sgimath $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9600,19 +9576,21 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath $BLAS_LIBDIR" fi @@ -9620,12 +9598,13 @@ fi # BLAS in IBM ESSL library? (requires generic BLAS lib, too) if test $pac_blas_ok = no; then - as_ac_Lib=`$as_echo "ac_cv_lib_blas_$sgemm" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lblas" >&5 -$as_echo_n "checking for $sgemm in -lblas... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_blas_$sgemm" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $sgemm in -lblas" >&5 +printf %s "checking for $sgemm in -lblas... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9633,24 +9612,27 @@ cat > conftest.$ac_ext <<_ACEOF call $sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lessl" >&5 -$as_echo_n "checking for sgemm in -lessl... " >&6; } -if ${ac_cv_lib_essl_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lessl" >&5 +printf %s "checking for sgemm in -lessl... " >&6; } +if test ${ac_cv_lib_essl_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lessl -lblas $FLIBS $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9658,18 +9640,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_essl_sgemm=yes -else +else $as_nop ac_cv_lib_essl_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_essl_sgemm" >&5 -$as_echo "$ac_cv_lib_essl_sgemm" >&6; } -if test "x$ac_cv_lib_essl_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_essl_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_essl_sgemm" >&6; } +if test "x$ac_cv_lib_essl_sgemm" = xyes +then : pac_blas_ok=yes; BLAS_LIBS="-lessl -lblas $BLAS_LIBDIR" fi @@ -9683,11 +9667,12 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lblas" >&5 -$as_echo_n "checking for sgemm in -lblas... " >&6; } -if ${ac_cv_lib_blas_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lblas" >&5 +printf %s "checking for sgemm in -lblas... " >&6; } +if test ${ac_cv_lib_blas_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9695,25 +9680,25 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_blas_sgemm=yes -else +else $as_nop ac_cv_lib_blas_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_sgemm" >&5 -$as_echo "$ac_cv_lib_blas_sgemm" >&6; } -if test "x$ac_cv_lib_blas_sgemm" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBBLAS 1 -_ACEOF +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_blas_sgemm" >&6; } +if test "x$ac_cv_lib_blas_sgemm" = xyes +then : + printf "%s\n" "#define HAVE_LIBBLAS 1" >>confdefs.h LIBS="-lblas $LIBS" -else +else $as_nop pac_blas_ok=yes;BLAS_LIBS="-lblas $BLAS_LIBDIR" fi @@ -9726,12 +9711,13 @@ if test $pac_blas_ok = no; then call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : pac_blas_ok=yes -else +else $as_nop BLAS_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi @@ -9742,11 +9728,12 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lblas" >&5 -$as_echo_n "checking for sgemm in -lblas... " >&6; } -if ${ac_cv_lib_blas_sgemm+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sgemm in -lblas" >&5 +printf %s "checking for sgemm in -lblas... " >&6; } +if test ${ac_cv_lib_blas_sgemm+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lblas $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9754,18 +9741,20 @@ cat > conftest.$ac_ext <<_ACEOF call sgemm end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : ac_cv_lib_blas_sgemm=yes -else +else $as_nop ac_cv_lib_blas_sgemm=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_sgemm" >&5 -$as_echo "$ac_cv_lib_blas_sgemm" >&6; } -if test "x$ac_cv_lib_blas_sgemm" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_blas_sgemm" >&5 +printf "%s\n" "$ac_cv_lib_blas_sgemm" >&6; } +if test "x$ac_cv_lib_blas_sgemm" = xyes +then : pac_blas_ok=yes; BLAS_LIBS="-lblas $BLAS_LIBDIR" fi @@ -9777,7 +9766,7 @@ LIBS="$pac_blas_save_LIBS" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$pac_blas_ok" = xyes; then -$as_echo "#define HAVE_BLAS 1" >>confdefs.h +printf "%s\n" "#define HAVE_BLAS 1" >>confdefs.h : else @@ -9791,7 +9780,8 @@ pac_lapack_ok=no # Check whether --with-lapack was given. -if test "${with_lapack+set}" = set; then : +if test ${with_lapack+y} +then : withval=$with_lapack; fi @@ -9813,8 +9803,8 @@ fi # First, check LAPACK_LIBS environment variable if test "x$LAPACK_LIBS" != x; then save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cheev in $LAPACK_LIBS" >&5 -$as_echo_n "checking for cheev in $LAPACK_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cheev in $LAPACK_LIBS" >&5 +printf %s "checking for cheev in $LAPACK_LIBS... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -9828,14 +9818,14 @@ EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pac_lapack_ok=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi @@ -9855,8 +9845,8 @@ fi # LAPACK linked to by default? (is sometimes included in BLAS lib) if test $pac_lapack_ok = no; then save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cheev in default libs" >&5 -$as_echo_n "checking for cheev in default libs... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cheev in default libs" >&5 +printf %s "checking for cheev in default libs... " >&6; } ac_ext=${ac_fc_srcext-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' @@ -9870,14 +9860,14 @@ EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pac_lapack_ok=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi @@ -9900,12 +9890,13 @@ ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_fc_compiler_gnu - as_ac_Lib=`$as_echo "ac_cv_lib_$lapack''_cheev" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cheev in -l$lapack" >&5 -$as_echo_n "checking for cheev in -l$lapack... " >&6; } -if eval \${$as_ac_Lib+:} false; then : - $as_echo_n "(cached) " >&6 -else + as_ac_Lib=`printf "%s\n" "ac_cv_lib_$lapack""_cheev" | $as_tr_sh` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for cheev in -l$lapack" >&5 +printf %s "checking for cheev in -l$lapack... " >&6; } +if eval test \${$as_ac_Lib+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-l$lapack $FLIBS $LIBS" cat > conftest.$ac_ext <<_ACEOF @@ -9913,19 +9904,21 @@ cat > conftest.$ac_ext <<_ACEOF call cheev end _ACEOF -if ac_fn_fc_try_link "$LINENO"; then : +if ac_fn_fc_try_link "$LINENO" +then : eval "$as_ac_Lib=yes" -else +else $as_nop eval "$as_ac_Lib=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi eval ac_res=\$$as_ac_Lib - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } +if eval test \"x\$"$as_ac_Lib"\" = x"yes" +then : pac_lapack_ok=yes; LAPACK_LIBS="-l$lapack" fi @@ -9973,17 +9966,17 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu #fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnumake" >&5 -$as_echo_n "checking for gnumake... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gnumake" >&5 +printf %s "checking for gnumake... " >&6; } MAKE=${MAKE:-make} if $MAKE --version 2>&1 | grep -e"GNU Make" >/dev/null; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } psblas_make_gnumake='yes' else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } psblas_make_gnumake='no' fi @@ -10002,10 +9995,11 @@ fi # Check whether --with-rsb was given. -if test "${with_rsb+set}" = set; then : +if test ${with_rsb+y} +then : withval=$with_rsb; if test x"$withval" = xno; then want_rsb_libs= ; else if test x"$withval" = xyes ; then want_rsb_libs=yes ; else want_rsb_libs="$withval" ; fi ; fi -else +else $as_nop want_rsb_libs="" fi @@ -10027,41 +10021,46 @@ LIBS="$RSB_LIBS ${LIBS}" # Check whether --with-metis was given. -if test "${with_metis+set}" = set; then : +if test ${with_metis+y} +then : withval=$with_metis; psblas_cv_metis=$withval -else +else $as_nop psblas_cv_metis='-lmetis' fi # Check whether --with-metisincfile was given. -if test "${with_metisincfile+set}" = set; then : +if test ${with_metisincfile+y} +then : withval=$with_metisincfile; psblas_cv_metisincfile=$withval -else +else $as_nop psblas_cv_metisincfile='metis.h' fi # Check whether --with-metisdir was given. -if test "${with_metisdir+set}" = set; then : +if test ${with_metisdir+y} +then : withval=$with_metisdir; psblas_cv_metisdir=$withval -else +else $as_nop psblas_cv_metisdir='' fi # Check whether --with-metisincdir was given. -if test "${with_metisincdir+set}" = set; then : +if test ${with_metisincdir+y} +then : withval=$with_metisincdir; psblas_cv_metisincdir=$withval -else +else $as_nop psblas_cv_metisincdir='' fi # Check whether --with-metislibdir was given. -if test "${with_metislibdir+set}" = set; then : +if test ${with_metislibdir+y} +then : withval=$with_metislibdir; psblas_cv_metislibdir=$withval -else +else $as_nop psblas_cv_metislibdir='' fi @@ -10089,65 +10088,65 @@ if test "x$psblas_cv_metislibdir" != "x"; then METIS_LIBDIR="-L$psblas_cv_metislibdir" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: metis dir $psblas_cv_metisdir" >&5 -$as_echo "$as_me: metis dir $psblas_cv_metisdir" >&6;} -for ac_header in limits.h $psblas_cv_metisincfile +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: metis dir $psblas_cv_metisdir" >&5 +printf "%s\n" "$as_me: metis dir $psblas_cv_metisdir" >&6;} + for ac_header in limits.h "$psblas_cv_metisincfile" do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF pac_metis_header_ok=yes -else +else $as_nop pac_metis_header_ok=no; METIS_INCLUDES="" fi done - if test "x$pac_metis_header_ok" == "xno" ; then unset ac_cv_header_metis_h METIS_INCLUDES="-I$psblas_cv_metisdir/include -I$psblas_cv_metisdir/Include " CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for metis_h in $METIS_INCLUDES" >&5 -$as_echo_n "checking for metis_h in $METIS_INCLUDES... " >&6; } - for ac_header in limits.h $psblas_cv_metisincfile + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for metis_h in $METIS_INCLUDES" >&5 +printf %s "checking for metis_h in $METIS_INCLUDES... " >&6; } + for ac_header in limits.h "$psblas_cv_metisincfile" do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF pac_metis_header_ok=yes -else +else $as_nop pac_metis_header_ok=no; METIS_INCLUDES="" fi done - fi if test "x$pac_metis_header_ok" == "xno" ; then unset ac_cv_header_metis_h METIS_INCLUDES="-I$psblas_cv_metisdir/UFconfig -I$psblas_cv_metisdir/METIS/Include -I$psblas_cv_metisdir/METIS/Include" CPPFLAGS="$METIS_INCLUDES $SAVE_CPPFLAGS" - for ac_header in limits.h $psblas_cv_metisincfile + for ac_header in limits.h "$psblas_cv_metisincfile" do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF pac_metis_header_ok=yes -else +else $as_nop pac_metis_header_ok=no; METIS_INCLUDES="" fi done - fi if test "x$pac_metis_header_ok" == "xyes" ; then @@ -10157,8 +10156,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS integer size" >&5 -$as_echo_n "checking for METIS integer size... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for METIS integer size" >&5 +printf %s "checking for METIS integer size... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -10168,15 +10167,16 @@ $as_echo_n "checking for METIS integer size... " >&6; } } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : pac_cv_metis_idx=`./conftest${ac_exeext} | sed 's/^ *//'` -else +else $as_nop pac_cv_metis_idx="unknown" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_cv_metis_idx" >&5 -$as_echo "$pac_cv_metis_idx" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_cv_metis_idx" >&5 +printf "%s\n" "$pac_cv_metis_idx" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -10193,8 +10193,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS real size" >&5 -$as_echo_n "checking for METIS real size... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for METIS real size" >&5 +printf %s "checking for METIS real size... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -10204,15 +10204,16 @@ $as_echo_n "checking for METIS real size... " >&6; } } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : pac_cv_metis_real=`./conftest${ac_exeext} | sed 's/^ *//'` -else +else $as_nop pac_cv_metis_real="unknown" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_cv_metis_real" >&5 -$as_echo "$pac_cv_metis_real" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_cv_metis_real" >&5 +printf "%s\n" "$pac_cv_metis_real" >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -10226,138 +10227,130 @@ if test "x$pac_metis_header_ok" = "xyes" ; then psblas_cv_metis_includes="$METIS_INCLUDES" METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR" LIBS="$METIS_LIBS -lm $LIBS"; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS_PartGraphKway in $METIS_LIBS" >&5 -$as_echo_n "checking for METIS_PartGraphKway in $METIS_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for METIS_PartGraphKway in $METIS_LIBS" >&5 +printf %s "checking for METIS_PartGraphKway in $METIS_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char METIS_PartGraphKway (); int -main () +main (void) { return METIS_PartGraphKway (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; -else +else $as_nop psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 -$as_echo "$pac_metis_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 +printf "%s\n" "$pac_metis_lib_ok" >&6; } if test "x$pac_metis_lib_ok" = "xno" ; then METIS_LIBDIR="-L$psblas_cv_metisdir/Lib -L$psblas_cv_metisdir/lib" METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR" LIBS="$METIS_LIBS -lm $SAVE_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS_PartGraphKway in $METIS_LIBS" >&5 -$as_echo_n "checking for METIS_PartGraphKway in $METIS_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for METIS_PartGraphKway in $METIS_LIBS" >&5 +printf %s "checking for METIS_PartGraphKway in $METIS_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char METIS_PartGraphKway (); int -main () +main (void) { return METIS_PartGraphKway (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; -else +else $as_nop psblas_cv_have_metis=no;pac_metis_lib_ok=no; METIS_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 -$as_echo "$pac_metis_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 +printf "%s\n" "$pac_metis_lib_ok" >&6; } fi if test "x$pac_metis_lib_ok" = "xno" ; then METIS_LIBDIR="-L$psblas_cv_metisdir/METIS/Lib -L$psblas_cv_metisdir/METIS/Lib" METIS_LIBS="$psblas_cv_metis $METIS_LIBDIR" LIBS="$METIS_LIBS -lm $SAVE_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS_PartGraphKway in $METIS_LIBS" >&5 -$as_echo_n "checking for METIS_PartGraphKway in $METIS_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for METIS_PartGraphKway in $METIS_LIBS" >&5 +printf %s "checking for METIS_PartGraphKway in $METIS_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char METIS_PartGraphKway (); int -main () +main (void) { return METIS_PartGraphKway (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_metis=yes;pac_metis_lib_ok="yes"; -else +else $as_nop psblas_cv_have_metis=no;pac_metis_lib_ok="no"; METIS_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 -$as_echo "$pac_metis_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 +printf "%s\n" "$pac_metis_lib_ok" >&6; } fi fi if test "x$pac_metis_lib_ok" = "xyes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for METIS_SetDefaultOptions in $LIBS" >&5 -$as_echo_n "checking for METIS_SetDefaultOptions in $LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for METIS_SetDefaultOptions in $LIBS" >&5 +printf %s "checking for METIS_SetDefaultOptions in $LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char METIS_SetDefaultOptions (); int -main () +main (void) { return METIS_SetDefaultOptions (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_metis=yes;pac_metis_lib_ok=yes; -else +else $as_nop psblas_cv_have_metis=no;pac_metis_lib_ok="no. Unusable METIS version, sorry."; METIS_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 -$as_echo "$pac_metis_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_metis_lib_ok" >&5 +printf "%s\n" "$pac_metis_lib_ok" >&6; } fi @@ -10365,8 +10358,8 @@ LIBS="$SAVE_LIBS"; CPPFLAGS="$SAVE_CPPFLAGS"; -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Compatibility between metis and LPK" >&5 -$as_echo_n "checking Compatibility between metis and LPK... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking Compatibility between metis and LPK" >&5 +printf %s "checking Compatibility between metis and LPK... " >&6; } if test "x$pac_cv_lpk_size" == "x4" ; then if test "x$pac_cv_metis_idx" == "x64" ; then psblas_cv_have_metis="no"; @@ -10377,17 +10370,17 @@ if test "x$pac_cv_lpk_size" == "x4" ; then psblas_cv_have_metis="no"; fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $psblas_cv_have_metis" >&5 -$as_echo "$psblas_cv_have_metis" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $psblas_cv_have_metis" >&5 +printf "%s\n" "$psblas_cv_have_metis" >&6; } if test "x$pac_cv_metis_idx" == "xunknown" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Unknown METIS bitsize." >&5 -$as_echo "$as_me: Unknown METIS bitsize." >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Unknown METIS bitsize." >&5 +printf "%s\n" "$as_me: Unknown METIS bitsize." >&6;} $psblas_cv_have_metis = "no"; fi if test "x$pac_cv_metis_real" == "xunknown" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Unknown METIS REAL bitsize." >&5 -$as_echo "$as_me: Unknown METIS REAL bitsize." >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: Unknown METIS REAL bitsize." >&5 +printf "%s\n" "$as_me: Unknown METIS REAL bitsize." >&6;} $psblas_cv_have_metis = "no"; fi if test "x$psblas_cv_have_metis" == "xyes" ; then @@ -10398,33 +10391,37 @@ fi # Check whether --with-amd was given. -if test "${with_amd+set}" = set; then : +if test ${with_amd+y} +then : withval=$with_amd; psblas_cv_amd=$withval -else +else $as_nop psblas_cv_amd='-lamd' fi # Check whether --with-amddir was given. -if test "${with_amddir+set}" = set; then : +if test ${with_amddir+y} +then : withval=$with_amddir; psblas_cv_amddir=$withval -else +else $as_nop psblas_cv_amddir='' fi # Check whether --with-amdincdir was given. -if test "${with_amdincdir+set}" = set; then : +if test ${with_amdincdir+y} +then : withval=$with_amdincdir; psblas_cv_amdincdir=$withval -else +else $as_nop psblas_cv_amdincdir='' fi # Check whether --with-amdlibdir was given. -if test "${with_amdlibdir+set}" = set; then : +if test ${with_amdlibdir+y} +then : withval=$with_amdlibdir; psblas_cv_amdlibdir=$withval -else +else $as_nop psblas_cv_amdlibdir='' fi @@ -10452,44 +10449,44 @@ if test "x$psblas_cv_amdlibdir" != "x"; then AMD_LIBDIR="-L$psblas_cv_amdlibdir" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: amd dir $psblas_cv_amddir" >&5 -$as_echo "$as_me: amd dir $psblas_cv_amddir" >&6;} -ac_fn_c_check_header_mongrel "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default" -if test "x$ac_cv_header_amd_h" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: amd dir $psblas_cv_amddir" >&5 +printf "%s\n" "$as_me: amd dir $psblas_cv_amddir" >&6;} +ac_fn_c_check_header_compile "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default" +if test "x$ac_cv_header_amd_h" = xyes +then : pac_amd_header_ok=yes -else +else $as_nop pac_amd_header_ok=no; AMD_INCLUDES="" fi - if test "x$pac_amd_header_ok" == "xno" ; then unset ac_cv_header_amd_h AMD_INCLUDES="-I$psblas_cv_amddir/include -I$psblas_cv_amddir/Include " CPPFLAGS="$AMD_INCLUDES $SAVE_CPPFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_h in $AMD_INCLUDES" >&5 -$as_echo_n "checking for amd_h in $AMD_INCLUDES... " >&6; } - ac_fn_c_check_header_mongrel "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default" -if test "x$ac_cv_header_amd_h" = xyes; then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for amd_h in $AMD_INCLUDES" >&5 +printf %s "checking for amd_h in $AMD_INCLUDES... " >&6; } + ac_fn_c_check_header_compile "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default" +if test "x$ac_cv_header_amd_h" = xyes +then : pac_amd_header_ok=yes -else +else $as_nop pac_amd_header_ok=no; AMD_INCLUDES="" fi - fi if test "x$pac_amd_header_ok" == "xno" ; then unset ac_cv_header_amd_h AMD_INCLUDES="-I$psblas_cv_amddir/UFconfig -I$psblas_cv_amddir/AMD/Include -I$psblas_cv_amddir/AMD/Include" CPPFLAGS="$AMD_INCLUDES $SAVE_CPPFLAGS" - ac_fn_c_check_header_mongrel "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default" -if test "x$ac_cv_header_amd_h" = xyes; then : + ac_fn_c_check_header_compile "$LINENO" "amd.h" "ac_cv_header_amd_h" "$ac_includes_default" +if test "x$ac_cv_header_amd_h" = xyes +then : pac_amd_header_ok=yes -else +else $as_nop pac_amd_header_ok=no; AMD_INCLUDES="" fi - fi @@ -10497,103 +10494,97 @@ if test "x$pac_amd_header_ok" == "xyes" ; then psblas_cv_amd_includes="$AMD_INCLUDES" AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR" LIBS="$AMD_LIBS -lm $LIBS"; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5 -$as_echo_n "checking for amd_order in $AMD_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5 +printf %s "checking for amd_order in $AMD_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char amd_order (); int -main () +main (void) { return amd_order (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_amd=yes;pac_amd_lib_ok=yes; -else +else $as_nop psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5 -$as_echo "$pac_amd_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5 +printf "%s\n" "$pac_amd_lib_ok" >&6; } if test "x$pac_amd_lib_ok" == "xno" ; then AMD_LIBDIR="-L$psblas_cv_amddir/Lib -L$psblas_cv_amddir/lib" AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR" LIBS="$AMD_LIBS -lm $SAVE_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5 -$as_echo_n "checking for amd_order in $AMD_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5 +printf %s "checking for amd_order in $AMD_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char amd_order (); int -main () +main (void) { return amd_order (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_amd=yes;pac_amd_lib_ok=yes; -else +else $as_nop psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5 -$as_echo "$pac_amd_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5 +printf "%s\n" "$pac_amd_lib_ok" >&6; } fi if test "x$pac_amd_lib_ok" == "xno" ; then AMD_LIBDIR="-L$psblas_cv_amddir/AMD/Lib -L$psblas_cv_amddir/AMD/Lib" AMD_LIBS="$psblas_cv_amd $AMD_LIBDIR" LIBS="$AMD_LIBS -lm $SAVE_LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5 -$as_echo_n "checking for amd_order in $AMD_LIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for amd_order in $AMD_LIBS" >&5 +printf %s "checking for amd_order in $AMD_LIBS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char amd_order (); int -main () +main (void) { return amd_order (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : psblas_cv_have_amd=yes;pac_amd_lib_ok=yes; -else +else $as_nop psblas_cv_have_amd=no;pac_amd_lib_ok=no; AMD_LIBS="" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5 -$as_echo "$pac_amd_lib_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $pac_amd_lib_ok" >&5 +printf "%s\n" "$pac_amd_lib_ok" >&6; } fi fi LIBS="$SAVE_LIBS"; @@ -10722,8 +10713,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -10753,15 +10744,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -10775,8 +10766,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -10829,7 +10820,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -10840,14 +10831,14 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -10873,8 +10864,8 @@ fi ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -10897,14 +10888,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -10914,46 +10907,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -10962,13 +10955,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -10977,8 +10963,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -10990,30 +10980,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -11026,13 +10996,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -11059,18 +11030,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -11082,12 +11055,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -11118,7 +11092,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -11140,6 +11114,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -11153,6 +11131,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -11194,7 +11178,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -11203,7 +11187,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -11266,7 +11250,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by PSBLAS $as_me 3.7.0, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -11319,14 +11303,16 @@ $config_commands Report bugs to ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ PSBLAS config.status 3.7.0 -configured by $0, generated by GNU Autoconf 2.69, +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -11366,21 +11352,21 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -11408,7 +11394,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -11422,7 +11408,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -11454,8 +11440,8 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree @@ -11683,7 +11669,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -11691,17 +11677,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -11718,7 +11704,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -11742,9 +11728,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -11806,8 +11792,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -11851,9 +11837,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -11865,8 +11851,8 @@ which seems to be undefined. Please make sure it is defined" >&2;} ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} ;; esac @@ -11892,7 +11878,7 @@ esac for am_mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line @@ -11904,7 +11890,7 @@ $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | +printf "%s\n" X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -11926,7 +11912,7 @@ $as_echo X"$am_mf" | $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | +printf "%s\n" X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -11951,8 +11937,8 @@ $as_echo X/"$am_mf" | (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is @@ -12002,14 +11988,14 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi #AC_OUTPUT(Make.inc Makefile) ############################################################################### -{ $as_echo "$as_me:${as_lineno-$LINENO}: +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${PACKAGE_NAME} ${psblas_cv_version} has been configured as follows: MPIFC : ${MPIFC} @@ -12039,7 +12025,7 @@ fi If you are satisfied, run 'make' to build ${PACKAGE_NAME} and its documentation; otherwise type ./configure --help=short for a complete list of configure options specific to ${PACKAGE_NAME}. " >&5 -$as_echo "$as_me: +printf "%s\n" "$as_me: ${PACKAGE_NAME} ${psblas_cv_version} has been configured as follows: MPIFC : ${MPIFC} @@ -12072,3 +12058,4 @@ $as_echo "$as_me: ############################################################################### + diff --git a/configure.ac b/configure.ac index 28e37269..60191cdb 100755 --- a/configure.ac +++ b/configure.ac @@ -104,6 +104,11 @@ AC_PROG_FC([ftn xlf2003_r xlf2003 xlf95_r xlf95 xlf90 xlf pgf95 pgf90 ifort ifc FCFLAGS="$save_FCFLAGS"; save_CFLAGS="$CFLAGS"; AC_PROG_CC([xlc pgcc icc gcc cc ]) +if test "x$ac_cv_prog_cc_stdc" == "xno" ; then + AC_MSG_ERROR([Problem : Need a C99 compiler ! ]) +else + C99OPT="$ac_cv_prog_cc_stdc"; +fi CFLAGS="$save_CFLAGS"; AC_PROG_CXX([CC xlc++ icpc g++]) @@ -118,12 +123,6 @@ fi if test "X$CC" == "X" ; then AC_MSG_ERROR([Problem : No C compiler specified nor found!]) fi -AC_PROG_CC_STDC() -if test "x$ac_cv_prog_cc_stdc" == "xno" ; then - AC_MSG_ERROR([Problem : Need a C99 compiler ! ]) -else - C99OPT="$ac_cv_prog_cc_stdc"; -fi @@ -148,7 +147,6 @@ if test "X$MPICC" = "X" ; then AC_CHECK_PROGS([MPICC],[mpxlc mpiicc mpcc mpicc cc]) fi ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for C]])]) -AC_PROG_CC_STDC AC_LANG([Fortran]) AC_LANG([C++]) @@ -157,7 +155,6 @@ if test "X$MPICXX" = "X" ; then AC_CHECK_PROGS([MPICXX],[mpxlc++ mpiicpc mpicxx]) fi ACX_MPI([], [AC_MSG_ERROR([[Cannot find any suitable MPI implementation for C++]])]) -dnl AC_PROG_CC_STDC AC_LANG([Fortran]) if test "X$MPIFC" = "X" ; then @@ -730,7 +727,7 @@ PAC_MAKE_IS_GNUMAKE # Note : also umfdi_local_search, ... #AC_CHECK_LIB(umf,umfpack_di_solve,psblas_cv_have_umfpack=yes,psblas_cv_have_umfpack=no,[amd]) -AC_ARG_WITH(rsb, AC_HELP_STRING([--with-rsb], [Specify Recursive Sparse BLAS library linkage info (that is, the output of librsb-config --static --ldflags, or a directory where the usual bin/include/lib subdirs with a regular RSB installation resides, or nothing to make the configure script invoke librsb-config)]), [if test x"$withval" = xno; then +AC_ARG_WITH(rsb, AS_HELP_STRING([--with-rsb], [Specify Recursive Sparse BLAS library linkage info (that is, the output of librsb-config --static --ldflags, or a directory where the usual bin/include/lib subdirs with a regular RSB installation resides, or nothing to make the configure script invoke librsb-config)]), [if test x"$withval" = xno; then want_rsb_libs= ; else if test x"$withval" = xyes ; then want_rsb_libs=yes ; else want_rsb_libs="$withval" ; fi ; fi], [want_rsb_libs=""]) if test x"$want_rsb_libs" != x ; then if test x"$want_rsb_libs" = xyes ; then diff --git a/docs/html/index.html b/docs/html/index.html index 2906d9ce..c4f777e4 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -20,8 +20,8 @@ class="newline" /> Salvatore Filippone
Alfredo Buttari
Software version: 3.7.0.1
May 11th, 2021 +class="newline" />Software version: 3.8.0
May 1st, 2022 diff --git a/docs/html/userhtml.html b/docs/html/userhtml.html index 2906d9ce..c4f777e4 100644 --- a/docs/html/userhtml.html +++ b/docs/html/userhtml.html @@ -20,8 +20,8 @@ class="newline" /> Salvatore Filippone
Alfredo Buttari
Software version: 3.7.0.1
May 11th, 2021 +class="newline" />Software version: 3.8.0
May 1st, 2022 diff --git a/docs/html/userhtml29x.png b/docs/html/userhtml29x.png index 64db17ce..b4efccdb 100644 Binary files a/docs/html/userhtml29x.png and b/docs/html/userhtml29x.png differ diff --git a/docs/html/userhtmlse8.html b/docs/html/userhtmlse8.html index 01a8f7f7..d4260b27 100644 --- a/docs/html/userhtmlse8.html +++ b/docs/html/userhtmlse8.html @@ -350,7 +350,7 @@ process).

-

+
 ==========================================================
 Process: 0.  PSBLAS Error (4010) in subroutine: df_sample
 Error from call to subroutine mat dist
diff --git a/docs/html/userhtmlsu2.html b/docs/html/userhtmlsu2.html
index 5d1e6f85..504e17fe 100644
--- a/docs/html/userhtmlsu2.html
+++ b/docs/html/userhtmlsu2.html
@@ -114,7 +114,7 @@ class="description">Each process has its own value(s) independently.
 src="userhtml0x.png" alt="psb_version_string_
 " class="math-display" >
 

whose current value is 3.7.0 +class="cmtt-10">3.8.0 diff --git a/docs/html/userhtmlsu36.html b/docs/html/userhtmlsu36.html index 9616adcb..d9cadf8e 100644 --- a/docs/html/userhtmlsu36.html +++ b/docs/html/userhtmlsu36.html @@ -22,7 +22,7 @@ href="userhtmlsu32.html#userhtmlsu39.html" >up]

-call psb_spall(a, desc_a, info, nnz)
+call psb_spall(a, desc_a, info [, nnz, dupl, bldmode])
 

@@ -61,12 +61,47 @@ class="newline" />Type: optional.
Intent: in.
Specified as: an integer value. -

+class="newline" />Specified as: an integer value. +

+dupl
How to handle duplicate coefficients.
Scope: global.
Type: optional.
Intent: in.
Specified as: integer, possible values: psb_dupl_ovwrt_, psb_dupl_add_, + psb_dupl_err_. +
+bldmode
Whether to keep track of matrix entries that do not belong to the + current process.
Scope: global.
Type: optional.
Intent: in.
Specified as: + an integer value psb_matbld_noremote_, psb_matbld_remote_. Default: + psb_matbld_noremote_.
+

On Return
+ + +
a
required
Intent: out.
An integer value; 0 means no error has been detected.
-

Notes

  1. On exit from this routine the sparse matrix is in the build state. - - -
  2. The descriptor may be in either the build or assembled state. @@ -110,19 +142,24 @@ class="cmbx-12">Notes class="cmmi-10">nnz in the assembled matrix may substantially improve performance in the matrix build phase, as it will reduce or eliminate the need for (potentially - multiple) data reallocations.
+ multiple) data reallocations; + +
  • Using psb_matbld_remote_ is likely to cause a runtime overhead at + assembly time;
  • -
    -

    -

    +

    +

    Type:
    optional.
    Specified as: a logical value; default: .false..
    -

    +

    On Return
    required
    Intent: out.
    An integer value; 0 means no error has been detected.
    -

    Notes

    1. ,ja(i),val(i), for i = 1i = 1,,nz; these triples should - belong to the current process, i.e. ia(i) should be one of the local indices, - but are otherwise arbitrary; +class="cmmi-10">,nz; these triples are + arbitrary;
    2. In CSR format the coefficients to be inserted for each input row -1 should be one of the local indices, but are otherwise call, according to the application needs;
    3. Any coefficients from matrix rows not owned by the calling process are - silently ignored; + class="enumerate" id="x48-85018x9">Coefficients from matrix rows not owned by the calling process are treated + according to the value of bldmode specified at allocation time; if bldmode + was chosen as psb_matbld_remote_ the library will keep track of them, + otherwise they are silently ignored; @@ -300,12 +302,12 @@ class="cmsy-10">-1 should be one of the local indices, but are otherwise -
    4. +
    5. If the bldmode=psb_matbld_remote_ value was specified at allocation + time, contributions defined on the current process but belonging to a + remote process will be handled accordingly. This is most likely to occur in + finite element applications, with dupl=psb_dupl_add_; it is necessary to + check for possible updates needed in the descriptor, hence there will be a + runtime overhead.
    -