I am a little confused on using ZGEBR2D and ZGEBS2D for broadcasting purpose of a complex*16 array to all other process.
Here is the related code:(I used NPROW=2 and NPCOL=2; callFLAG=0 and 1 are used to finish two callings of myPZMATGEN(...) )
- Code: Select all
SUBROUTINE myPZMATGEN( ICTXT, AFORM, DIAG, M, N, MB, NB, A, LDA,
$ IAROW, IACOL, ISEED, IROFF, IRNUM, ICOFF,
$ ICNUM, MYROW, MYCOL, NPROW, NPCOL,
$ callFLAG)
CHARACTER*1 AFORM, DIAG
INTEGER IACOL, IAROW, ICNUM, ICOFF, ICTXT, IRNUM,
$ IROFF, ISEED, LDA, M, MB, MYCOL, MYROW, N,
$ NB, NPCOL, NPROW, nELE, igA
INTEGER MATRIX_TYPE,callFLAG
COMPLEX*16 gA( M*(M+1)/2 )
* other variable definitions
* ...
MATRIX_TYPE = 1
if (MATRIX_TYPE==4) then
....
ELSEif (MATRIX_TYPE==1) then
CALL BLACS_BARRIER( ICTXT, 'All' )
nELE = M*(M+1)/2
if (MYROW==0 .and. MYCOL==0) then
DO igA=1,nELE
gA(igA) = 1.0*igA
ENDDO
CALL ZGEBS2D(ICTXT,'A',' ',nELE,1,gA,nELE)
write(*,*) MYROW, MYCOL, ' sent in PZMATGEN..', callFLAG
else
write(*,*) MYROW,MYCOL,' receiving in PZMATGEN..',callFLAG
CALL ZGEBR2D(ICTXT,'A',' ',nELE,1,gA,nELE,0,0)
write(*,*) MYROW, MYCOL, ' received in PZMATGEN..',callFLAG
endif
CALL BLACS_BARRIER( ICTXT, 'All' )
endif
Here is the error message I got from running it in CenOS Linux:
0 1 receiving in PZMATGEN.. 0
1 0 receiving in PZMATGEN.. 0
1 1 receiving in PZMATGEN.. 0
1 0 received in PZMATGEN.. 0
1 1 received in PZMATGEN.. 0
0 0 sent in PZMATGEN.. 0
0 1 received in PZMATGEN.. 0
1 0 receiving in PZMATGEN.. 1
0 0 sent in PZMATGEN.. 1
1 0 received in PZMATGEN.. 1
Fatal error in PMPI_Bcast: Message truncated, error stack:
PMPI_Bcast(1478)......................: MPI_Bcast(buf=0x7fffda994098, count=1, dtype=USER<vector>, root=0, comm=0xc4000000) failed
MPIR_Bcast_impl(1321).................:
MPIR_Bcast_intra(1119)................:
MPIR_Bcast_scatter_ring_allgather(962):
MPIR_Bcast_binomial(145)..............:
MPIDI_CH3U_Receive_data_found(129)....: Message from rank 0 and tag 2 truncated; 45600 bytes received but buffer size is 8
Fatal error in PMPI_Bcast: Message truncated, error stack:
PMPI_Bcast(1478)......................: MPI_Bcast(buf=0x7fff0f117a58, count=1, dtype=USER<vector>, root=0, comm=0xc4000000) failed
MPIR_Bcast_impl(1321).................:
MPIR_Bcast_intra(1119)................:
MPIR_Bcast_scatter_ring_allgather(962):
MPIR_Bcast_binomial(145)..............:
MPIDI_CH3U_Receive_data_found(129)....: Message from rank 2 and tag 2 truncated; 45600 bytes received but buffer size is 8
My question is that if the use of these subroutine is in trouble, why callFLAG=0 passed and got the right results I expected but not for callGLAG=1.
Many thanks

