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

Go to the source code of this file.

Data Structures

struct  MDESC
 
struct  IDESC
 

Macros

#define static2   static
 
#define fortran_mr2d   pdtrmr2do
 
#define fortran_mr2dnew   pdtrmr2d
 
#define dcopy_   dcopy
 
#define dlacpy_   dlacpy
 
#define Clacpy   Cdtrlacpy
 
#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   dtrscanD0
 
#define dispmat   dtrdispmat
 
#define setmemory   dtrsetmemory
 
#define freememory   dtrfreememory
 
#define scan_intervals   dtrscan_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 Cdgesd2d ()
 
void Cdgerv2d ()
 
void dlacpy_ ()
 
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 Cpdtrmr2do ()
 
void Cpdtrmr2d ()
 
void fortran_mr2d (char *uplo, char *diag, int *m, int *n, double *A, int *ia, int *ja, desc_A, double *B, int *ib, int *jb, desc_B)
 
void fortran_mr2dnew (char *uplo, char *diag, int *m, int *n, double *A, int *ia, int *ja, desc_A, double *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 Cpdtrmr2do (char *uplo, char *diag, int m, int n, double *ptrmyblock, int ia, int ja, MDESC *ma, double *ptrmynewblock, int ib, int jb, MDESC *mb)
 
void Cpdtrmr2d (char *uplo, char *diag, int m, int n, double *ptrmyblock, int ia, int ja, MDESC *ma, double *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, double *a, int lda, double *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 pdtrmr.c.

◆ Clacpy

#define Clacpy   Cdtrlacpy

Definition at line 173 of file pdtrmr.c.

◆ dcopy_

#define dcopy_   dcopy

Definition at line 170 of file pdtrmr.c.

◆ DESCLEN

#define DESCLEN   9

Definition at line 257 of file pdtrmr.c.

◆ dispmat

#define dispmat   dtrdispmat

Definition at line 233 of file pdtrmr.c.

◆ DIVUP

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

Definition at line 194 of file pdtrmr.c.

◆ dlacpy_

#define dlacpy_   dlacpy

Definition at line 171 of file pdtrmr.c.

◆ fortran_mr2d

#define fortran_mr2d   pdtrmr2do

Definition at line 168 of file pdtrmr.c.

◆ fortran_mr2dnew

#define fortran_mr2dnew   pdtrmr2d

Definition at line 169 of file pdtrmr.c.

◆ freememory

#define freememory   dtrfreememory

Definition at line 235 of file pdtrmr.c.

◆ MAGIC_MAX

#define MAGIC_MAX   100000000

Definition at line 312 of file pdtrmr.c.

◆ max

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

Definition at line 192 of file pdtrmr.c.

◆ min

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

Definition at line 193 of file pdtrmr.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 pdtrmr.c.

◆ NDEBUG

#define NDEBUG

Definition at line 252 of file pdtrmr.c.

◆ RECVBUFF

#define RECVBUFF   1

Definition at line 246 of file pdtrmr.c.

◆ ROUNDUP

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

Definition at line 195 of file pdtrmr.c.

◆ scan_intervals

#define scan_intervals   dtrscan_intervals

Definition at line 236 of file pdtrmr.c.

◆ scanD0

#define scanD0   dtrscanD0

Definition at line 232 of file pdtrmr.c.

◆ SENDBUFF

#define SENDBUFF   0

Definition at line 245 of file pdtrmr.c.

◆ setmemory

#define setmemory   dtrsetmemory

Definition at line 234 of file pdtrmr.c.

◆ SHIFT

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

Definition at line 191 of file pdtrmr.c.

◆ SIZEBUFF

#define SIZEBUFF   2

Definition at line 247 of file pdtrmr.c.

◆ static2

#define static2   static

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

$ CTXT)

Purpose

PDTRMR2D 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) DOUBLE PRECISION 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) DOUBLE PRECISION 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 pdtrmr.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 ( )

◆ Cdgerv2d()

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

◆ Cdgesd2d()

void Cdgesd2d ( )
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,
double *  a,
int  lda,
double *  b,
int  ldb 
)

Definition at line 652 of file pdtrmr.c.

◆ Cpdtrmr2d() [1/2]

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

◆ Cpdtrmr2d() [2/2]

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

Definition at line 314 of file pdtrmr.c.

Here is the call graph for this function:

◆ Cpdtrmr2do() [1/2]

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

◆ Cpdtrmr2do() [2/2]

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

Definition at line 289 of file pdtrmr.c.

Here is the call graph for this function:

◆ Csetpvmtids()

void Csetpvmtids ( )

◆ dispmat()

void dispmat ( )

◆ dlacpy_()

void dlacpy_ ( )

◆ fortran_mr2d()

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

Definition at line 259 of file pdtrmr.c.

Here is the call graph for this function:

◆ fortran_mr2dnew()

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

Definition at line 271 of file pdtrmr.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 pdtrmr.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 pdtrmr.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 ( )