Pls See the example:

program test

INTEGER :: LWORK, MAXN, LDA,M, N, MAXMAXN, MAXPROCS

REAL, PARAMETER :: MONE = -1.0E+0, ZERO = 0.0E+0

* ..

* .. Local Scalars ..

INTEGER :: CONTEXT, I, IAM, INFO, MYCOL, MYROW, NB

INTEGER :: NPCOL, NPROCS, NPROW

REAL, DIMENSION(:,:), ALLOCATABLE :: A

ALLOCATE(WORK(10000*10000))

ALLOCATE(W(10000))

ALLOCATE(A(10000,10000))

* Initialize the BLACS

*

CALL BLACS_PINFO( IAM, NPROCS )

IF( ( NPROCS.LT.1 ) ) THEN

CALL BLACS_SETUP( IAM, NPROW*NPCOL )

END IF

*

* Initialize a single BLACS context

*

CALL BLACS_GET( -1, 0, CONTEXT )

CALL BLACS_GRIDINIT( CONTEXT, 'R', NPROW, NPCOL )

CALL BLACS_GRIDINFO( CONTEXT, NPROW, NPCOL, MYROW, MYCOL )

* Bail out if this process is not a part of this context.

*

IF( MYROW.EQ.-1 )

$ GO TO 20

* These are basic array descriptors

CALL DESCINIT( DESCA, N, N, NB, NB, 0, 0, CONTEXT, LDA, INFO )

...................

other Omission

And then I run the job on several nodes: mpirun -np 8 test. Assume the first node's name is Node001

The question are:

(1)where are these global variable A ,work, W stored? Node001 or all nodes? whether are there copies of A stored on all nodes?

(2)if all nodes, then when A is very big, the other nodes need the same memory with the main node001? How to save memory?

(3)I hope the main node has a big memory to store A matrix, then the other nodes store the distributed sub(A) with a very small memory, how to do?

Thanks. I am new man for these basic problems.