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

Go to the source code of this file.

Data Structures

struct  MDESC
 
struct  IDESC
 

Macros

#define static2   static
 
#define fortran_mr2d   pdgemr2do
 
#define fortran_mr2dnew   pdgemr2d
 
#define dcopy_   dcopy
 
#define dlacpy_   dlacpy
 
#define Clacpy   Cdgelacpy
 
#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   dgescanD0
 
#define dispmat   dgedispmat
 
#define setmemory   dgesetmemory
 
#define freememory   dgefreememory
 
#define scan_intervals   dgescan_intervals
 
#define SENDBUFF   0
 
#define RECVBUFF   1
 
#define SIZEBUFF   2
 
#define NDEBUG
 
#define DESCLEN   9
 
#define NBPARAM
 
#define MAGIC_MAX   100000000
 
#define Mlacpy(mo, no, ao, ldao, bo, ldbo)
 

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 Cpdgemr2do ()
 
void Cpdgemr2d ()
 
void fortran_mr2d (int *m, int *n, double *A, int *ia, int *ja, desc_A, double *B, int *ib, int *jb, desc_B)
 
void fortran_mr2dnew (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 Cpdgemr2do (int m, int n, double *ptrmyblock, int ia, int ja, MDESC *ma, double *ptrmynewblock, int ib, int jb, MDESC *mb)
 
void Cpdgemr2d (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)
 
static2 int block2buff (IDESC *vi, int vinb, IDESC *hi, int hinb, double *ptra, MDESC *ma, double *buff)
 
static2 void buff2block (IDESC *vi, int vinb, IDESC *hi, int hinb, double *buff, double *ptrb, MDESC *mb)
 
static2 int inter_len (int hinb, IDESC *hi, int vinb, IDESC *vi)
 
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 171 of file pdgemr.c.

◆ Clacpy

#define Clacpy   Cdgelacpy

Definition at line 158 of file pdgemr.c.

◆ dcopy_

#define dcopy_   dcopy

Definition at line 155 of file pdgemr.c.

◆ DESCLEN

#define DESCLEN   9

Definition at line 242 of file pdgemr.c.

◆ dispmat

#define dispmat   dgedispmat

Definition at line 218 of file pdgemr.c.

◆ DIVUP

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

Definition at line 179 of file pdgemr.c.

◆ dlacpy_

#define dlacpy_   dlacpy

Definition at line 156 of file pdgemr.c.

◆ fortran_mr2d

#define fortran_mr2d   pdgemr2do

Definition at line 153 of file pdgemr.c.

◆ fortran_mr2dnew

#define fortran_mr2dnew   pdgemr2d

Definition at line 154 of file pdgemr.c.

◆ freememory

#define freememory   dgefreememory

Definition at line 220 of file pdgemr.c.

◆ MAGIC_MAX

#define MAGIC_MAX   100000000

Definition at line 294 of file pdgemr.c.

◆ max

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

Definition at line 177 of file pdgemr.c.

◆ min

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

Definition at line 178 of file pdgemr.c.

◆ Mlacpy

#define Mlacpy (   mo,
  no,
  ao,
  ldao,
  bo,
  ldbo 
)
Value:
{ \
double *_a,*_b; \
int _m,_n,_lda,_ldb; \
int _i,_j; \
_m = (mo);_n = (no); \
_a = (ao);_b = (bo); \
_lda = (ldao) - _m; \
_ldb = (ldbo) - _m; \
assert(_lda >= 0 && _ldb >= 0); \
for (_j=0;_j<_n;_j++) { \
for (_i=0;_i<_m;_i++) \
*_b++ = *_a++; \
_b += _ldb; \
_a += _lda; \
} \
}

Definition at line 627 of file pdgemr.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 292 of file pdgemr.c.

◆ NDEBUG

#define NDEBUG

Definition at line 237 of file pdgemr.c.

◆ RECVBUFF

#define RECVBUFF   1

Definition at line 231 of file pdgemr.c.

◆ ROUNDUP

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

Definition at line 180 of file pdgemr.c.

◆ scan_intervals

#define scan_intervals   dgescan_intervals

Definition at line 221 of file pdgemr.c.

◆ scanD0

#define scanD0   dgescanD0

Definition at line 217 of file pdgemr.c.

◆ SENDBUFF

#define SENDBUFF   0

Definition at line 230 of file pdgemr.c.

◆ setmemory

#define setmemory   dgesetmemory

Definition at line 219 of file pdgemr.c.

◆ SHIFT

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

Definition at line 176 of file pdgemr.c.

◆ SIZEBUFF

#define SIZEBUFF   2

Definition at line 232 of file pdgemr.c.

◆ static2

#define static2   static

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

$ CTXT)

Purpose

PDGEMR2D 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.

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

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 143 of file pdgemr.c.

Function Documentation

◆ block2buff() [1/2]

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

◆ block2buff() [2/2]

static2 int block2buff ( IDESC vi,
int  vinb,
IDESC hi,
int  hinb,
double *  ptra,
MDESC ma,
double *  buff 
)

Definition at line 645 of file pdgemr.c.

◆ buff2block() [1/2]

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

◆ buff2block() [2/2]

static2 void buff2block ( IDESC vi,
int  vinb,
IDESC hi,
int  hinb,
double *  buff,
double *  ptrb,
MDESC mb 
)

Definition at line 667 of file pdgemr.c.

◆ 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 702 of file pdgemr.c.

◆ Cpdgemr2d() [1/2]

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

◆ Cpdgemr2d() [2/2]

void Cpdgemr2d ( 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 296 of file pdgemr.c.

Here is the call graph for this function:

◆ Cpdgemr2do() [1/2]

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

◆ Cpdgemr2do() [2/2]

void Cpdgemr2do ( int  m,
int  n,
double *  ptrmyblock,
int  ia,
int  ja,
MDESC ma,
double *  ptrmynewblock,
int  ib,
int  jb,
MDESC mb 
)

Definition at line 272 of file pdgemr.c.

Here is the call graph for this function:

◆ Csetpvmtids()

void Csetpvmtids ( )

◆ dispmat()

void dispmat ( )

◆ dlacpy_()

void dlacpy_ ( )

◆ fortran_mr2d()

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

Definition at line 244 of file pdgemr.c.

Here is the call graph for this function:

◆ fortran_mr2dnew()

void fortran_mr2dnew ( 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 255 of file pdgemr.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 718 of file pdgemr.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 572 of file pdgemr.c.

Here is the call graph for this function:

◆ inter_len() [1/2]

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

◆ inter_len() [2/2]

static2 int inter_len ( int  hinb,
IDESC hi,
int  vinb,
IDESC vi 
)

Definition at line 688 of file pdgemr.c.

◆ 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 ( )