ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
strsd2d_.c
Go to the documentation of this file.
00001 #include "Bdef.h"
00002 
00003 #if (INTFACE == C_CALL)
00004 void Cstrsd2d(int ConTxt, char *uplo, char *diag, int m, int n, float *A,
00005               int lda, int rdest, int cdest)
00006 #else
00007 F_VOID_FUNC strsd2d_(int *ConTxt, F_CHAR uplo, F_CHAR diag, int *m, int *n,
00008                      float *A, int *lda, int *rdest, int *cdest)
00009 #endif
00010 /*
00011  *  -- V1.1 BLACS routine --
00012  *  University of Tennessee, May 1, 1996
00013  *  Written by Clint Whaley.
00014  *
00015  *  Purpose
00016  *  =======
00017  *  Locally-blocking point-to-point trapezoidal real send.
00018  *
00019  *  Arguments
00020  *  =========
00021  *
00022  *  ConTxt  (input) Ptr to int
00023  *          Index into MyConTxts00 (my contexts array).
00024  *
00025  *  UPLO    (input) Ptr to char
00026  *          Specifies the part of the matrix to be sent.
00027  *          = 'U':      Upper trapezoidal part
00028  *          ELSE :      Lower trapezoidal part
00029  *
00030  *  DIAG    (input) Ptr to char
00031  *          Specifies whether the matrix is unit diagonal or not.
00032  *          = 'U':      Matrix is unit diagonal, diagonal not communicated.
00033  *          ELSE :      Matrix is not unit diagonal, diagonal is communicated.
00034  *
00035  *  M       (input) Ptr to int
00036  *          The number of rows of the matrix A.  M >= 0.
00037  *
00038  *  N       (input) Ptr to int
00039  *          The number of columns of the matrix A.  N >= 0.
00040  *
00041  *  A       (input) Ptr to real two dimensional array
00042  *          The m by n matrix A.  Fortran77 (column-major) storage
00043  *          assumed.
00044  *          If UPLO = 'U', only the upper trapezoid is accessed;
00045  *          if UPLO = 'L', only the lower trapezoid is accessed.
00046  *
00047  *  LDA     (input) Ptr to int
00048  *          The leading dimension of the array A.  LDA >= M.
00049  *
00050  *  RDEST   (input) Ptr to int
00051  *          The process row of the destination process.
00052  *
00053  *  CDEST   (input) Ptr to int
00054  *          The process column of the destination process.
00055  *
00056  * ------------------------------------------------------------------------
00057  */
00058 {
00059    void BI_ArgCheck(int, int, char *, char, char, char, int, int, int, int,
00060                     int *, int *);
00061    MPI_Datatype BI_GetMpiTrType(BLACSCONTEXT *, char, char, int, int, int,
00062                                    MPI_Datatype, int *);
00063    BLACBUFF *BI_Pack(BLACSCONTEXT *, BVOID *, BLACBUFF *, MPI_Datatype);
00064    void BI_Ssend(BLACSCONTEXT *, int, int, BLACBUFF *);
00065    void BI_Asend(BLACSCONTEXT *, int, int, BLACBUFF *);
00066    void BI_UpdateBuffs(BLACBUFF *);
00067    BLACBUFF *BI_GetBuff(int);
00068    int BI_BuffIsFree(BLACBUFF *, int);
00069 
00070    char tuplo, tdiag;
00071    int dest, length, tlda, ierr;
00072    BLACBUFF *bp;
00073    BLACSCONTEXT *ctxt;
00074    MPI_Datatype MatTyp;
00075    extern BLACBUFF BI_AuxBuff, *BI_ActiveQ;
00076 
00077    MGetConTxt(Mpval(ConTxt), ctxt);
00078    tuplo = F2C_CharTrans(uplo);
00079    tdiag = F2C_CharTrans(diag);
00080    tuplo = Mlowcase(tuplo);
00081    tdiag = Mlowcase(tdiag);
00082 
00083 #if (BlacsDebugLvl > 0)
00084    BI_ArgCheck(Mpval(ConTxt), RT_SD, "STRSD2D", 'a', tuplo, tdiag, Mpval(m),
00085                Mpval(n), Mpval(lda), 1, Mpaddress(rdest), Mpaddress(cdest));
00086 #endif
00087    if (Mpval(lda) < Mpval(m)) tlda = Mpval(m);
00088    else tlda = Mpval(lda);
00089    dest = Mvkpnum(ctxt, Mpval(rdest), Mpval(cdest));
00090    ctxt->scp = &ctxt->pscp;
00091 
00092    MatTyp = BI_GetMpiTrType(ctxt, tuplo, tdiag, Mpval(m), Mpval(n), tlda,
00093                             MPI_FLOAT, &BI_AuxBuff.N);
00094 #ifdef SndIsLocBlk
00095    BI_AuxBuff.Buff = (char *) A;
00096    BI_AuxBuff.dtype = MatTyp;
00097    BI_Ssend(ctxt, dest, PT2PTID, &BI_AuxBuff);
00098 #else
00099    bp = BI_Pack(ctxt, (BVOID *) A, NULL, MatTyp);
00100    BI_Asend(ctxt, Mkpnum(ctxt, Mpval(rdest), Mpval(cdest)), PT2PTID, bp);
00101 #endif
00102    ierr=BI_MPI_TYPE_FREE(&MatTyp);
00103 
00104 /*
00105  * Having started the async send, update the buffers (reform links, check if
00106  * active buffers have become inactive, etc.)
00107  */
00108 #ifdef SndIsLocBlk
00109    if (BI_ActiveQ) BI_UpdateBuffs(NULL);
00110 #else
00111    BI_UpdateBuffs(bp);
00112 #endif
00113 }  /* end of strsd2d */