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

◆ rdsdrv()

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

Definition at line 1546 of file blacstest.f.

1548*
1549* -- BLACS tester (version 1.0) --
1550* University of Tennessee
1551* December 15, 1994
1552*
1553*
1554* .. Scalar Arguments ..
1555 INTEGER MEMUSED, MEMLEN, CMEMUSED, CMEMLEN, OUTNUM
1556* ..
1557* .. Array Arguments ..
1558 CHARACTER*1 CMEM(CMEMLEN)
1559 INTEGER MEM(MEMLEN)
1560* ..
1561*
1562* Purpose
1563* =======
1564* RDSDRV: Read and process the input file SDRV.dat.
1565*
1566* Arguments
1567* =========
1568* MEMUSED (output) INTEGER
1569* Number of elements in MEM that this subroutine ends up using.
1570*
1571* MEM (output) INTEGER array of dimension memlen
1572* On output, holds information read in from sdrv.dat.
1573*
1574* MEMLEN (input) INTEGER
1575* Number of elements of MEM that this subroutine
1576* may safely write into.
1577*
1578* CMEMUSED (output) INTEGER
1579* Number of elements in CMEM that this subroutine ends up using.
1580*
1581* CMEM (output) CHARACTER*1 array of dimension cmemlen
1582* On output, holds the values for UPLO and DIAG.
1583*
1584* CMEMLEN (input) INTEGER
1585* Number of elements of CMEM that this subroutine
1586* may safely write into.
1587*
1588* OUTNUM (input) INTEGER
1589* Unit number of the output file.
1590*
1591* =================================================================
1592*
1593* .. Parameters ..
1594 INTEGER SDIN
1595 parameter( sdin = 12 )
1596* ..
1597* .. External Functions ..
1598 LOGICAL LSAME
1599 EXTERNAL lsame
1600* ..
1601* .. Local Scalars ..
1602 INTEGER NSHAPE, NMAT, NSRC, NGRID, I, J
1603 INTEGER UPLOPTR, DIAGPTR, MPTR, NPTR, LDSPTR, LDDPTR, RSRCPTR
1604 INTEGER CSRCPTR, RDESTPTR, CDESTPTR, PPTR, QPTR
1605* ..
1606* .. Executable Statements
1607*
1608* Open and read the file sdrv.dat. The expected format is
1609* below.
1610*
1611*------
1612*integer number of shapes of the matrix
1613*array of CHAR*1's UPLO
1614*array of CHAR*1's DIAG: unit diagonal or not?
1615*integer number of nmat
1616*array of integers M: number of rows in matrix
1617*array of integers N: number of columns in matrix
1618*integer LDA: leading dimension on source proc
1619*integer LDA: leading dimension on dest proc
1620*integer number of source/dest pairs
1621*array of integers RSRC: process row of message source
1622*array of integers CSRC: process column of msg. src.
1623*array of integers RDEST: process row of msg. dest.
1624*array of integers CDEST: process column of msg. dest.
1625*integer Number of grids
1626*array of integers NPROW: number of rows in process grid
1627*array of integers NPCOL: number of col's in proc. grid
1628*------
1629* note: UPLO stands for 'upper or lower trapezoidal or general
1630* rectangular.'
1631* note: the text descriptions as shown above are present in
1632* the sample sdrv.dat included with this distribution,
1633* but are not required.
1634*
1635* Read input file
1636*
1637 memused = 1
1638 cmemused = 1
1639 OPEN(unit = sdin, file = 'sdrv.dat', status = 'OLD')
1640*
1641* Read in number of shapes, and values of UPLO and DIAG
1642*
1643 READ(sdin, *) nshape
1644 uploptr = cmemused
1645 diagptr = uploptr + nshape
1646 cmemused = diagptr + nshape
1647 IF ( cmemused .GT. cmemlen ) THEN
1648 WRITE(outnum, 1000) cmemlen, nshape, 'MATRIX SHAPES.'
1649 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1650 stop
1651 ELSE IF( nshape .LT. 1 ) THEN
1652 WRITE(outnum, 2000) 'MATRIX SHAPE.'
1653 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1654 stop
1655 END IF
1656*
1657* Read in, upcase, and fatal error if UPLO/DIAG not recognized
1658*
1659 READ(sdin, *) ( cmem(uploptr+i), i = 0, nshape-1 )
1660 DO 30 i = 0, nshape-1
1661 IF( lsame(cmem(uploptr+i), 'G') ) THEN
1662 cmem(uploptr+i) = 'G'
1663 ELSE IF( lsame(cmem(uploptr+i), 'U') ) THEN
1664 cmem(uploptr+i) = 'U'
1665 ELSE IF( lsame(cmem(uploptr+i), 'L') ) THEN
1666 cmem(uploptr+i) = 'L'
1667 ELSE
1668 WRITE(outnum, 3000) 'UPLO ', cmem(uploptr+i)
1669 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1670 stop
1671 END IF
1672 30 CONTINUE
1673*
1674 READ(sdin, *) ( cmem(diagptr+i), i = 0, nshape-1 )
1675 DO 40 i = 0, nshape-1
1676 IF( cmem(uploptr+i) .NE. 'G' ) THEN
1677 IF( lsame(cmem(diagptr+i), 'U') ) THEN
1678 cmem( diagptr+i ) = 'U'
1679 ELSE IF( lsame(cmem(diagptr+i), 'N') ) THEN
1680 cmem(diagptr+i) = 'N'
1681 ELSE
1682 WRITE(outnum, 3000) 'DIAG ', cmem(diagptr+i)
1683 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1684 stop
1685 END IF
1686 END IF
1687 40 CONTINUE
1688*
1689* Read in number of matrices, and values for M, N, LDASRC, and LDADEST
1690*
1691 READ(sdin, *) nmat
1692 mptr = memused
1693 nptr = mptr + nmat
1694 ldsptr = nptr + nmat
1695 lddptr = ldsptr + nmat
1696 memused = lddptr + nmat
1697 IF( memused .GT. memlen ) THEN
1698 WRITE(outnum, 1000) memlen, nmat, 'MATRICES.'
1699 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1700 stop
1701 ELSE IF( nmat .LT. 1 ) THEN
1702 WRITE(outnum, 2000) 'MATRIX.'
1703 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1704 stop
1705 END IF
1706 READ(sdin, *) ( mem( mptr+i ), i = 0, nmat-1 )
1707 READ(sdin, *) ( mem( nptr+i ), i = 0, nmat-1 )
1708 READ(sdin, *) ( mem( ldsptr+i ), i = 0, nmat-1 )
1709 READ(sdin, *) ( mem( lddptr+i ), i = 0, nmat-1 )
1710*
1711* Make sure matrix values are legal
1712*
1713 CALL chkmatdat( outnum, 'SDRV.dat', .false., nmat, mem(mptr),
1714 $ mem(nptr), mem(ldsptr), mem(lddptr), mem(lddptr) )
1715*
1716* Read in number of src/dest pairs, and values of src/dest
1717*
1718 READ(sdin, *) nsrc
1719 rsrcptr = memused
1720 csrcptr = rsrcptr + nsrc
1721 rdestptr = csrcptr + nsrc
1722 cdestptr = rdestptr + nsrc
1723 memused = cdestptr + nsrc
1724 IF( memused .GT. memlen ) THEN
1725 WRITE(outnum, 1000) memlen, nmat, 'SRC/DEST.'
1726 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1727 stop
1728 ELSE IF( nsrc .LT. 1 ) THEN
1729 WRITE(outnum, 2000) 'SRC/DEST.'
1730 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1731 stop
1732 END IF
1733 READ(sdin, *) ( mem(rsrcptr+i), i = 0, nsrc-1 )
1734 READ(sdin, *) ( mem(csrcptr+i), i = 0, nsrc-1 )
1735 READ(sdin, *) ( mem(rdestptr+i), i = 0, nsrc-1 )
1736 READ(sdin, *) ( mem(cdestptr+i), i = 0, nsrc-1 )
1737*
1738* Read in number of grids pairs, and values of P (process rows) and
1739* Q (process columns)
1740*
1741 READ(sdin, *) ngrid
1742 pptr = memused
1743 qptr = pptr + ngrid
1744 memused = qptr + ngrid
1745 IF( memused .GT. memlen ) THEN
1746 WRITE(outnum, 1000) memlen, ngrid, 'PROCESS GRIDS.'
1747 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1748 stop
1749 ELSE IF( ngrid .LT. 1 ) THEN
1750 WRITE(outnum, 2000) 'PROCESS GRID'
1751 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE( outnum )
1752 stop
1753 END IF
1754*
1755 READ(sdin, *) ( mem(pptr+i), i = 0, ngrid-1 )
1756 READ(sdin, *) ( mem(qptr+i), i = 0, ngrid-1 )
1757 IF( sdin .NE. 6 .AND. sdin .NE. 0 ) CLOSE( sdin )
1758*
1759* Fatal error if we've got an illegal grid
1760*
1761 DO 70 j = 0, ngrid-1
1762 IF( mem(pptr+j).LT.1 .OR. mem(qptr+j).LT.1 ) THEN
1763 WRITE(outnum, 4000) mem(pptr+j), mem(qptr+j)
1764 IF( outnum .NE. 6 .AND. outnum .NE. 0 ) CLOSE(outnum)
1765 stop
1766 END IF
1767 70 CONTINUE
1768*
1769* Prepare output variables
1770*
1771 mem(memused) = nshape
1772 mem(memused+1) = nmat
1773 mem(memused+2) = nsrc
1774 mem(memused+3) = ngrid
1775 memused = memused + 3
1776 cmemused = cmemused - 1
1777*
1778 1000 FORMAT('Mem too short (',i8,') to handle',i4,' ',a20)
1779 2000 FORMAT('Must have at least one ',a20)
1780 3000 FORMAT('UNRECOGNIZABLE ',a5,' ''', a1, '''.')
1781 4000 FORMAT('Illegal process grid: {',i3,',',i3,'}.')
1782*
1783 RETURN
1784*
1785* End of RDSDRV.
1786*
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: