ScaLAPACK 2.1  2.1
ScaLAPACK: Scalable Linear Algebra PACKage
pstrmr.c File Reference
#include "redist.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
Include dependency graph for pstrmr.c:

Go to the source code of this file.

Data Structures

struct  MDESC
 
struct  IDESC
 

Macros

#define static2   static
 
#define fortran_mr2d   pstrmr2do
 
#define fortran_mr2dnew   pstrmr2d
 
#define scopy_   scopy
 
#define slacpy_   slacpy
 
#define Clacpy   Cstrlacpy
 
#define BLOCK_CYCLIC_2D   1
 
#define SHIFT(row, sprow, nbrow)   ((row)-(sprow)+ ((row) >= (sprow) ? 0 : (nbrow)))
 
#define max(A, B)   ((A)>(B)?(A):(B))
 
#define min(A, B)   ((A)>(B)?(B):(A))
 
#define DIVUP(a, b)   ( ((a)-1) /(b)+1)
 
#define ROUNDUP(a, b)   (DIVUP(a,b)*(b))
 
#define scanD0   strscanD0
 
#define dispmat   strdispmat
 
#define setmemory   strsetmemory
 
#define freememory   strfreememory
 
#define scan_intervals   strscan_intervals
 
#define SENDBUFF   0
 
#define RECVBUFF   1
 
#define SIZEBUFF   2
 
#define NDEBUG
 
#define DESCLEN   9
 
#define NBPARAM
 
#define MAGIC_MAX   100000000
 

Functions

void Clacpy ()
 
void Cblacs_pcoord ()
 
int Cblacs_pnum ()
 
void Csetpvmtids ()
 
void Cblacs_get ()
 
void Cblacs_pinfo ()
 
void Cblacs_gridinfo ()
 
void Cblacs_gridinit ()
 
void Cblacs_exit ()
 
void Cblacs_gridexit ()
 
void Cblacs_setup ()
 
void Cigebs2d ()
 
void Cigebr2d ()
 
void Cigesd2d ()
 
void Cigerv2d ()
 
void Cigsum2d ()
 
void Cigamn2d ()
 
void Cigamx2d ()
 
void Csgesd2d ()
 
void Csgerv2d ()
 
void slacpy_ ()
 
int localindice ()
 
void * mr2d_malloc ()
 
int ppcm ()
 
int localsize ()
 
int memoryblocksize ()
 
int changeorigin ()
 
void paramcheck ()
 
void scanD0 ()
 
void dispmat ()
 
void setmemory ()
 
void freememory ()
 
int scan_intervals ()
 
void Cpstrmr2do ()
 
void Cpstrmr2d ()
 
void fortran_mr2d (char *uplo, char *diag, int *m, int *n, float *A, int *ia, int *ja, desc_A, float *B, int *ib, int *jb, desc_B)
 
void fortran_mr2dnew (char *uplo, char *diag, int *m, int *n, float *A, int *ia, int *ja, desc_A, float *B, int *ib, int *jb, desc_B, int *gcontext)
 
static2 void init_chenille ()
 
static2 int inter_len ()
 
static2 int block2buff ()
 
static2 void buff2block ()
 
static2 void gridreshape ()
 
void Cpstrmr2do (char *uplo, char *diag, int m, int n, float *ptrmyblock, int ia, int ja, MDESC *ma, float *ptrmynewblock, int ib, int jb, MDESC *mb)
 
void Cpstrmr2d (char *uplo, char *diag, int m, int n, float *ptrmyblock, int ia, int ja, MDESC *ma, float *ptrmynewblock, int ib, int jb, MDESC *mb, int globcontext)
 
static2 void init_chenille (int mypnum, int nprocs, int n0, int *proc0, int n1, int *proc1, int **psend, int **precv, int *myrang)
 
void Clacpy (int m, int n, float *a, int lda, float *b, int ldb)
 
static2 void gridreshape (int *ctxtp)
 

Macro Definition Documentation

◆ BLOCK_CYCLIC_2D

#define BLOCK_CYCLIC_2D   1

Definition at line 186 of file pstrmr.c.

◆ Clacpy

#define Clacpy   Cstrlacpy

Definition at line 173 of file pstrmr.c.

◆ DESCLEN

#define DESCLEN   9

Definition at line 257 of file pstrmr.c.

◆ dispmat

#define dispmat   strdispmat

Definition at line 233 of file pstrmr.c.

◆ DIVUP

#define DIVUP (   a,
 
)    ( ((a)-1) /(b)+1)

Definition at line 194 of file pstrmr.c.

◆ fortran_mr2d

#define fortran_mr2d   pstrmr2do

Definition at line 168 of file pstrmr.c.

◆ fortran_mr2dnew

#define fortran_mr2dnew   pstrmr2d

Definition at line 169 of file pstrmr.c.

◆ freememory

#define freememory   strfreememory

Definition at line 235 of file pstrmr.c.

◆ MAGIC_MAX

#define MAGIC_MAX   100000000

Definition at line 312 of file pstrmr.c.

◆ max

#define max (   A,
 
)    ((A)>(B)?(A):(B))

Definition at line 192 of file pstrmr.c.

◆ min

#define min (   A,
 
)    ((A)>(B)?(B):(A))

Definition at line 193 of file pstrmr.c.

◆ NBPARAM

#define NBPARAM
Value:
20 /* p0,q0,p1,q1, puis ma,na,mba,nba,rowa,cola puis
* idem B puis ia,ja puis ib,jb */

Definition at line 310 of file pstrmr.c.

◆ NDEBUG

#define NDEBUG

Definition at line 252 of file pstrmr.c.

◆ RECVBUFF

#define RECVBUFF   1

Definition at line 246 of file pstrmr.c.

◆ ROUNDUP

#define ROUNDUP (   a,
 
)    (DIVUP(a,b)*(b))

Definition at line 195 of file pstrmr.c.

◆ scan_intervals

#define scan_intervals   strscan_intervals

Definition at line 236 of file pstrmr.c.

◆ scanD0

#define scanD0   strscanD0

Definition at line 232 of file pstrmr.c.

◆ scopy_

#define scopy_   scopy

Definition at line 170 of file pstrmr.c.

◆ SENDBUFF

#define SENDBUFF   0

Definition at line 245 of file pstrmr.c.

◆ setmemory

#define setmemory   strsetmemory

Definition at line 234 of file pstrmr.c.

◆ SHIFT

#define SHIFT (   row,
  sprow,
  nbrow 
)    ((row)-(sprow)+ ((row) >= (sprow) ? 0 : (nbrow)))

Definition at line 191 of file pstrmr.c.

◆ SIZEBUFF

#define SIZEBUFF   2

Definition at line 247 of file pstrmr.c.

◆ slacpy_

#define slacpy_   slacpy

Definition at line 171 of file pstrmr.c.

◆ static2

#define static2   static

$Id: pstrmr.c,v 1.1.1.1 2000/02/15 18:04:09 susan Exp $

– ScaLAPACK routine (version 1.7) – Oak Ridge National Laboratory, Univ. of Tennessee, and Univ. of California, Berkeley. October 31, 1994.

SUBROUTINE PSTRMR2D(UPLO, DIAG, M, N, $ A, IA, JA, ADESC, $ B, IB, JB, BDESC,

$ CTXT)

Purpose

PSTRMR2D copies a submatrix of A on a submatrix of B. A and B can have different distributions: they can be on different processor grids, they can have different blocksizes, the beginning of the area to be copied can be at a different places on A and B.

The parameters can be confusing when the grids of A and B are partially or completly disjoint, in the case a processor calls this routines but is either not in the A context or B context, the ADESC[CTXT] or BDESC[CTXT] must be equal to -1, to ensure the routine recognise this situation. To summarize the rule:

  • If a processor is in A context, all parameters related to A must be valid.
  • If a processor is in B context, all parameters related to B must be valid.
  • ADESC[CTXT] and BDESC[CTXT] must be either valid contexts or equal to -1.
  • M and N must be valid for everyone.
  • other parameters are not examined.

The submatrix to be copied is assumed to be trapezoidal. So only the upper or the lower part will be copied. The other part is unchanged.

Notes

A description vector is associated with each 2D block-cyclicly dis- tributed matrix. This vector stores the information required to establish the mapping between a matrix entry and its corresponding process and memory location.

In the following comments, the character _ should be read as "of the distributed matrix". Let A be a generic term for any 2D block cyclicly distributed matrix. Its description vector is DESC_A:

NOTATION STORED IN EXPLANATION


DT_A (global) DESCA( DT_ ) The descriptor type. CTXT_A (global) DESCA( CTXT_ ) The BLACS context handle, indicating the BLACS process grid A is distribu- ted over. The context itself is glo- bal, but the handle (the integer value) may vary. M_A (global) DESCA( M_ ) The number of rows in the distributed matrix A. N_A (global) DESCA( N_ ) The number of columns in the distri- buted matrix A. MB_A (global) DESCA( MB_ ) The blocking factor used to distribute the rows of A. NB_A (global) DESCA( NB_ ) The blocking factor used to distribute the columns of A. RSRC_A (global) DESCA( RSRC_ ) The process row over which the first row of the matrix A is distributed. CSRC_A (global) DESCA( CSRC_ ) The process column over which the first column of A is distributed. LLD_A (local) DESCA( LLD_ ) The leading dimension of the local array storing the local blocks of the distributed matrix A. LLD_A >= MAX(1,LOCp(M_A)).

Important notice

The parameters of the routine have changed in April 1996 There is a new last argument. It must be a context englobing all processors involved in the initial and final distribution.

Be aware that all processors included in this context must call the redistribution routine.

Parameters

UPLO (input) CHARACTER*1. On entry, UPLO specifies whether we should copy the upper part of the lower part of the defined submatrix: UPLO = 'U' or 'u' copy the upper triangular part. UPLO = 'L' or 'l' copy the lower triangular part. Unchanged on exit.

DIAG (input) CHARACTER*1. On entry, DIAG specifies whether we should copy the diagonal. DIAG = 'U' or 'u' do NOT copy the diagonal of the submatrix. DIAG = 'N' or 'n' DO copy the diagonal of the submatrix. Unchanged on exit.

M (input) INTEGER. On entry, M specifies the number of rows of the submatrix to be copied. M must be at least zero. Unchanged on exit.

N (input) INTEGER. On entry, N specifies the number of cols of the submatrix to be redistributed.rows of B. M must be at least zero. Unchanged on exit.

A (input) REAL On entry, the source matrix. Unchanged on exit.

IA,JA (input) INTEGER On entry,the coordinates of the beginning of the submatrix of A to copy. 1 <= IA <= M_A - M + 1,1 <= JA <= N_A - N + 1, Unchanged on exit.

ADESC (input) A description vector (see Notes above) If the current processor is not part of the context of A the ADESC[CTXT] must be equal to -1.

B (output) REAL On entry, the destination matrix. The portion corresponding to the defined submatrix are updated.

IB,JB (input) INTEGER On entry,the coordinates of the beginning of the submatrix of B that will be updated. 1 <= IB <= M_B - M + 1,1 <= JB <= N_B - N + 1, Unchanged on exit.

BDESC (input) B description vector (see Notes above) For processors not part of the context of B BDESC[CTXT] must be equal to -1.

CTXT (input) a context englobing at least all processors included in either A context or B context

Memory requirement :

for the processors belonging to grid 0, one buffer of size block 0 and for the processors belonging to grid 1, also one buffer of size block 1.


Created March 1993 by B. Tourancheau (See sccs for modifications).

Modifications by Loic PRYLLI 1995

Definition at line 158 of file pstrmr.c.

Function Documentation

◆ block2buff()

static2 int block2buff ( )

◆ buff2block()

static2 void buff2block ( )

◆ Cblacs_exit()

void Cblacs_exit ( )

◆ Cblacs_get()

void Cblacs_get ( )
Here is the caller graph for this function:

◆ Cblacs_gridexit()

void Cblacs_gridexit ( )
Here is the caller graph for this function:

◆ Cblacs_gridinfo()

void Cblacs_gridinfo ( )
Here is the caller graph for this function:

◆ Cblacs_gridinit()

void Cblacs_gridinit ( )
Here is the caller graph for this function:

◆ Cblacs_pcoord()

void Cblacs_pcoord ( )

◆ Cblacs_pinfo()

void Cblacs_pinfo ( )
Here is the caller graph for this function:

◆ Cblacs_pnum()

int Cblacs_pnum ( )
Here is the caller graph for this function:

◆ Cblacs_setup()

void Cblacs_setup ( )

◆ changeorigin()

int changeorigin ( )
Here is the caller graph for this function:

◆ Cigamn2d()

void Cigamn2d ( )
Here is the caller graph for this function:

◆ Cigamx2d()

void Cigamx2d ( )

◆ Cigebr2d()

void Cigebr2d ( )

◆ Cigebs2d()

void Cigebs2d ( )

◆ Cigerv2d()

void Cigerv2d ( )

◆ Cigesd2d()

void Cigesd2d ( )

◆ Cigsum2d()

void Cigsum2d ( )

◆ Clacpy() [1/2]

void Clacpy ( )

◆ Clacpy() [2/2]

void Clacpy ( int  m,
int  n,
float *  a,
int  lda,
float *  b,
int  ldb 
)

Definition at line 652 of file pstrmr.c.

◆ Cpstrmr2d() [1/2]

void Cpstrmr2d ( )
Here is the caller graph for this function:

◆ Cpstrmr2d() [2/2]

void Cpstrmr2d ( char *  uplo,
char *  diag,
int  m,
int  n,
float *  ptrmyblock,
int  ia,
int  ja,
MDESC ma,
float *  ptrmynewblock,
int  ib,
int  jb,
MDESC mb,
int  globcontext 
)

Definition at line 314 of file pstrmr.c.

Here is the call graph for this function:

◆ Cpstrmr2do() [1/2]

void Cpstrmr2do ( )
Here is the caller graph for this function:

◆ Cpstrmr2do() [2/2]

void Cpstrmr2do ( char *  uplo,
char *  diag,
int  m,
int  n,
float *  ptrmyblock,
int  ia,
int  ja,
MDESC ma,
float *  ptrmynewblock,
int  ib,
int  jb,
MDESC mb 
)

Definition at line 289 of file pstrmr.c.

Here is the call graph for this function:

◆ Csetpvmtids()

void Csetpvmtids ( )

◆ Csgerv2d()

void Csgerv2d ( )
Here is the caller graph for this function:

◆ Csgesd2d()

void Csgesd2d ( )
Here is the caller graph for this function:

◆ dispmat()

void dispmat ( )

◆ fortran_mr2d()

void fortran_mr2d ( char *  uplo,
char *  diag,
int *  m,
int *  n,
float *  A,
int *  ia,
int *  ja,
desc_A  ,
float *  B,
int *  ib,
int *  jb,
desc_B   
)

Definition at line 259 of file pstrmr.c.

Here is the call graph for this function:

◆ fortran_mr2dnew()

void fortran_mr2dnew ( char *  uplo,
char *  diag,
int *  m,
int *  n,
float *  A,
int *  ia,
int *  ja,
desc_A  ,
float *  B,
int *  ib,
int *  jb,
desc_B  ,
int *  gcontext 
)

Definition at line 271 of file pstrmr.c.

Here is the call graph for this function:

◆ freememory()

void freememory ( )

◆ gridreshape() [1/2]

static2 void gridreshape ( )
Here is the caller graph for this function:

◆ gridreshape() [2/2]

static2 void gridreshape ( int *  ctxtp)

Definition at line 668 of file pstrmr.c.

Here is the call graph for this function:

◆ init_chenille() [1/2]

static2 void init_chenille ( )
Here is the caller graph for this function:

◆ init_chenille() [2/2]

static2 void init_chenille ( int  mypnum,
int  nprocs,
int  n0,
int *  proc0,
int  n1,
int *  proc1,
int **  psend,
int **  precv,
int *  myrang 
)

Definition at line 596 of file pstrmr.c.

Here is the call graph for this function:

◆ inter_len()

static2 int inter_len ( )

◆ localindice()

int localindice ( )

◆ localsize()

int localsize ( )

◆ memoryblocksize()

int memoryblocksize ( )
Here is the caller graph for this function:

◆ mr2d_malloc()

void* mr2d_malloc ( )
Here is the caller graph for this function:

◆ paramcheck()

void paramcheck ( )
Here is the caller graph for this function:

◆ ppcm()

int ppcm ( )

◆ scan_intervals()

int scan_intervals ( )

◆ scanD0()

void scanD0 ( )

◆ setmemory()

void setmemory ( )

◆ slacpy_()

void slacpy_ ( )