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

Go to the source code of this file.

Data Structures

struct  complex
 
struct  MDESC
 
struct  IDESC
 

Macros

#define static2   static
 
#define fortran_mr2d   pctrmr2do
 
#define fortran_mr2dnew   pctrmr2d
 
#define ccopy_   ccopy
 
#define clacpy_   clacpy
 
#define Clacpy   Cctrlacpy
 
#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   ctrscanD0
 
#define dispmat   ctrdispmat
 
#define setmemory   ctrsetmemory
 
#define freememory   ctrfreememory
 
#define scan_intervals   ctrscan_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 Ccgesd2d ()
 
void Ccgerv2d ()
 
void clacpy_ ()
 
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 Cpctrmr2do ()
 
void Cpctrmr2d ()
 
void fortran_mr2d (char *uplo, char *diag, int *m, int *n, complex *A, int *ia, int *ja, desc_A, complex *B, int *ib, int *jb, desc_B)
 
void fortran_mr2dnew (char *uplo, char *diag, int *m, int *n, complex *A, int *ia, int *ja, desc_A, complex *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 Cpctrmr2do (char *uplo, char *diag, int m, int n, complex *ptrmyblock, int ia, int ja, MDESC *ma, complex *ptrmynewblock, int ib, int jb, MDESC *mb)
 
void Cpctrmr2d (char *uplo, char *diag, int m, int n, complex *ptrmyblock, int ia, int ja, MDESC *ma, complex *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, complex *a, int lda, complex *b, int ldb)
 
static2 void gridreshape (int *ctxtp)
 

Macro Definition Documentation

◆ BLOCK_CYCLIC_2D

#define BLOCK_CYCLIC_2D   1

Definition at line 189 of file pctrmr.c.

◆ ccopy_

#define ccopy_   ccopy

Definition at line 170 of file pctrmr.c.

◆ Clacpy

#define Clacpy   Cctrlacpy

Definition at line 173 of file pctrmr.c.

◆ clacpy_

#define clacpy_   clacpy

Definition at line 171 of file pctrmr.c.

◆ DESCLEN

#define DESCLEN   9

Definition at line 260 of file pctrmr.c.

◆ dispmat

#define dispmat   ctrdispmat

Definition at line 236 of file pctrmr.c.

◆ DIVUP

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

Definition at line 197 of file pctrmr.c.

◆ fortran_mr2d

#define fortran_mr2d   pctrmr2do

Definition at line 168 of file pctrmr.c.

◆ fortran_mr2dnew

#define fortran_mr2dnew   pctrmr2d

Definition at line 169 of file pctrmr.c.

◆ freememory

#define freememory   ctrfreememory

Definition at line 238 of file pctrmr.c.

◆ MAGIC_MAX

#define MAGIC_MAX   100000000

Definition at line 315 of file pctrmr.c.

◆ max

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

Definition at line 195 of file pctrmr.c.

◆ min

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

Definition at line 196 of file pctrmr.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 313 of file pctrmr.c.

◆ NDEBUG

#define NDEBUG

Definition at line 255 of file pctrmr.c.

◆ RECVBUFF

#define RECVBUFF   1

Definition at line 249 of file pctrmr.c.

◆ ROUNDUP

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

Definition at line 198 of file pctrmr.c.

◆ scan_intervals

#define scan_intervals   ctrscan_intervals

Definition at line 239 of file pctrmr.c.

◆ scanD0

#define scanD0   ctrscanD0

Definition at line 235 of file pctrmr.c.

◆ SENDBUFF

#define SENDBUFF   0

Definition at line 248 of file pctrmr.c.

◆ setmemory

#define setmemory   ctrsetmemory

Definition at line 237 of file pctrmr.c.

◆ SHIFT

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

Definition at line 194 of file pctrmr.c.

◆ SIZEBUFF

#define SIZEBUFF   2

Definition at line 250 of file pctrmr.c.

◆ static2

#define static2   static

$Id: pctrmr.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 PCTRMR2D(UPLO, DIAG, M, N, $ A, IA, JA, ADESC, $ B, IB, JB, BDESC,

$ CTXT)

Purpose

PCTRMR2D 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) COMPLEX 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) COMPLEX 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 pctrmr.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 ( )

◆ Ccgerv2d()

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

◆ Ccgesd2d()

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

◆ 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,
complex a,
int  lda,
complex b,
int  ldb 
)

Definition at line 655 of file pctrmr.c.

◆ clacpy_()

void clacpy_ ( )

◆ Cpctrmr2d() [1/2]

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

◆ Cpctrmr2d() [2/2]

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

Definition at line 317 of file pctrmr.c.

Here is the call graph for this function:

◆ Cpctrmr2do() [1/2]

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

◆ Cpctrmr2do() [2/2]

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

Definition at line 292 of file pctrmr.c.

Here is the call graph for this function:

◆ Csetpvmtids()

void Csetpvmtids ( )

◆ dispmat()

void dispmat ( )

◆ fortran_mr2d()

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

Definition at line 262 of file pctrmr.c.

Here is the call graph for this function:

◆ fortran_mr2dnew()

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

Definition at line 274 of file pctrmr.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 671 of file pctrmr.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 599 of file pctrmr.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 ( )