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

Go to the source code of this file.

Data Structures

struct  dcomplex
 
struct  MDESC
 
struct  IDESC
 

Macros

#define static2   static
 
#define fortran_mr2d   pzgemr2do
 
#define fortran_mr2dnew   pzgemr2d
 
#define zcopy_   zcopy
 
#define zlacpy_   zlacpy
 
#define Clacpy   Czgelacpy
 
#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   zgescanD0
 
#define dispmat   zgedispmat
 
#define setmemory   zgesetmemory
 
#define freememory   zgefreememory
 
#define scan_intervals   zgescan_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 Czgesd2d ()
 
void Czgerv2d ()
 
void zlacpy_ ()
 
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 Cpzgemr2do ()
 
void Cpzgemr2d ()
 
void fortran_mr2d (int *m, int *n, dcomplex *A, int *ia, int *ja, desc_A, dcomplex *B, int *ib, int *jb, desc_B)
 
void fortran_mr2dnew (int *m, int *n, dcomplex *A, int *ia, int *ja, desc_A, dcomplex *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 Cpzgemr2do (int m, int n, dcomplex *ptrmyblock, int ia, int ja, MDESC *ma, dcomplex *ptrmynewblock, int ib, int jb, MDESC *mb)
 
void Cpzgemr2d (int m, int n, dcomplex *ptrmyblock, int ia, int ja, MDESC *ma, dcomplex *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, dcomplex *ptra, MDESC *ma, dcomplex *buff)
 
static2 void buff2block (IDESC *vi, int vinb, IDESC *hi, int hinb, dcomplex *buff, dcomplex *ptrb, MDESC *mb)
 
static2 int inter_len (int hinb, IDESC *hi, int vinb, IDESC *vi)
 
void Clacpy (int m, int n, dcomplex *a, int lda, dcomplex *b, int ldb)
 
static2 void gridreshape (int *ctxtp)
 

Macro Definition Documentation

◆ BLOCK_CYCLIC_2D

#define BLOCK_CYCLIC_2D   1

Definition at line 174 of file pzgemr.c.

◆ Clacpy

#define Clacpy   Czgelacpy

Definition at line 158 of file pzgemr.c.

◆ DESCLEN

#define DESCLEN   9

Definition at line 245 of file pzgemr.c.

◆ dispmat

#define dispmat   zgedispmat

Definition at line 221 of file pzgemr.c.

◆ DIVUP

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

Definition at line 182 of file pzgemr.c.

◆ fortran_mr2d

#define fortran_mr2d   pzgemr2do

Definition at line 153 of file pzgemr.c.

◆ fortran_mr2dnew

#define fortran_mr2dnew   pzgemr2d

Definition at line 154 of file pzgemr.c.

◆ freememory

#define freememory   zgefreememory

Definition at line 223 of file pzgemr.c.

◆ MAGIC_MAX

#define MAGIC_MAX   100000000

Definition at line 297 of file pzgemr.c.

◆ max

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

Definition at line 180 of file pzgemr.c.

◆ min

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

Definition at line 181 of file pzgemr.c.

◆ Mlacpy

#define Mlacpy (   mo,
  no,
  ao,
  ldao,
  bo,
  ldbo 
)
Value:
{ \
dcomplex *_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 630 of file pzgemr.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 295 of file pzgemr.c.

◆ NDEBUG

#define NDEBUG

Definition at line 240 of file pzgemr.c.

◆ RECVBUFF

#define RECVBUFF   1

Definition at line 234 of file pzgemr.c.

◆ ROUNDUP

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

Definition at line 183 of file pzgemr.c.

◆ scan_intervals

#define scan_intervals   zgescan_intervals

Definition at line 224 of file pzgemr.c.

◆ scanD0

#define scanD0   zgescanD0

Definition at line 220 of file pzgemr.c.

◆ SENDBUFF

#define SENDBUFF   0

Definition at line 233 of file pzgemr.c.

◆ setmemory

#define setmemory   zgesetmemory

Definition at line 222 of file pzgemr.c.

◆ SHIFT

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

Definition at line 179 of file pzgemr.c.

◆ SIZEBUFF

#define SIZEBUFF   2

Definition at line 235 of file pzgemr.c.

◆ static2

#define static2   static

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

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

SUBROUTINE PZGEMR2D( M, N, $ A, IA, JA, ADESC, $ B, IB, JB, BDESC,

$ CTXT)

Purpose

PZGEMR2D 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) COMPLEX*16 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*16 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 pzgemr.c.

◆ zcopy_

#define zcopy_   zcopy

Definition at line 155 of file pzgemr.c.

◆ zlacpy_

#define zlacpy_   zlacpy

Definition at line 156 of file pzgemr.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,
dcomplex ptra,
MDESC ma,
dcomplex buff 
)

Definition at line 648 of file pzgemr.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,
dcomplex buff,
dcomplex ptrb,
MDESC mb 
)

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

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

Definition at line 705 of file pzgemr.c.

◆ Cpzgemr2d() [1/2]

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

◆ Cpzgemr2d() [2/2]

void Cpzgemr2d ( int  m,
int  n,
dcomplex ptrmyblock,
int  ia,
int  ja,
MDESC ma,
dcomplex ptrmynewblock,
int  ib,
int  jb,
MDESC mb,
int  globcontext 
)

Definition at line 299 of file pzgemr.c.

Here is the call graph for this function:

◆ Cpzgemr2do() [1/2]

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

◆ Cpzgemr2do() [2/2]

void Cpzgemr2do ( int  m,
int  n,
dcomplex ptrmyblock,
int  ia,
int  ja,
MDESC ma,
dcomplex ptrmynewblock,
int  ib,
int  jb,
MDESC mb 
)

Definition at line 275 of file pzgemr.c.

Here is the call graph for this function:

◆ Csetpvmtids()

void Csetpvmtids ( )

◆ Czgerv2d()

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

◆ Czgesd2d()

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

◆ dispmat()

void dispmat ( )

◆ fortran_mr2d()

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

Definition at line 247 of file pzgemr.c.

Here is the call graph for this function:

◆ fortran_mr2dnew()

void fortran_mr2dnew ( int *  m,
int *  n,
dcomplex A,
int *  ia,
int *  ja,
desc_A  ,
dcomplex B,
int *  ib,
int *  jb,
desc_B  ,
int *  gcontext 
)

Definition at line 258 of file pzgemr.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 721 of file pzgemr.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 575 of file pzgemr.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 691 of file pzgemr.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 ( )

◆ zlacpy_()

void zlacpy_ ( )