root / synthbench / euroben-dm / mod2f / gtrans.f @ 0:839f52ef7657
History | View | Annotate | Download (1.8 kB)
1 |
Subroutine gtrans( ar, ai, atr, ati, n1, n2, size1, size2, time ) |
---|---|
2 |
! ---------------------------------------------------------------------- |
3 |
! --- 'gtrans' does a global transpose of array 'a' and puts it in |
4 |
! array 'at'. |
5 |
! ---------------------------------------------------------------------- |
6 |
Use numerics |
7 |
Use mpi_module ! Contains # of proc.s & proc. no.s |
8 |
Implicit None |
9 |
|
10 |
Integer :: n1, n2, size1, size2 |
11 |
Real(l_) :: ar(n1,size2), ai(n1,size2), |
12 |
& atr(n2,size1), ati(n2,size1) |
13 |
Real(l_) :: time |
14 |
|
15 |
Real(l_) :: wrkr(size2,n1), wrki(size2,n1) |
16 |
Real(l_) :: ltime |
17 |
Integer :: scnts(0:nodes-1), sdpls(0:nodes-1), |
18 |
& rcnts(0:nodes-1), rdpls(0:nodes-1) |
19 |
! ---------------------------------------------------------------------- |
20 |
! --- Do local transposition. |
21 |
|
22 |
Call ltrans( n1, sizes(me,2), ar, ai, atr, ati ) |
23 |
! ---------------------------------------------------------------------- |
24 |
! --- Determine sizes and displacements of data to be sent. |
25 |
|
26 |
Call cntdpls( scnts, sdpls, rcnts, rdpls ) |
27 |
! ---------------------------------------------------------------------- |
28 |
! --- Distribute appropriate blocks over the processors. |
29 |
|
30 |
ltime = MPI_Wtime() |
31 |
Call MPI_AlltoAllv( atr, scnts, sdpls, rtyp, |
32 |
& wrkr, rcnts, rdpls, rtyp, |
33 |
& comm, ierr ) |
34 |
Call MPI_AlltoAllv( ati, scnts, sdpls, rtyp, |
35 |
& wrki, rcnts, rdpls, rtyp, |
36 |
& comm, ierr ) |
37 |
time = time + MPI_Wtime() - ltime |
38 |
! ---------------------------------------------------------------------- |
39 |
! --- Do block transposition of the communicated data. |
40 |
|
41 |
Call btrans( sizes(me,1), n2, wrkr, wrki, atr, ati ) |
42 |
! ---------------------------------------------------------------------- |
43 |
End Subroutine gtrans |