SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ rdbsbr()

subroutine rdbsbr ( integer  memused,
integer, dimension(memlen)  mem,
integer  memlen,
integer  cmemused,
character*1, dimension(cmemlen)  cmem,
integer  cmemlen,
integer  outnum 
)

Definition at line 1912 of file blacstest.f.

1914*
1915* -- BLACS tester (version 1.0) --
1916* University of Tennessee
1917* December 15, 1994
1918*
1919*
1920* .. Scalar Arguments ..
1921 INTEGER MEMUSED, MEMLEN, CMEMUSED, CMEMLEN, OUTNUM
1922* ..
1923* .. Array Arguments ..
1924 CHARACTER*1 CMEM(CMEMLEN)
1925 INTEGER MEM(MEMLEN)
1926* ..
1927*
1928* Purpose
1929* =======
1930* RDBSBR: Read and process the input file BSBR.dat.
1931*
1932* Arguments
1933* =========
1934* MEMUSED (output) INTEGER
1935* Number of elements in MEM that this subroutine ends up using.
1936*
1937* MEM (output) INTEGER array of dimension memlen
1938* On output, holds information read in from sdrv.dat.
1939*
1940* MEMLEN (input) INTEGER
1941* Number of elements of MEM that this subroutine
1942* may safely write into.
1943*
1944* CMEMUSED (output) INTEGER
1945* Number of elements in CMEM that this subroutine ends up using.
1946*
1947* CMEM (output) CHARACTER*1 array of dimension cmemlen
1948* On output, holds the values for UPLO and DIAG.
1949*
1950* CMEMLEN (input) INTEGER
1951* Number of elements of CMEM that this subroutine
1952* may safely write into.
1953*
1954* OUTNUM (input) INTEGER
1955* Unit number of the output file.
1956*
1957* =================================================================
1958*
1959* .. Parameters ..
1960 INTEGER SDIN
1961 parameter( sdin = 12 )
1962* ..
1963* .. External Functions ..
1964 LOGICAL LSAME
1965 EXTERNAL lsame
1966* ..
1967* .. Local Scalars ..
1968 INTEGER NSCOPE, NTOP, NSHAPE, NMAT, NSRC, NGRID, I, J
1969 INTEGER SCOPEPTR, TOPPTR, UPLOPTR, DIAGPTR, MPTR, NPTR
1970 INTEGER LDSPTR, LDDPTR, RSRCPTR, CSRCPTR, PPTR, QPTR
1971* ..
1972* .. Executable Statements
1973*
1974* Open and read the file bsbr.dat. The expected format is
1975* below.
1976*
1977*------
1978*integer Number of scopes
1979*array of CHAR*1's Values for Scopes
1980*integer Number of topologies
1981*array of CHAR*1's Values for TOP
1982*integer number of shapes of the matrix
1983*array of CHAR*1's UPLO
1984*array of CHAR*1's DIAG: unit diagonal or not?
1985*integer number of nmat
1986*array of integers M: number of rows in matrix
1987*array of integers N: number of columns in matrix
1988*integer LDA: leading dimension on source proc
1989*integer LDA: leading dimension on dest proc
1990*integer number of source/dest pairs
1991*array of integers RSRC: process row of message source
1992*array of integers CSRC: process column of msg. src.
1993*integer Number of grids
1994*array of integers NPROW: number of rows in process grid
1995*array of integers NPCOL: number of col's in proc. grid
1996*------
1997* note: UPLO stands for 'upper or lower trapezoidal or general
1998* rectangular.'
1999* note: the text descriptions as shown above are present in
2000* the sample bsbr.dat included with this distribution,
2001* but are not required.
2002*
2003* Read input file
2004*
2005 memused = 1
2006 cmemused = 1
2007 OPEN(unit = sdin, file = 'bsbr.dat', status = 'OLD')
2008*
2009* Read in scopes and topologies
2010*
2011 READ(sdin, *) nscope
2012 scopeptr = cmemused
2013 cmemused = scopeptr + nscope
2014 IF ( cmemused .GT. cmemlen ) THEN
2015 WRITE(outnum, 1000) cmemlen, nscope, 'SCOPES.'
2016 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2017 stop
2018 ELSE IF( nscope .LT. 1 ) THEN
2019 WRITE(outnum, 2000) 'SCOPE.'
2020 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2021 stop
2022 END IF
2023*
2024 READ(sdin, *) ( cmem(scopeptr+i), i = 0, nscope-1 )
2025 DO 20 i = 0, nscope-1
2026 IF( lsame(cmem(scopeptr+i), 'R') ) THEN
2027 cmem(scopeptr+i) = 'R'
2028 ELSE IF( lsame(cmem(scopeptr+i), 'C') ) THEN
2029 cmem(scopeptr+i) = 'C'
2030 ELSE IF( lsame(cmem(scopeptr+i), 'A') ) THEN
2031 cmem(scopeptr+i) = 'A'
2032 ELSE
2033 WRITE(outnum, 3000) 'SCOPE', cmem(scopeptr+i)
2034 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2035 stop
2036 END IF
2037 20 CONTINUE
2038*
2039 READ(sdin, *) ntop
2040 topptr = cmemused
2041 cmemused = topptr + ntop
2042 IF ( cmemused .GT. cmemlen ) THEN
2043 WRITE(outnum, 1000) cmemlen, ntop, 'TOPOLOGIES.'
2044 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2045 stop
2046 ELSE IF( ntop .LT. 1 ) THEN
2047 WRITE(outnum, 2000) 'TOPOLOGY.'
2048 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2049 stop
2050 END IF
2051 READ(sdin, *) ( cmem(topptr+i), i = 0, ntop-1 )
2052*
2053*
2054* Read in number of shapes, and values of UPLO and DIAG
2055*
2056 READ(sdin, *) nshape
2057 uploptr = cmemused
2058 diagptr = uploptr + nshape
2059 cmemused = diagptr + nshape
2060 IF ( cmemused .GT. cmemlen ) THEN
2061 WRITE(outnum, 1000) cmemlen, nshape, 'MATRIX SHAPES.'
2062 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2063 stop
2064 ELSE IF( nshape .LT. 1 ) THEN
2065 WRITE(outnum, 2000) 'MATRIX SHAPE.'
2066 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2067 stop
2068 END IF
2069*
2070* Read in, upcase, and fatal error if UPLO/DIAG not recognized
2071*
2072 READ(sdin, *) ( cmem(uploptr+i), i = 0, nshape-1 )
2073 DO 30 i = 0, nshape-1
2074 IF( lsame(cmem(uploptr+i), 'G') ) THEN
2075 cmem(uploptr+i) = 'G'
2076 ELSE IF( lsame(cmem(uploptr+i), 'U') ) THEN
2077 cmem(uploptr+i) = 'U'
2078 ELSE IF( lsame(cmem(uploptr+i), 'L') ) THEN
2079 cmem(uploptr+i) = 'L'
2080 ELSE
2081 WRITE(outnum, 3000) 'UPLO ', cmem(uploptr+i)
2082 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2083 stop
2084 END IF
2085 30 CONTINUE
2086*
2087 READ(sdin, *) ( cmem(diagptr+i), i = 0, nshape-1 )
2088 DO 40 i = 0, nshape-1
2089 IF( cmem(uploptr+i) .NE. 'G' ) THEN
2090 IF( lsame(cmem(diagptr+i), 'U') ) THEN
2091 cmem( diagptr+i ) = 'U'
2092 ELSE IF( lsame(cmem(diagptr+i), 'N') ) THEN
2093 cmem(diagptr+i) = 'N'
2094 ELSE
2095 WRITE(outnum, 3000) 'DIAG ', cmem(diagptr+i)
2096 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2097 stop
2098 END IF
2099 END IF
2100 40 CONTINUE
2101*
2102* Read in number of matrices, and values for M, N, LDASRC, and LDADEST
2103*
2104 READ(sdin, *) nmat
2105 mptr = memused
2106 nptr = mptr + nmat
2107 ldsptr = nptr + nmat
2108 lddptr = ldsptr + nmat
2109 memused = lddptr + nmat
2110 IF( memused .GT. memlen ) THEN
2111 WRITE(outnum, 1000) memlen, nmat, 'MATRICES.'
2112 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2113 stop
2114 ELSE IF( nmat .LT. 1 ) THEN
2115 WRITE(outnum, 2000) 'MATRIX.'
2116 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2117 stop
2118 END IF
2119 READ(sdin, *) ( mem( mptr+i ), i = 0, nmat-1 )
2120 READ(sdin, *) ( mem( nptr+i ), i = 0, nmat-1 )
2121 READ(sdin, *) ( mem( ldsptr+i ), i = 0, nmat-1 )
2122 READ(sdin, *) ( mem( lddptr+i ), i = 0, nmat-1 )
2123*
2124* Make sure matrix values are legal
2125*
2126 CALL chkmatdat( outnum, 'BSBR.dat', .false., nmat, mem(mptr),
2127 $ mem(nptr), mem(ldsptr), mem(lddptr), mem(lddptr) )
2128*
2129* Read in number of src pairs, and values of src
2130*
2131 READ(sdin, *) nsrc
2132 rsrcptr = memused
2133 csrcptr = rsrcptr + nsrc
2134 memused = csrcptr + nsrc
2135 IF( memused .GT. memlen ) THEN
2136 WRITE(outnum, 1000) memlen, nmat, 'SRC.'
2137 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2138 stop
2139 ELSE IF( nsrc .LT. 1 ) THEN
2140 WRITE(outnum, 2000) 'SRC.'
2141 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2142 stop
2143 END IF
2144 READ(sdin, *) ( mem(rsrcptr+i), i = 0, nsrc-1 )
2145 READ(sdin, *) ( mem(csrcptr+i), i = 0, nsrc-1 )
2146*
2147* Read in number of grids pairs, and values of P (process rows) and
2148* Q (process columns)
2149*
2150 READ(sdin, *) ngrid
2151 pptr = memused
2152 qptr = pptr + ngrid
2153 memused = qptr + ngrid
2154 IF( memused .GT. memlen ) THEN
2155 WRITE(outnum, 1000) memlen, ngrid, 'PROCESS GRIDS.'
2156 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2157 stop
2158 ELSE IF( ngrid .LT. 1 ) THEN
2159 WRITE(outnum, 2000) 'PROCESS GRID'
2160 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE( outnum )
2161 stop
2162 END IF
2163*
2164 READ(sdin, *) ( mem(pptr+i), i = 0, ngrid-1 )
2165 READ(sdin, *) ( mem(qptr+i), i = 0, ngrid-1 )
2166 IF( sdin .NE. 6 .AND. sdin .NE. 0 ) CLOSE( sdin )
2167*
2168* Fatal error if we've got an illegal grid
2169*
2170 DO 70 j = 0, ngrid-1
2171 IF( mem(pptr+j).LT.1 .OR. mem(qptr+j).LT.1 ) THEN
2172 WRITE(outnum, 4000) mem(pptr+j), mem(qptr+j)
2173 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
2174 stop
2175 END IF
2176 70 CONTINUE
2177*
2178* Prepare output variables
2179*
2180 mem(memused) = nscope
2181 mem(memused+1) = ntop
2182 mem(memused+2) = nshape
2183 mem(memused+3) = nmat
2184 mem(memused+4) = nsrc
2185 mem(memused+5) = ngrid
2186 memused = memused + 5
2187 cmemused = cmemused - 1
2188*
2189 1000 FORMAT('Mem too short (',i4,') to handle',i4,' ',a20)
2190 2000 FORMAT('Must have at least one ',a20)
2191 3000 FORMAT('UNRECOGNIZABLE ',a5,' ''', a1, '''.')
2192 4000 FORMAT('Illegal process grid: {',i3,',',i3,'}.')
2193*
2194 RETURN
2195*
2196* End of RDBSBR.
2197*
subroutine chkmatdat(nout, infile, tstflag, nmat, m0, n0, ldas0, ldad0, ldi0)
Definition blacstest.f:1791
logical function lsame(ca, cb)
Definition tools.f:1724
Here is the call graph for this function:
Here is the caller graph for this function: